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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | getSolarToLunar | 获取公历日期对应的农历日期 | async getSolarToLunar(year: number, solarMonth: number, solarDay: number): Promise<LunarDate | null> {
await this.ensureYearMapping(year);
const yearData = this.mappingCache.get(year);
if (!yearData) return null;
const solarKey = `${solarMonth}-${solarDay}`;
const mapping = yearData.solarToLunar.g... | AST#method_declaration#Left async getSolarToLunar 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#Left solarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | async getSolarToLunar(year: number, solarMonth: number, solarDay: number): Promise<LunarDate | null> {
await this.ensureYearMapping(year);
const yearData = this.mappingCache.get(year);
if (!yearData) return null;
const solarKey = `${solarMonth}-${solarDay}`;
const mapping = yearData.solarToLunar.g... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L180-L207 | 722a42978ef3daa668ae3e722e06addd8c916ebb | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/repeat.d.ets | arkts | Define a builder template option parameter.
@interface TemplateOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 20 | export interface TemplateOptions {
/**
* The cached number of each template.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 20
*/
cachedCount?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TemplateOptions AST#object_type#Left { /**
* The cached number of each template.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 20
*/ AST#type_member#Left cachedCount ? : AST#type_annotation#Left AS... | export interface TemplateOptions {
cachedCount?: number;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/repeat.d.ets#L172-L181 | 3be8fb39eab65bc373ae08046df5e354d381aaef | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/DeviceManagement/ScreenDetector/entry/src/main/ets/pages/ScreenInfo.ets | arkts | In low-code mode, do not add anything to the build function, as it will be
overwritten by the content generated by the .visual file in the build phase. | build() {
Column() {
Row() {
Text($r('app.string.entry_ScreenInfo'))
.fontSize(20)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
}
.height('6%')
.width('100%')
.padding({ left: 15 })
.backgroundColor('#0D9FFB')
.constraintSize({ ... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Column() {
Row() {
Text($r('app.string.entry_ScreenInfo'))
.fontSize(20)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
}
.height('6%')
.width('100%')
.padding({ left: 15 })
.backgroundColor('#0D9FFB')
.constraintSize({ ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/DeviceManagement/ScreenDetector/entry/src/main/ets/pages/ScreenInfo.ets#L34-L55 | cf4df7e699815b5a90fc33a1d5103cfd3261466e | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | testVibrationPattern | 测试震动功能 | private async testVibrationPattern(pattern: string): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Testing vibration pattern: ${pattern}`);
// 这里应该调用HarmonyOS的震动API
// 实际实现中可以使用@kit.SensorServiceKit的vibrator模块
// import { vibrator } from '@kit.SensorServic... | AST#method_declaration#Left private async testVibrationPattern AST#parameter_list#Left ( AST#parameter#Left pattern : 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#ERROR#Left : AST#type_annotation#Left AST#primar... | private async testVibrationPattern(pattern: string): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Testing vibration pattern: ${pattern}`);
let vibrationTime = 500;
switch (pattern) {
case '短震':
vibrationTime = 100;
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6316-L6330 | 9b501ca887d0bc88b10cc61c4ff17c92b709da53 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/RegexUtils.ets | arkts | isValidCard | 验证身份证号码的有效性
@param id
@returns | static isValidCard(id: string): boolean {
if (id.length === 18) {
const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
const lastLetter = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
id = id.toUpperCase();
const lastChar = id.charAt(17).toUpperCase();
let s... | AST#method_declaration#Left static isValidCard AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | static isValidCard(id: string): boolean {
if (id.length === 18) {
const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
const lastLetter = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
id = id.toUpperCase();
const lastChar = id.charAt(17).toUpperCase();
let s... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/RegexUtils.ets#L242-L259 | 6d5a6cce63ba854da379d5e67692cc374514da04 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/AboutSample/entry/src/main/ets/common/bean/ListItemData.ets | arkts | Basic list item data bean. | export class ListItemData {
/**
* Indicates unique id for list item.
*/
id: number;
/**
* Indicates list item title.
*/
title: Resource;
/**
* Indicates list item icon.
*/
icon: Resource;
/**
* Indicates list item summary.
*/
summary: Resource;
} | AST#export_declaration#Left export AST#class_declaration#Left class ListItemData AST#class_body#Left { /**
* Indicates unique id for list item.
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Ri... | export class ListItemData {
id: number;
title: Resource;
icon: Resource;
summary: Resource;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/AboutSample/entry/src/main/ets/common/bean/ListItemData.ets#L4-L23 | 98792934113fe956a72d138ade38013435f4b867 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/UdpClient_Server.ets | arkts | startServer | 启动服务器 | startServer() {
if (!this.serverIp || !this.serverPort) {
this.msgHistory += 'Some required fields are missing.\n';
Logger.error('Some required fields are missing.');
return;
}
let tcpMessage: TcpMessage = {
type: 'startServer',
serverIp: this.serverIp,
serverPort: this.... | AST#method_declaration#Left startServer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expressio... | startServer() {
if (!this.serverIp || !this.serverPort) {
this.msgHistory += 'Some required fields are missing.\n';
Logger.error('Some required fields are missing.');
return;
}
let tcpMessage: TcpMessage = {
type: 'startServer',
serverIp: this.serverIp,
serverPort: this.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/UdpClient_Server.ets#L209-L236 | 6f69e56c572f2f82f0cd834b50035be261f0c246 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildInfoItem | 信息项 | @Builder
buildInfoItem(label: string, value: string) {
Row() {
Text(label)
.fontSize(16)
.fontColor(this.COLORS.textSecondary)
.layoutWeight(1)
Text(value)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
}
.width... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildInfoItem AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left... | @Builder
buildInfoItem(label: string, value: string) {
Row() {
Text(label)
.fontSize(16)
.fontColor(this.COLORS.textSecondary)
.layoutWeight(1)
Text(value)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
}
.width... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3893-L3910 | d230b051c9f3f9919ce5a79b95c7fad8c9e27a51 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | decrypt | 解密,异步
@param data 加密或者解密的数据。data不能为null。
@param priKey 指定解密私钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(RSA1024|PKCS1、RSA2048|PKCS1、等)。 | static async decrypt(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, priKey, null, transformation);
} | AST#method_declaration#Left static async decrypt AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey... | static async decrypt(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, priKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L58-L61 | 9a70cb939b0c7936b0036415a89ea2bf3cb2f1db | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DbFileUtility.ets | arkts | getFileExtension | 获取文件扩展名(不带点)
@param filename 文件名
@returns 文件扩展名(小写) | private static getFileExtension(filename: string): string {
const dotIndex = filename.lastIndexOf('.');
return dotIndex === -1 ? '' : filename.substring(dotIndex + 1).toLowerCase();
} | AST#method_declaration#Left private static getFileExtension 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 strin... | private static getFileExtension(filename: string): string {
const dotIndex = filename.lastIndexOf('.');
return dotIndex === -1 ? '' : filename.substring(dotIndex + 1).toLowerCase();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DbFileUtility.ets#L186-L189 | affee97cbff01f593a162e6e529be6541f3d3e19 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets | arkts | default constructor | constructor() {
super();
this.mTextSize = 10;
this.mXOffset = Utils.convertDpToPixel(5);
this.mYOffset = Utils.convertDpToPixel(5);
this.mLimitLines = new JArrayList<LimitLine>();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST... | constructor() {
super();
this.mTextSize = 10;
this.mXOffset = Utils.convertDpToPixel(5);
this.mYOffset = Utils.convertDpToPixel(5);
this.mLimitLines = new JArrayList<LimitLine>();
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L193-L199 | b0cd1e00e2332b1bca31629dfb86c769c0018c79 | gitee | |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/asfcommandwidget/entryformability/EntryFormAbility.ets | arkts | onRemoveForm | Tips 卡片变换大小时会调用,删除被变换的 Form | async onRemoveForm(formId: string) {
// Called to notify the form provider that a specified form has been destroyed.
Logger.debug(this.LOG_TAG, `onRemoveForm() formID: ${formId}`);
this.init();
await this.unbindForm(formId);
} | AST#method_declaration#Left async onRemoveForm AST#parameter_list#Left ( AST#parameter#Left formId : 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#builder_function_body#Left { // Called to notify the form provide... | async onRemoveForm(formId: string) {
Logger.debug(this.LOG_TAG, `onRemoveForm() formID: ${formId}`);
this.init();
await this.unbindForm(formId);
} | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/asfcommandwidget/entryformability/EntryFormAbility.ets#L31-L38 | 674cdd4a705ae0eb6adf48db4705839c9217ec09 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets | arkts | 一天的信息。包含农历 | export interface Day {
dayNum: number, // 日期
lunarDay: string, // 农历中文日期
dayInfo: DayInfo, // 一天的年月日信息
isShowSchedulePoint: boolean // 是否显示日程点
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Day AST#object_type#Left { AST#type_member#Left dayNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , // 日期 AST#type_member#Left lunarDay : AST#type_annotation#Le... | export interface Day {
dayNum: number,
lunarDay: string,
dayInfo: DayInfo,
isShowSchedulePoint: boolean
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets#L32-L37 | f2dcc7bc5542f8111f3389c6ab00a2848112cf4a | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showError | 显示失败提示
@param {string | ResourceStr} message - 提示内容
@returns {void} 无返回值 | static showError(message: string | ResourceStr): void {
IBestToast.show({
type: "fail",
message: message
});
} | AST#method_declaration#Left static showError AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Rig... | static showError(message: string | ResourceStr): void {
IBestToast.show({
type: "fail",
message: message
});
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L34-L39 | e997486cc7c4cd1d4dc5899c79bac0d1fb0df217 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowMoreOptions.ets | arkts | can_save_zone | Enabled | can_save_zone() {
return this.is_zone || !this.zones.includes(this.my_window_alias);
} | AST#method_declaration#Left can_save_zone AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#exp... | can_save_zone() {
return this.is_zone || !this.zones.includes(this.my_window_alias);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowMoreOptions.ets#L396-L398 | a7a1ef07a9e58abb13f1c5faf7527653dcf40baf | gitee |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/ui/layout/BannerItemLayout.ets | arkts | BannerItemLayout | bannerUI页面 | @Component
export struct BannerItemLayout {
@State private banners: Array<IBanner> = []
private swiperController: SwiperController = new SwiperController()
onItemClick: (item: IBanner) => void
build() {
Swiper(this.swiperController) {
ForEach(this.banners, (value: IBanner) => {
this.bannerCon... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BannerItemLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private banners : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#... | @Component
export struct BannerItemLayout {
@State private banners: Array<IBanner> = []
private swiperController: SwiperController = new SwiperController()
onItemClick: (item: IBanner) => void
build() {
Swiper(this.swiperController) {
ForEach(this.banners, (value: IBanner) => {
this.bannerCon... | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/ui/layout/BannerItemLayout.ets#L6-L34 | 1f8cf4169126ebb8edaa06a321a8054c53325755 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | setAndProp | Called when dynamic properties are set.
@since 10 | static setAndProp<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> {
return StorageMap.shared.setAndProp(propName, defaultValue)
} | AST#method_declaration#Left static setAndProp 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#param... | static setAndProp<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> {
return StorageMap.shared.setAndProp(propName, defaultValue)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L108-L110 | b85fac2196ee7e66965741ad5e35003b53c861cc | gitee |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/utils/MoodDB.ets | arkts | loginUser | 登录:成功后记录 UserID | static async loginUser(username: string, password: string): Promise<boolean> {
if (!MoodDB.rdbStore) return Promise.reject('DB Error');
let predicates = new relationalStore.RdbPredicates('USER_TABLE');
predicates.equalTo('username', username);
predicates.equalTo('password', password);
let resultSe... | AST#method_declaration#Left static async loginUser AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#... | static async loginUser(username: string, password: string): Promise<boolean> {
if (!MoodDB.rdbStore) return Promise.reject('DB Error');
let predicates = new relationalStore.RdbPredicates('USER_TABLE');
predicates.equalTo('username', username);
predicates.equalTo('password', password);
let resultSe... | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/utils/MoodDB.ets#L57-L73 | 67dcfd2b2855d673468101a58173211e153e4045 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment8.ets | arkts | UserCardBuilder | [Start Case6] 1. Customizing @Builder Function Components | @Builder
function UserCardBuilder(name: string, age?: number, avatarImage?: ResourceStr) {
Row() {
Row() {
Image(avatarImage)
.size({ width: 50, height: 50 })
.borderRadius(25)
.margin(8)
Text(name)
.fontSize(30)
}
Text(`age:${age?.toString()}`)
.fontSize(... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function UserCardBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left age ? : AS... | @Builder
function UserCardBuilder(name: string, age?: number, avatarImage?: ResourceStr) {
Row() {
Row() {
Image(avatarImage)
.size({ width: 50, height: 50 })
.borderRadius(25)
.margin(8)
Text(name)
.fontSize(30)
}
Text(`age:${age?.toString()}`)
.fontSize(... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment8.ets#L29-L49 | 634202dbcbbb345b62732e816ac13f876759fcec | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/TEUtility.ets | arkts | clipString | ② 全角分号(;) ---------- 对外方法:clipString(srcString) ---------- | static clipString(srcString: string | undefined | null): string {
if (srcString) {
return TEUtility.clipStringWithLength(srcString, 10);
}
return ''
} | AST#method_declaration#Left static clipString AST#parameter_list#Left ( AST#parameter#Left srcString : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_t... | static clipString(srcString: string | undefined | null): string {
if (srcString) {
return TEUtility.clipStringWithLength(srcString, 10);
}
return ''
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/TEUtility.ets#L179-L184 | 656752551c4bd096c9212736f260ea81364846ac | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/common/Constants.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 const CONFIGURATION: Record<string, number> = {
'TABCONTENT_OVERFLOW_TOAST_DURATION': 300,
'TABCONTENT_OVERFLOW_INTERVAL_NUMBER': 30,
'TABCONTENT_OVERFLOW_ZINDEX': 2,
'TABCONTENT_OVERFLOW_TABS_DURATION': 100,
'TABCONTENT_OVERFLOW_OPACITY': 0.5,
'TABCONTENT_OVERFLOW_TEXT_OPACITY': 0.7,
'TABCONTENT_O... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CONFIGURATION : 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... | export const CONFIGURATION: Record<string, number> = {
'TABCONTENT_OVERFLOW_TOAST_DURATION': 300,
'TABCONTENT_OVERFLOW_INTERVAL_NUMBER': 30,
'TABCONTENT_OVERFLOW_ZINDEX': 2,
'TABCONTENT_OVERFLOW_TABS_DURATION': 100,
'TABCONTENT_OVERFLOW_OPACITY': 0.5,
'TABCONTENT_OVERFLOW_TEXT_OPACITY': 0.7,
'TABCONTENT_O... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/common/Constants.ets#L16-L35 | fcf13c6fb15337a17c770c8f630e19dbbe32ff72 | gitee | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/common/constants/ApiKey.ets | arkts | 网络请求时使用的 API 密钥。 | export default class ApiKey {
/**
* 高德地图网络请求密钥。
*/
public static readonly key: string = '1cfc033b636eb37ab3b8eba82bf2cabd';
} | AST#export_declaration#Left export default AST#class_declaration#Left class ApiKey AST#class_body#Left { /**
* 高德地图网络请求密钥。
*/ AST#property_declaration#Left public static readonly key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '1cf... | export default class ApiKey {
public static readonly key: string = '1cfc033b636eb37ab3b8eba82bf2cabd';
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/common/constants/ApiKey.ets#L4-L9 | bd5d4b159c8085487a0365cebefe184323897c9f | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ExpandTitle/entry/src/main/ets/pages/MemoItem.ets | arkts | MemoItem | 笔记内容视图 | @Component
export default struct MemoItem {
@State memoItem: MemoInfo = MEMO_DATA[0];
build() {
Row() {
Column({ space: Constants.MEMO_COL_SPACE }) {
Text(this.memoItem.title)
.fontSize($r('app.float.expanded_title_font_size_normal'))
.memoTextExpand()
.fontColor($r(... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct MemoItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right memoItem : AST#type_annotation#Left AST#primary_type#Left MemoInfo AST#primary_type#Right AST#typ... | @Component
export default struct MemoItem {
@State memoItem: MemoInfo = MEMO_DATA[0];
build() {
Row() {
Column({ space: Constants.MEMO_COL_SPACE }) {
Text(this.memoItem.title)
.fontSize($r('app.float.expanded_title_font_size_normal'))
.memoTextExpand()
.fontColor($r(... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ExpandTitle/entry/src/main/ets/pages/MemoItem.ets#L23-L60 | 1176d06f45a662d6e1b164542f922aa3e371b831 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/pages/Index.ets | arkts | setTimer | 视频索引 | setTimer(): void {
let that = this;
this.timeout = setTimeout(() => {
that.isClickScreen = false; // 隐藏操作面板
}, SET_TIME_OUT); // 8秒后隐藏
} | AST#method_declaration#Left setTimer AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left that = AST#express... | setTimer(): void {
let that = this;
this.timeout = setTimeout(() => {
that.isClickScreen = false;
}, SET_TIME_OUT);
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/pages/Index.ets#L77-L82 | f72f8eca4a262480d5ed6558abb5d525f5af86ba | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/DialogConfig.ets | arkts | 弹窗配置(初始化默认值) | export class DialogConfig implements IDialogStyle {
//------------------------------------公共参数---promptAction.BaseDialogOptions----------------------------------------
/**
* 设置 UIAbilityContext(用于吐司类弹窗 需要)
* 其他类型弹窗为 NavDestination.mode(NavDestinationMode.DIALOG) 无需设置
*/
uiAbilityContext?: common.UIAbilit... | AST#export_declaration#Left export AST#class_declaration#Left class DialogConfig AST#implements_clause#Left implements IDialogStyle AST#implements_clause#Right AST#class_body#Left { //------------------------------------公共参数---promptAction.BaseDialogOptions---------------------------------------- /**
* 设置 UIAbilityC... | export class DialogConfig implements IDialogStyle {
uiAbilityContext?: common.UIAbilityContext;
autoCancel: boolean = true;
alignment: DialogAlignment = DialogAlignment.Default;
levelMode: LevelMode = LevelMode.EMBEDDED;
maskColor: ResourceColor = '#B3000000';
onWillDismiss?: Callback<D... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/DialogConfig.ets#L16-L155 | 37daa0b56ef6d01e6e032c7b5edc2365ce80709b | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/SpeechRecognizerHelper.ets | arkts | writeAudio | 写音频流,最大音频长度为60000ms。为了确保收到识别结果,请优先调用setListener和startListening。
@param sessionId 会话ID。
@param audio 待识别的音频数据,当前仅支持音频数据长度为640字节或1280字节。建议每次发送音频调用间隔为20ms(传输音频长度为640字节)或40ms(传输音频长度为1280字节)。 | static writeAudio(sessionId: string, audio: Uint8Array): void {
SpeechRecognizerHelper.recognitionEngine?.writeAudio(sessionId, audio);
} | AST#method_declaration#Left static writeAudio AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left audio : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#pri... | static writeAudio(sessionId: string, audio: Uint8Array): void {
SpeechRecognizerHelper.recognitionEngine?.writeAudio(sessionId, audio);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/SpeechRecognizerHelper.ets#L86-L88 | bc6c29462ac9e4b49c10aa31815af546347ef613 | gitee |
wenfujing/honms-super-market.git | 0858abecd8be5db7b8dcf88dcd77b7c66d37517a | common/src/main/ets/constants/GridConstants.ets | arkts | Constants for Grid components. | export class GridConstants {
/**
* Current component width: 4 grids.
*/
static readonly COLUMN_FOUR: number = 4;
/**
* Current component width: 8 grids.
*/
static readonly COLUMN_EIGHT: number = 8;
/**
* Current component width: 12 grids.
*/
static readonly COLUMN_TWELVE: number = 12;
... | AST#export_declaration#Left export AST#class_declaration#Left class GridConstants AST#class_body#Left { /**
* Current component width: 4 grids.
*/ AST#property_declaration#Left static readonly COLUMN_FOUR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AS... | export class GridConstants {
static readonly COLUMN_FOUR: number = 4;
static readonly COLUMN_EIGHT: number = 8;
static readonly COLUMN_TWELVE: number = 12;
static readonly SPAN_ONE: number = 1;
static readonly SPAN_TWO: number = 2;
static readonly SPAN_THREE: number = 3;
static ... | https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/constants/GridConstants.ets#L19-L89 | e11a5b5c9cf2c35f6b34f43a9a62d2847f7a356d | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets | arkts | addData | 改变单个数据。
@param {number} index - 索引值。
@param {CustomDataType} data - 修改后的值。 | public addData(index: number, data: CustomDataType): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#method_declaration#Left public addData 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#Left data : AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primary... | public addData(index: number, data: CustomDataType): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets#L163-L166 | 5f96f5d9039532bce60ea4f49adb138e8fe627d4 | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/common/utils/ASF.ets | arkts | send | 发送正常指令 | async send(command: string): Promise<http.HttpResponse> {
try {
const result = await this.sendRequest(this.address, this.asfPassword, command);
return result;
} catch (err) {
Logger.error(this.LOG_TAG, `send() 错误, ${JSON.stringify(err)}`);
throw err as Err... | AST#method_declaration#Left async send AST#parameter_list#Left ( AST#parameter#Left command : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promi... | async send(command: string): Promise<http.HttpResponse> {
try {
const result = await this.sendRequest(this.address, this.asfPassword, command);
return result;
} catch (err) {
Logger.error(this.LOG_TAG, `send() 错误, ${JSON.stringify(err)}`);
throw err as Err... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/ASF.ets#L30-L38 | 15cabb936d030bcddc15a27e98ca00bd8334d5b5 | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/database/Rdb.ets | arkts | query | 查询数据
@param predicates - 查询数据的条件
@param callback - 查询成功后的回调函数 | query(predicates: relationalStore.RdbPredicates, callback: Function = () => {
}): void {
// 如果回调函数未提供,记录警告信息
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'query() has no callback!');
return;
}
// 如果 rdbStore 存在,使用关系型存储库... | AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback :... | query(predicates: relationalStore.RdbPredicates, callback: Function = () => {
}): void {
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'query() has no callback!');
return;
}
if (this.rdbStore) {
this.rdbStore... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/database/Rdb.ets#L175-L197 | 7d5144fd2992edc7b1686ad559e795cf71f59268 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets | arkts | deleteTransactions | 删除交易记录 | public async deleteTransactions(transactionId: number) {
const condition: TablePredicateParams = {
field: TransactionTableFields.TRANSACTION_ID,
value: transactionId,
operator: DBOperator.EQUAL,
};
try {
await this.delete(AccountingDBConstants.TRANSACTION_TABLE_NAME, [
condit... | AST#method_declaration#Left public async deleteTransactions AST#parameter_list#Left ( AST#parameter#Left transactionId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST... | public async deleteTransactions(transactionId: number) {
const condition: TablePredicateParams = {
field: TransactionTableFields.TRANSACTION_ID,
value: transactionId,
operator: DBOperator.EQUAL,
};
try {
await this.delete(AccountingDBConstants.TRANSACTION_TABLE_NAME, [
condit... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L120-L139 | 959a6856cde336e68a0780e1a033b7eaea992538 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/example/Index.ets | arkts | @Author csx
@DateTime 2025/7/7 21:54
@TODO Index | export class Index {
} | AST#export_declaration#Left export AST#class_declaration#Left class Index AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right | export class Index {
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/example/Index.ets#L22-L23 | 787e218605e35e94a32d88ef09e4b96cb9cae3f0 | gitee | |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/TargetInfoApi.type.ets | arkts | 删除目标 | export interface TargetInfoDeleteParam {
/**
* 目标内容id
*/
id: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TargetInfoDeleteParam AST#object_type#Left { /**
* 目标内容id
*/ AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AS... | export interface TargetInfoDeleteParam {
id: number
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/TargetInfoApi.type.ets#L59-L65 | a77a369b391460d5121ee8907a2bef862dbb9301 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets | arkts | isVideoStabilizationModeSupported | 查询是否支持视频防抖。HDR录像需要支持视频防抖。 | function isVideoStabilizationModeSupported(session: camera.VideoSession, mode: camera.VideoStabilizationMode): boolean {
let isSupported: boolean = false;
try {
isSupported = session.isVideoStabilizationModeSupported(mode);
} catch (error) {
// 失败返回错误码error.code并处理
let err = error as BusinessError;
... | AST#function_declaration#Left function isVideoStabilizationModeSupported AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . VideoSession AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST... | function isVideoStabilizationModeSupported(session: camera.VideoSession, mode: camera.VideoStabilizationMode): boolean {
let isSupported: boolean = false;
try {
isSupported = session.isVideoStabilizationModeSupported(mode);
} catch (error) {
let err = error as BusinessError;
Logger.error(`The isV... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets#L74-L84 | 9b9c6ce28d8e9cf2d41fd348b9f69a9031952715 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | movePlaneByHandle | 收到手柄指令后移动飞机 | movePlaneByHandle() {
this.planePosX += Math.cos((this.angle + 90) * (Math.PI / 180)) * 10
this.planePosY -= Math.sin((this.angle + 90) * (Math.PI / 180)) * 10
if (this.planePosX < 0) {
this.planePosX = 0
}
if (this.planePosY < 0) {
this.planePosY = 0
}
if (this.planePosX > thi... | AST#method_declaration#Left movePlaneByHandle 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 . planePosX AST#member_expression#... | movePlaneByHandle() {
this.planePosX += Math.cos((this.angle + 90) * (Math.PI / 180)) * 10
this.planePosY -= Math.sin((this.angle + 90) * (Math.PI / 180)) * 10
if (this.planePosX < 0) {
this.planePosX = 0
}
if (this.planePosY < 0) {
this.planePosY = 0
}
if (this.planePosX > thi... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L337-L357 | e9c565ca0e63b48ebab8ed8b87c45bbc17566b7f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Social/PublishMultimediaUpdate/publishmultimediaupdate/src/main/ets/components/OneMoment.ets | arkts | OneMoment | 列表子组件
TODO: 性能知识点:@Reusable复用组件优化,详情请见:https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/quick-start/arkts-reusable.md | @Reusable
@Component
export struct OneMoment {
@Prop moment: FriendMoment;
controller: VideoController = new VideoController()
aboutToReuse(params: Record<string, Object>): void {
this.moment = params.moment as FriendMoment;
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Reusable AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct OneMoment AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right moment : AST#type_annotation#Left AST#primary_type#Left... | @Reusable
@Component
export struct OneMoment {
@Prop moment: FriendMoment;
controller: VideoController = new VideoController()
aboutToReuse(params: Record<string, Object>): void {
this.moment = params.moment as FriendMoment;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/PublishMultimediaUpdate/publishmultimediaupdate/src/main/ets/components/OneMoment.ets#L25-L33 | c88b802a0a0ea4ad7e606cdfc77cc658fbd493e6 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 自动备份配置接口 | export interface AutoBackupConfig {
enabled: boolean;
frequency: BackupFrequency;
location: BackupLocation;
maxBackups: number;
includeImages: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AutoBackupConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left frequency : AST#type_ann... | export interface AutoBackupConfig {
enabled: boolean;
frequency: BackupFrequency;
location: BackupLocation;
maxBackups: number;
includeImages: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L90-L96 | b77e735e0ac160933d3f76aa0990b1a919392593 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets | arkts | unregisterDataChangeListener | Register a controller that changes data.
@param {DataChangeListener} listener Data change listener | unregisterDataChangeListener(listener: DataChangeListener): void {
let pos: number = this.listeners.indexOf(listener);
if (pos >= 0) {
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 {
let pos: number = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets#L74-L79 | 293e2d73693f53d3c58776ad68c49a24bc7c4a7d | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/extension_actions.ets | arkts | Reads the locale JSON object of extension.
@param path The path of the extension root directory.
@param locale The locale code, like 'en'.
@returns The JSON object or undefined, if not found. | export function locale_messages_of_extension(path: string | undefined, locale: string) {
let messages: object | undefined;
if (!path) {
return undefined;
}
let locale_text = sandbox_read_text_sync(`${path}/_locales/${locale}/messages.json`);
if (locale_text == 'undefined') {
// Locale not found
re... | AST#export_declaration#Left export AST#function_declaration#Left function locale_messages_of_extension AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_t... | export function locale_messages_of_extension(path: string | undefined, locale: string) {
let messages: object | undefined;
if (!path) {
return undefined;
}
let locale_text = sandbox_read_text_sync(`${path}/_locales/${locale}/messages.json`);
if (locale_text == 'undefined') {
return undefined;
}... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L271-L283 | 6598e31df9b13e58d81c93031e9bd89c9058702f | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/shortcut/ShortcutManager.ets | arkts | updateContactShortcut | 更新特定联系人的快捷方式 | async updateContactShortcut(contact: Contact): Promise<void> {
try {
// 如果今天是该联系人的生日,创建特定的快捷方式
if (this.isToday(contact.birthday.date)) {
const shortcut: ShortcutInfo = {
id: `greeting_${contact.id}`,
shortLabel: `祝福${contact.name}`,
longLabel: `为${contact.name}发送生日... | AST#method_declaration#Left async updateContactShortcut AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener... | async updateContactShortcut(contact: Contact): Promise<void> {
try {
if (this.isToday(contact.birthday.date)) {
const shortcut: ShortcutInfo = {
id: `greeting_${contact.id}`,
shortLabel: `祝福${contact.name}`,
longLabel: `为${contact.name}发送生日祝福`,
iconId: $r... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L204-L247 | 19140a76a7c33e2d28c8784a18d60288cde38af7 | github |
azhuge233/Wake-HarmonyOS.git | 68c4e961f9cf5fab8699af99313dd5854ea313a1 | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | returnFromSubPage | 从 NavDestination 由 pop() 返回时 显示回调 popInfo | public returnFromSubPage(popInfo: PopInfo): void {
Logger.debug(this.LOG_TAG,
`从 [${popInfo.info.name}] 页面返回, 携带参数: ${JSON.stringify(popInfo.result)}`);
} | AST#method_declaration#Left public returnFromSubPage AST#parameter_list#Left ( AST#parameter#Left popInfo : AST#type_annotation#Left AST#primary_type#Left PopInfo 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#pri... | public returnFromSubPage(popInfo: PopInfo): void {
Logger.debug(this.LOG_TAG,
`从 [${popInfo.info.name}] 页面返回, 携带参数: ${JSON.stringify(popInfo.result)}`);
} | https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/common/utils/CommonUtils.ets#L45-L48 | 5e6ece03c5ee7be4c2dc84c528dc24b6290331c5 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/ResourceAllocation/ApplicationThemeSwitch/entry/src/main/ets/models/HomeModel.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class TabTitleModel {
constructor(public id: number, public uri: Resource, public selectedUri: Resource, public title: Resource) {
this.id = id
this.uri = uri
this.selectedUri = selectedUri
this.title = title
}
} | AST#export_declaration#Left export AST#class_declaration#Left class TabTitleModel AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left public AST#ERROR#Left id AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#ty... | export class TabTitleModel {
constructor(public id: number, public uri: Resource, public selectedUri: Resource, public title: Resource) {
this.id = id
this.uri = uri
this.selectedUri = selectedUri
this.title = title
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ResourceAllocation/ApplicationThemeSwitch/entry/src/main/ets/models/HomeModel.ets#L16-L23 | 0abb3113c2e12a43b5589a474c6a648f00bb6d69 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoProcessBaseWeb/entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | [EndExclude index] | aboutToAppear(): void {
window.getLastWindow(this.context).then((windowClass) => this.windowClass = windowClass);
// [StartExclude index]
this.manager.registerController(Constants.INDEX_WEB_CONTROLLER, this.webController);
AppStorage.setOrCreate<ComponentContent<Object>>('contentNode', this.contentNode)... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
window.getLastWindow(this.context).then((windowClass) => this.windowClass = windowClass);
this.manager.registerController(Constants.INDEX_WEB_CONTROLLER, this.webController);
AppStorage.setOrCreate<ComponentContent<Object>>('contentNode', this.contentNode);
hilog.info(0x000,... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoProcessBaseWeb/entry/src/main/ets/pages/Index.ets#L107-L114 | 6c5d9717a1a7485c34467d4785e63b06625543d2 | gitee |
ali5669/ArkTSShopping.git | 7065d61468d80c143788532337c499eb9eaa5ffd | entry/src/main/ets/viewmodel/ItemModel.ets | arkts | 不同的样式 | export class ItemStyle {
title: string = ''
price: number = 0
image?: ResourceStr = ''
} | AST#export_declaration#Left export AST#class_declaration#Left class ItemStyle AST#class_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left '' AS... | export class ItemStyle {
title: string = ''
price: number = 0
image?: ResourceStr = ''
} | https://github.com/ali5669/ArkTSShopping.git/blob/7065d61468d80c143788532337c499eb9eaa5ffd/entry/src/main/ets/viewmodel/ItemModel.ets#L2-L6 | a9f528c7accfa1350174aea4c03c17dbd87c01c0 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/AccessPermission/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Common constants for all features. | export class CommonConstants {
/**
* Full percent.
*/
static readonly FULL_PERCENT: string = '100%';
/**
* X-axis coordinate of the dialog box.
*/
static readonly DIALOG_OFFSET_X: number = 0;
/**
* Y-axis coordinate of the dialog box.
*/
static readonly DIALOG_OFFSET_Y: number = -20;
... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Full percent.
*/ AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left... | export class CommonConstants {
static readonly FULL_PERCENT: string = '100%';
static readonly DIALOG_OFFSET_X: number = 0;
static readonly DIALOG_OFFSET_Y: number = -20;
static readonly HOME_IMAGE_HEIGHT: string = '34.5%';
static readonly HOME_BUTTON_WIDTH: string = '86.7%';
static re... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/AccessPermission/entry/src/main/ets/common/constants/CommonConstants.ets#L27-L143 | b99ae778df15ab440892a2e1f5929cf584e08d11 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/example/dto/MockData.ets | arkts | Mock数据 | export const MEMO_DATA: FileItem[] = [
new FileItem('test1.png'),
new FileItem('test2.ppt'),
new FileItem('test3.doc'),
new FileItem('test4.xls'),
new FileItem('test5.xls'),
new FileItem('test6.xls'),
new FileItem('test7.doc'),
new FileItem('test8.ppt'),
new FileItem('test9.doc'),
new FileItem('test... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MEMO_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FileItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#express... | export const MEMO_DATA: FileItem[] = [
new FileItem('test1.png'),
new FileItem('test2.ppt'),
new FileItem('test3.doc'),
new FileItem('test4.xls'),
new FileItem('test5.xls'),
new FileItem('test6.xls'),
new FileItem('test7.doc'),
new FileItem('test8.ppt'),
new FileItem('test9.doc'),
new FileItem('test... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/example/dto/MockData.ets#L19-L30 | 95a226b5d73c2ecce9065b0c55eb43e414ee2b1c | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/slider/sliderNormal.ets | arkts | SliderNormalBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function SliderNormalBuilder(name: string, param: Object) {
SliderNormalExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SliderNormalBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p... | @Builder
export function SliderNormalBuilder(name: string, param: Object) {
SliderNormalExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/slider/sliderNormal.ets#L16-L19 | 61a388d67f540436744cf1043b354c320ed1be8f | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MusicHome-master/features/musicComment/src/main/ets/constants/CommonConstants.ets | arkts | Common constants for all features. | export class CommonConstants {
/**
* Spacing between list items.
*/
static readonly LIST_SPACE: string = '10vp';
/**
* A maximum of 4 reviews can be displayed under sm and md device types.
*/
static readonly LIST_COUNT: number = 4;
/**
* Prefix of the reply message.
*/
static readonly NI... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Spacing between list items.
*/ AST#property_declaration#Left static readonly LIST_SPACE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#exp... | export class CommonConstants {
static readonly LIST_SPACE: string = '10vp';
static readonly LIST_COUNT: number = 4;
static readonly NICKNAME_PREV: string = '@';
static readonly NICKNAME_SUFFIX: string = ':';
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/musicComment/src/main/ets/constants/CommonConstants.ets#L19-L39 | dd9acc97d43b773733827b8ed84926fa52899b2e | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | Enumerates the aspect ratios of the grid item display, including 1:1 and the original image's aspect ratio.
@enum { number } Grid item display aspect ratio.
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 20 | export declare enum ItemDisplayRatio {
/**
* Square ratio item
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 20
*/
SQUARE_RATIO = 0,
/**
* original size ratio item
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @at... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum ItemDisplayRatio AST#enum_body#Left { /**
* Square ratio item
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 20
*/ AST#enum_member#Left SQUARE_RATIO = ... | export declare enum ItemDisplayRatio {
SQUARE_RATIO = 0,
ORIGINAL_SIZE_RATIO = 1
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L1270-L1288 | 5ee4d8292538ab67f7f909493a5f4dd5ebe62088 | gitee | |
Glace-Dev/Harmony_Projects.git | 845cef3c5fdf5d049c942fe62cbf083c2c78e84a | basis/entry/src/main/ets/views/task/TaskItem.ets | arkts | finishedTask | 任务完成样式 | @Extend(Text) function finishedTask(){
.decoration({type:TextDecorationType.LineThrough})
.fontColor('#B1B2B1')
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function finishedTask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . decoration ( AST#expression#Left AST#o... | @Extend(Text) function finishedTask(){
.decoration({type:TextDecorationType.LineThrough})
.fontColor('#B1B2B1')
} | https://github.com/Glace-Dev/Harmony_Projects.git/blob/845cef3c5fdf5d049c942fe62cbf083c2c78e84a/basis/entry/src/main/ets/views/task/TaskItem.ets#L37-L40 | fd4a53ac14d9f578fc47124a94357fa9e5cab290 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/GreetingGenerationService.ets | arkts | simulateMultipleGeneration | 模拟批量生成 | private async simulateMultipleGeneration(
prompt: string,
params: GreetingGenerateParams,
count: number
): Promise<string[]> {
await this.delay(1500 + Math.random() * 1000);
const contact = params.contact;
const style = params.style;
const occasion = params.occasion;
const templates =... | AST#method_declaration#Left private async simulateMultipleGeneration AST#parameter_list#Left ( AST#parameter#Left prompt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Le... | private async simulateMultipleGeneration(
prompt: string,
params: GreetingGenerateParams,
count: number
): Promise<string[]> {
await this.delay(1500 + Math.random() * 1000);
const contact = params.contact;
const style = params.style;
const occasion = params.occasion;
const templates =... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L374-L392 | dfe27efc864ba4bb8973f5a7505c917a70f360d8 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | clearChat | Clear chat history | clearChat(): void {
this.chatMessages = [];
this.agentService.clearHistory();
this.addChatMessage('Chat cleared. How can I help you?', false);
} | AST#method_declaration#Left clearChat AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_e... | clearChat(): void {
this.chatMessages = [];
this.agentService.clearHistory();
this.addChatMessage('Chat cleared. How can I help you?', false);
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L520-L524 | a486be83e6fc164111f1239898f739f1f28d9c8d | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/EncryptUtils.ets | arkts | generateRandomString | 生成随机字符串 | static generateRandomString(length: number = 32): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
} | AST#method_declaration#Left static generateRandomString 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#expression#Left 32 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann... | static generateRandomString(length: number = 32): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/EncryptUtils.ets#L57-L64 | 9e62e9381eb8898e01798d4847c5ecd7f90767fa | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/pages/DetailPage.ets | arkts | DetailPage | DetailPage 页面组件。 | @Entry
@Component
export default struct DetailPage {
// 监听 alarmItem 属性变化,提供给子组件使用
@Watch('onAlarmItemChange') @Provide(DetailConstants.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem = new AlarmItem();
// 存储重复设置的数据
@State repeatSettingArr: Array<AlarmSettingItem> = [];
// 存储闹钟设置的数据
@State alarmSettingInfoArr:... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export default struct DetailPage AST#component_body#Left { // 监听 alarmItem 属性变化,提供给子组件使用 AST#property_declaration#Left AST#decorator#Left @ Watch ( AST#expression#Left 'onAlarmItemChan... | @Entry
@Component
export default struct DetailPage {
@Watch('onAlarmItemChange') @Provide(DetailConstants.DEFAULT_PROVIDER_KEY) alarmItem: AlarmItem = new AlarmItem();
@State repeatSettingArr: Array<AlarmSettingItem> = [];
@State alarmSettingInfoArr: Array<AlarmSettingItem> = [];
private isNew: b... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/DetailPage.ets#L17-L155 | 11bf33eb16d5362b81c04e2034db1c781842eed2 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | initializeThemeManager | 初始化主题管理器 | private async initializeThemeManager(): Promise<void> {
try {
// 加载预设主题
await this.loadPresetThemes();
// 加载字体配置
await this.loadFontConfigs();
// 加载当前主题配置
await this.loadCurrentTheme();
// 应用主题
if (this.currentTheme) {
await this.applyThem... | AST#method_declaration#Left private async initializeThemeManager 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#Ri... | private async initializeThemeManager(): Promise<void> {
try {
await this.loadPresetThemes();
await this.loadFontConfigs();
await this.loadCurrentTheme();
if (this.currentTheme) {
await this.applyTheme(this.currentTheme);
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L144-L164 | b8b930199073d83fa31ea93086df590179e7c87b | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/AgentService.ets | arkts | executeSaveMemo | Execute save_memo function
Saves a new memo in the database
@param args - Function arguments
@returns Result message | private async executeSaveMemo(args: SaveMemoArgs): Promise<string> {
try {
const normalizedContent = this.normalizeQuotes(args.content) ?? args.content;
console.info(`[AgentService] Saving memo: ${normalizedContent}`);
// Create memo object
const memo = new Memo(0, normalizedContent, Date.n... | AST#method_declaration#Left private async executeSaveMemo AST#parameter_list#Left ( AST#parameter#Left args : AST#type_annotation#Left AST#primary_type#Left SaveMemoArgs AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g... | private async executeSaveMemo(args: SaveMemoArgs): Promise<string> {
try {
const normalizedContent = this.normalizeQuotes(args.content) ?? args.content;
console.info(`[AgentService] Saving memo: ${normalizedContent}`);
const memo = new Memo(0, normalizedContent, Date.now());
... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/AgentService.ets#L594-L614 | 0f3494445dbaa6df64471fa0256645b619ede9fb | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | hideConfirmReceiveDialog | 隐藏确认收货弹窗
@returns {void} 无返回值 | hideConfirmReceiveDialog(): void {
this.showConfirmDialog = false;
} | AST#method_declaration#Left hideConfirmReceiveDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Le... | hideConfirmReceiveDialog(): void {
this.showConfirmDialog = false;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L279-L281 | ea0049959e7c7a5a2709096f838e5bb2c16dc8ad | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxShape.ets | arkts | CheckboxShapeBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function CheckboxShapeBuilder(name: string, param: Object) {
CheckboxShapeExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CheckboxShapeBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ... | @Builder
export function CheckboxShapeBuilder(name: string, param: Object) {
CheckboxShapeExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxShape.ets#L16-L19 | c26c82e7615fa6db4378d9e63bc6d22a4c301368 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets | arkts | getAnimateSelectIndex | 获取动画控制的下标
用于切换选项时,先让标签回到底部,然后让当前选项在上移 | getAnimateSelectIndex() {
// 动画等待时间 - 用于等待上一个选项动画结束
let animateDelay = 500;
animateTo({
duration: this.animateTime,
delay: animateDelay
}, () => {
this.animateSelectIndex = this.selectIndex
})
// 绘制canvas 用于兼容点击 凸起时,canvas 同时移动
this.createAnimation()
} | AST#method_declaration#Left getAnimateSelectIndex AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 动画等待时间 - 用于等待上一个选项动画结束 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animateDelay = AST#expression#Left 500 AST#expression#Right AST#variable_declarato... | getAnimateSelectIndex() {
let animateDelay = 500;
animateTo({
duration: this.animateTime,
delay: animateDelay
}, () => {
this.animateSelectIndex = this.selectIndex
})
this.createAnimation()
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets#L64-L76 | 123a697513b952bc3c787248027a7e79375dfd84 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SaveNetWorkPictures.ets | arkts | saveImage | 保存ArrayBuffer到图库
@param buffer:图片ArrayBuffer
@returns | async saveImage(buffer: ArrayBuffer | string): Promise<void> {
const context = getContext(this) as common.UIAbilityContext; // 获取getPhotoAccessHelper需要的context
const helper = photoAccessHelper.getPhotoAccessHelper(context); // 获取相册管理模块的实例
const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAG... | AST#method_declaration#Left async saveImage AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right... | async saveImage(buffer: ArrayBuffer | string): Promise<void> {
const context = getContext(this) as common.UIAbilityContext;
const helper = photoAccessHelper.getPhotoAccessHelper(context);
const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg');
const file = await fs.open(uri, f... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SaveNetWorkPictures.ets#L96-L103 | ea9523963dd6a59c80893b72c8d88fe6a54f149d | gitee |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/pages/DustMonitoringPage.ets | arkts | getNormalAreaCount | 获取正常区域数量 | private getNormalAreaCount(): number {
return this.dustList.filter(item => item.status === 0).length;
} | AST#method_declaration#Left private getNormalAreaCount 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#memb... | private getNormalAreaCount(): number {
return this.dustList.filter(item => item.status === 0).length;
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/DustMonitoringPage.ets#L184-L186 | 3bd8679bdb7760c92d5c3ffdd0bfdab85999956a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/selecttextmenu/Index.ets | arkts | SelectTextMenuComponent | 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 { SelectTextMenuComponent } from './src/main/ets/view/SelectTextMenu'; | AST#export_declaration#Left export { SelectTextMenuComponent } from './src/main/ets/view/SelectTextMenu' ; AST#export_declaration#Right | export { SelectTextMenuComponent } from './src/main/ets/view/SelectTextMenu'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/selecttextmenu/Index.ets#L16-L16 | fcebc9436cb7f2da1e1468e91d8930604bbe7fbf | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 聊天消息请求参数 | export interface ChatMessagesParams {
sessionId: string;
pageNum: number;
pageSize: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ChatMessagesParams AST#object_type#Left { AST#type_member#Left sessionId : 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 pageNum : AST#type_an... | export interface ChatMessagesParams {
sessionId: string;
pageNum: number;
pageSize: number;
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L206-L210 | 8a822de715932b9b850380d372fd832f90150a46 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets | arkts | Superclass of all render classes for the different data types (line, bar, ...).
@author Philipp Jahoda | export default abstract class DataRenderer extends Renderer {
/**
* the animator object used to perform animations on the chart data
*/
protected mAnimator: ChartAnimator = new ChartAnimator();
/**
* main paint object used for rendering
*/
protected mRenderPaint: Paint;
protected mPathPaint: Pat... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class DataRenderer extends AST#type_annotation#Left AST#primary_type#Left Renderer AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* the animator object used to perform animations on the chart data
*/ AST#pro... | export default abstract class DataRenderer extends Renderer {
protected mAnimator: ChartAnimator = new ChartAnimator();
protected mRenderPaint: Paint;
protected mPathPaint: PathPaint;
protected mHighlightPaint: Paint;
protected mDrawPaint: Paint;
public mValuePaint: Paint;
constructor(an... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets#L33-L194 | 3a817afd17b911f10508c082be5ca446e4b6c21e | gitee | |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/database/Rdb.ets | arkts | 导出一个名为 Rdb 的类,用于封装关系型数据库的操作 | export default class Rdb {
private rdbStore: relationalStore.RdbStore | null = null;
private tableName: string;
private sqlCreateTable: string;
private columns: Array<string>;
/**
* 构造函数,用于创建 Rdb 类的实例
* @param tableName - 表名
* @param sqlCreateTable - 创建表的 SQL 语句
* @param columns - 表的列名数组
*/
... | AST#export_declaration#Left export default AST#class_declaration#Left class Rdb AST#class_body#Left { AST#property_declaration#Left private rdbStore : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore AST#qualified_type#Right AST#primary_type#Right | A... | export default class Rdb {
private rdbStore: relationalStore.RdbStore | null = null;
private tableName: string;
private sqlCreateTable: string;
private columns: Array<string>;
constructor(tableName: string, sqlCreateTable: string, columns: Array<string>) {
this.tableName = tableName;
this.sqlCreat... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/database/Rdb.ets#L11-L198 | 3185eaa7a8409a4c24bbf422be8f3a712200ae2c | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuTransition.ets | arkts | BindContextMenuTransitionBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function BindContextMenuTransitionBuilder(name: string, param: Object) {
BindContextMenuTransitionExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindContextMenuTransitionBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | @Builder
export function BindContextMenuTransitionBuilder(name: string, param: Object) {
BindContextMenuTransitionExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuTransition.ets#L16-L19 | 769ef05261352c0d3d64ae776736c708af21b540 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/AESSync.ets | arkts | decodeCBC128 | 解密-CBC模式-128位
@param str 加密的字符串
@param aesKey AES密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns | static decodeCBC128(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeCBC(str, aesKey, iv, 'AES128', 'AES128|CBC|PKCS7', 128, keyCoding, dataCoding);
} | AST#method_declaration#Left static decodeCBC128 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static decodeCBC128(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeCBC(str, aesKey, iv, 'AES128', 'AES128|CBC|PKCS7', 128, keyCoding, dataCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L244-L247 | 960e2013063b06094cec6e4c498275f755d94591 | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/view/Detail/DetailTopComponent.ets | arkts | DetailTopView | 明细页展示结余信息 | @Component
@Preview
export default struct DetailTopView {
@Link homeStore: HomeStore;
@Link detailType: string;
build() {
Row() {
Column() {
Row() {
Text(this.getTitle() + '结余')
.fontSize(Const.DEFAULT_24)
Text('¥ ' + this.homeStore.getCustomBalance())
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right AST#decorator#Left @ Preview AST#decorator#Right export default struct DetailTopView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right homeStore : AST#type_annotation#Left AST#pri... | @Component
@Preview
export default struct DetailTopView {
@Link homeStore: HomeStore;
@Link detailType: string;
build() {
Row() {
Column() {
Row() {
Text(this.getTitle() + '结余')
.fontSize(Const.DEFAULT_24)
Text('¥ ' + this.homeStore.getCustomBalance())
... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/Detail/DetailTopComponent.ets#L8-L137 | 6fcd856fd6cb04fa68f8ac34d4bccc25e99b84be | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语统计接口 | export interface GreetingStatistics {
total: number;
totalGenerated: number;
totalUsed: number;
averageRating: number;
byStyle: Record<string, number>;
byOccasion: Record<string, number>;
byLanguage: Record<string, number>;
customCount: number;
presetCount: number;
popularGreetings: Greeting[];
to... | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingStatistics AST#object_type#Left { AST#type_member#Left total : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalGenerated : AST#type... | export interface GreetingStatistics {
total: number;
totalGenerated: number;
totalUsed: number;
averageRating: number;
byStyle: Record<string, number>;
byOccasion: Record<string, number>;
byLanguage: Record<string, number>;
customCount: number;
presetCount: number;
popularGreetings: Greeting[];
to... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L240-L256 | 45ed3027ee4997f017977854e545f81d52e7a9e7 | github | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelPinsUpdate.ets | arkts | handle | 应用约束:1. 强制使用静态类型,明确方法参数类型 | handle(packet: Packet): void {
const client = this.packetManager.client;
const data = packet.d;
// 应用约束:1. 强制使用静态类型,添加类型断言
const channel = client.channels.get(data.channel_id) as Channel | undefined;
// 应用约束:32. 限制一元运算符使用,显式转换日期
const timeStr = data.last_pin_timestamp ? data.last_pin_t... | AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left Packet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#... | handle(packet: Packet): void {
const client = this.packetManager.client;
const data = packet.d;
const channel = client.channels.get(data.channel_id) as Channel | undefined;
const timeStr = data.last_pin_timestamp ? data.last_pin_timestamp : '';
const time = timeStr ? new Date(tim... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelPinsUpdate.ets#L15-L33 | e534c0c0363c525272ed8a354331dafde5735b99 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/DateUtils.ets | arkts | getMonthDates | 获取本月的日期数组
@returns 本月所有日期数组 | static getMonthDates(): Date[] {
const monthStart = DateUtils.getMonthStart();
const monthEnd = new Date(monthStart.getFullYear(), monthStart.getMonth() + 1, 0);
const dates: Date[] = [];
for (let i = 1; i <= monthEnd.getDate(); i++) {
dates.push(new Date(monthStart.getFullYear(), monthStart.getM... | AST#method_declaration#Left static getMonthDates AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Date [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration... | static getMonthDates(): Date[] {
const monthStart = DateUtils.getMonthStart();
const monthEnd = new Date(monthStart.getFullYear(), monthStart.getMonth() + 1, 0);
const dates: Date[] = [];
for (let i = 1; i <= monthEnd.getDate(); i++) {
dates.push(new Date(monthStart.getFullYear(), monthStart.getM... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L178-L188 | ad30c4f4508bbe025c9d6a2b4f567ffeae822619 | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/utils/FileUtils.ets | arkts | writeData | 异步向path写入数据
@param path 文件绝对路径
@param content 文件内容 | async writeData(path: string, content: ArrayBuffer | string): Promise<boolean> {
try {
let fd = (await fs.open(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE)).fd
let stat = await fs.stat(path)
await fs.write(fd, content, { offset: stat.size })
await fs.close(fd)
return true
}
... | AST#method_declaration#Left async writeData AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Arr... | async writeData(path: string, content: ArrayBuffer | string): Promise<boolean> {
try {
let fd = (await fs.open(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE)).fd
let stat = await fs.stat(path)
await fs.write(fd, content, { offset: stat.size })
await fs.close(fd)
return true
}
... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L93-L105 | 67648b066c5c3c7c0365f577b4aef522e9c918ea | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/UserState.ets | arkts | getUserId | 获取当前用户 ID
@returns {number | null} 用户 ID,未登录返回 null | getUserId(): number | null {
return this.userInfo?.id ?? null;
} | AST#method_declaration#Left getUserId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#... | getUserId(): number | null {
return this.userInfo?.id ?? null;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L138-L140 | 924afe6d6e974cd411e4ad86088b81fd7ceded4a | github |
wenfujing/honms-super-market.git | 0858abecd8be5db7b8dcf88dcd77b7c66d37517a | common/src/main/ets/utils/Utils.ets | arkts | Format date.
@param timestamp time
@param format = "yyyy-mm-dd"
@returns res | export function formatDate(timestamp: number, format = 'yyyy-mm-dd') {
let res = "";
try {
const date = new Date(timestamp);
const opt: Opt = {
yy: date.getFullYear().toString(),
mm: (date.getMonth() + 1).toString(),
dd: date.getDate().toString(),
HH: date.getHours().toString(),
... | AST#export_declaration#Left export AST#function_declaration#Left function formatDate AST#parameter_list#Left ( AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format = AST#expression#Left 'yyyy... | export function formatDate(timestamp: number, format = 'yyyy-mm-dd') {
let res = "";
try {
const date = new Date(timestamp);
const opt: Opt = {
yy: date.getFullYear().toString(),
mm: (date.getMonth() + 1).toString(),
dd: date.getDate().toString(),
HH: date.getHours().toString(),
... | https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/Utils.ets#L13-L53 | 84df89b0121b1880d914e8eeb7acb48bdae66afe | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | isUsingSliceColorAsValueLineColor | This method is deprecated.
Use isUseValueColorForLineEnabled() instead.
@Deprecated | public isUsingSliceColorAsValueLineColor(): boolean {
return this.isUseValueColorForLineEnabled();
} | AST#method_declaration#Left public isUsingSliceColorAsValueLineColor 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#expressio... | public isUsingSliceColorAsValueLineColor(): boolean {
return this.isUseValueColorForLineEnabled();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L165-L167 | d051a7c86e228faeaf65dd16f3721e0526439032 | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkUIWantOpenManageApplications/entry/src/main/ets/pages/Index.ets | arkts | implicitStartAbility | 隐示启动Ability | async implicitStartAbility() {
try {
let want = {
// 调用应用管理
"action": wantConstant.Action.ACTION_MANAGE_APPLICATIONS_SETTINGS
}
let context = getContext(this) as context.AbilityContext;
await context.startAbility(want)
console.info(`implicit start ability succeed`)
... | AST#method_declaration#Left async implicitStartAbility 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 want = AST#expression#Left AST... | async implicitStartAbility() {
try {
let want = {
"action": wantConstant.Action.ACTION_MANAGE_APPLICATIONS_SETTINGS
}
let context = getContext(this) as context.AbilityContext;
await context.startAbility(want)
console.info(`implicit start ability succeed`)
} catch (... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIWantOpenManageApplications/entry/src/main/ets/pages/Index.ets#L23-L35 | e0949b1b0ce66df53369c36d07cbdb0e951865ff | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CharUtil.ets | arkts | isIdeograph | 判断字符串char是否是表意文字
@param char
@returns | static isIdeograph(char: string): boolean {
return i18n.Unicode.isIdeograph(char);
} | AST#method_declaration#Left static isIdeograph AST#parameter_list#Left ( AST#parameter#Left char : 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_ty... | static isIdeograph(char: string): boolean {
return i18n.Unicode.isIdeograph(char);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CharUtil.ets#L94-L96 | cc19a2a105b7f33b57092d36e9bf5fc1281b4925 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index.ets | arkts | search_timestamps | Searches in the index_map and return eligible timestamps
@param key the keywords, for example "huawei developers harmony"
@returns number[] of timestamps | static search_timestamps(key: string, max?: number) {
let div_keys = divide_string(key);
// console.log("[qwq]" + div_keys.toString());
let ranges: collections.Array<collections.Array<number>> = new collections.Array<collections.Array<number>>();
for (const key of div_keys) {
// Pushes it
r... | AST#method_declaration#Left static search_timestamps AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max ? : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | static search_timestamps(key: string, max?: number) {
let div_keys = divide_string(key);
let ranges: collections.Array<collections.Array<number>> = new collections.Array<collections.Array<number>>();
for (const key of div_keys) {
ranges.push(bunch_of_history_index.index_map.get(key) || ne... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index.ets#L64-L76 | 4587ce0c6dcf2c8c957d9cc1109be0f216740b0b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildCalendarDay | 构建日历日期格子 | @Builder
buildCalendarDay(week: number, day: number) {
Column({ space: 2 }) {
Text(((week - 1) * 7 + day).toString())
.fontSize(14)
.fontWeight(((week - 1) * 7 + day) === new Date().getDate() ? FontWeight.Bold : FontWeight.Normal)
.fontColor(((week - 1) * 7 + day) === new Date().getD... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCalendarDay AST#parameter_list#Left ( AST#parameter#Left week : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left day : AST#type_annotation#Left... | @Builder
buildCalendarDay(week: number, day: number) {
Column({ space: 2 }) {
Text(((week - 1) * 7 + day).toString())
.fontSize(14)
.fontWeight(((week - 1) * 7 + day) === new Date().getDate() ? FontWeight.Bold : FontWeight.Normal)
.fontColor(((week - 1) * 7 + day) === new Date().getD... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L1285-L1312 | 32a1c68f2b1bb5785e3f3744b1cf5224884403c9 | github |
jianguo888/nut-recipes | 262304b5d2bee2d5f1df4e29c094c9ddd58f9d51 | entry/src/main/ets/MainAbility/model/processModel.ets | arkts | Copyright (c) 2021 JianGuo 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, sof... | export class ProcessData {
pcontent: string //
pic: string //
} | AST#export_declaration#Left export AST#class_declaration#Left class ProcessData AST#class_body#Left { AST#ERROR#Left pcontent : string // pic : string AST#ERROR#Right // } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right | export class ProcessData {
pcontent: string
pic: string
} | https://github.com/jianguo888/nut-recipes/blob/262304b5d2bee2d5f1df4e29c094c9ddd58f9d51/entry/src/main/ets/MainAbility/model/processModel.ets#L16-L22 | 92e38399d13e0edfb7d51de5636a0802e087dc11 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | putString | 存储字符串值
@param key 键
@param value 值 | async putString(key: string, value: string): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.put(key, value);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogCons... | AST#method_declaration#Left async putString AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri... | async putString(key: string, value: string): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.put(key, value);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogCons... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L64-L74 | d3836de4b90f220b34937ab0762fe76d6ca14a02 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Language/LanguageManager.ets | arkts | getCurrentLanguage | 获取当前实际使用的语言 | static getCurrentLanguage(): AppLanguage {
try {
// 1️⃣ 优先读取应用设置的首选语言
const appLang = i18n.System.getAppPreferredLanguage();
if (appLang) {
if (appLang.startsWith("zh-Hant")) return AppLanguage.Traditional;
return AppLanguage.Simplified; // 默认简体
}
// 2️⃣ 如果没有设置应用首选语言,则... | AST#method_declaration#Left static getCurrentLanguage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppLanguage AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // ... | static getCurrentLanguage(): AppLanguage {
try {
const appLang = i18n.System.getAppPreferredLanguage();
if (appLang) {
if (appLang.startsWith("zh-Hant")) return AppLanguage.Traditional;
return AppLanguage.Simplified;
}
const systemLang = i18n.System.getSystemL... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Language/LanguageManager.ets#L41-L60 | e44bc50249425ef0688e855eeda6cf60f26b8e39 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/PickerUtil.ets | arkts | selectAudio | 拉起picker选择音频 - 返回值方式
@returns | static async selectAudio(): Promise<Array<string>> {
//创建picker
let context = getContext() as common.UIAbilityContext;
let audioPicker = new picker.AudioViewPicker(context);
//拉起
let list = await audioPicker.select(new picker.AudioSelectOptions());
if (list !== null && list !== undefined) {
... | AST#method_declaration#Left static async selectAudio AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type... | static async selectAudio(): Promise<Array<string>> {
let context = getContext() as common.UIAbilityContext;
let audioPicker = new picker.AudioViewPicker(context);
let list = await audioPicker.select(new picker.AudioSelectOptions());
if (list !== null && list !== undefined) {
return list;... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PickerUtil.ets#L217-L227 | 4fa2965c2328fa71b68bc840358c0e9239f93a60 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreviewUtil.ets | arkts | TODO 文件预览工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class PreviewUtil {
/**
* 通过传入文件预览信息,打开预览窗口。1秒内重复调用无效。
* @param previewInfo 文件的预览信息
* @returns
*/
static openPreview(previewInfo: filePreview.PreviewInfo): Promise<void> {
return filePreview.openPreview(AppUtil.getContext(), previewInfo);
}
/**
* 通过传入文件的uri,打开预览窗口。1秒内重复调用无效。
* @pa... | AST#export_declaration#Left export AST#class_declaration#Left class PreviewUtil AST#class_body#Left { /**
* 通过传入文件预览信息,打开预览窗口。1秒内重复调用无效。
* @param previewInfo 文件的预览信息
* @returns
*/ AST#method_declaration#Left static openPreview AST#parameter_list#Left ( AST#parameter#Left previewInfo : AST#type_annotation#Le... | export class PreviewUtil {
static openPreview(previewInfo: filePreview.PreviewInfo): Promise<void> {
return filePreview.openPreview(AppUtil.getContext(), previewInfo);
}
static async openPreviewEasy(uri: string): Promise<void> {
const previewInfo = PreviewUtil.generatePreviewInfo(uri);
return ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L28-L171 | d2972777c7f8335fc4116a8578b982efda0fe90f | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/SubscribeManager.ets | arkts | loadCurrentItem | ------------------------- 本地偏好读取/保存 ------------------------- 加载当前订阅项 | private loadCurrentItem(): void {
const pref = this.getPrefs();
if (!pref) return;
const sku = pref.getSync(SubscribeManagerPref.kSku, null) as string | null;
const expDate = pref.getSync(SubscribeManagerPref.kExpiresDate, 0) as number;
const token = pref.getSync(SubscribeManagerPref... | AST#method_declaration#Left private loadCurrentItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left p... | private loadCurrentItem(): void {
const pref = this.getPrefs();
if (!pref) return;
const sku = pref.getSync(SubscribeManagerPref.kSku, null) as string | null;
const expDate = pref.getSync(SubscribeManagerPref.kExpiresDate, 0) as number;
const token = pref.getSync(SubscribeManagerPref... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/SubscribeManager.ets#L77-L89 | 2680ff39be3a5c27940fddd8a8ae60d0ce17c159 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/localization/I18nManager.ets | arkts | addResources | 添加语言资源 | addResources(language: Language, resources: LanguageResources): void {
this.resources[language] = {
...this.resources[language],
...resources
};
} | AST#method_declaration#Left addResources AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left Language AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resources : AST#type_annotation#Left AST#primary_type#Left LanguageResources ... | addResources(language: Language, resources: LanguageResources): void {
this.resources[language] = {
...this.resources[language],
...resources
};
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/localization/I18nManager.ets#L115-L120 | cf7f7bc5201437932fed36e80dca37e838d7d319 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/ListSample/entry/src/main/ets/view/ListAreaComponent.ets | arkts | ListAreaComponent | List area of the main tab content. | @Component
export struct ListAreaComponent {
build() {
Column() {
List() {
LazyForEach(PageViewModel.getListDataSource(), (item: ListItemData) => {
ListItem() {
ListItemComponent({ itemInfo: item })
}
.onClick(() => {
router.push({
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListAreaComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_bod... | @Component
export struct ListAreaComponent {
build() {
Column() {
List() {
LazyForEach(PageViewModel.getListDataSource(), (item: ListItemData) => {
ListItem() {
ListItemComponent({ itemInfo: item })
}
.onClick(() => {
router.push({
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/ListSample/entry/src/main/ets/view/ListAreaComponent.ets#L10-L41 | 3a2eb8eae1703443249e14f1ccabb8d1b30a0ff9 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 映射函数类型 | export type Mapper<T, R> = (item: T) => R; | AST#export_declaration#Left export AST#type_declaration#Left type Mapper AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right , AST#type_parameter#Left R AST#type_parameter#Right > AST#type_parameters#Right = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#paramete... | export type Mapper<T, R> = (item: T) => R; | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L261-L261 | 4a891a602759de04588b5c715b181b9b8a4ded77 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Filter.d.ets | arkts | This parameter is used to define the input of each filtering dimension.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
This parameter is used to define the input of each filtering dimension.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class FilterParams {
/**
* filter item name.
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* filter item name.
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 1... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class FilterParams AST#class_body#Left { /**
* filter item name.
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* filter item name.
* @type { Re... | export declare class FilterParams {
name: ResourceStr;
options: Array<ResourceStr>;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Filter.d.ets#L79-L108 | c37767f7007594e4bd231fa01f70c21e0fccfb87 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语导出数据接口 | export interface GreetingExportData {
greetings: Greeting[];
history: GreetingHistory[];
statistics: GreetingStatistics;
exportDate: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingExportData AST#object_type#Left { AST#type_member#Left greetings : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Greeting [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Rig... | export interface GreetingExportData {
greetings: Greeting[];
history: GreetingHistory[];
statistics: GreetingStatistics;
exportDate: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L259-L264 | f0481ba9e7a1da9d5137cd1bb066b206f34f5ab8 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Set | Called when setting.
@since 7
@deprecated since 10 | static Set<T>(propName: string, newValue: T): boolean {
return AppStorage.set(propName, newValue)
} | AST#method_declaration#Left static Set 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#parameter#Ri... | static Set<T>(propName: string, newValue: T): boolean {
return AppStorage.set(propName, newValue)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L149-L151 | 9750ac436041131e110b87266afbfc20c5e179c4 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/src/main/ets/repository/AuthRepository.ets | arkts | loginByPassword | 密码登录
@param params 登录参数,包含用户名、密码等
@returns 包含认证信息的网络响应 | async loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>> {
return this.networkDataSource.loginByPassword(params);
} | AST#method_declaration#Left async loginByPassword AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PasswordLoginRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST... | async loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>> {
return this.networkDataSource.loginByPassword(params);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/AuthRepository.ets#L36-L38 | a3ba8a889d22c52493670daa5d22b2ec08f5c59d | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets | arkts | getH | Get height.
@returns | getH(): number {
return this.h;
} | AST#method_declaration#Left getH AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST... | getH(): number {
return this.h;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets#L59-L61 | 066f8f0aa5fa24f3ed8341fced7d5ec1ee6b64bf | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/navdestination/AppNavDestination.ets | arkts | 渲染通用 NavDestination
@returns {void} 无返回值 | build() {
NavDestination() {
if (this.content) {
this.content();
}
}
.title(this.title, this.titleOptions)
.hideTitleBar(this.hideTitleBar)
.menus(this.menus, this.menuOptions)
.onShown((reason: VisibilityChangeReason) => {
this.viewModel.onShown(reason);
})
.on... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST... | build() {
NavDestination() {
if (this.content) {
this.content();
}
}
.title(this.title, this.titleOptions)
.hideTitleBar(this.hideTitleBar)
.menus(this.menus, this.menuOptions)
.onShown((reason: VisibilityChangeReason) => {
this.viewModel.onShown(reason);
})
.on... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/navdestination/AppNavDestination.ets#L122-L139 | 0b92034cbbdadbb837a27274ded2ef45a99851e7 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/view/ProfilePage.ets | arkts | AccountInfoCard | 账号信息卡片
@returns {void} 无返回值 | @Builder
private AccountInfoCard(): void {
Card() {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
}) {
IBestCell({
title: $r("app.string.phone"),
value: this.vm.getPhoneText(),
hasBorder: true,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AccountInfoCard 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 AccountInfoCard(): void {
Card() {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
}) {
IBestCell({
title: $r("app.string.phone"),
value: this.vm.getPhoneText(),
hasBorder: true,
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L129-L154 | 46abeafbada807ebea30ffe3923215ceffa4c72a | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | ability/ability_runtime/startup/startupmanualhelp1/entry/src/main/ets/MainAbility/PageAbility6.ets | arkts | onCreate | Sample_002 -> Sample_003 -> Sample_001 | onCreate(want:Want, launchParam: AbilityConstant.LaunchParam){
hilog.info(0x0000, 'StartupTest PageAbility6', '%{public}s', 'Ability onCreate');
if (want.parameters && want.parameters?.keepAlive) {
console.info('StartupTest PageAbility6 keepAlive = true');
keepAlive = true;
}
if (want.param... | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want:Want, launchParam: AbilityConstant.LaunchParam){
hilog.info(0x0000, 'StartupTest PageAbility6', '%{public}s', 'Ability onCreate');
if (want.parameters && want.parameters?.keepAlive) {
console.info('StartupTest PageAbility6 keepAlive = true');
keepAlive = true;
}
if (want.param... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/ability/ability_runtime/startup/startupmanualhelp1/entry/src/main/ets/MainAbility/PageAbility6.ets#L38-L116 | 5cba755123bb7c629794321a674b44ea3c1c1029 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ReviewDataModel.ets | arkts | ReviewListDataSource 类继承自 BasicDataSource<ReviewItem>,处理评论列表数据源操作
@extends {BasicDataSource<ReviewItem>} | export class ReviewListDataSource extends BasicDataSource<ReviewItem> {} | AST#export_declaration#Left export AST#class_declaration#Left class ReviewListDataSource extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BasicDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ReviewItem AST#primary_type#Right AST#type_annotation#Right > AST... | export class ReviewListDataSource extends BasicDataSource<ReviewItem> {} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ReviewDataModel.ets#L35-L35 | df0dd559967590036114a08551f9a5b628e61e01 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets | arkts | startPlaying | ===================== 播放核心方法 ===================== | private async startPlaying(): Promise<void> {
await this.stopPlaying()
if (this.isPlaying || !this.soundName) return;
try {
// 1. 从数据库获取音频数据
const recordSound = await SpeechRecordDbAccessor.shared.getRecordSound(this.soundName);
if (!recordSound?.pronData) return;
// 2. 创建临时文件路径
... | AST#method_declaration#Left private async startPlaying 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 startPlaying(): Promise<void> {
await this.stopPlaying()
if (this.isPlaying || !this.soundName) return;
try {
const recordSound = await SpeechRecordDbAccessor.shared.getRecordSound(this.soundName);
if (!recordSound?.pronData) return;
const tempFilePath = `${... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets#L157-L211 | a6ddb01800eec867403a1444343f62fd79c92631 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/onlinesearch/OnlineSearchWordsView.ets | arkts | search | 执行搜索 | private async search(val: string): Promise<void> {
if (!this.searchText.trim()) {
this.errorMessage = '请输入搜索内容';
return;
}
///会员检查
if (!MemberManager.shared.checkOnlineDictUsable()) {
return
}
//记录次数
DailyCountManager.shared.increase(DailyCountType.onlineDict)
this.is... | AST#method_declaration#Left private async search AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left... | private async search(val: string): Promise<void> {
if (!this.searchText.trim()) {
this.errorMessage = '请输入搜索内容';
return;
}
if (!MemberManager.shared.checkOnlineDictUsable()) {
return
}
DailyCountManager.shared.increase(DailyCountType.onlineDict)
this.isLoading = tru... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/onlinesearch/OnlineSearchWordsView.ets#L227-L264 | 24526fcd3ed954dc34bc3cc6ed4b49a9946fd4db | github |
Nuist666/Alzheimer.git | c171b8e739357bfc5a3fc71c90aaea6ce5d463d1 | entry/src/main/ets/utils/Recorder.ets | arkts | pauseRecord | 暂停录制 | async pauseRecord() {
// 仅在started状态下调用pause为合理状态切换
if (this.avRecorder != undefined && this.avRecorder.state === 'started') {
await this.avRecorder.pause();
}
} | AST#method_declaration#Left async pauseRecord AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 仅在started状态下调用pause为合理状态切换 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#expre... | async pauseRecord() {
if (this.avRecorder != undefined && this.avRecorder.state === 'started') {
await this.avRecorder.pause();
}
} | https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/utils/Recorder.ets#L49-L54 | 5d9aab656a77fcf230c640f046f570763cb23991 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.