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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets | arkts | HTTP请求方法 | export enum RequestMethod {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
DELETE = 'DELETE'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum RequestMethod AST#enum_body#Left { AST#enum_member#Left GET = AST#expression#Left 'GET' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left POST = AST#expression#Left 'POST' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ... | export enum RequestMethod {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
DELETE = 'DELETE'
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L207-L212 | d2e6bd587c20bed1bdbe3766ffe50fd713068d40 | github | |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/game/core/world.ets | arkts | get world data | export function getWorldData(): t.TArchiveFile {
const data = AppStorage.get<string>(utils.ResourceConvertString($r('app.string.PersistentStoragePath')))
if (!data) {
return initWorldData()
}
const res = JSON.parse(utils.decodeStr(data)) as t.TArchiveFile
return res
} | AST#export_declaration#Left export AST#function_declaration#Left function getWorldData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left t . TArchiveFile AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statem... | export function getWorldData(): t.TArchiveFile {
const data = AppStorage.get<string>(utils.ResourceConvertString($r('app.string.PersistentStoragePath')))
if (!data) {
return initWorldData()
}
const res = JSON.parse(utils.decodeStr(data)) as t.TArchiveFile
return res
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/world.ets#L12-L19 | e5310c940d150683b4da30285cf5b8c8ab8760fa | github | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/control_flow/conditional_stmt/conditional_if_006_F.ets | arkts | Introduction 条件语句-else if | export function conditional_if_006_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
if (false) {}
else if(true){
taint.Sink(clean)
}
else {}
} | AST#export_declaration#Left export AST#function_declaration#Left function conditional_if_006_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function conditional_if_006_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
if (false) {}
else if(true){
taint.Sink(clean)
}
else {}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/conditional_stmt/conditional_if_006_F.ets#L6-L14 | 6dfbae85a6bb9c4408b30affb3368f141c17ea47 | github | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/viewmodel/AlarmClockViewModel.ets | arkts | queryAlarmsTasker | 刷新闹钟任务。
@param callback (alarms: Array<AlarmItem>) => void 回调函数,用于处理查询结果 | public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) {
let that = this;
// 查询数据库中的闹钟项
that.queryDatabaseAlarms(callback);
// 获取全局上下文中的 PreferencesHandler 实例
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
// 添加数据库变化监听器,用于在数据发生变化时刷新闹钟任务... | AST#method_declaration#Left public queryAlarmsTasker AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left alarms : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type... | public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) {
let that = this;
that.queryDatabaseAlarms(callback);
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.addPreferencesListener({
onDataChanged() {
that... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/AlarmClockViewModel.ets#L64-L76 | c5d5761ed12650df33946afc550d9d8418fafa6d | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Filter.d.ets | arkts | Filter | Declare Filter.The Filter is used in scenarios where multi-dimensional filtering is required.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare Filter.The Filter is used in scenarios where multi-dimensional filtering is required.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @Component
export declare struct Filter {
/**
* Container in the user-defined filtering result display area.
* @type { () => void }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Container in the user-defined filtering result display area.
* @type { () => voi... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct Filter AST#component_body#Left { /**
* Container in the user-defined filtering result display area.
* @type { () => void }
* @syscap SystemCapability.ArkUI.ArkUI.F... | @Component
export declare struct Filter {
@BuilderParam
container: () => void;
@Prop
multiFilters: Array<FilterParams>;
@Prop
additionFilters?: FilterParams;
onFilterChanged: (filterResults: Array<FilterResult>) => void;
@Prop
filterT... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Filter.d.ets#L167-L243 | 0005e70b68c1c63a26c1ebf9b3d3a0ed821bef36 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/efRcpConfig.ets | arkts | 请求转换JSON失败时是否返回结果字符串 | export let isConvertError: boolean = false; | AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left isConvertError : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right A... | export let isConvertError: boolean = false; | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L348-L348 | ae618fa60e626d47f9af3947a665cb4a31dd366e | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SyncTypes.ets | arkts | 同步事件 | export interface SyncEvent {
type: SyncEventType;
syncId?: string;
data?: Record<string, string | number | boolean>;
timestamp: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SyncEvent AST#object_type#Left { AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left SyncEventType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left syncId ? : AST#type_annotati... | export interface SyncEvent {
type: SyncEventType;
syncId?: string;
data?: Record<string, string | number | boolean>;
timestamp: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L308-L313 | 2fd520f816b34e8e1b59b4b371948f44f58d476c | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getMarkerPosition | @Override | protected getMarkerPosition(highlight: Highlight): number[] {
let center: MPPointF = this.getCenterCircleBox();
let r: number = this.getRadius();
let off: number = r / 10 * 3.6;
if (this.isDrawHoleEnabled()) {
off = (r - (r / 100 * this.getHoleRadius())) / 2;
}
r -= off; // offset to k... | AST#method_declaration#Left protected getMarkerPosition AST#parameter_list#Left ( AST#parameter#Left highlight : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#a... | protected getMarkerPosition(highlight: Highlight): number[] {
let center: MPPointF = this.getCenterCircleBox();
let r: number = this.getRadius();
let off: number = r / 10 * 3.6;
if (this.isDrawHoleEnabled()) {
off = (r - (r / 100 * this.getHoleRadius())) / 2;
}
r -= off;
let rota... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L189-L226 | e0b2d23d032311eaa9a95ccfc215e9d60f4c07eb | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/models/ContactModel.ets | arkts | createBirthdayInfo | 静态方法:创建生日信息 | private static createBirthdayInfo(birthday: BirthdayInfo): BirthdayInfo {
const birthdayInfo: BirthdayInfo = {
date: birthday.date,
isLunar: birthday.isLunar,
year: birthday.year,
month: birthday.month,
day: birthday.day
};
if (birthday.isLunar) {
// 农历生日处理
birthda... | AST#method_declaration#Left private static createBirthdayInfo AST#parameter_list#Left ( AST#parameter#Left birthday : AST#type_annotation#Left AST#primary_type#Left BirthdayInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Le... | private static createBirthdayInfo(birthday: BirthdayInfo): BirthdayInfo {
const birthdayInfo: BirthdayInfo = {
date: birthday.date,
isLunar: birthday.isLunar,
year: birthday.year,
month: birthday.month,
day: birthday.day
};
if (birthday.isLunar) {
birthdayInfo.lun... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L68-L119 | eb0d4854f987fc020523c0c55abc5d1d27250986 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LogUtil.ets | arkts | debug | 打印DEBUG级别日志
@param args | static debug(...args: string[] | object[]): void {
LogUtil.uniLog(args, hilog.LogLevel.DEBUG);
} | AST#method_declaration#Left static debug AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left object [ ] AST#array_type#Right AST#p... | static debug(...args: string[] | object[]): void {
LogUtil.uniLog(args, hilog.LogLevel.DEBUG);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L86-L88 | b20f5b163990f53b50e399b5c16e8f0119ceed2d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/ContactsPage.ets | arkts | mapRelationToEnum | 映射数据库关系到枚举类型 | private mapRelationToEnum(relation: string): RelationType {
switch (relation) {
case '家人': return RelationType.FAMILY;
case '朋友': return RelationType.FRIEND;
case '同事': return RelationType.COLLEAGUE;
case '其他': return RelationType.OTHER;
default: return RelationType.FRIEND;
} | AST#method_declaration#Left private mapRelationToEnum AST#parameter_list#Left ( AST#parameter#Left relation : 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 RelationTyp... | private mapRelationToEnum(relation: string): RelationType {
switch (relation) {
case '家人': return RelationType.FAMILY;
case '朋友': return RelationType.FRIEND;
case '同事': return RelationType.COLLEAGUE;
case '其他': return RelationType.OTHER;
default: return RelationType.FRIEND;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/ContactsPage.ets#L117-L124 | f9428e665d56adca65374cd55731a16aadc1521c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/componentstack/src/main/ets/model/DataSource.ets | arkts | getData | 获取指定数据项 | public getData(index: number): T | void {
console.info('getData, index:' + index);
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST... | public getData(index: number): T | void {
console.info('getData, index:' + index);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/model/DataSource.ets#L31-L33 | 47afd284da063befc0dab231ea51f7db053b4bae | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets | arkts | setMainWindowImmersive | 当前主窗口是否开启沉浸模式
@param enable 是否开启
@returns {void} | setMainWindowImmersive(enable: boolean): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
logger.error(`Failed to obtain the main window. Code:${er... | AST#method_declaration#Left setMainWindowImmersive AST#parameter_list#Left ( AST#parameter#Left enable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | setMainWindowImmersive(enable: boolean): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
logger.error(`Failed to obtain the main window. Code:${er... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets#L69-L86 | a4e742d5007dd21fa798379de052da1856a48aec | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/web/WebSearchService.ets | arkts | formatSearchKeyword | 格式化搜索关键词 | public formatSearchKeyword(contact: Contact, occasion: string, interests: string[]): string {
let keyword = '';
// 基于场合
switch (occasion) {
case 'birthday':
keyword = '生日礼物';
break;
case 'anniversary':
keyword = '纪念日礼物'; | AST#method_declaration#Left public formatSearchKeyword 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#Left occasion : AST#type_annotation#Left AST#primary_type#Left string ... | public formatSearchKeyword(contact: Contact, occasion: string, interests: string[]): string {
let keyword = '';
switch (occasion) {
case 'birthday':
keyword = '生日礼物';
break;
case 'anniversary':
keyword = '纪念日礼物'; | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/web/WebSearchService.ets#L245-L254 | eab150f39d330e66f19989effb40692cae894877 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/viewmodel/EntryViewModel.ets | arkts | aboutToDisappear | 入口页面销毁
由 EntryPage.aboutToDisappear 调用,释放窗口监听
@returns {void} 无返回值 | aboutToDisappear(): void {
this.windowAdapter.dispose();
} | AST#method_declaration#Left aboutToDisappear 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#express... | aboutToDisappear(): void {
this.windowAdapter.dispose();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/viewmodel/EntryViewModel.ets#L34-L36 | d538d3b787bae78593ffbacc5fe4ccb40922c9c2 | github |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/utils/PreferenceModel.ets | arkts | deletePreference | 删除key对应的value | async deletePreference(key:string) {
try {
await preference.delete(key)
} catch (err) {
console.error(err)
}
} | AST#method_declaration#Left async deletePreference 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_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left... | async deletePreference(key:string) {
try {
await preference.delete(key)
} catch (err) {
console.error(err)
}
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L54-L60 | 692e274a3382c98b7276ae51339401bc75a083a8 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | enableAutoThemeSwitch | 根据时间自动切换主题 | async enableAutoThemeSwitch(enabled: boolean): Promise<void> {
try {
if (enabled) {
// 启动定时检查
this.startAutoThemeCheck();
} else {
// 停止定时检查
this.stopAutoThemeCheck();
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Auto theme switch ${enab... | AST#method_declaration#Left async enableAutoThemeSwitch AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener... | async enableAutoThemeSwitch(enabled: boolean): Promise<void> {
try {
if (enabled) {
this.startAutoThemeCheck();
} else {
this.stopAutoThemeCheck();
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Auto theme switch ${enabled ? 'enabled' : ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L460-L474 | 63e7b7733971084e85f7778f1fae77294189e976 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets | arkts | putFaultMessage | 存储数据异常信息
@param faultMessage 异常信息集合 | public static async putFaultMessage(faultMessage: Array<string>): Promise<void> {
logger.info(`putMessage start`);
try {
// TODO:知识点:通过 dataPreferencesManager.put方法存储数据
dataPreferencesManager.put('faultMessage', JSON.stringify(faultMessage), async (err: BusinessError) => {
if (err) {
... | AST#method_declaration#Left public static async putFaultMessage AST#parameter_list#Left ( AST#parameter#Left faultMessage : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio... | public static async putFaultMessage(faultMessage: Array<string>): Promise<void> {
logger.info(`putMessage start`);
try {
dataPreferencesManager.put('faultMessage', JSON.stringify(faultMessage), async (err: BusinessError) => {
if (err) {
logger.error("Failed to put value of 'faultM... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets#L45-L62 | 8b541be38ce3a570949f9ae8a2307d97cb47d343 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Menu/entry/src/main/ets/common/MyComponent.ets | arkts | MyComponent | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct MyComponent {
title: string = 'test'
func: () => void = () => {
}
@Styles
pressedStyle(){
.backgroundColor(0x238E23)
}
@Styles
normalStyles() {
.backgroundColor(0x0000ff)
}
build() {
Text(this.title)
.key(this.title)
.fontSize(10)
.background... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyComponent AST#component_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#expression#Left A... | @Component
export struct MyComponent {
title: string = 'test'
func: () => void = () => {
}
@Styles
pressedStyle(){
.backgroundColor(0x238E23)
}
@Styles
normalStyles() {
.backgroundColor(0x0000ff)
}
build() {
Text(this.title)
.key(this.title)
.fontSize(10)
.background... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Menu/entry/src/main/ets/common/MyComponent.ets#L16-L42 | f4ca26f6a1442093f79393d5fa57298f011ade1c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/utils/ValidationUtils.ets | arkts | validatePhone | 验证手机号码
@param phone 手机号码
@returns 是否有效 | static validatePhone(phone: string): boolean {
if (!phone || phone.trim() === '') {
return false;
}
return RegexConstants.PHONE_REGEX.test(phone.trim());
} | AST#method_declaration#Left static validatePhone AST#parameter_list#Left ( AST#parameter#Left phone : 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... | static validatePhone(phone: string): boolean {
if (!phone || phone.trim() === '') {
return false;
}
return RegexConstants.PHONE_REGEX.test(phone.trim());
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/ValidationUtils.ets#L16-L22 | ac1dc9e32872c44d3f09dd4d265fc2a2b92bc1d6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | getLunarToSolar | 获取农历日期对应的公历日期 | async getLunarToSolar(year: number, lunarMonth: number, lunarDay: number): Promise<SolarDate | null> {
await this.ensureYearMapping(year);
const yearData = this.mappingCache.get(year);
if (!yearData) return null;
const lunarKey = `${lunarMonth}-${lunarDay}`;
const mapping = yearData.mappings.get(l... | AST#method_declaration#Left async getLunarToSolar 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 lunarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | async getLunarToSolar(year: number, lunarMonth: number, lunarDay: number): Promise<SolarDate | null> {
await this.ensureYearMapping(year);
const yearData = this.mappingCache.get(year);
if (!yearData) return null;
const lunarKey = `${lunarMonth}-${lunarDay}`;
const mapping = yearData.mappings.get(l... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L157-L175 | 3fdcfff4322bd3e27f0248b9762688bd18e55636 | 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 | _initDefaultAccounts | 初始化账本 | private async _initDefaultAccounts() {
const accountTable: AccountTableBasis = {
accountId: AccountID.DEFAULT,
name: '默认账本',
type: 'default',
};
const existing = await this.query<Account>(
AccountingDBConstants.ACCOUNT_TABLE_NAME,
[
{
field: AccountTableFields... | AST#method_declaration#Left private async _initDefaultAccounts AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left accountTable : AST#type_annotation#Left AST#primary_type#Left AccountTableBasis AST#primary_t... | private async _initDefaultAccounts() {
const accountTable: AccountTableBasis = {
accountId: AccountID.DEFAULT,
name: '默认账本',
type: 'default',
};
const existing = await this.query<Account>(
AccountingDBConstants.ACCOUNT_TABLE_NAME,
[
{
field: AccountTableFields... | 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#L62-L88 | 405f79ea9c499d405b3d0843f27c1f31ea4f6f20 | github |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/home/HomeTabContent.ets | arkts | aboutToAppear | 组件即将出现时加载初始数据 | aboutToAppear() {
this.loadInitialData();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadInitialData AST#me... | aboutToAppear() {
this.loadInitialData();
} | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/home/HomeTabContent.ets#L59-L61 | 11a820e532e33c2d6ef88167c1e4a8c8e9419a86 | github |
changweizhang/ChatUI | 36df7ce41aeb281d8472ca9182f449da6dc109f7 | chatui/src/main/ets/components/Chat.ets | arkts | setTyping | @State isTyping: boolean = false; | setTyping(isTyping: boolean = false) {
if (isTyping) {
this.messages.pushData(new ChatMessage({
role: ChatRole.Assistant,
content: ""
}))
this.listScroller.scrollToIndex(this.messages.totalCount() - 1)
} else {
let lastMsg: ChatMessage = this.messages.getData(this.message... | AST#method_declaration#Left setTyping AST#parameter_list#Left ( AST#parameter#Left isTyping : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) ... | setTyping(isTyping: boolean = false) {
if (isTyping) {
this.messages.pushData(new ChatMessage({
role: ChatRole.Assistant,
content: ""
}))
this.listScroller.scrollToIndex(this.messages.totalCount() - 1)
} else {
let lastMsg: ChatMessage = this.messages.getData(this.message... | https://github.com/changweizhang/ChatUI/blob/36df7ce41aeb281d8472ca9182f449da6dc109f7/chatui/src/main/ets/components/Chat.ets#L132-L146 | 923d8e6493990e417258d1c5961ccda0832e330b | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/FlawService.ets | arkts | 通用响应接口 | export interface ApiResponse<T = object> {
code: number;
msg: string;
data?: T;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ApiResponse AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left ... | export interface ApiResponse<T = object> {
code: number;
msg: string;
data?: T;
} | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L47-L51 | a7b6ec1147ca28af9b4a874a283a436eac675787 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/objects/HistoryDataSource.ets | arkts | notifyDataChange | 通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件 | notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
// 写法2:listener.onDatasetChange([{type: DataOperationType.CHANGE, index: index}]);
});
} | AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
});
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/HistoryDataSource.ets#L52-L57 | 44db91ebc5424972f03ff6b263d2f7b78e7fc06a | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/ui/animation/AnimationUtils.ets | arkts | 页面转场动画工具 | export class PageTransition {
/**
* 淡入淡出转场配置
*/
static fade(): PageTransitionConfig {
return {
duration: 300,
curve: curve.EaseOut
};
}
/**
* 滑动转场配置
*/
static slide(): PageTransitionConfig {
return {
duration: 300,
curve: curve.EaseOut
};
}
} | AST#export_declaration#Left export AST#class_declaration#Left class PageTransition AST#class_body#Left { /**
* 淡入淡出转场配置
*/ AST#method_declaration#Left static fade AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PageTransitionConfig AST#primary_type#Right AST#t... | export class PageTransition {
static fade(): PageTransitionConfig {
return {
duration: 300,
curve: curve.EaseOut
};
}
static slide(): PageTransitionConfig {
return {
duration: 300,
curve: curve.EaseOut
};
}
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L81-L101 | 6d6bba768ab7468333b699b178023797a8456487 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/I18nManager.ets | arkts | detectSystemLanguage | 检测系统语言 | private async detectSystemLanguage(): Promise<void> {
try {
// TODO: 获取系统语言
// const systemLanguage = await getSystemLanguage();
// 暂时使用硬编码
const systemLanguage = SupportedLanguage.ZH_CN;
if (this.isLanguageSupported(systemLanguage)) {
this.currentLanguage = systemLangua... | AST#method_declaration#Left private async detectSystemLanguage 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#Righ... | private async detectSystemLanguage(): Promise<void> {
try {
const systemLanguage = SupportedLanguage.ZH_CN;
if (this.isLanguageSupported(systemLanguage)) {
this.currentLanguage = systemLanguage;
this.config.language = systemLanguage;
}
} catch (error... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L670-L685 | a2c31cca19fb228806243252d63cb900bc0b3715 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | 完整农历系统设计.ets | arkts | calculateLunarDateAfterSpringFestival | 计算春节后的农历日期 | private static calculateLunarDateAfterSpringFestival(daysDiff: number, yearConfig: LunarYearConfig): LunarDateInfo {
let remainingDays = daysDiff;
let lunarMonth = 1;
let lunarDay = 1;
let isLeapMonth = false;
// 先处理正月的剩余天数(已过初一)
const remainingInMonth1 = yearConfig.monthDays[0] - 1; // 正月天数 - ... | AST#method_declaration#Left private static calculateLunarDateAfterSpringFestival AST#parameter_list#Left ( AST#parameter#Left daysDiff : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left yearConfig : AST#type_annotation#Left A... | private static calculateLunarDateAfterSpringFestival(daysDiff: number, yearConfig: LunarYearConfig): LunarDateInfo {
let remainingDays = daysDiff;
let lunarMonth = 1;
let lunarDay = 1;
let isLeapMonth = false;
const remainingInMonth1 = yearConfig.monthDays[0] - 1;
if (remainingDays < rema... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L335-L373 | d448321e2ec55981ef0426855971a8904d5f1549 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Security/CertificateFramework/entry/src/main/ets/model/CertFrameworkModel.ets | arkts | 功能模型 | export class CertFrameworkModel {
// cert data
private certEncodingBlob: certEncodingBlob = {
data: CERT_DATA,
encodingFormat: cert.EncodingFormat.FORMAT_DER
};
// origin data
private originText: string = 'Dear Tom, can we go for a spring outing on Sunday at the Central Garden?';
private originDat... | AST#export_declaration#Left export AST#class_declaration#Left class CertFrameworkModel AST#class_body#Left { // cert data AST#property_declaration#Left private certEncodingBlob : AST#type_annotation#Left AST#primary_type#Left certEncodingBlob AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#ob... | export class CertFrameworkModel {
private certEncodingBlob: certEncodingBlob = {
data: CERT_DATA,
encodingFormat: cert.EncodingFormat.FORMAT_DER
};
private originText: string = 'Dear Tom, can we go for a spring outing on Sunday at the Central Garden?';
private originData: cryptoFrameWork.DataBlo... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/CertificateFramework/entry/src/main/ets/model/CertFrameworkModel.ets#L94-L218 | 62d9e701f70312ffc3338cbec45b1b9d85f92010 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/web_actions.ets | arkts | Should be called when a tab has a change on its progress.
@param pk The tab_info_packed.
@param event The OnProgressChangeEvent. | export function on_progress_change(pk: tab_info_packed, event: OnProgressChangeEvent) {
if (!event) {
return;
}
let progress: number = event.newProgress;
if (progress == 0) {
return;
}
let tabs = pk.storage.get('bunch_of_tabs') as bunch_of_tabs;
if (pk.index >= tabs.get_tabs_count()) {
// If... | AST#export_declaration#Left export AST#function_declaration#Left function on_progress_change AST#parameter_list#Left ( AST#parameter#Left pk : AST#type_annotation#Left AST#primary_type#Left tab_info_packed AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left event : AST#type_annotat... | export function on_progress_change(pk: tab_info_packed, event: OnProgressChangeEvent) {
if (!event) {
return;
}
let progress: number = event.newProgress;
if (progress == 0) {
return;
}
let tabs = pk.storage.get('bunch_of_tabs') as bunch_of_tabs;
if (pk.index >= tabs.get_tabs_count()) {
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L232-L289 | 9ab1aba7925b6c75400bbaecbdf69434c630f973 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/MockData.ets | arkts | Mock按钮文本数据 | export const BUTTON_TEXT: Array<Resource> = [
$r('app.string.application_exception_crash_event'),
$r('app.string.application_exception_freeze_event')
] | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUTTON_TEXT : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ... | export const BUTTON_TEXT: Array<Resource> = [
$r('app.string.application_exception_crash_event'),
$r('app.string.application_exception_freeze_event')
] | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/MockData.ets#L17-L20 | b68f8f21bd814c63fcc6f9e7ecd8c6ab200d04a9 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionSync.ets | arkts | genKeyPairByData | 生成SM2密钥对 | function genKeyPairByData(pubKeyData: Uint8Array, priKeyData: Uint8Array) {
let pubKeyBlob: cryptoFramework.DataBlob = { data: pubKeyData };
let priKeyBlob: cryptoFramework.DataBlob = { data: priKeyData };
let sm2Generator = cryptoFramework.createAsyKeyGenerator('SM2_256');
let keyPair = sm2Generator.convertKey... | AST#function_declaration#Left function genKeyPairByData AST#parameter_list#Left ( AST#parameter#Left pubKeyData : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKeyData : AST#type_annotation#Left AST#primary_type#Lef... | function genKeyPairByData(pubKeyData: Uint8Array, priKeyData: Uint8Array) {
let pubKeyBlob: cryptoFramework.DataBlob = { data: pubKeyData };
let priKeyBlob: cryptoFramework.DataBlob = { data: priKeyData };
let sm2Generator = cryptoFramework.createAsyKeyGenerator('SM2_256');
let keyPair = sm2Generator.convertKey... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionSync.ets#L36-L43 | 0229e1813da39411ca9f572d9aa3db7529d21e1b | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/wordcard/memo/ComposeMemoView.ets | arkts | actionSave | 发送反馈 | private async actionSave() {
await SearchManager.shared.saveLocalMemoForWord(this.word, this.content)
//返回
NavPop()
} | AST#method_declaration#Left private async actionSave AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi... | private async actionSave() {
await SearchManager.shared.saveLocalMemoForWord(this.word, this.content)
NavPop()
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/memo/ComposeMemoView.ets#L149-L155 | 33589671b1960cf8f77e53392c71c3fc648fe120 | github |
junw2024/hnchain-ArkTs.git | 0cc3c182ad418709b577fa24e9fe909a205232c6 | entry/src/main/ets/service/HomeService.ets | arkts | getRecommendPage | 获得推存商品页
@param recommend
@returns | public getRecommendPage(recommend: Recommend):Promise<ArrayList<Product>> {
let list = new ArrayList<Product>()
return post(CommonConstants.BASE_URL+'/v1/mall/recommend',null,recommend)
.then((res: Response)=>{
if(res.code === 200){
if(res.data.products !== null){
res.data.pr... | AST#method_declaration#Left public getRecommendPage AST#parameter_list#Left ( AST#parameter#Left recommend : AST#type_annotation#Left AST#primary_type#Left Recommend 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... | public getRecommendPage(recommend: Recommend):Promise<ArrayList<Product>> {
let list = new ArrayList<Product>()
return post(CommonConstants.BASE_URL+'/v1/mall/recommend',null,recommend)
.then((res: Response)=>{
if(res.code === 200){
if(res.data.products !== null){
res.data.pr... | https://github.com/junw2024/hnchain-ArkTs.git/blob/0cc3c182ad418709b577fa24e9fe909a205232c6/entry/src/main/ets/service/HomeService.ets#L39-L63 | 545d5d82c0efb792401a84c5138d77e17f941e5c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets | arkts | getTitleHeightChangeOptions | 获取标题栏高度变化参数
@param offset: 当前产生的偏移
@returns {number} 标题栏高度变化值 | getTitleHeightChangeOptions(offset: number): number {
return Math.max(Math.min(offset, this.animationAttribute.expandTitleHeight - this.heightValue), this.animationAttribute.normalTitleHeight - this.heightValue);
} | AST#method_declaration#Left getTitleHeightChangeOptions AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#... | getTitleHeightChangeOptions(offset: number): number {
return Math.max(Math.min(offset, this.animationAttribute.expandTitleHeight - this.heightValue), this.animationAttribute.normalTitleHeight - this.heightValue);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets#L203-L205 | c3f3b7afaeb551acc861d89c02786eab89b9017c | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets | arkts | inputFilter | 通过正则表达式设置输入过滤器
@description 通过正则表达式设置输入过滤器
@param inputFilter
@returns | inputFilter(inputFilter: InputFilter) {
this.builderOptions.inputFilter = inputFilter;
return this
} | AST#method_declaration#Left inputFilter AST#parameter_list#Left ( AST#parameter#Left inputFilter : AST#type_annotation#Left AST#primary_type#Left InputFilter AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_state... | inputFilter(inputFilter: InputFilter) {
this.builderOptions.inputFilter = inputFilter;
return this
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets#L59-L62 | a2c014b8ed1d4fff98bfd4a465777b400e5e39d0 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/PictureItem.ets | arkts | Picture entity class. | export class PictureItem {
id: string = '1';
name: string = '怒海';
description: string = '怒海波涛';
image: Resource = $r('app.media.ic_image1');
} | AST#export_declaration#Left export AST#class_declaration#Left class PictureItem AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '1' AST#expression#Right ; AST#property_declaration#Right ... | export class PictureItem {
id: string = '1';
name: string = '怒海';
description: string = '怒海波涛';
image: Resource = $r('app.media.ic_image1');
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/PictureItem.ets#L19-L24 | 46a6e11934c801d10722c08b119111cb22f70211 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | getAxisLineWidth | Returns the width of the axis line (line alongside the axis).
@return | public getAxisLineWidth(): number {
return this.mAxisLineWidth;
} | AST#method_declaration#Left public getAxisLineWidth 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_... | public getAxisLineWidth(): number {
return this.mAxisLineWidth;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L294-L296 | 68e7d559450002ab269127fea7b5311ccb5e8fff | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeComponent.ets | arkts | leftAddressBuilder | 左侧地址 | @Builder
leftAddressBuilder() {
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right leftAddressBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right | @Builder
leftAddressBuilder() {
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeComponent.ets#L59-L61 | d9aea610f8bf514b53eee823468be4d056570185 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets | arkts | isDlpFileFunc | 是否为dlp文件 | async isDlpFileFunc(fd: number): Promise<boolean> {
try {
this.isDLPFile = await dlpPermission.isDLPFile(fd); // 是否加密DLP文件
Logger.info(TAG, 'isDlpFile:' + this.isDLPFile);
promptAction.showToast({ message: 'isDlpFile:' + this.isDLPFile, duration: 2000 });
return this.isDLPFile;
} catch (... | AST#method_declaration#Left async isDlpFileFunc AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left P... | async isDlpFileFunc(fd: number): Promise<boolean> {
try {
this.isDLPFile = await dlpPermission.isDLPFile(fd);
Logger.info(TAG, 'isDlpFile:' + this.isDLPFile);
promptAction.showToast({ message: 'isDlpFile:' + this.isDLPFile, duration: 2000 });
return this.isDLPFile;
} catch (err) {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets#L319-L329 | 3e22e603c729642692b956e6b5ba50a86bfa2a4d | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets | arkts | getDefaultAvatarBase64 | 获取默认头像的Base64字符串 | private getDefaultAvatarBase64(): string {
// 返回一个1x1像素的透明PNG图像的Base64编码
return "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
} | AST#method_declaration#Left private getDefaultAvatarBase64 AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 返回一个1x1像素的透明PNG图像的Base64编码 AST#statement#Left AST#return_statement#Left r... | private getDefaultAvatarBase64(): string {
return "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets#L278-L281 | cacb54255c3cb500208d636308f4609f0daf9ab9 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FramedRendering/entry/src/main/ets/view/TransitionScene.ets | arkts | typeSwiper | [End Case1] | @Builder
typeSwiper(): void {
Row() {
Swiper() {
LazyForEach(this.swiperDataSource, (item: ProductIntroductionModel) => {
SwiperItem({
icon: item.icon,
title: item.title
})
}, (item: ProductIntroductionModel) => item.id)
}
.itemSpace(3)... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right typeSwiper 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#ui_element_wi... | @Builder
typeSwiper(): void {
Row() {
Swiper() {
LazyForEach(this.swiperDataSource, (item: ProductIntroductionModel) => {
SwiperItem({
icon: item.icon,
title: item.title
})
}, (item: ProductIntroductionModel) => item.id)
}
.itemSpace(3)... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FramedRendering/entry/src/main/ets/view/TransitionScene.ets#L92-L118 | b903c970f379b2ab301825ee21ea0c8de6da4379 | gitee |
robotzzh/AgricultureApp.git | 7b12c588dd1d07cc07a8b25577d785d30bd838f6 | entry/src/main/ets/common/bean/FarmBean.ets | arkts | to_JSON | 将自身转化为JSON
e.g.
写部分
arr.add(1),arr.add(2),arr.add(2);
let f2 = new FarmBean(2,'农田2',22.5,56,30,800,25,'123.0.0.1',11111,arr,7,16);
let message = fs.writeSync(file.fd, f2.to_JSON());
读部分
let buf = new ArrayBuffer(100000);
let readLen = fs.readSync(file.fd, buf, { offset: 0 });
let str:string = String.fromCharCode.apply... | to_JSON():string{
var temp ={
fieldId:this.fieldId,
name: this.name,
temperature: this.temperature,
humidity: this.humidity,
co2: this.co2,
lumination: this.lumination,
soilHumidity: this.soilHumidity,
sensor_IP : this.sensor_IP,
sensor_port: this.sensor_port,
... | AST#method_declaration#Left to_JSON AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left temp = AST#expres... | to_JSON():string{
var temp ={
fieldId:this.fieldId,
name: this.name,
temperature: this.temperature,
humidity: this.humidity,
co2: this.co2,
lumination: this.lumination,
soilHumidity: this.soilHumidity,
sensor_IP : this.sensor_IP,
sensor_port: this.sensor_port,
... | https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/common/bean/FarmBean.ets#L62-L78 | 1d3275bd9759dc8cff5a3b4de8bba15faa6d85fb | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/CombinedData.ets | arkts | getDataSetByHighlight | Get dataset for highlight
@param highlight current highlight
@return dataset related to highlight | public getDataSetByHighlight(highlight: Highlight): IBarLineScatterCandleBubbleDataSet<EntryOhos> | null {
if (highlight.getDataIndex() >= this.getAllData().size())
return null;
let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> = this.getDataByIndex(highlight.getData... | AST#method_declaration#Left public getDataSetByHighlight AST#parameter_list#Left ( AST#parameter#Left highlight : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#pr... | public getDataSetByHighlight(highlight: Highlight): IBarLineScatterCandleBubbleDataSet<EntryOhos> | null {
if (highlight.getDataIndex() >= this.getAllData().size())
return null;
let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> = this.getDataByIndex(highlight.getData... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CombinedData.ets#L240-L250 | 087a9cc5dd9b847f8e3f06d4fd9f8b50aa2d588e | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | finishSideBarScroll | 结束侧边栏联动滚动
@returns {void} 无返回值 | finishSideBarScroll(): void {
this.isSideBarScrolling = false;
} | AST#method_declaration#Left finishSideBarScroll 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 AS... | finishSideBarScroll(): void {
this.isSideBarScrolling = false;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L92-L94 | 0d4e1a71ea122e9ef2a088b382026b8df29910b2 | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/CertVerify/entry/src/main/ets/pages/Index.ets | arkts | showCertInfo | 输出证书信息 | async showCertInfo(x509Cert: cert.X509Cert) {
try {
let issuerName = x509Cert.getIssuerX500DistinguishedName().getName()
this.msgHistory += `颁发者可分辨名称:${issuerName}\r\n`;
let subjectName = x509Cert.getSubjectX500DistinguishedName().getName()
this.msgHistory += `证书主题可分辨名称:${subjectName}\r\n`;
... | AST#method_declaration#Left async showCertInfo AST#parameter_list#Left ( AST#parameter#Left x509Cert : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cert . X509Cert AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block... | async showCertInfo(x509Cert: cert.X509Cert) {
try {
let issuerName = x509Cert.getIssuerX500DistinguishedName().getName()
this.msgHistory += `颁发者可分辨名称:${issuerName}\r\n`;
let subjectName = x509Cert.getSubjectX500DistinguishedName().getName()
this.msgHistory += `证书主题可分辨名称:${subjectName}\r\n`;
... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/CertVerify/entry/src/main/ets/pages/Index.ets#L156-L169 | a3ed59391883b626bed93ee8b062790bd6bca3b2 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets | arkts | getHardwareListData | 获取硬件耗电统计
CONSUMPTION_TYPE_INVALID -17 表示电量消耗类型未知。
CONSUMPTION_TYPE_APP -16 表示应用消耗的电量类型。
CONSUMPTION_TYPE_BLUETOOTH -15 表示蓝牙消耗的电量类型。
CONSUMPTION_TYPE_IDLE -14 表示CPU空闲时消耗的电量类型。
CONSUMPTION_TYPE_PHONE -13 表示通话来电消耗的电量类型。
CONSUMPTION_TYPE_RADIO -12 表示无线通讯消耗的电量类型。
CONSUMPTION_TYPE_SCREEN -11 表示屏幕消耗的电量类型。
CONSUM... | getHardwareListData(): Promise<Array<BatteryStatsModel>> {
return new Promise(async (resolve, reject) => {
let listItems: Array<BatteryStatsModel> = [];
listItems.push(this.getItemDataHardware(batteryStats.ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH));
listItems.push(this.getItemDataHardware(batter... | AST#method_declaration#Left getHardwareListData 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_anno... | getHardwareListData(): Promise<Array<BatteryStatsModel>> {
return new Promise(async (resolve, reject) => {
let listItems: Array<BatteryStatsModel> = [];
listItems.push(this.getItemDataHardware(batteryStats.ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH));
listItems.push(this.getItemDataHardware(batter... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets#L76-L87 | 81eee3f1f5d5f0a0046da1dbe70762dc136e24ed | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplescreening/src/main/ets/components/FilterComponent.ets | arkts | onChange | 选择的数据的行数index数组 | onChange() {
this.selectArr = this.item.selectItem;
} | AST#method_declaration#Left onChange 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 . selectArr AST#member_expression#Right = A... | onChange() {
this.selectArr = this.item.selectItem;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/components/FilterComponent.ets#L212-L214 | a43b4b3e877228a67ccc896781905899bbe36f64 | gitee |
patient-fyd/HarmonyOS4.git | 5ee3421130cb66278a1eac52fbd43dde7843f845 | RentRoom/entry/src/main/ets/model/HomeData.ets | arkts | 定义轮播图数据类型 数组类型使用type定义,对象类型用interface 将数据复制一份,用来参考定义类型 | export interface IBannerItem {
"id": number
"name": string
"imageURL": string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IBannerItem AST#object_type#Left { AST#ERROR#Left "id" : number "name" : string "imageURL" : string AST#ERROR#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface IBannerItem {
"id": number
"name": string
"imageURL": string
} | https://github.com/patient-fyd/HarmonyOS4.git/blob/5ee3421130cb66278a1eac52fbd43dde7843f845/RentRoom/entry/src/main/ets/model/HomeData.ets#L4-L8 | 9dfdd128bf213b32bd5fca62b4b5f8300c0003ea | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | publishMultiLine | 发布多文本通知
@param options 通知实体
@returns | static async publishMultiLine(options: NotificationMultiLineOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。
const multiLineContent: notificationManager.NotificationMultiLineContent = {
title: options.title,
text: options.tex... | AST#method_declaration#Left static async publishMultiLine AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationMultiLineOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim... | static async publishMultiLine(options: NotificationMultiLineOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtil.generateNotificationId();
const multiLineContent: notificationManager.NotificationMultiLineContent = {
title: options.title,
text: options.text,
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L201-L224 | 0589c4b4cf6ea9abec4503609141cda50fedf7b8 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets | arkts | onLoadMore | 触发上滑加载更多
@returns {void} 无返回值 | onLoadMore(): void {
if (this.isLoading || !this.isEnableSlideUp || this.listData.length === 0) {
return;
}
this.isLoading = true;
this.currentPage += 1;
this.loadListData();
} | AST#method_declaration#Left onLoadMore AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#e... | onLoadMore(): void {
if (this.isLoading || !this.isEnableSlideUp || this.listData.length === 0) {
return;
}
this.isLoading = true;
this.currentPage += 1;
this.loadListData();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L153-L160 | 4556280aa5bf2405971902c481f82081ac6b2c8c | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/RdbUtils.ets | arkts | insert | 插入数据 | insert(tableName: string, values: dataRdb.ValuesBucket | Array<dataRdb.ValuesBucket>): Promise<number> {
return this.getDb().then(dbHelper => {
return dbHelper.insert(tableName, values);
})
} | AST#method_declaration#Left insert AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left values : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qual... | insert(tableName: string, values: dataRdb.ValuesBucket | Array<dataRdb.ValuesBucket>): Promise<number> {
return this.getDb().then(dbHelper => {
return dbHelper.insert(tableName, values);
})
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbUtils.ets#L85-L89 | 2b5b0c9413831cde3d2421fd02dd514a4279ce78 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowAxisAlignRadioList.ets | arkts | RowAxisAlignRadioList | Set Axis Alignment in Row | @Component
export struct RowAxisAlignRadioList {
private rowModuleList: ContainerModuleItem[] = getRowModuleList();
private groupName: string = this.rowModuleList[1].groupName;
private moduleName: Resource = this.rowModuleList[1].moduleName;
private radioList: Array<string> = this.rowModuleList[1].attributeList... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RowAxisAlignRadioList AST#component_body#Left { AST#property_declaration#Left private rowModuleList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContainerModuleItem [ ] AST#array_type#Right AST... | @Component
export struct RowAxisAlignRadioList {
private rowModuleList: ContainerModuleItem[] = getRowModuleList();
private groupName: string = this.rowModuleList[1].groupName;
private moduleName: Resource = this.rowModuleList[1].moduleName;
private radioList: Array<string> = this.rowModuleList[1].attributeList... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowAxisAlignRadioList.ets#L23-L56 | c7bd540d57915992a6422fd337473d3976034750 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | getUserAgent | Gets the default user agent.
@returns { string } Return user agent information.
@throws { BusinessError } 17100001 - Init error. The AtomicServiceWebController must be associated with a
AtomicServiceWeb component.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | getUserAgent(): string; | AST#method_declaration#Left getUserAgent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | getUserAgent(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L355-L355 | 8c4ecb9b837ead67a5bf1b2b3a6988601aec79b5 | gitee |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | common/component/src/main/ets/default/headComponent.ets | arkts | HeadComponent | head custom component | @Component
export default struct HeadComponent {
@State isTouch: boolean = false;
private isActive: boolean = true;
private icBackIsVisibility: boolean = true;
private headName: string | Resource = '';
build() {
Row() {
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.ic_back... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct HeadComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isTouch : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#... | @Component
export default struct HeadComponent {
@State isTouch: boolean = false;
private isActive: boolean = true;
private icBackIsVisibility: boolean = true;
private headName: string | Resource = '';
build() {
Row() {
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.ic_back... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/headComponent.ets#L21-L68 | 991ec53b6928ce6eea8f9791fdbe1c0b41200221 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets | arkts | GlobalStateDialog | 全局状态保留能力弹窗组件 | @Component
export struct GlobalStateDialog {
@StorageProp('isShowGlobalStateDialog') isShowGlobalStateDialog: boolean = false;
build() {
Column() {
Stack({ alignContent: Alignment.TopEnd }) {
// 关闭按钮
Button({ type: ButtonType.Circle, stateEffect: true }) {
Image($r("app.media.gl... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GlobalStateDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'isShowGlobalStateDialog' AST#expression#Right ) AST#decorator#Right isShowGlobalStateDi... | @Component
export struct GlobalStateDialog {
@StorageProp('isShowGlobalStateDialog') isShowGlobalStateDialog: boolean = false;
build() {
Column() {
Stack({ alignContent: Alignment.TopEnd }) {
Button({ type: ButtonType.Circle, stateEffect: true }) {
Image($r("app.media.global_st... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets#L21-L58 | c4f6480c4f4343f31887ba994e7a7151e731286f | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | getUpdateState | 取升级状态缓存数据
@return 升级状态 | getUpdateState(): number {
return this._updateStatus;
} | AST#method_declaration#Left getUpdateState 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_expressio... | getUpdateState(): number {
return this._updateStatus;
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L229-L231 | 5fb89669afe0fa2b1d3c57a6e43781478d28f775 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/common/utils/DateUtils.ets | arkts | getDate | Obtaining time.
@param {number} days Days.
@return Return the specific year, month, day, and time. | getDate(days: number) {
let date: Date = new Date(new Date().getTime() - days * CommonConstants.TODAY_MILLI_SECOND);
let year: number = date.getFullYear();
let month: number = date.getMonth() + CommonConstants.MONTH_PLUS_ONE;
let day: number = date.getDate();
return '' + year + month + day;
} | AST#method_declaration#Left getDate AST#parameter_list#Left ( AST#parameter#Left days : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AS... | getDate(days: number) {
let date: Date = new Date(new Date().getTime() - days * CommonConstants.TODAY_MILLI_SECOND);
let year: number = date.getFullYear();
let month: number = date.getMonth() + CommonConstants.MONTH_PLUS_ONE;
let day: number = date.getDate();
return '' + year + month + day;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/DateUtils.ets#L28-L34 | 009e6be94ba4609a22852971856330299698972f | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | PickerColorMode. include AUTO, LIGHT and DARK
@enum { number } PickerColorMode
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum PickerColorMode {
/**
* AUTO. follow system color
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
AUTO = 0,
/**
* LIGHT. light color
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicser... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PickerColorMode AST#enum_body#Left { /**
* AUTO. follow system color
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#enum_member#Left AUTO = A... | export declare enum PickerColorMode {
AUTO = 0,
LIGHT = 1,
DARK = 2
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L1001-L1028 | 398651a7c5d669ee7f36a7466bf48862f1617008 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/FileUtil.ets | arkts | getFileName | 通过URI或路径获取文件名。
@param uriOrPath URI或路径
@returns | static getFileName(uriOrPath: string): string {
return new fileUri.FileUri(uriOrPath).name;
} | AST#method_declaration#Left static getFileName AST#parameter_list#Left ( AST#parameter#Left uriOrPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static getFileName(uriOrPath: string): string {
return new fileUri.FileUri(uriOrPath).name;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L123-L125 | 19049f115759af9e87b94bff2b314ae3f2a50317 | gitee |
zhangyuhang0914/ArkTs-HarmonyOs.git | c9773cad7ebeee413f98ee1a57cc8fba91fecf7d | entry/src/main/ets/http/Http.ets | arkts | 基础 API 响应体 | export interface BaseResponse {
errorCode: number
errorMsg: string
// 可拓展 API 响应体
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BaseResponse AST#object_type#Left { AST#type_member#Left errorCode : 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 errorMsg : AST#type_annotatio... | export interface BaseResponse {
errorCode: number
errorMsg: string
} | https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/http/Http.ets#L7-L11 | 63fd961b1755521d4e446f415eb546c1d5f4671e | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Keys | Called when a dictionary is sorted.
@since 7
@deprecated since 10 | static Keys(): IterableIterator<string> {
return AppStorage.keys()
} | AST#method_declaration#Left static Keys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type... | static Keys(): IterableIterator<string> {
return AppStorage.keys()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L197-L199 | 822d1234d1786f4529d7e98feeb51d064ccad398 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | convertKeyFromStr | 将对称加密字符串AESKey转换为symKey对象
@param aesKey字符串key
@param symAlgName 秘钥规格
@param keyName 密钥长度
@param keyCoding 秘钥的编码方式(utf8/hex/base64)
@returns | static convertKeyFromStr(aesKey: string, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding) {
let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(aesKey, keyName, keyCoding) };
let aesGenerator = crypto.createSymKeyGenerator(symAlgName);
let symKey = aesGenerator.c... | AST#method_declaration#Left static convertKeyFromStr AST#parameter_list#Left ( AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AS... | static convertKeyFromStr(aesKey: string, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding) {
let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(aesKey, keyName, keyCoding) };
let aesGenerator = crypto.createSymKeyGenerator(symAlgName);
let symKey = aesGenerator.c... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L92-L97 | 58c962a41e184545bb4b495076fae62bbe70165b | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.router.d.ets | arkts | Defines the option of DisableAlertBeforeBackPage.
@interface DisableAlertBeforeBackPageOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 6
@deprecated since 8
@useinstead ohos.router#RouterOptions | export interface DisableAlertBeforeBackPageOptions {
/**
* Called when the dialog box is displayed.
*
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
* @deprecated since 8
*/
success?: (errMsg: string) => void;
/**
* Called when the operation is cancelled.
... | AST#export_declaration#Left export AST#interface_declaration#Left interface DisableAlertBeforeBackPageOptions AST#object_type#Left { /**
* Called when the dialog box is displayed.
*
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
* @deprecated since 8
*/ AST#type_member... | export interface DisableAlertBeforeBackPageOptions {
success?: (errMsg: string) => void;
cancel?: (errMsg: string) => void;
complete?: () => void;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L193-L223 | a0706edb441b9d8433c39329eb5e71a02db1c5f5 | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/index.ets | arkts | Copyright (c) 2022-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,... | export * from "./ArkAnimation" | AST#export_declaration#Left export * from "./ArkAnimation" AST#export_declaration#Right | export * from "./ArkAnimation" | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/index.ets#L16-L16 | 3220ffd8a02655d169031d2959503b3c8031bed1 | gitee | |
zqf-dev/WAndroidHOS.git | e2e560a7c96110c43d13eb232826707601172b6d | entry/src/main/ets/http/Request.ets | arkts | post json 方法
@param url: 地址
@returns :返回值 | export function post(url: string, params: HashMap<string, Object>): Promise<Response> {
let httpRequest = http.createHttp();
console.log(Constants.TAG, url)
let responseResult = httpRequest.request(url, {
method: http.RequestMethod.POST,
readTimeout: API.HTTP_READ_TIMEOUT,
connectTimeout: API.HTTP_REA... | AST#export_declaration#Left export AST#function_declaration#Left function post AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_... | export function post(url: string, params: HashMap<string, Object>): Promise<Response> {
let httpRequest = http.createHttp();
console.log(Constants.TAG, url)
let responseResult = httpRequest.request(url, {
method: http.RequestMethod.POST,
readTimeout: API.HTTP_READ_TIMEOUT,
connectTimeout: API.HTTP_REA... | https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/http/Request.ets#L51-L83 | ad6f41b341f3da15470089bf2faccf40cd532393 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets | arkts | 工具类 | export class Utils {
static generateAlphaList(cityGroupList: ICityGroup[]) {
return cityGroupList.map(v => v.name);
}
static applyLocationPermission(): Promise<string> {
return new Promise((resolve) => {
SystemSceneUtils.applyLocationPermission().then((isGranted) => {
if (isGranted) {
... | AST#export_declaration#Left export AST#class_declaration#Left class Utils AST#class_body#Left { AST#method_declaration#Left static generateAlphaList AST#parameter_list#Left ( AST#parameter#Left cityGroupList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ICityGroup [ ] AST#array_type#Right AST#pri... | export class Utils {
static generateAlphaList(cityGroupList: ICityGroup[]) {
return cityGroupList.map(v => v.name);
}
static applyLocationPermission(): Promise<string> {
return new Promise((resolve) => {
SystemSceneUtils.applyLocationPermission().then((isGranted) => {
if (isGranted) {
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets#L62-L80 | 290b3d93019c1dfbe4d95d2d8d4170c432724678 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets | arkts | getData | 获取指定数据项 | getData(index: number): CommentModel {
return this.comments[index];
} | AST#method_declaration#Left getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CommentModel AST#primary_type#Ri... | getData(index: number): CommentModel {
return this.comments[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets#L125-L127 | 8b302537571d3f9f21ec402a79ca13b151b6aec0 | gitee |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/utils/GestureUtils.ets | arkts | createDragGesture | 创建拖拽手势处理器
@param onStart - 拖拽开始回调
@param onUpdate - 拖拽更新回调
@param onEnd - 拖拽结束回调
@returns 拖拽手势处理器 | static createDragGesture(
onStart: (x: number, y: number) => void,
onUpdate: (state: GestureState) => void,
onEnd: (state: GestureState) => void
): PanGestureInterface {
let gestureState: GestureState | null = null;
hilog.debug(0x0000, TAG, 'GestureUtils.createDragGesture: 创建拖拽手势');
return P... | AST#method_declaration#Left static createDragGesture AST#parameter_list#Left ( AST#parameter#Left onStart : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#paramete... | static createDragGesture(
onStart: (x: number, y: number) => void,
onUpdate: (state: GestureState) => void,
onEnd: (state: GestureState) => void
): PanGestureInterface {
let gestureState: GestureState | null = null;
hilog.debug(0x0000, TAG, 'GestureUtils.createDragGesture: 创建拖拽手势');
return P... | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L126-L175 | ed2006bde16ab67613c2afdcee9b815ffd8e813c | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/TextAreaBuilderProxy.ets | arkts | textAlign | 文本水平对齐方式
@description 控制文本在输入框内的水平对齐(如左对齐、居中、右对齐)
@returns | textAlign(textAlign: TextAlign) {
this.builderOptions.textAlign = textAlign;
return this
} | AST#method_declaration#Left textAlign AST#parameter_list#Left ( AST#parameter#Left textAlign : AST#type_annotation#Left AST#primary_type#Left TextAlign AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#L... | textAlign(textAlign: TextAlign) {
this.builderOptions.textAlign = textAlign;
return this
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextAreaBuilderProxy.ets#L39-L42 | f1a6cd4f8e3abfaf8462dde7685595381768cd67 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | getBoolean | 获取boolean类型的缓存值
@param key
@returns | static async getBoolean(key: string, defValue: boolean = false,
preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<boolean> {
let value = await PreferencesUtil.get(key, defValue, preferenceName);
return value as boolean;
} | AST#method_declaration#Left static async getBoolean 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 defValue : AST#type_annotation#Left AST#primary_type#Left boolean AST#pri... | static async getBoolean(key: string, defValue: boolean = false,
preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<boolean> {
let value = await PreferencesUtil.get(key, defValue, preferenceName);
return value as boolean;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L183-L187 | 660e2685bf361396ad4a434829e68d137f24a7ef | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_layout/ace_ets_module_layout_nowear_api11/entry/src/main/ets/MainAbility/common/Common.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 class RectValue {
left: number = 0;
top: number = 0;
right: number = 0;
bottom: number = 0;
} | AST#export_declaration#Left export AST#class_declaration#Left class RectValue AST#class_body#Left { AST#property_declaration#Left left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AS... | export class RectValue {
left: number = 0;
top: number = 0;
right: number = 0;
bottom: number = 0;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_layout/ace_ets_module_layout_nowear_api11/entry/src/main/ets/MainAbility/common/Common.ets#L15-L20 | e00c04954c7a787b55a7729ccad0c351281fd917 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | navigateToPayment | 跳转到支付页面
@param {Order} order - 订单信息
@returns {void} 无返回值 | private navigateToPayment(order: Order): void {
const paymentPrice: number = order.price - order.discountPrice;
OrderNavigator.toPay(order.id, paymentPrice, "confirm");
} | AST#method_declaration#Left private navigateToPayment AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | private navigateToPayment(order: Order): void {
const paymentPrice: number = order.price - order.discountPrice;
OrderNavigator.toPay(order.id, paymentPrice, "confirm");
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L319-L322 | 23cc6031ef41b8f4c74bf002c8c6e4e8906cf695 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/base/IBaseInputOptions.ets | arkts | 输入弹框基础参数配置接口
@extends BaseContentOptions | export interface IBaseInputOptions extends IBaseContentOptions {
/**
* 输入弹框的样式配置(可选)
*/
style?: IInputDialogStyle;
/**
* Input/InputArea观察的数据(内部已构建该实例)
* @description 即经过@ObservedV2修饰过的实例
*/
observedData: InputObserved
/**
* 输入框的默认文本内容(可选)
*/
text?: ResourceStr;
/**
* 输入框的占位提示文本(... | AST#export_declaration#Left export AST#interface_declaration#Left interface IBaseInputOptions AST#extends_clause#Left extends IBaseContentOptions AST#extends_clause#Right AST#object_type#Left { /**
* 输入弹框的样式配置(可选)
*/ AST#type_member#Left style ? : AST#type_annotation#Left AST#primary_type#Left IInputDialogStyle A... | export interface IBaseInputOptions extends IBaseContentOptions {
style?: IInputDialogStyle;
observedData: InputObserved
text?: ResourceStr;
placeholder?: ResourceStr;
defaultFocus?: boolean;
maxLength?: number;
inputFilter?: InputFilter;
onChange?: StringCallback;
but... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/base/IBaseInputOptions.ets#L12-L68 | bbd139deeea4ee3756cbf8593d12379e497734f4 | github | |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/entryability/EntryAbility.ets | arkts | importPreferenceItems | ------------------ Item Manager ------------------// | importPreferenceItems(dataPreferences: preferences.Preferences, items: OTPItemInfo[], secrets: SecretSchema[]): OTPItemInfo[] {
const failed: OTPItemInfo[] = [];
//
for (let i=0; i<items.length; i++) {
const item = items[i];
const secret = secrets[i];
const ke... | AST#method_declaration#Left importPreferenceItems AST#parameter_list#Left ( AST#parameter#Left dataPreferences : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#... | importPreferenceItems(dataPreferences: preferences.Preferences, items: OTPItemInfo[], secrets: SecretSchema[]): OTPItemInfo[] {
const failed: OTPItemInfo[] = [];
for (let i=0; i<items.length; i++) {
const item = items[i];
const secret = secrets[i];
const keyA... | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/entryability/EntryAbility.ets#L314-L338 | 22456d34e61b9bed691ac6041f8fd2912a84ca5a | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | 构建通用 Row 布局
@returns {void} 无返回值
@example
RowBase({ fillMaxSize: true }) { Text("Hi"); } | build(): void {
Row(this.options) {
if (this.content) {
this.content();
}
}
.justifyContent(this.justifyContent)
.alignItems(this.alignItems)
.attributeModifier(this.buildCommonModifier());
} | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#ERROR#Left this . options AST#ERROR#Right ) AST#container_content_body... | build(): void {
Row(this.options) {
if (this.content) {
this.content();
}
}
.justifyContent(this.justifyContent)
.alignItems(this.alignItems)
.attributeModifier(this.buildCommonModifier());
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L80-L89 | 0d09bdbc346d656ccab43e981411037166b9b5c1 | github | |
din0sauria/audio-deepfake-detection.git | e38df736b8d843e0742657f1c683c0277576740e | entry/src/main/ets/utils/WindowManager.ets | arkts | enableFullScreen | 开启沉浸式显示 | static async enableFullScreen() {
const context = getContext()
const win = await window.getLastWindow(context)
win.setWindowLayoutFullScreen(true)
const topHeight = win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
AppStorage.setOrCreate("topHeight", px2vp(topHeight.topRect.height))
} | AST#method_declaration#Left static async enableFullScreen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expressi... | static async enableFullScreen() {
const context = getContext()
const win = await window.getLastWindow(context)
win.setWindowLayoutFullScreen(true)
const topHeight = win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
AppStorage.setOrCreate("topHeight", px2vp(topHeight.topRect.height))
} | https://github.com/din0sauria/audio-deepfake-detection.git/blob/e38df736b8d843e0742657f1c683c0277576740e/entry/src/main/ets/utils/WindowManager.ets#L5-L12 | 40532dd682bb4bdb654b262781c53db5b6e028ca | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/GlobalContext.ets | arkts | 全局上下文类,用于在应用程序中共享全局数据和对象。 | export class GlobalContext {
private constructor() {
}
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
/**
* 获取全局上下文实例。
*
* @return 全局上下文实例
*/
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new... | AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat... | export class GlobalContext {
private constructor() {
}
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.in... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/GlobalContext.ets#L4-L42 | a12f21acedf82fa2580c5303f6587a7785b14fa5 | github | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | setting/src/main/ets/utils/ValidatorUtils.ets | arkts | isEmail | 验证邮箱 | static isEmail(text: string): boolean {
if (!text || text.trim() === '') return false;
return ValidatorUtils.STRICT_EMAIL_REGEX.test(text.trim());
} | AST#method_declaration#Left static isEmail AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R... | static isEmail(text: string): boolean {
if (!text || text.trim() === '') return false;
return ValidatorUtils.STRICT_EMAIL_REGEX.test(text.trim());
} | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/utils/ValidatorUtils.ets#L19-L22 | 245ee2e1323a599113c22358f150453ccf6dce64 | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/model/WindowModel.ets | arkts | updateSubWindowContent | 更新子窗口显示内容
Update the UI content of the sub-window.
@param url The page url to load. | updateSubWindowContent(url: string) {
if (this.subWindowClass === undefined) {
Logger.error('Failed to update content: subWindowClass is undefined.');
return;
}
this.subWindowClass.setUIContent(url, (err) => {
if (err.code) {
Logger.error(`Failed to update window content to ${url}.... | AST#method_declaration#Left updateSubWindowContent AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left ... | updateSubWindowContent(url: string) {
if (this.subWindowClass === undefined) {
Logger.error('Failed to update content: subWindowClass is undefined.');
return;
}
this.subWindowClass.setUIContent(url, (err) => {
if (err.code) {
Logger.error(`Failed to update window content to ${url}.... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/model/WindowModel.ets#L133-L145 | 85101f78652c315d755022d938081e2c19a88565 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/user/UserNavigator.ets | arkts | @file 用户模块导航封装
@author Joker.X | export class UserNavigator {
/**
* 跳转到个人中心
* @returns {void} 无返回值
*/
static toProfile(): void {
navigateTo(UserRoutes.Profile);
}
/**
* 跳转到收货地址列表
* @param {boolean} isSelectMode - 是否为选择模式(默认 false)
* @returns {Promise<UserSelectAddressResult | undefined>} 返回选中的地址结果 Promise
*/
static ... | AST#export_declaration#Left export AST#class_declaration#Left class UserNavigator AST#class_body#Left { /**
* 跳转到个人中心
* @returns {void} 无返回值
*/ AST#method_declaration#Left static toProfile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ... | export class UserNavigator {
static toProfile(): void {
navigateTo(UserRoutes.Profile);
}
static toAddressList(isSelectMode: boolean = false): Promise<UserSelectAddressResult | undefined> {
const params: UserAddressListParam = { isSelectMode };
return navigateToForResult<UserSelectAddressResult... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/user/UserNavigator.ets#L11-L48 | 198eb9fae26b9d7d34c3a95517219e6bd6833fdf | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getUIContext | 获取UIContext
@returns | static getUIContext(): UIContext {
return AppUtils.getMainWindow().getUIContext()
} | AST#method_declaration#Left static getUIContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_exp... | static getUIContext(): UIContext {
return AppUtils.getMainWindow().getUIContext()
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L60-L62 | fd56ca4003284837ca527ec28999dd1b8c93a791 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets | arkts | 从文件路径获取文件名 | export function getFileNameFromPath(filePath: string) {
let segments = filePath.split('/')
//文件名称
return segments[segments.length-1]
} | AST#export_declaration#Left export AST#function_declaration#Left function getFileNameFromPath AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function getFileNameFromPath(filePath: string) {
let segments = filePath.split('/')
return segments[segments.length-1]
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L44-L48 | bf6f5b9e7d6c7aaba0d6e1314db25c4ffad1400d | gitee | |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets | arkts | deleteSchedule | 根据日程ID删除日程 | static async deleteSchedule(scheduleId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/schedule/${scheduleId}`,
{
method: RequestMethod.DELETE,
header: {
'userId': `${userId}`
... | AST#method_declaration#Left static async deleteSchedule AST#parameter_list#Left ( AST#parameter#Left scheduleId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string... | static async deleteSchedule(scheduleId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/schedule/${scheduleId}`,
{
method: RequestMethod.DELETE,
header: {
'userId': `${userId}`
... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L247-L269 | 785ddb4d92cfebd7ee1fffc1f4b6d52d9f75452f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsShippingServiceCard.ets | arkts | 构建发货与服务卡片
@returns {void} 无返回值 | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
}
}) {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: ... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width... | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
}
}) {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: ... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsShippingServiceCard.ets#L15-L51 | d5a82444ce3c53a165530772ce95dd21571a1db2 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputConsumerUtil.ets | arkts | unsubscribe | 取消订阅组合按键
@param keyOptions 组合键选项 默认:a+b+e组合按键 | unsubscribe(): void {
if (this.mCallback) {
inputConsumer.off('key', this.mKeyOptionS, this.mCallback)
inputConsumer.off('key', this.mKeyOptionD, this.mCallback)
} else {
inputConsumer.off('key', this.mKeyOptionS)
inputConsumer.off('key', this.mKeyOptionD)
}
} | AST#method_declaration#Left unsubscribe AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expre... | unsubscribe(): void {
if (this.mCallback) {
inputConsumer.off('key', this.mKeyOptionS, this.mCallback)
inputConsumer.off('key', this.mKeyOptionD, this.mCallback)
} else {
inputConsumer.off('key', this.mKeyOptionS)
inputConsumer.off('key', this.mKeyOptionD)
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputConsumerUtil.ets#L49-L57 | 4e3e1bb4f3d7ce868925cc1c36db3b8f9815904e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets | arkts | getData | 获取指定索引数据。
@param {number} index - 索引值。
@returns {CustomDataType} 返回指定索引数据。 | public getData(index: number): Month {
return this.dataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Month AST#primary_type#Ri... | public getData(index: number): Month {
return this.dataArray[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L45-L47 | fdaaedf447efc380fc13964c4e457cd4d758b4fd | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/social/SearchPage.ets | arkts | buildSearchTip | 构建搜索提示项 | @Builder
buildSearchTip(tip: string) {
Row({ space: 8 }) {
Image($r('app.media.ic_lightbulb'))
.width(16)
.height(16)
.fillColor($r('app.color.warning'))
Text(tip)
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
.layoutWeight(1)
}
.widt... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchTip AST#parameter_list#Left ( AST#parameter#Left tip : 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#L... | @Builder
buildSearchTip(tip: string) {
Row({ space: 8 }) {
Image($r('app.media.ic_lightbulb'))
.width(16)
.height(16)
.fillColor($r('app.color.warning'))
Text(tip)
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
.layoutWeight(1)
}
.widt... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/SearchPage.ets#L340-L354 | 56d5ebb170a5a8a87898356f22f356e39ddf1d2b | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/Index.ets | arkts | RouterModule | 路由工具 | export { RouterModule, NavRouterInfo, DialogInfo } from './src/main/ets/utils/RouterModule'; | AST#export_declaration#Left export { RouterModule , NavRouterInfo , DialogInfo } from './src/main/ets/utils/RouterModule' ; AST#export_declaration#Right | export { RouterModule, NavRouterInfo, DialogInfo } from './src/main/ets/utils/RouterModule'; | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/Index.ets#L8-L8 | 4f8d82e36952037bef3ed918791f0564944683e4 | github |
RicardoWesleyli/ArkUI-Animations.git | a85f94156d3fde1439bfb68a2108dbc3eb4a1dca | BuyButtonAnimation/entry/src/main/ets/pages/Index.ets | arkts | handleClick | 按钮点击事件 | private handleClick() {
this.loading = true // 开启加载动画
animateTo({ duration: 500, curve: Curve.Linear }, () => {
this.start = !this.start // 切换按钮状态
})
if (this.start) {
// 3 秒后完成加载,显示 ✅
setTimeout(() => {
this.loading = false
animateTo({}, () => {
this.showC... | AST#method_declaration#Left private handleClick AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loading AST#membe... | private handleClick() {
this.loading = true
animateTo({ duration: 500, curve: Curve.Linear }, () => {
this.start = !this.start
})
if (this.start) {
setTimeout(() => {
this.loading = false
animateTo({}, () => {
this.showCheckmark = true
this.spi... | https://github.com/RicardoWesleyli/ArkUI-Animations.git/blob/a85f94156d3fde1439bfb68a2108dbc3eb4a1dca/BuyButtonAnimation/entry/src/main/ets/pages/Index.ets#L53-L71 | 641ac07b8b0f58979a5f43ce2a7d3425500c9a08 | github |
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | AxisLineCalculator 接口的具体实现类(关联 C++ 实例) | export class AxisLineCalculatorImpl implements IAxisLineCalculator {
// 持有 C++ 实例引用
private instance: AxisRenderInstance;
constructor(instance: AxisRenderInstance) {
this.instance = instance;
}
/**
* 代理到 C++ 实例的 getXByValue 方法
*/
getAxisByValue(targetTime: number): number {
... | AST#export_declaration#Left export AST#class_declaration#Left class AxisLineCalculatorImpl AST#implements_clause#Left implements IAxisLineCalculator AST#implements_clause#Right AST#class_body#Left { // 持有 C++ 实例引用 AST#property_declaration#Left private instance : AST#type_annotation#Left AST#primary_type#Left AxisRender... | export class AxisLineCalculatorImpl implements IAxisLineCalculator {
private instance: AxisRenderInstance;
constructor(instance: AxisRenderInstance) {
this.instance = instance;
}
getAxisByValue(targetTime: number): number {
return this.instance.getAxisByValue(targetTime);
... | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L190-L211 | 4ace4aa89622f311eec2e82af5cbbc5b838bd96f | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/GoodsDetail.ets | arkts | @file 商品详情信息
@author Joker.X | export class GoodsDetail {
/**
* 商品信息
*/
goodsInfo: Goods = new Goods();
/**
* 优惠券列表
*/
coupon: Coupon[] = [];
/**
* 评论列表
*/
comment: Comment[] = [];
constructor(init?: Partial<GoodsDetail>) {
if (!init) {
return;
}
this.goodsInfo = init.goodsInfo ? new Goods(init.good... | AST#export_declaration#Left export AST#class_declaration#Left class GoodsDetail AST#class_body#Left { /**
* 商品信息
*/ AST#property_declaration#Left goodsInfo : AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#exp... | export class GoodsDetail {
goodsInfo: Goods = new Goods();
coupon: Coupon[] = [];
comment: Comment[] = [];
constructor(init?: Partial<GoodsDetail>) {
if (!init) {
return;
}
this.goodsInfo = init.goodsInfo ? new Goods(init.goodsInfo) : this.goodsInfo;
this.coupon = init.coupon ? i... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/GoodsDetail.ets#L9-L31 | 79b4414f1ee20d770d52aa5ae07a06598ee01737 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | addDays | MARK: - 工具函数 (Swift 的 Date 扩展方法替代) | private addDays(date: Date, days: number): Date {
let d = new Date(date);
d.setDate(d.getDate() + days);
return d;
} | AST#method_declaration#Left private addDays AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left days : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ... | private addDays(date: Date, days: number): Date {
let d = new Date(date);
d.setDate(d.getDate() + days);
return d;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L457-L461 | 8379589aba00137f004042641ef65ecf5661fb85 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | tableExists | 检查表是否存在
@param tableName 表名
@returns 是否存在 | async tableExists(tableName: string): Promise<boolean> {
try {
const result = await this.query(
'sqlite_master',
['name'],
'type = ? AND name = ?',
['table', tableName]
);
return result.length > 0;
} catch (error) {
hilog.error(LogConstants.DOMAIN_DATABASE... | AST#method_declaration#Left async tableExists AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | async tableExists(tableName: string): Promise<boolean> {
try {
const result = await this.query(
'sqlite_master',
['name'],
'type = ? AND name = ?',
['table', tableName]
);
return result.length > 0;
} catch (error) {
hilog.error(LogConstants.DOMAIN_DATABASE... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L645-L658 | b0a75f6cf3b06ab4a094d1df773f39a8ef0cada9 | github |
conradsheeran/steam-totp.git | af0eba089e77ff73e6983ce61fa89190c628721e | src/main/ets/pages/SteamTOTP.ets | arkts | time | 返回当前的 Unix 时间戳
@param timeOffset - 与 Steam 服务器的时间偏移量,单位为秒
@returns { number } | public static time(timeOffset: number = 0): number {
return Math.floor(Date.now() / 1000) + timeOffset;
} | AST#method_declaration#Left public static time AST#parameter_list#Left ( AST#parameter#Left timeOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotatio... | public static time(timeOffset: number = 0): number {
return Math.floor(Date.now() / 1000) + timeOffset;
} | https://github.com/conradsheeran/steam-totp.git/blob/af0eba089e77ff73e6983ce61fa89190c628721e/src/main/ets/pages/SteamTOTP.ets#L48-L50 | aff0bf5c736199c886f042bbe135c00d27bd9e91 | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.app.appstartup.StartupTask.d.ets | arkts | The base class of startup task.
@syscap SystemCapability.Ability.AppStartup
@stagemodelonly
@since 12 | @Sendable
export default class StartupTask {
/**
* Called when specific dependent task complete.
*
* @param { string } dependency - Indicates name of specific dependent startup task.
* @param { Object } result - Indicates result of specific dependent startup task.
* @syscap SystemCapability... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export default AST#class_declaration#Left class StartupTask AST#class_body#Left { /**
* Called when specific dependent task complete.
*
* @param { string } dependency - Indicates name of specific dependent startup tas... | @Sendable
export default class StartupTask {
onDependencyCompleted?(dependency: string, result: Object): void;
init(context: AbilityStageContext): Promise<Object | void>;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.app.appstartup.StartupTask.d.ets#L27-L50 | b1a14531ef5b042573a810050190869b4738a37c | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | TODO App相关工具类(使用该工具前请在UIAbility的onCreate方法中调用AppUtil的init方法初始化)
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class AppUtil {
private static context: common.UIAbilityContext; //common.UIAbilityContext,上下文
/**
* 初始化方法,缓存全局变量,在UIAbility的onCreate方法中初始化该方法。
* @param windowStage 窗口管理器
*/
static init(context: common.UIAbilityContext) {
AppUtil.context = context;
}
/**
* 检查API版本是否安全
* @param a... | AST#export_declaration#Left export AST#class_declaration#Left class AppUtil AST#class_body#Left { AST#property_declaration#Left private static context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Ri... | export class AppUtil {
private static context: common.UIAbilityContext;
static init(context: common.UIAbilityContext) {
AppUtil.context = context;
}
static isApiSupported(apiVersion: number): boolean {
return deviceInfo.sdkApiVersion >= apiVersion;
}
static getApplicationContext():c... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L41-L625 | 0beb20d72d365c49da22019b504796586f9e5b60 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/Rect.ets | arkts | offset | Offset the rectangle by adding dx to its left and right coordinates, and
adding dy to its top and bottom coordinates.
@param dx The amount to add to the rectangle's left and right coordinates
@param dy The amount to add to the rectangle's top and bottom coordinates | public offset(dx: number, dy: number) {
this.left += dx;
this.top += dy;
this.right += dx;
this.bottom += dy;
} | AST#method_declaration#Left public offset AST#parameter_list#Left ( AST#parameter#Left dx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dy : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AS... | public offset(dx: number, dy: number) {
this.left += dx;
this.top += dy;
this.right += dx;
this.bottom += dy;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L169-L174 | 09833f86d1e6bd9f95cafcd4052adebc3761babb | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/DownloadService.ets | arkts | deleteDownloadedFile | 删除已下载文件 | async deleteDownloadedFile(episode: Episode): Promise<void> {
if (episode.localPath) {
try {
// 删除文件
await fs.unlink(episode.localPath);
// 更新数据库
episode.downloadStatus = DownloadStatus.NOT_DOWNLOADED;
episode.localPath = '';
await this.dbService.update... | AST#method_declaration#Left async deleteDownloadedFile AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi... | async deleteDownloadedFile(episode: Episode): Promise<void> {
if (episode.localPath) {
try {
await fs.unlink(episode.localPath);
episode.downloadStatus = DownloadStatus.NOT_DOWNLOADED;
episode.localPath = '';
await this.dbService.updateEpisodeDownload... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L251-L270 | d001c44c7c41e35c467ab39e10c12cea7129b477 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.