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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
LiuAnclouds/Harmony-ArkTS-App.git | 2119ce333927599b81a31081bc913e1416837308 | WeatherMind/entry/src/main/ets/pages/ChooseCity.ets | arkts | selectCity | 选择城市并更新热度 | private async selectCity(cityName: string) {
this.selectedCity = cityName;
// 只更新城市热度,不设置为当前城市
try {
let httpRequest = http.createHttp();
await httpRequest.request(Config.API.UPDATE_POPULARITY, {
method: http.RequestMethod.POST,
extraData: JSON.stringify({
city_name: c... | AST#method_declaration#Left private async selectCity AST#parameter_list#Left ( AST#parameter#Left cityName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_... | private async selectCity(cityName: string) {
this.selectedCity = cityName;
try {
let httpRequest = http.createHttp();
await httpRequest.request(Config.API.UPDATE_POPULARITY, {
method: http.RequestMethod.POST,
extraData: JSON.stringify({
city_name: cityName
}),... | https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L281-L307 | 7ff5a88f03229574ff1eaaf1d09926cea822c15c | github |
fengcreate/harmony-document | 798534b0f76399dc84e7940f5b14b3ae4e53c6a9 | BackupRestore/entry/src/main/ets/restore/db/DbTransferManager.ets | arkts | initSourceDb | Initialize the rdbStore of the database.
@param context context.
@return success return true, failed return false. | private async initSourceDb(context: common.Context): Promise<boolean> {
if (this.sourceRdbStore) {
hilog.info(0x0000, 'BackupRestore DbTransferManager', 'initSourceDb, sourceRdbStore has been initialized');
return true;
}
try {
const SOURCE_CONFIG: relationalStore.StoreConfig = {
... | AST#method_declaration#Left private async initSourceDb 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 :... | private async initSourceDb(context: common.Context): Promise<boolean> {
if (this.sourceRdbStore) {
hilog.info(0x0000, 'BackupRestore DbTransferManager', 'initSourceDb, sourceRdbStore has been initialized');
return true;
}
try {
const SOURCE_CONFIG: relationalStore.StoreConfig = {
... | https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/db/DbTransferManager.ets#L118-L138 | ab1978b6b85f0d3694be5c70747d3aa65ae95f5f | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/util/VersionUtils.ets | arkts | 排序
@param components 升级包集合
@return 升级包集合 | export function sortComponents(components: Array<update.VersionComponent>): Array<update.VersionComponent> {
if (components) {
return components.sort((component: update.VersionComponent, nextComponent: update.VersionComponent) => {
return component.componentType - nextComponent.componentType;
})... | AST#export_declaration#Left export AST#function_declaration#Left function sortComponents AST#parameter_list#Left ( AST#parameter#Left components : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left u... | export function sortComponents(components: Array<update.VersionComponent>): Array<update.VersionComponent> {
if (components) {
return components.sort((component: update.VersionComponent, nextComponent: update.VersionComponent) => {
return component.componentType - nextComponent.componentType;
})... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/util/VersionUtils.ets#L83-L90 | b4dc35df81e5ce75ab7eb450a320125527b0565b | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/ImageConstants.ets | arkts | @author 2008
@datetime 2024/6/28 22:34
@className: ImageConstants
通用图片属性 | export default class ImageConstants{
//图片宽度
static readonly IMG_WIDTH_18: number = 18;
static readonly IMG_WIDTH_20: number = 20;
static readonly IMG_WIDTH_24: number = 24;
static readonly IMG_WIDTH_32: number = 32;
static readonly IMG_WIDTH_40: number = 40;
static readonly IMG_WIDTH_48: number = 48;
st... | AST#export_declaration#Left export default AST#class_declaration#Left class ImageConstants AST#class_body#Left { //图片宽度 AST#property_declaration#Left static readonly IMG_WIDTH_18 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 18 AST#express... | export default class ImageConstants{
static readonly IMG_WIDTH_18: number = 18;
static readonly IMG_WIDTH_20: number = 20;
static readonly IMG_WIDTH_24: number = 24;
static readonly IMG_WIDTH_32: number = 32;
static readonly IMG_WIDTH_40: number = 40;
static readonly IMG_WIDTH_48: number = 48;
static r... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/ImageConstants.ets#L7-L25 | 17b3ec8aefaf7a341f195213bffc16a8bd8f30a0 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/backgroundTask/src/main/ets/view/TransientTaskView.ets | arkts | TransientTaskView | 文本格式 | @Component
export struct TransientTaskView {
@State message: string = 'Click button to calculate.';
private requestId: number = 0;
// 申请短时任务
requestSuspendDelay() {
try {
let delayInfo = backgroundTaskManager.requestSuspendDelay('compute', () => {
console.info('Request suspension delay will t... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TransientTaskView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_... | @Component
export struct TransientTaskView {
@State message: string = 'Click button to calculate.';
private requestId: number = 0;
requestSuspendDelay() {
try {
let delayInfo = backgroundTaskManager.requestSuspendDelay('compute', () => {
console.info('Request suspension delay will time out.'... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/backgroundTask/src/main/ets/view/TransientTaskView.ets#L25-L80 | 9445b7e99596061f2e43e777ea5b4c7e6641b10e | gitee |
cljhwt/Gemini3_to_ArkTS.git | 11507c45be72ecccef2f757eaf024c2b8617ad34 | ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/pages/Index.ets | arkts | pixelFormatToString | 像素格式转换为字符串 | function pixelFormatToString(fmt: image.PixelMapFormat | number): string {
switch (fmt) {
case image.PixelMapFormat.RGBA_8888:
return 'RGBA_8888';
case image.PixelMapFormat.BGRA_8888:
return 'BGRA_8888';
case image.PixelMapFormat.RGB_565:
return 'RGB_565';
case image.PixelMapFormat.A... | AST#function_declaration#Left function pixelFormatToString AST#parameter_list#Left ( AST#parameter#Left fmt : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMapFormat AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#... | function pixelFormatToString(fmt: image.PixelMapFormat | number): string {
switch (fmt) {
case image.PixelMapFormat.RGBA_8888:
return 'RGBA_8888';
case image.PixelMapFormat.BGRA_8888:
return 'BGRA_8888';
case image.PixelMapFormat.RGB_565:
return 'RGB_565';
case image.PixelMapFormat.A... | https://github.com/cljhwt/Gemini3_to_ArkTS.git/blob/11507c45be72ecccef2f757eaf024c2b8617ad34/ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/pages/Index.ets#L46-L65 | b48be682c6b7ac761cc44b9368b06482377e0490 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | isUsePercentValuesEnabled | Returns true if using percentage values is enabled for the chart.
@return | public isUsePercentValuesEnabled(): boolean {
return this.mUsePercentValues;
} | AST#method_declaration#Left public isUsePercentValuesEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left A... | public isUsePercentValuesEnabled(): boolean {
return this.mUsePercentValues;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L781-L783 | 1a0d20274b5dfb9e96ee2030b5bf6501e72eaf3b | gitee |
HunZiLei/ArtTs_PokeAccountBook.git | 3d91db931f5dd6cea3c6cd414fad7c28942a58ac | entry/src/main/ets/pages/mePage.ets | arkts | jumpDetailPage | 页面跳转的函数 | jumpDetailPage(): void{
console.info("###ToBuyPage-yPos: "+ this.yPos[0] + "-" + this.yPos[1]);
router.pushUrl({
url: 'pages/Index' // 目标url
}, router.RouterMode.Single, (err) => {
if (err) {
console.error(`###Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`);
... | AST#method_declaration#Left jumpDetailPage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | jumpDetailPage(): void{
console.info("###ToBuyPage-yPos: "+ this.yPos[0] + "-" + this.yPos[1]);
router.pushUrl({
url: 'pages/Index'
}, router.RouterMode.Single, (err) => {
if (err) {
console.error(`###Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`);
retur... | https://github.com/HunZiLei/ArtTs_PokeAccountBook.git/blob/3d91db931f5dd6cea3c6cd414fad7c28942a58ac/entry/src/main/ets/pages/mePage.ets#L26-L37 | 91a7ea78813d18deb6cbaed8067b9073ad632e1b | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets | arkts | cameraInputOpenFn | Turn on the camera | async cameraInputOpenFn(cameraInput: camera.CameraInput): Promise<boolean> {
let isOpenSuccess: boolean = false;
try {
await cameraInput.open();
isOpenSuccess = true;
Logger.info(TAG, 'cameraInput open success');
} catch (error) {
Logger.error(TAG, `createCameraInput failed : ${JSON.... | AST#method_declaration#Left async cameraInputOpenFn AST#parameter_list#Left ( AST#parameter#Left cameraInput : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraInput AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | async cameraInputOpenFn(cameraInput: camera.CameraInput): Promise<boolean> {
let isOpenSuccess: boolean = false;
try {
await cameraInput.open();
isOpenSuccess = true;
Logger.info(TAG, 'cameraInput open success');
} catch (error) {
Logger.error(TAG, `createCameraInput failed : ${JSON.... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets#L292-L302 | 5d4f9db2260d6ea3a66fb24be53cc727930ee89d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | executeSql | 执行原始SQL
@param sql SQL语句
@param args 参数
@returns 执行结果 | async executeSql(sql: string, args?: Array<relationalStore.ValueType>): Promise<void> {
try {
this.checkInitialized();
await this.store!.executeSql(sql, args);
hilog.debug(LogConstants.DOMAIN_DATABASE, LogConstants.TAG_DATABASE, `Executed SQL: ${sql}`);
} catch (error) {
const businessEr... | AST#method_declaration#Left async executeSql AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left args ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Ar... | async executeSql(sql: string, args?: Array<relationalStore.ValueType>): Promise<void> {
try {
this.checkInitialized();
await this.store!.executeSql(sql, args);
hilog.debug(LogConstants.DOMAIN_DATABASE, LogConstants.TAG_DATABASE, `Executed SQL: ${sql}`);
} catch (error) {
const businessEr... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L480-L490 | 962eccd9a32f9d499fabb41281e7feeae26967a7 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets | arkts | addSearchHistory | 添加搜索历史记录
@param {SearchHistory} searchHistory 搜索历史记录
@returns {Promise<void>} Promise<void> | async addSearchHistory(searchHistory: SearchHistory): Promise<void> {
this.orm.save(this.toEntity(searchHistory));
} | AST#method_declaration#Left async addSearchHistory AST#parameter_list#Left ( AST#parameter#Left searchHistory : AST#type_annotation#Left AST#primary_type#Left SearchHistory AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS... | async addSearchHistory(searchHistory: SearchHistory): Promise<void> {
this.orm.save(this.toEntity(searchHistory));
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L44-L46 | 20e9d3a218fabf5310a283d9b389eeca34fb4fcb | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_noui/ace_ets_module_perf/ace_ets_module_perf_api12/entry/src/main/ets/MainAbility/common/Utils.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over..... | AST#export_declaration#Left export default AST#class_declaration#Left class Utils AST#class_body#Left { AST#property_declaration#Left static rect_left ; AST#property_declaration#Right AST#property_declaration#Left static rect_top ; AST#property_declaration#Right AST#property_declaration#Left static rect_right ; AST#pro... | export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over..... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_perf/ace_ets_module_perf_api12/entry/src/main/ets/MainAbility/common/Utils.ets#L15-L119 | 89cb65e91b84ced3f969d4bc6778aebb5bad5744 | gitee | |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets | arkts | notifyDataMove | 通知LazyForEach组件将from索引和to索引处的子组件进行交换 | notifyDataMove(from: number, to: number): void {
Logger.debug('notifyDataMove: ' + from + ' ' + to);
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
} | AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right... | notifyDataMove(from: number, to: number): void {
Logger.debug('notifyDataMove: ' + from + ' ' + to);
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
} | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets#L261-L266 | 786f3db1b791bd9432f717e7197ee65ec626f4fc | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isSet | Check whether the entered value is of type set.
@param { Object } value - A Set instance value
@returns { boolean } Returns true if the value is a built-in Set instance.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20 | isSet(value: Object): boolean; | AST#method_declaration#Left isSet AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST... | isSet(value: Object): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1323-L1323 | 43ab899af9afa349647a475146c729c9f43d7728 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.ets | arkts | NotesInfo item information. | export class NotesInfoBean {
/**
* Note Id.
*/
noteId: string;
/**
* Note title.
*/
title: string;
/**
* Folder type.
*/
folder: FolderType;
/**
* Create time.
*/
time: string;
/**
* Collect note.
*/
isFavorite: boolean;
/**
* Note images.
*/
imageArr: st... | AST#export_declaration#Left export AST#class_declaration#Left class NotesInfoBean AST#class_body#Left { /**
* Note Id.
*/ AST#property_declaration#Left noteId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Note tit... | export class NotesInfoBean {
noteId: string;
title: string;
folder: FolderType;
time: string;
isFavorite: boolean;
imageArr: string[];
content: string;
constructor(noteId: string, title: string, folder: FolderType, time: string, isFavorite: boolean, imageArr: string[],
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.ets#L36-L85 | 77ea823b6cd675b08bd69f05a4b8710c6c0b0cc4 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/managers/AIModelManager.ets | arkts | initialize | 初始化AI模型管理器 | static async initialize(): Promise<boolean> {
try {
// 从存储中加载配置
await this.loadConfigurations();
this.isInitialized = true;
this.logInfo('AI模型管理器初始化成功');
return true;
} catch (error) {
this.logError('AI模型管理器初始化失败', error);
return false;
}
} | AST#method_declaration#Left static async initialize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#... | static async initialize(): Promise<boolean> {
try {
await this.loadConfigurations();
this.isInitialized = true;
this.logInfo('AI模型管理器初始化成功');
return true;
} catch (error) {
this.logError('AI模型管理器初始化失败', error);
return false;
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/AIModelManager.ets#L63-L74 | f9ea19cf1b422391b795bc8dc38c79a8df71c928 | github |
GAOMUgenius/SounderHarbor.git | ac0efa1a290980999e38aa868259d32c2f107bb2 | commons/datasource/src/main/ets/datasource/BasicDataSource.ets | arkts | BasicDataSource | Basic implementation of IDataSource to handle data listener | @ObservedV2
export abstract class BasicDataSource implements IDataSource {
@Trace private listeners: DataChangeListener[] = [];
public abstract totalCount(): number
public abstract getData(index: number): ESObject
// 该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听
registerDataChangeListener(listener: DataChange... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export abstract class BasicDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right private listene... | @ObservedV2
export abstract class BasicDataSource implements IDataSource {
@Trace private listeners: DataChangeListener[] = [];
public abstract totalCount(): number
public abstract getData(index: number): ESObject
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.inde... | https://github.com/GAOMUgenius/SounderHarbor.git/blob/ac0efa1a290980999e38aa868259d32c2f107bb2/commons/datasource/src/main/ets/datasource/BasicDataSource.ets#L2-L61 | 9f2f8e53076de185dd082fdad4bf32a1ac441e6d | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/models/UserModel.ets | arkts | logout | 退出登录 | static async logout(): Promise<void> {
if (!UserManager.preferencesInstance) {
return;
}
try {
await UserManager.preferencesInstance.delete(UserManager.KEY_CURRENT_USER);
await UserManager.preferencesInstance.flush();
} catch (error) {
console.error('Logout error:', error);
... | AST#method_declaration#Left static async logout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | static async logout(): Promise<void> {
if (!UserManager.preferencesInstance) {
return;
}
try {
await UserManager.preferencesInstance.delete(UserManager.KEY_CURRENT_USER);
await UserManager.preferencesInstance.flush();
} catch (error) {
console.error('Logout error:', error);
... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/UserModel.ets#L181-L192 | 80de51c8278559fdf7f7435b645cabd9035023c7 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/product/entry/src/main/ets/model/PanPositionModel.ets | arkts | PanPositionModel | 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... | @Observed
export class PanPositionModel {
public currentX: number;
public currentY: number;
public lastX: number = 0;
public lastY: number = 0;
constructor(x: number = 0, y: number = 0) {
this.currentX = x;
this.currentY = y;
}
reset(): void {
this.currentX = 0;
this.currentY = 0;
th... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class PanPositionModel AST#class_body#Left { AST#property_declaration#Left public currentX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Ri... | @Observed
export class PanPositionModel {
public currentX: number;
public currentY: number;
public lastX: number = 0;
public lastY: number = 0;
constructor(x: number = 0, y: number = 0) {
this.currentX = x;
this.currentY = y;
}
reset(): void {
this.currentX = 0;
this.currentY = 0;
th... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/model/PanPositionModel.ets#L16-L39 | 004d189324580838b6da0fcacedd18e96473aa15 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/components/utilcomponents/stringcode/SpecInput.ets | arkts | SpecInput | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct SpecInput {
private result_str: Resource = $r('app.string.result_f');
@Link specStrInput: string;
build() {
Row() {
Text(this.result_str)
.height(30)
.fontSize(15)
.textAlign(TextAlign.Start)
Text(this.specStrInput)
.height(30)
.lay... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SpecInput AST#component_body#Left { AST#property_declaration#Left private result_str : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST... | @Component
export struct SpecInput {
private result_str: Resource = $r('app.string.result_f');
@Link specStrInput: string;
build() {
Row() {
Text(this.result_str)
.height(30)
.fontSize(15)
.textAlign(TextAlign.Start)
Text(this.specStrInput)
.height(30)
.lay... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/components/utilcomponents/stringcode/SpecInput.ets#L16-L36 | 7e09b25da0a44e4b2d499632737a1c5ec02bf11d | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/empty/Empty.ets | arkts | Empty | @file 通用缺省页组件(基于 IBestEmpty 封装)
@author Joker.X | @ComponentV2
export struct Empty {
/**
* 描述文案
*/
@Param
description: ResourceStr = "暂无内容";
/**
* 占位图资源
*/
@Param
@Require
imageRes: ResourceStr = "";
/**
* 操作按钮文案(仅当 onAction 存在时展示)
*/
@Param
actionText: ResourceStr = "重试";
/**
* 操作按钮点击回调(不传则不展示按钮)
*/
@Param
onAction: (... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct Empty AST#component_body#Left { /**
* 描述文案
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_t... | @ComponentV2
export struct Empty {
@Param
description: ResourceStr = "暂无内容";
@Param
@Require
imageRes: ResourceStr = "";
@Param
actionText: ResourceStr = "重试";
@Param
onAction: (() => void) | undefined = undefined;
build(): void {
Column() {
IBestEmpty({
description... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/Empty.ets#L8-L86 | 8dbcdcf383c8747b2a1f581ebfcbd3072b7b6b23 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/demoCollect/startAbility/frame/AbilityKit/StartAbilityForResult/entry/src/main/ets/pages/Index.ets | arkts | listItemStyle | 复用样式 | @Styles
listItemStyle(){
.width(StyleConstants.FULL_PERCENT)
.height(StyleConstants.LIST_ITEM_HEIGHT)
.backgroundColor(Color.White)
} | AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right listItemStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Rig... | @Styles
listItemStyle(){
.width(StyleConstants.FULL_PERCENT)
.height(StyleConstants.LIST_ITEM_HEIGHT)
.backgroundColor(Color.White)
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/frame/AbilityKit/StartAbilityForResult/entry/src/main/ets/pages/Index.ets#L121-L126 | 007ec2af5a9bc29c45d06787ff4001a48fb1d568 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the different build user of the same baseline code.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get buildUser(): string; | AST#method_declaration#Left static get AST#ERROR#Left build User AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get buildUser(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L338-L338 | 90aa8c7ca9f2a5eca45d24563c157c70200bc8a3 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/IdCardUtil.ets | arkts | isValidCard18 | 判断18位身份证的合法性
排列顺序从左至右依次为:六位数字地址码,八位数字出生日期码,三位数字顺序码和一位数字校验码。
顺序码: 表示在同一地址码所标识的区域范围内,对同年、同月、同 日出生的人编定的顺序号,顺序码的奇数分配给男性,偶数分配 给女性。
<li>第1、2位数字表示:所在省份的代码</li>
<li>第3、4位数字表示:所在城市的代码</li>
<li>第5、6位数字表示:所在区县的代码</li>
<li>第7~14位数字表示:出生年、月、日</li>
<li>第15、16位数字表示:所在地的派出所的代码</li>
<li>第17位数字表示性别:奇数表示男性,偶数表示女性</li>
<li>第18位数字是校检码,用来检验... | static isValidCard18(idCard: string): OutDTO<string> {
if (IdCardUtil.PROVINCE_CODES.size == 0) {
IdCardUtil.init();
}
if (IdCardUtil.CHINA_ID_MAX_LENGTH != idCard.length) {
return OutDTO.Error("身份证长度不足18位");
}
// 省份
let proCode: string = idCard.substring(0, 2) + "0000";
if (n... | AST#method_declaration#Left static isValidCard18 AST#parameter_list#Left ( AST#parameter#Left idCard : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | static isValidCard18(idCard: string): OutDTO<string> {
if (IdCardUtil.PROVINCE_CODES.size == 0) {
IdCardUtil.init();
}
if (IdCardUtil.CHINA_ID_MAX_LENGTH != idCard.length) {
return OutDTO.Error("身份证长度不足18位");
}
let proCode: string = idCard.substring(0, 2) + "0000";
if (null =... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdCardUtil.ets#L100-L145 | 21a88e4c7154da121d9ca552ce1ff9afcc27bd5e | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | osReleaseType | 系统的发布类型 | static osReleaseType(): string {
return deviceInfo.osReleaseType
} | AST#method_declaration#Left static osReleaseType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp... | static osReleaseType(): string {
return deviceInfo.osReleaseType
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L127-L129 | d02ebb816799f29600f7a16fc9092ad673d78676 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/DeleteDialog.ets | arkts | DeleteDialog | 用户输入名字的弹窗 | @CustomDialog
export struct DeleteDialog {
controller?: CustomDialogController
confirm: () => void = () => {}
build() {
Column() {
Text($r('app.string.label_is_delete'))
.fontSize(20)
.margin({ bottom: 20 })
Row() {
Text($r('app.string.label_delete'))
.id('check... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct DeleteDialog AST#component_body#Left { AST#property_declaration#Left controller ? : AST#ERROR#Left CustomDialogController confirm : AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left AST#parameter_list... | @CustomDialog
export struct DeleteDialog {
controller?: CustomDialogController
confirm: () => void = () => {}
build() {
Column() {
Text($r('app.string.label_is_delete'))
.fontSize(20)
.margin({ bottom: 20 })
Row() {
Text($r('app.string.label_delete'))
.id('check... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/DeleteDialog.ets#L17-L54 | 9ba7ae1db519c09568fb1f82b58b97b4f4953bc5 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | stopSubscriptionUpdateTimer | 停止订阅更新定时器 | stopSubscriptionUpdateTimer() {
if (this.subscriptionUpdateTimer !== -1) {
clearInterval(this.subscriptionUpdateTimer);
this.subscriptionUpdateTimer = -1;
}
} | AST#method_declaration#Left stopSubscriptionUpdateTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#... | stopSubscriptionUpdateTimer() {
if (this.subscriptionUpdateTimer !== -1) {
clearInterval(this.subscriptionUpdateTimer);
this.subscriptionUpdateTimer = -1;
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L169-L174 | 15bc19504d0ba7720f3d02631fcb5290afab5ccd | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/subscription/SubscriptionInfo.ets | arkts | 订阅结束时间戳(毫秒) | constructor(json?: Record<string, Object>) {
if (json) {
this.userId = (json['user_id'] as number) ?? null;
this.sku = (json['sku'] as string) ?? null;
this.endDateMs = (json['end_date'] as number) ?? null;
}
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left json ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annot... | constructor(json?: Record<string, Object>) {
if (json) {
this.userId = (json['user_id'] as number) ?? null;
this.sku = (json['sku'] as string) ?? null;
this.endDateMs = (json['end_date'] as number) ?? null;
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/subscription/SubscriptionInfo.ets#L17-L23 | eff52f1e2b20693f9f591a04a0c01bf026566993 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets | arkts | Calls a worker thread to save built index to disk.
@param map the map to be saved.
@param file_name the name of stored file, like 'index_2024_04_00_00_00_00_000' | export function history_index_save_to_disk_worker(map: collections.Map<string, collections.Array<number>>, file_name: string, clear: boolean) {
let history_index_saving = AppStorage.get('history_index_saving') as boolean | undefined;
let history_index_loading = AppStorage.get('history_index_loading') as boolean | u... | AST#export_declaration#Left export AST#function_declaration#Left function history_index_save_to_disk_worker AST#parameter_list#Left ( AST#parameter#Left map : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left collections . Map AST#qualified_type#Right AST#type_arguments#Left <... | export function history_index_save_to_disk_worker(map: collections.Map<string, collections.Array<number>>, file_name: string, clear: boolean) {
let history_index_saving = AppStorage.get('history_index_saving') as boolean | undefined;
let history_index_loading = AppStorage.get('history_index_loading') as boolean | u... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets#L85-L132 | 9f57fb79707c852516ea2c8b90de4ffa55db7706 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/constraint.ets | arkts | 系统深浅色模式切换监听 | export const DialogThemeColorMode: string = "harmony-dialog_ThemeColorMode"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DialogThemeColorMode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "harmony-dialog_ThemeColorMode" AST#expression#Right AST#variable_declar... | export const DialogThemeColorMode: string = "harmony-dialog_ThemeColorMode"; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/constraint.ets#L2-L2 | 216b454e5756a57074358d93cbd4f87ef7477d52 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/data_operation_tools.ets | arkts | Constructs a boolean array of a specific length that contains only true values.
@param length The length of the array.
@returns The boolean array. | export function all_true(length: number) {
let result: boolean[] = [];
for (let index = 0; index < length; index++) {
result.push(true);
}
return result;
} | AST#export_declaration#Left export AST#function_declaration#Left function all_true AST#parameter_list#Left ( AST#parameter#Left length : 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#st... | export function all_true(length: number) {
let result: boolean[] = [];
for (let index = 0; index < length; index++) {
result.push(true);
}
return result;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L140-L146 | 4d92feaf1fe5d219674e716fe44959d3b6672320 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/FlowManagement_case/entry/src/main/ets/pages/Index.ets | arkts | getIfaceRxBytes | [Start obtain_realtime_traffic_statistics_of_network_interface_cards/uid] 获取各种实体的流量数据方法 | getIfaceRxBytes() {
statistics.getIfaceRxBytes(IFACE).then((stats: number) => {
this.logMessage = `Interface ${IFACE} downstream traffic: ${JSON.stringify(stats)}`;
}).catch((err: BusinessError) => {
this.logMessage = `Failed to get downstream traffic for interface ${IFACE}: ${JSON.stringify(err)}`;... | AST#method_declaration#Left getIfaceRxBytes AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST... | getIfaceRxBytes() {
statistics.getIfaceRxBytes(IFACE).then((stats: number) => {
this.logMessage = `Interface ${IFACE} downstream traffic: ${JSON.stringify(stats)}`;
}).catch((err: BusinessError) => {
this.logMessage = `Failed to get downstream traffic for interface ${IFACE}: ${JSON.stringify(err)}`;... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/FlowManagement_case/entry/src/main/ets/pages/Index.ets#L176-L182 | 718d2a70f29f8a1a0cb669f2c8fedf54612c3708 | gitee |
hackeris/HiSH | 6485c7b24ee47727fe464dc3a69484f44689e85b | entry/src/main/ets/lib/QemuAgent.ets | arkts | QEMU Guest Agent 客户端
通过 LocalSocket 与虚拟机内的 qemu-guest-agent 通信 | export class QemuAgent {
private socketPath: string
private client: socket.LocalSocket | null = null
private requestId: number = 0
private pendingResponse: string = ''
private isConnected: boolean = false
private commandMutex: Promise<void> = Promise.resolve()
constructor | AST#export_declaration#Left export AST#ERROR#Left class QemuAgent { AST#property_declaration#Left private socketPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left private client : AST#type_annotation... | export class QemuAgent {
private socketPath: string
private client: socket.LocalSocket | null = null
private requestId: number = 0
private pendingResponse: string = ''
private isConnected: boolean = false
private commandMutex: Promise<void> = Promise.resolve()
constructor | https://github.com/hackeris/HiSH/blob/6485c7b24ee47727fe464dc3a69484f44689e85b/entry/src/main/ets/lib/QemuAgent.ets#L97-L105 | 73fa7a2f0c65f2a5f6cef8867037aeb25ced9884 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/PromptUtils.ets | arkts | 显示错误提示
@param message 消息内容 | export function showError(message: string) {
try {
promptAction.showToast({
message: message,
duration: 3000
});
} catch (error) {
console.error('显示错误提示失败:', error);
}
} | AST#export_declaration#Left export AST#function_declaration#Left function showError 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#block_statement#Left { AST#... | export function showError(message: string) {
try {
promptAction.showToast({
message: message,
duration: 3000
});
} catch (error) {
console.error('显示错误提示失败:', error);
}
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/PromptUtils.ets#L109-L118 | 660d451d6b9eebd0d799028b948b993dffa41467 | github | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_imageText/ace_ets_module_imageText_api18/entry/src/main/ets/MainAbility/common/MessageManager.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface Message<T> {
name: string;
value: T;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Message AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AS... | export interface Message<T> {
name: string;
value: T;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_imageText/ace_ets_module_imageText_api18/entry/src/main/ets/MainAbility/common/MessageManager.ets#L15-L18 | 9c581b33dba11947ee28dfac63afe5bbd3fda3a9 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | offLocationError | 取消订阅持续定位过程中的错误码。需要权限:ohos.permission.APPROXIMATELY_LOCATION
@param callback 需要取消订阅的回调函数。该回调函数需要与on接口传入的回调函数保持一致。若无此参数,则取消当前类型的所有订阅 | static offLocationError(callback?: Callback<geoLocationManager.LocationError>) {
if (callback) {
geoLocationManager.off('locationError', callback);
} else {
geoLocationManager.off('locationError');
}
} | AST#method_declaration#Left static offLocationError AST#parameter_list#Left ( AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left geoLocationManager . LocationError ... | static offLocationError(callback?: Callback<geoLocationManager.LocationError>) {
if (callback) {
geoLocationManager.off('locationError', callback);
} else {
geoLocationManager.off('locationError');
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L162-L168 | 5982cad2a793dab003ef1eca4c3c25acbc223e48 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | goContacts | 跳转到联系人页面 | async goContacts(): Promise<void> {
await this.push(RoutePaths.CONTACTS);
} | AST#method_declaration#Left async goContacts 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_argum... | async goContacts(): Promise<void> {
await this.push(RoutePaths.CONTACTS);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L243-L245 | 854862ab8aa12506a7a7644ad5ec6bbe9e36513c | github |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/model/MoodData.ets | arkts | 图片路径 ★ 修改:构造函数增加 userId 参数,一共 8 个参数 | constructor(id: number, userId: number, date: number, moodType: number, moodScore: number, reason: string, diaryContent: string, images: string) {
this.id = id;
this.userId = userId; // ★ 赋值
this.date = date;
this.moodType = moodType;
this.moodScore = moodScore;
this.reason = reason;
this.di... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | constructor(id: number, userId: number, date: number, moodType: number, moodScore: number, reason: string, diaryContent: string, images: string) {
this.id = id;
this.userId = userId;
this.date = date;
this.moodType = moodType;
this.moodScore = moodScore;
this.reason = reason;
this.diaryCont... | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/model/MoodData.ets#L13-L22 | d25da04aced3dee50c7ef3c5fccc8ff8f3c34eef | github | |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/view/HomeComponent.ets | arkts | onScrollAction | 向上滑动时,改变顶部组件的透明度 | onScrollAction() {
this.yOffset = this.scroller.currentOffset().yOffset;
if (this.yOffset > Const.DEFAULT_56) {
this.naviAlpha = 1;
} else {
this.naviAlpha = this.yOffset / Const.DEFAULT_56;
}
} | AST#method_declaration#Left onScrollAction 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 . yOffset AST#member_expression#Right... | onScrollAction() {
this.yOffset = this.scroller.currentOffset().yOffset;
if (this.yOffset > Const.DEFAULT_56) {
this.naviAlpha = 1;
} else {
this.naviAlpha = this.yOffset / Const.DEFAULT_56;
}
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/HomeComponent.ets#L143-L150 | aa75491d61de9bd603e7fd60a8d50bc00bf19b9c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | 交互历史接口 | export interface InteractionHistory {
itemId: string;
type: RecommendationType;
interactions: UserAction[];
totalEngagementTime: number;
lastInteraction: string;
satisfaction: number; // 满意度评分
} | AST#export_declaration#Left export AST#interface_declaration#Left interface InteractionHistory AST#object_type#Left { AST#type_member#Left itemId : 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 type : AST#type_annotati... | export interface InteractionHistory {
itemId: string;
type: RecommendationType;
interactions: UserAction[];
totalEngagementTime: number;
lastInteraction: string;
satisfaction: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L142-L149 | c8f88d381dae58429a01b678e2d1d8e9921416aa | github | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/SubscriptionPage.ets | arkts | showUnsubscribeDialog | 显示取消订阅确认对话框 | showUnsubscribeDialog(podcast: Podcast): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('确定', '#FF3B30')
];
UIUtils.showDialog(new DialogOptions(
'取消订阅',
`确定要取消订阅《${podcast.title}》吗?\n\n取消订阅后,该播客的所有单集和下载内容都将被删除。`,
buttons
)).... | AST#method_declaration#Left showUnsubscribeDialog AST#parameter_list#Left ( AST#parameter#Left podcast : AST#type_annotation#Left AST#primary_type#Left Podcast 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#primar... | showUnsubscribeDialog(podcast: Podcast): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('确定', '#FF3B30')
];
UIUtils.showDialog(new DialogOptions(
'取消订阅',
`确定要取消订阅《${podcast.title}》吗?\n\n取消订阅后,该播客的所有单集和下载内容都将被删除。`,
buttons
)).... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/SubscriptionPage.ets#L244-L263 | 51cf73e4e1d3bc4e3bdf0621b0dc426d94880168 | github |
openharmony/base_location | 724370a03f6f23ddc07c8eb9f49dfc61ab716bdb | services/location_ui/entry/src/main/ets/pages/BluetoothReceive.ets | arkts | generateFileUri | 根据不同的文件类型生成不同的文件路径 | private async generateFileUri() {
try {
await this.getFileType();
switch (this.fileType) {
case btCreateFilePickerPage.FILE_TYPE_FILES:
await this.generateFileManagerUri();
break;
case btCreateFilePickerPage.FILE_TYPE_IMAGE:
... | AST#method_declaration#Left private async generateFileUri AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#ERROR#Left try { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ... | private async generateFileUri() {
try {
await this.getFileType();
switch (this.fileType) {
case btCreateFilePickerPage.FILE_TYPE_FILES:
await this.generateFileManagerUri();
break;
case btCreateFilePickerPage.FILE_TYPE_IMAGE:
... | https://github.com/openharmony/base_location/blob/724370a03f6f23ddc07c8eb9f49dfc61ab716bdb/services/location_ui/entry/src/main/ets/pages/BluetoothReceive.ets#L67-L86 | af88340dcab423e2d719582962a7dd2bea4eaf88 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/expression/special_expression/template_literal_002_F.ets | arkts | Introduction 模板字面量 | export function template_literal_002_F(taint_src : string) {
let _t = taint_src;
let t = "_";
let clean =`_${t}`;
taint.Sink(clean);
} | AST#export_declaration#Left export AST#function_declaration#Left function template_literal_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem... | export function template_literal_002_F(taint_src : string) {
let _t = taint_src;
let t = "_";
let clean =`_${t}`;
taint.Sink(clean);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/template_literal_002_F.ets#L6-L11 | 396f5babf0d643840c365c273f0913d0d9152781 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NetworkManagement/entry/src/main/ets/pages/CellularNetworkQuery.ets | arkts | getNetworkStatus | [Start get_network_status] | getNetworkStatus() {
radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => {
if (err) {
hilog.error(0x0000, 'Sample', 'getNetworkState failed, callback: err->: %{public}s', JSON.stringify(err));
return;
}
hilog.info(0x0000, 'Sample', 'getNetworkState success, call... | AST#method_declaration#Left getNetworkStatus 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 radio AST#expression#Right . getNetworkState AS... | getNetworkStatus() {
radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => {
if (err) {
hilog.error(0x0000, 'Sample', 'getNetworkState failed, callback: err->: %{public}s', JSON.stringify(err));
return;
}
hilog.info(0x0000, 'Sample', 'getNetworkState success, call... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/CellularNetworkQuery.ets#L33-L44 | 8d562f9c71de665ca78eb0994ca8ced37ae37905 | gitee |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/util.ets | arkts | UTF-8 decode bytes to string | export function decodeUTF8(b: Uint8Array): string {
let out = ''
let i = 0
while (i < b.length) {
const byte1 = b[i++]
if (byte1 < 0x80) {
out += String.fromCharCode(byte1)
} else if (byte1 >= 0xc0 && byte1 < 0xe0) {
const byte2 = b[i++]
const codePoint = ((byte1 & 0x1f) << 6) | (byt... | AST#export_declaration#Left export AST#function_declaration#Left function decodeUTF8 AST#parameter_list#Left ( AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#p... | export function decodeUTF8(b: Uint8Array): string {
let out = ''
let i = 0
while (i < b.length) {
const byte1 = b[i++]
if (byte1 < 0x80) {
out += String.fromCharCode(byte1)
} else if (byte1 >= 0xc0 && byte1 < 0xe0) {
const byte2 = b[i++]
const codePoint = ((byte1 & 0x1f) << 6) | (byt... | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/util.ets#L34-L58 | 488e38da0f11c054367808379fb4c73a722cd768 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/common/utils/Logger.ets | arkts | constructor.
@param prefix Identifies the log tag.
@param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF
@param args Indicates the log parameters. | constructor(prefix: string = '', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_annotation#Le... | constructor(prefix: string = '', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/utils/Logger.ets#L34-L37 | 4abbca4f471aa377a4954f3c164d7046e5d8b392 | gitee | |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets | arkts | 综合类下的音频信息 | export class AudioInfo{
public audioId: number; // 音频ID
public audioName: string; // 音频名称
public audioIcon: Resource; // 音频图片
public audioAuthorName: string; // 音频作者名称
public audioTime: string; // 音频时间
public audioNum: string; // 音频使用人数
public audio: string; // 播放音频的文件名称
constructor(audioId: number, au... | AST#export_declaration#Left export AST#class_declaration#Left class AudioInfo AST#class_body#Left { AST#property_declaration#Left public audioId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 音频ID AST#property_declaration#Left... | export class AudioInfo{
public audioId: number;
public audioName: string;
public audioIcon: Resource;
public audioAuthorName: string;
public audioTime: string;
public audioNum: string;
public audio: string;
constructor(audioId: number, audioName: string, audioIcon: Resource, audioAuthorName: str... | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets#L19-L37 | 967968b2d40ad773fd6d882b521430a7a9a0103c | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/photopickandsave/Index.ets | arkts | PictureManagerComponent | 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 {PictureManagerComponent} from './src/main/ets/components/PictureManager'; | AST#export_declaration#Left export { PictureManagerComponent } from './src/main/ets/components/PictureManager' ; AST#export_declaration#Right | export {PictureManagerComponent} from './src/main/ets/components/PictureManager'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/Index.ets#L16-L16 | 79d201ea537c8d4754d5f5bdeabda9f595dbf53e | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinE.ets | arkts | SpinE | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinE {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 1;
@Local opacity1: number = 1;
build() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.borderRadius(this.spinSize)
.backgroundColor(this... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinE AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinE {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 1;
@Local opacity1: number = 1;
build() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.borderRadius(this.spinSize)
.backgroundColor(this... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinE.ets#L26-L63 | f3ae6caa0cb1a123af384f699116023b7e9c00b8 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppDelay/entry/src/main/ets/pages/CityListPage.ets | arkts | onPageShow | [StartExclude city_list_page] | onPageShow() {
hiTraceMeter.finishTrace("clickCity", 1);
} | AST#method_declaration#Left onPageShow 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 hiTraceMeter AST#expression#Right . finishTrace AST#m... | onPageShow() {
hiTraceMeter.finishTrace("clickCity", 1);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/pages/CityListPage.ets#L61-L63 | 60be19053b2a9a255a179376f20a0a71e65edbea | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/AxisRenderer.ets | arkts | Baseclass of all axis renderers. | export default abstract class AxisRenderer extends Renderer {
/** base axis this axis renderer works with */
protected mAxis: AxisBase | null = null;
/** transformer to transform values to screen pixels and return */
protected mTrans: Transformer | null = null;
/**
* paint object for the grid lines
*/
... | AST#export_declaration#Left export default AST#ERROR#Left abstract class AxisRenderer extends AST#type_annotation#Left AST#primary_type#Left Renderer AST#primary_type#Right AST#type_annotation#Right { /** base axis this axis renderer works with */ AST#property_declaration#Left protected mAxis : AST#type_annotation#Left... | export default abstract class AxisRenderer extends Renderer {
protected mAxis: AxisBase | null = null;
protected mTrans: Transformer | null = null;
protected mGridPaint: Paint = new Paint();
protected mAxisLabelPaint: Paint = new Paint();
protected mAxisLinePaint: Paint = new Paint();
prot... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/AxisRenderer.ets#L28-L312 | 2f3fc0d251162e02346b287222242475ad6e096c | gitee | |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | taoyao/src/main/ets/shijing/taoyao/picker/camera/CameraBuilder.ets | arkts | setVideoMaxDuration | 视频最大时长
@param videoMaxDuration
@returns | public setVideoMaxDuration(videoMaxDuration: number): CameraBuilder {
this._videoMaxDuration = videoMaxDuration
return this
} | AST#method_declaration#Left public setVideoMaxDuration AST#parameter_list#Left ( AST#parameter#Left videoMaxDuration : 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 Ca... | public setVideoMaxDuration(videoMaxDuration: number): CameraBuilder {
this._videoMaxDuration = videoMaxDuration
return this
} | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/picker/camera/CameraBuilder.ets#L62-L65 | 08580728023fcf36bd238013bc7b1080f9edc62d | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets | arkts | aboutToAppear | 在弹窗出现前准备数据 | aboutToAppear() {
this.repeatType = this.alarmItem.repeatType;
this.selects = DataTypeUtils.deepCopy(this.alarmItem.repeatDays);
for (let repeatTypeKey in RepeatType) {
this.repeatKeys.push(repeatTypeKey);
}
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . repeatType AST#member_e... | aboutToAppear() {
this.repeatType = this.alarmItem.repeatType;
this.selects = DataTypeUtils.deepCopy(this.alarmItem.repeatDays);
for (let repeatTypeKey in RepeatType) {
this.repeatKeys.push(repeatTypeKey);
}
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets#L28-L34 | eb464fd982fb3bdc73d8ce0b0d4fc0c6c1fd5aa0 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | entry/src/main/ets/pages/demos/guide/GuideBuilder.ets | arkts | 全局引导 | export class GuideImageDemoContentBuilder {
private static _WrappedBuilder?: WrappedBuilder<[]> = undefined;
static getBuilder() {
if (!GuideImageDemoContentBuilder._WrappedBuilder) {
GuideImageDemoContentBuilder._WrappedBuilder = wrapBuilder(buildGuideImage)
}
return GuideImageDemoContentBuilder... | AST#export_declaration#Left export AST#class_declaration#Left class GuideImageDemoContentBuilder AST#class_body#Left { AST#property_declaration#Left private static _WrappedBuilder ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left A... | export class GuideImageDemoContentBuilder {
private static _WrappedBuilder?: WrappedBuilder<[]> = undefined;
static getBuilder() {
if (!GuideImageDemoContentBuilder._WrappedBuilder) {
GuideImageDemoContentBuilder._WrappedBuilder = wrapBuilder(buildGuideImage)
}
return GuideImageDemoContentBuilder... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/entry/src/main/ets/pages/demos/guide/GuideBuilder.ets#L61-L70 | 501a5c78add91f08ad318ad2364a4f377882d897 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/constraint.ets | arkts | 弹框操作按钮Callback
action:
1、当action小于0时,对应弹框操作按钮的Action,类型为DialogAction。
2、当action大于等于0时,对选的是选项索引值。
dialogId: 对应弹框的id。
value: string 弹框内容回调,如输入框的输入内容。
value: string | string[] picker选中值
date: Date 选中日期 | export declare type ActionCallBack = (action: number, dialogId: string) => void; | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type ActionCallBack = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation... | export declare type ActionCallBack = (action: number, dialogId: string) => void; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/constraint.ets#L26-L26 | 24dca0f22f4ebebeaf0e2e8d9f23264858b3e714 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets | arkts | isEmptyObj | Check obj is empty.
@param {object} obj
@return {boolean} true(empty) | isEmptyObj(obj: object | string) {
return (typeof obj === 'undefined' || obj === null || obj === '');
} | AST#method_declaration#Left isEmptyObj AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left object 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#parame... | isEmptyObj(obj: object | string) {
return (typeof obj === 'undefined' || obj === null || obj === '');
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets#L26-L28 | 6e4a718a371dc7eedfc25027a1bc71dc23ffb502 | gitee |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/InterviewRecordModel.ets | arkts | getStatusText | 获取面试状态显示文本 | getStatusText(): string {
switch (this.status) {
case InterviewStatus.SCHEDULED:
return '已安排';
case InterviewStatus.COMPLETED:
return '已完成';
case InterviewStatus.CANCELLED:
return '已取消';
case InterviewStatus.PENDING:
return '待定';
default:
return ... | AST#method_declaration#Left getStatusText 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left swit... | getStatusText(): string {
switch (this.status) {
case InterviewStatus.SCHEDULED:
return '已安排';
case InterviewStatus.COMPLETED:
return '已完成';
case InterviewStatus.CANCELLED:
return '已取消';
case InterviewStatus.PENDING:
return '待定';
default:
return ... | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L85-L98 | f25e2c6d06379e49af5da46120a477b3b1e1c440 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets | arkts | getEasyQuestionCount | 获取容易题数量
@returns | public getEasyQuestionCount(): number {
return this.examDetails.filter(item => item.classificationType === ClassificationTypeEnum.EASY).length;
} | AST#method_declaration#Left public getEasyQuestionCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#mem... | public getEasyQuestionCount(): number {
return this.examDetails.filter(item => item.classificationType === ClassificationTypeEnum.EASY).length;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L212-L214 | 7a8970957f28a5bb0ea9127f5a2e50041d3f4dd9 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/market/src/main/ets/navigation/MarketGraph.ets | arkts | @file 营销模块导航图
@author Joker.X | export class MarketGraph implements RouteGraph {
/**
* 注册营销模块导航路由
*/
register(): void {
RouteBuild.register(MarketRoutes.Coupon, wrapBuilder(CouponNav));
}
} | AST#export_declaration#Left export AST#class_declaration#Left class MarketGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /**
* 注册营销模块导航路由
*/ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Lef... | export class MarketGraph implements RouteGraph {
register(): void {
RouteBuild.register(MarketRoutes.Coupon, wrapBuilder(CouponNav));
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/market/src/main/ets/navigation/MarketGraph.ets#L9-L16 | 1ae95e06d86fe79d9b89fb23c4955f134c48c9f3 | github | |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/common/utils/Request.ets | arkts | get | GET 请求
@param url 接口地址
@param params 请求参数
泛型说明:
T: 响应数据类型
第二个泛型 T: 响应体(R)就是 T | static async get<T>(url: string, params?: Object): Promise<T> {
// 显式传入三个泛型:<T, R, D>,其中 R=T, D=null
return instance.get<T, T, null>(url, { params: params });
} | AST#method_declaration#Left static async get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#R... | static async get<T>(url: string, params?: Object): Promise<T> {
return instance.get<T, T, null>(url, { params: params });
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/common/utils/Request.ets#L29-L32 | 0a29a92ad9584daac138750556e1e2ada42936e4 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/mainDialog.ets | arkts | mainDialog | Copyright (c) 2022-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,... | @CustomDialog
export struct mainDialog {
private controller: CustomDialogController = {} as CustomDialogController
build() {
Column() {
Text($r('app.string.mainDialog_inputText'))
.fontSize(16)
.fontFamily('HarmonyHeiTi')
.fontColor(Color.White)
Row() {
Button({ stat... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct mainDialog AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right = AST#e... | @CustomDialog
export struct mainDialog {
private controller: CustomDialogController = {} as CustomDialogController
build() {
Column() {
Text($r('app.string.mainDialog_inputText'))
.fontSize(16)
.fontFamily('HarmonyHeiTi')
.fontColor(Color.White)
Row() {
Button({ stat... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/mainDialog.ets#L16-L47 | 04936de6c64d8e18e67ab6b8c5a253b2b8395ac7 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/book/CategoryManager.ets | arkts | loadCategories | 初始化分类数据 | async loadCategories(): Promise<Category[]> {
// 已有缓存直接返回
if (this.categories.length !== 0) {
return this.categories;
}
try {
const books = await BookDbAccess.shared.getAllBooks();
if (books) {
const uniqueCategories = new Map<string, Category>();
books.forEach(book =... | AST#method_declaration#Left async loadCategories AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] AST#array_type#Right AST#primary_... | async loadCategories(): Promise<Category[]> {
if (this.categories.length !== 0) {
return this.categories;
}
try {
const books = await BookDbAccess.shared.getAllBooks();
if (books) {
const uniqueCategories = new Map<string, Category>();
books.forEach(book => {
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/CategoryManager.ets#L47-L80 | a5018e7fe17065769580f159c284da4258b6534c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets | arkts | getNextId | 获取组件ID | public getNextId(): number {
this.idGen += 1;
return this.idGen;
} | AST#method_declaration#Left public getNextId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expres... | public getNextId(): number {
this.idGen += 1;
return this.idGen;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L72-L75 | 0aea7e62f39e0d54ade485eb99762a63343e7912 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isUint32Array | Check whether the entered value is the uint32array array type.
@param { Object } value - A Uint32Array value
@returns { boolean } Returns true if the value is a built-in Uint32Array instance.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20 | isUint32Array(value: Object): boolean; | AST#method_declaration#Left isUint32Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R... | isUint32Array(value: Object): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1389-L1389 | 051a76e796c1888ae9e57657c0daa61af2a866a3 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets | arkts | getData | 返回指定索引位置的数据 | public getData(index: number): number {
return this.dataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | public getData(index: number): number {
return this.dataArray[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets#L62-L64 | 87f3e72cabfed5e646ac7ebe76582ee21227529d | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocreategif/src/main/ets/model/VideoInfo.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface VideoInfo {
image: Resource;
title: string;
description: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface VideoInfo AST#object_type#Left { AST#type_member#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left... | export interface VideoInfo {
image: Resource;
title: string;
description: string;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/model/VideoInfo.ets#L16-L20 | bcd255027239b6291a6ca9b14eb235ecc1fbcc83 | gitee | |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/constants.ets | arkts | UA | export const customUserAgent: string = `top.rayawa.dashboard ${APP_VERSION} ${deviceInfo.osFullName} API:${deviceInfo.sdkApiVersion} ${device_model}`; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left customUserAgent : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left ` top.rayawa.dashboard AST#template_substitution#L... | export const customUserAgent: string = `top.rayawa.dashboard ${APP_VERSION} ${deviceInfo.osFullName} API:${deviceInfo.sdkApiVersion} ${device_model}`; | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/constants.ets#L30-L30 | ea13e046e25a191c2d756b3a0423fdfe50d1422f | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LogUtil.ets | arkts | setDomain | 设置日志对应的领域标识,范围是0x0~0xFFFF。(该方法建议在Ability里调用)
@param domain | static setDomain(domain: number = LogUtil.domain) {
LogUtil.domain = domain
} | AST#method_declaration#Left static setDomain AST#parameter_list#Left ( AST#parameter#Left domain : 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 LogUtil AST#expression#Right . domain AST#member_... | static setDomain(domain: number = LogUtil.domain) {
LogUtil.domain = domain
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L53-L55 | 475b7cc1084a488029c8f56c5646849c805dbdd4 | gitee |
yongoe1024/RdbPlus.git | 4a3fc04ba5903bc1c1b194efbc557017976909dc | rdbplus/src/main/ets/core/Wrapper.ets | arkts | 构造查询参数 | export class Wrapper {
protected selectSql: string = '*'
protected groupSql: string = ''
protected havingSql: string = ''
protected orderList: string[] = []
protected whereList: string[] = []
protected valueList: relationalStore.ValueType[] = []
protected updateList: string[] = []
protected updateValueL... | AST#export_declaration#Left export AST#ERROR#Left class Wrapper { AST#property_declaration#Left protected selectSql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '*' AST#expression#Right AST#property_declaration#Right AST#property_declara... | export class Wrapper {
protected selectSql: string = '*'
protected groupSql: string = ''
protected havingSql: string = ''
protected orderList: string[] = []
protected whereList: string[] = []
protected valueList: relationalStore.ValueType[] = []
protected updateList: string[] = []
protected updateValueL... | https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/Wrapper.ets#L6-L16 | 18c50189fcc300ee7133ac37f7ae70256e24697a | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/data/MockData.ets | arkts | 分类树数据 | export const mockCategoryTrees: CategoryTree[] = [
{
id: 1,
name: '手机',
children: [
{ id: 101, name: '红米 K 系列', pic: 'https://picsum.photos/120/120?random=101' },
{ id: 102, name: '小米数字旗舰', pic: 'https://picsum.photos/120/120?random=102' },
{ id: 103, name: '红米数字系列', pic: 'https://picsum... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left mockCategoryTrees : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CategoryTree [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [... | export const mockCategoryTrees: CategoryTree[] = [
{
id: 1,
name: '手机',
children: [
{ id: 101, name: '红米 K 系列', pic: 'https://picsum.photos/120/120?random=101' },
{ id: 102, name: '小米数字旗舰', pic: 'https://picsum.photos/120/120?random=102' },
{ id: 103, name: '红米数字系列', pic: 'https://picsum... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/data/MockData.ets#L43-L104 | efae17ac1c03f06870b38d59162f1495e9730629 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/faceandfingerprintunlocking/Index.ets | arkts | FaceAndFingerprintUnlocking | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this fil e 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, sof... | export { FaceAndFingerprintUnlocking } from "./src/main/ets/view/MainPage"; | AST#export_declaration#Left export { FaceAndFingerprintUnlocking } from "./src/main/ets/view/MainPage" ; AST#export_declaration#Right | export { FaceAndFingerprintUnlocking } from "./src/main/ets/view/MainPage"; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/faceandfingerprintunlocking/Index.ets#L15-L15 | 4d1863afe0246ad9a623a58cec5630f5a69f05fc | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageloading/src/main/ets/model/CommodityDataSource.ets | arkts | unregisterDataChangeListener | 该方法为框架侧调用,为对应的LazyForEach组件在数据源处去除listener监听 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
logger.info('remove listener');
this.listeners.splice(pos, 1);
}
} | AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
logger.info('remove listener');
this.listeners.splice(pos, 1);
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageloading/src/main/ets/model/CommodityDataSource.ets#L53-L59 | 68bfd5932abe179085ef82b7e260fc4fabc97ef8 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SettingsPage.ets | arkts | clearAllData | 清空所有数据 | private async clearAllData(): Promise<void> {
try {
// 显示加载提示
promptAction.showToast({
message: '正在清空数据...',
duration: 2000
});
// 清空数据库中的所有数据
await this.databaseService.clearAllData();
// 重新加载联系人统计数据
this.contactsCount = 0;
// 显示成功提示
promptAc... | AST#method_declaration#Left private async clearAllData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#... | private async clearAllData(): Promise<void> {
try {
promptAction.showToast({
message: '正在清空数据...',
duration: 2000
});
await this.databaseService.clearAllData();
this.contactsCount = 0;
promptAction.showToast({
message: '数据清空成功',
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L130-L159 | 058605cd86c38dd9ee2bcf5f6f1019228658a05a | github |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/components/NavigationBar.ets | arkts | clickBack | 标题
点击返回 | clickBack(): void {
if (this.routerState.index > 1) {
router.back()
} else {
router.replaceUrl({
url: 'pages/Index'
})
}
} | AST#method_declaration#Left clickBack AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_express... | clickBack(): void {
if (this.routerState.index > 1) {
router.back()
} else {
router.replaceUrl({
url: 'pages/Index'
})
}
} | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/components/NavigationBar.ets#L12-L20 | 02f7715c3cab1cffa504dd2c52013e7833ddcbac | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/pages/MainPage.ets | arkts | selectListItem | 选中列表项 | selectListItem(item: Account) {
this.index = this.filteredAccounts.indexOf(item);
this.newAccount = item;
} | AST#method_declaration#Left selectListItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Account 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#express... | selectListItem(item: Account) {
this.index = this.filteredAccounts.indexOf(item);
this.newAccount = item;
} | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/pages/MainPage.ets#L74-L77 | a440b3b8225bc47a0178d02b77c0506da6604067 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/todo/TodoEditPage.ets | arkts | buildLoadingView | 构建加载视图 | @Builder
buildLoadingView() {
PageLoadingView({ message: '加载中...' })
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildLoadingView 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 PageLoadingView ( AST#component_parameters#Left { AST#com... | @Builder
buildLoadingView() {
PageLoadingView({ message: '加载中...' })
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/todo/TodoEditPage.ets#L555-L558 | d9fd8be88e1e9f9ac2c487c268e91396319f158b | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/Mistake.ets | arkts | MARK: - Helper Classes | export class MistakeHelper {
static fromWrongTimes(wrongTimes: number): Mistake {
switch (true) {
case wrongTimes === 0 : return Mistake.mistake_0
case wrongTimes === 1 : return Mistake.mistake_1_Only
case wrongTimes >= 2 && wrongTimes <= 3 : return Mistake.mistak... | AST#export_declaration#Left export AST#class_declaration#Left class MistakeHelper AST#class_body#Left { AST#method_declaration#Left static fromWrongTimes AST#parameter_list#Left ( AST#parameter#Left wrongTimes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#p... | export class MistakeHelper {
static fromWrongTimes(wrongTimes: number): Mistake {
switch (true) {
case wrongTimes === 0 : return Mistake.mistake_0
case wrongTimes === 1 : return Mistake.mistake_1_Only
case wrongTimes >= 2 && wrongTimes <= 3 : return Mistake.mistak... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/Mistake.ets#L14-L36 | 6ad76feaf9780991b56b36d907c94e81677ddf18 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/others/SpecifyAppNetworkType/entry/src/main/ets/pages/Index.ets | arkts | ShowNetInfo | 显示网络信息 | async ShowNetInfo() {
this.netHandleArray = await connection.getAllNets();
this.msgHistory += `激活网络数量:${this.netHandleArray.length}\r\n\r\n`
//清空下拉列表元素
this.netShowArray.splice(0, this.netShowArray.length);
for (let i = 0; i < this.netHandleArray.length; i++) {
let connProp = await connectio... | AST#method_declaration#Left async ShowNetInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . netHandleArray AST#... | async ShowNetInfo() {
this.netHandleArray = await connection.getAllNets();
this.msgHistory += `激活网络数量:${this.netHandleArray.length}\r\n\r\n`
this.netShowArray.splice(0, this.netShowArray.length);
for (let i = 0; i < this.netHandleArray.length; i++) {
let connProp = await connection.getConne... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/others/SpecifyAppNetworkType/entry/src/main/ets/pages/Index.ets#L151-L166 | 52bbb1bb84be6e26c9c9bd78d3bbdd09eb0f5114 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets | arkts | clearNodes | 清空节点 | clearNodes(): void {
if (this.rootNode === null) {
return;
}
if (this.rootRenderNode !== null) {
this.rootRenderNode.clearChildren();
}
} | AST#method_declaration#Left clearNodes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#e... | clearNodes(): void {
if (this.rootNode === null) {
return;
}
if (this.rootRenderNode !== null) {
this.rootRenderNode.clearChildren();
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L99-L106 | 734796bbf298546bcc1f64b8d0ece6dc62647eaa | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/select/Cascade.ets | arkts | init | 初始化城市数据 | private init() {
try {
//获取区域数据
let jsonStr = getContext().resourceManager.getRawFileContentSync("area.json");
//转码
let textCoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
let vStr = textCoder.decodeWithStream(jsonStr, { stream: false });
//获取数据
this.province... | AST#method_declaration#Left private init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { //获取区域数据 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left jsonStr = AST#expression#Left AST#c... | private init() {
try {
let jsonStr = getContext().resourceManager.getRawFileContentSync("area.json");
let textCoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
let vStr = textCoder.decodeWithStream(jsonStr, { stream: false });
this.provinceList = JSON.parse(... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L91-L109 | b647701b73ab914fa11492b9034b5deee18fc839 | gitee |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | taoyao/src/main/ets/shijing/taoyao/origin/ContextOrigin.ets | arkts | 在UI中申请权限 | export class ContextOrigin extends Origin {
private context: common.UIAbilityContext
constructor | AST#export_declaration#Left export AST#ERROR#Left class ContextOrigin extends AST#type_annotation#Left AST#primary_type#Left Origin AST#primary_type#Right AST#type_annotation#Right { private context : AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#ERROR#Right AST#variable_declaration#Lef... | export class ContextOrigin extends Origin {
private context: common.UIAbilityContext
constructor | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/origin/ContextOrigin.ets#L7-L11 | 30783afccfc96fd83ff429654e8a411c7585bf1a | gitee | |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/common/conts.ets | arkts | 90s | export const ATL3_AUTH_TIMEOUT = 90*1000; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ATL3_AUTH_TIMEOUT = AST#expression#Left AST#binary_expression#Left AST#expression#Left 90 AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable... | export const ATL3_AUTH_TIMEOUT = 90*1000; | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/common/conts.ets#L23-L23 | 59d2f1967186e10f72e954a5fc12757777a64df3 | github | |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/Visitor.ets | arkts | 字段访问者接口
每个 visit 方法对应一种字段类型,Visitor 实现类负责具体的格式编码逻辑。
消息类通过 traverse() 方法遍历所有字段,调用相应的 visit 方法。 | export interface Visitor {
// ========== 标量字段 ==========
/**
* 访问 int32 字段
* @param value 字段值
* @param fieldNumber proto 字段编号
*/
visitInt32(value: number, fieldNumber: number): void
/**
* 访问 int64 字段
* @param value 字段值(使用 bigint)
* @param fieldNumber proto 字段编号
*/
visitInt64(value: b... | AST#export_declaration#Left export AST#interface_declaration#Left interface Visitor AST#object_type#Left { // ========== 标量字段 ========== /**
* 访问 int32 字段
* @param value 字段值
* @param fieldNumber proto 字段编号
*/ AST#type_member#Left visitInt32 AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annot... | export interface Visitor {
visitInt32(value: number, fieldNumber: number): void
visitInt64(value: bigint, fieldNumber: number): void
visitUint32(value: number, fieldNumber: number): void
visitUint64(value: bigint, fieldNumber: number): void
visitSint32(value: number, fieldNumber: number... | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/Visitor.ets#L30-L370 | 84b06105e5c5d9c2ba1c2b5b5de64523b3b3f7cf | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/NetUtil.ets | arkts | getAllNets | 获取所有处于连接状态的网络列表 | static getAllNets(): GlobalContext {
let list = connection.getAllNetsSync();
let ctx = GlobalContext.getContext();
if (list) {
ctx.netList = list;
}
return ctx;
} | AST#method_declaration#Left static getAllNets AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GlobalContext AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ... | static getAllNets(): GlobalContext {
let list = connection.getAllNetsSync();
let ctx = GlobalContext.getContext();
if (list) {
ctx.netList = list;
}
return ctx;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/NetUtil.ets#L54-L61 | 70c0aa9fa8ac670b7a89fecfa8cf1490ed7f7124 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | replaceOmitAndPoint | replace omit and remove last point | private static replaceOmitAndPoint(srcText: string): string {
let str: string = srcText;
const strPoint: string = STR_POINT_HALF;
const strOmitHalf: string = STR_OMIT_HALF;
const strOmitFull: string = STR_OMIT_FULL;
const indexNoFound: number = -1;
str = str.replace(strOmitHalf, strOmitFull);
... | AST#method_declaration#Left private static replaceOmitAndPoint AST#parameter_list#Left ( AST#parameter#Left srcText : 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 str... | private static replaceOmitAndPoint(srcText: string): string {
let str: string = srcText;
const strPoint: string = STR_POINT_HALF;
const strOmitHalf: string = STR_OMIT_HALF;
const strOmitFull: string = STR_OMIT_FULL;
const indexNoFound: number = -1;
str = str.replace(strOmitHalf, strOmitFull);
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L276-L289 | 543b9e74780b2ae37726ee12a9dd538a67bdea0f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottompanelslide/Index.ets | arkts | BottomPanelSlideComponent | 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 { BottomPanelSlideComponent } from './src/main/ets/view/BottomPanelSlide'; | AST#export_declaration#Left export { BottomPanelSlideComponent } from './src/main/ets/view/BottomPanelSlide' ; AST#export_declaration#Right | export { BottomPanelSlideComponent } from './src/main/ets/view/BottomPanelSlide'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/Index.ets#L15-L15 | 6b7376e8132c917af3295e0f1dab76fd73f887f0 | gitee |
Neptune-EX/OS_System_Design.git | c728a82d48079ae0c52d50c4a2e2586b69f4ce55 | entry/src/main/ets/common/utils/FileManager.ets | arkts | isValidFilename | 验证文件名是否合法
@param filename 文件名
@returns 是否合法 | private isValidFilename(filename: string): boolean {
if (!filename || filename.trim() === '') {
return false;
}
// 检查非法字符
const illegalChars = /[<>:"/\\|?*]/;
if (illegalChars.test(filename)) {
return false;
}
// 检查文件名长度
if (filename.length > 255) {
return false;
... | AST#method_declaration#Left private isValidFilename AST#parameter_list#Left ( AST#parameter#Left filename : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#p... | private isValidFilename(filename: string): boolean {
if (!filename || filename.trim() === '') {
return false;
}
const illegalChars = /[<>:"/\\|?*]/;
if (illegalChars.test(filename)) {
return false;
}
if (filename.length > 255) {
return false;
}
const r... | https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/FileManager.ets#L343-L369 | 9c4ed207a671b524169b8a33c051db6009817b16 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarUtils.ets | arkts | getZodiac | 获取生肖
@param year 农历年份
@returns 生肖名称 | static getZodiac(year: number): string {
return LunarUtils.ZODIAC_ANIMALS[(year - 4) % 12];
} | AST#method_declaration#Left static getZodiac AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static getZodiac(year: number): string {
return LunarUtils.ZODIAC_ANIMALS[(year - 4) % 12];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L415-L417 | c1893638b0a03b123789ac13c10931ada9777509 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/view/MainPage.ets | arkts | MainPage | @file 主页面视图
@author Joker.X | @ComponentV2
export struct MainPage {
/**
* 主页面 ViewModel
*/
@Local
private vm: MainViewModel = new MainViewModel();
/**
* 窗口安全区状态
*/
@Local
private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
/**
* 屏幕断点状态
*/
@Local
private breakpointState: BreakpointState = ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MainPage AST#component_body#Left { /**
* 主页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left MainViewModel ... | @ComponentV2
export struct MainPage {
@Local
private vm: MainViewModel = new MainViewModel();
@Local
private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
@Local
private breakpointState: BreakpointState = getBreakpointState();
build() {
AppNavDestination({
hid... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MainPage.ets#L17-L126 | c6df7aaea21002b99cb14986fda0409d2a61ace0 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | SetOrCreate | Called when setting or creating.
@since 7
@deprecated since 10 | static SetOrCreate<T>(propName: string, newValue: T): void {
AppStorage.setOrCreate(propName, newValue)
} | AST#method_declaration#Left static SetOrCreate AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#para... | static SetOrCreate<T>(propName: string, newValue: T): void {
AppStorage.setOrCreate(propName, newValue)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L165-L167 | 55ad4b5c8f3ec39e6d70b41f30c1490639435b63 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderCommentPage.ets | arkts | CommentFieldCard | 评论输入框卡片
@returns {void} 无返回值 | @Builder
private CommentFieldCard(): void {
IBestField({
showLabel: false,
value: this.vm.commentContent!!,
placeholder: $r("app.string.comment_placeholder"),
rows: 6,
maxlength: 200,
showWordLimit: true,
hasBorder: false,
autosize: true,
fieldPadding: $r("app... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CommentFieldCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST... | @Builder
private CommentFieldCard(): void {
IBestField({
showLabel: false,
value: this.vm.commentContent!!,
placeholder: $r("app.string.comment_placeholder"),
rows: 6,
maxlength: 200,
showWordLimit: true,
hasBorder: false,
autosize: true,
fieldPadding: $r("app... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderCommentPage.ets#L125-L142 | e1c692a86ff1c6a908494d5f3b515413e26aa0d8 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/BreakpointState.ets | arkts | isLG | 是否为大断点
@returns {boolean} 是否大断点 | isLG(): boolean {
return this.current === BreakpointType.LG;
} | AST#method_declaration#Left isLG AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AS... | isLG(): boolean {
return this.current === BreakpointType.LG;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L113-L115 | f5077fa37afae1f10e571e8eb5e2b50c7590cef7 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DeviceUtils.ets | arkts | isHonorDevice | 判断是否为荣耀设备 | static isHonorDevice(): boolean {
return DeviceUtil.getPhoneBrand() === 'honor';
} | AST#method_declaration#Left static isHonorDevice AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_ex... | static isHonorDevice(): boolean {
return DeviceUtil.getPhoneBrand() === 'honor';
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DeviceUtils.ets#L74-L76 | 39e87f17bea93994d337eca3dc5364cb31bb6593 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/refresh/RefreshLayout.ets | arkts | 渲染刷新布局
@returns {void} 无返回值 | build() {
IBestPullRefresh({
loading: this.loading,
scroller: this.scroller,
isEnableSlideUp: this.isEnableSlideUp,
defaultContent: (): void => {
if (this.content) {
this.content();
}
},
onRefresh: (direction: "pull" | "slideUp"): void => this.onRefresh(... | AST#build_method#Left build ( ) AST#build_body#Left { AST#expression_statement#Left AST#expression#Left AST#arrow_function#Left IBestPullRefresh AST#ERROR#Left ( { AST#component_parameter#Left loading : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loading AST#member_exp... | build() {
IBestPullRefresh({
loading: this.loading,
scroller: this.scroller,
isEnableSlideUp: this.isEnableSlideUp,
defaultContent: (): void => {
if (this.content) {
this.content();
}
},
onRefresh: (direction: "pull" | "slideUp"): void => this.onRefresh(... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/refresh/RefreshLayout.ets#L41-L52 | 1bba7aa58a277bea9c53201573d3d4f28c6a65f3 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindow.ets | arkts | PipWindowViewComponent | 功能描述:本示例主要介绍视频小窗口播放场景,利用媒体的AVPlayer实现视频播放以及相关操作,利用PiPWindow开启悬浮窗从而实现小窗口播放视频。
推荐场景:需跨出应用开启悬浮窗时使用
核心组件:
1.XComponentView 视频播放组件
2.PipWindowComponent 画中画控制开启、播放组件
3.ControlPanel 控制器组件
实现步骤:
1.初始化视频播放控制器。
@example
@State player: AVPlayer = PipManager.getInstance().player;
2.传入在线视频资源。
@example
@State url: string = "https... | @Component
export struct PipWindowViewComponent {
@State player: AVPlayer = PipManager.getInstance().player;
@State url: string = "https://v.oh4k.com/muhou/2022/07/20220704-RIUq3Z.mp4"; // 传入在线视频资源
@State videoHeight: string | number | Resource = $r('app.integer.pip_window_component_stack_height');
@State video... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PipWindowViewComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right player : AST#type_annotation#Left AST#primary_type#Left AVPlayer AST#primary_type#Right AST... | @Component
export struct PipWindowViewComponent {
@State player: AVPlayer = PipManager.getInstance().player;
@State url: string = "https://v.oh4k.com/muhou/2022/07/20220704-RIUq3Z.mp4";
@State videoHeight: string | number | Resource = $r('app.integer.pip_window_component_stack_height');
@State videoWidth: stri... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindow.ets#L49-L73 | 90538180f47bdbc6f0acf9d7119b80194a09b1c5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/components/CustomScanCameraComp.ets | arkts | CustomScanCameraComp | 扫码相机流组件
实现步骤:
1.使用XComponent展示相机流内容
2.XComponent加载完成之后开启扫码服务
3.监控应用前后台切换、折叠屏状态变更,释放和重启扫码服务 | @Component
export default struct CustomScanCameraComp {
// 自定义扫码vm实例
@Consume('customScanVM') customScanVM: CustomScanViewModel;
// 相机流展示组件控制器
private cameraSurfaceController: XComponentController = new XComponentController();
aboutToAppear() {
// 注册屏幕状态监听(仅折叠屏)
this.customScanVM.regDisplayListener()... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CustomScanCameraComp AST#component_body#Left { // 自定义扫码vm实例 AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'customScanVM' AST#expression#Right ) AST#decorator#Right customScan... | @Component
export default struct CustomScanCameraComp {
@Consume('customScanVM') customScanVM: CustomScanViewModel;
private cameraSurfaceController: XComponentController = new XComponentController();
aboutToAppear() {
this.customScanVM.regDisplayListener();
this.customScanVM.regXCompSizeU... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CustomScanCameraComp.ets#L27-L92 | 4bcd01bc79435914af8fd1791810e98ff637b7ac | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/decompressfile/src/main/ets/view/MainPage.ets | arkts | aboutToAppear | 解压后的文件列表 | aboutToAppear() {
this.initZip(this.rawfileZipName)
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initZip AST#member_exp... | aboutToAppear() {
this.initZip(this.rawfileZipName)
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/view/MainPage.ets#L53-L55 | 235d4a7eae36544f5ba133fac733d20c9489fe73 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | insertSampleGreetingHistory | 插入示例祝福历史数据 | private async insertSampleGreetingHistory(): Promise<void> {
try {
const sampleGreetings: GreetingHistoryEntity[] = [
{
contact_id: 1,
greeting_content: '亲爱的妹妹,生日快乐!愿你永远年轻美丽,工作顺利,身体健康!',
occasion: '生日祝福',
sent_at: '2024-03-15T09:00:00.000Z',
created_at... | AST#method_declaration#Left private async insertSampleGreetingHistory 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_annotati... | private async insertSampleGreetingHistory(): Promise<void> {
try {
const sampleGreetings: GreetingHistoryEntity[] = [
{
contact_id: 1,
greeting_content: '亲爱的妹妹,生日快乐!愿你永远年轻美丽,工作顺利,身体健康!',
occasion: '生日祝福',
sent_at: '2024-03-15T09:00:00.000Z',
created_at... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L619-L667 | 9f8f9f9081a2367d6f596b7557210571241ef6b4 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | isEmpty | 字符串是否为空
@param str 被检测的字符串
@return 是否为空 | static isEmpty(str: string): boolean {
return str == null || str.length == 0;
} | AST#method_declaration#Left static isEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Ri... | static isEmpty(str: string): boolean {
return str == null || str.length == 0;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L127-L129 | 012a71b0394de275b845eec33bab84a6888707b0 | gitee |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets | arkts | TODO: should we use a lock here? | constructor() {
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right | constructor() {
} | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets#L16-L17 | eca4403f09857f66d3198c593c5ff6d6f7d951c6 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.