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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/pages/学习/27.class类.ets | arkts | 构造函数 | constructor(name: string, price: number) {
this.name = name
this.price = price
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left price : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | constructor(name: string, price: number) {
this.name = name
this.price = price
} | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/27.class类.ets#L25-L28 | dd330b0855b7034c1de2bd46fbe021a950147368 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets | arkts | getPlanByPlanId | /从DB加载plan / 根据 planId 从 DB 获取单个 Plan | public static async getPlanByPlanId(planId: number): Promise<Plan | null> {
const dbPlan: DBPlan | null = await PlanDbAccess.shared.getPlanByPlanId(planId);
if (!dbPlan) return null;
const dbPlanHelper: DBPlanHelper = new DBPlanHelper(dbPlan);
// 预先获取所有异步数据
const pieces: Piece[] = await dbPlanHelp... | AST#method_declaration#Left public static async getPlanByPlanId AST#parameter_list#Left ( AST#parameter#Left planId : 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... | public static async getPlanByPlanId(planId: number): Promise<Plan | null> {
const dbPlan: DBPlan | null = await PlanDbAccess.shared.getPlanByPlanId(planId);
if (!dbPlan) return null;
const dbPlanHelper: DBPlanHelper = new DBPlanHelper(dbPlan);
const pieces: Piece[] = await dbPlanHelper.getPieces(... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L169-L192 | f5bf9773d04c96756b0d231793ab518ecf1443fb | github |
kaina404/HarmonyStock.git | 99233a46fb0dfb21e02294c730fd80e2fb404f9b | entry/src/main/ets/pages/component/MinuteLineComponent.ets | arkts | drawBackgroundLine | 绘制背景的方格线 | drawBackgroundLine() {
//-------------绘制背景的分时方格线-------start---------
let w = this.minuteRect.width
let h = this.minuteRect.height
//绘制4x4方格背景矩形
this.minuteRect.strokeRect(this.context, '#E7E7E7')
this.context.strokeStyle = '#E7E7E7'
let itemDistanceY = h / 4
//3条水平线
let startY = th... | AST#method_declaration#Left drawBackgroundLine AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //-------------绘制背景的分时方格线-------start--------- AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left w = AST#expression#Left AST#member_expression#Left AST#expressio... | drawBackgroundLine() {
let w = this.minuteRect.width
let h = this.minuteRect.height
this.minuteRect.strokeRect(this.context, '#E7E7E7')
this.context.strokeStyle = '#E7E7E7'
let itemDistanceY = h / 4
let startY = this.minuteRect.startY + itemDistanceY
for (let i = 0; i < 3; i+... | https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/MinuteLineComponent.ets#L211-L252 | 347dc5bd0ae7aa844aaea0eadee81c59a4c86fd0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets | arkts | WeekViewItem | 时间计算工具类
周视图子组件 | @Component
export struct WeekViewItem {
// 周视图日期数据
@State @Watch("getFirstDayData") weekDays: Day[][] = [];
// 当前选中的日期
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0); // 当前选中的日期
// 当前选中的日期,格式'year-month-date'
@Link @Watch('OnC... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WeekViewItem AST#component_body#Left { // 周视图日期数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left "getFirstDayData" AST#expression#Right ) ... | @Component
export struct WeekViewItem {
@State @Watch("getFirstDayData") weekDays: Day[][] = [];
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0);
,格式'year-month-date'
@Link @Watch('OnChangeSelectDate') currentSelectDate: str... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets#L25-L164 | e7b88583abe21802f3fa52df2d979410d08970b7 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/OnChartGestureListener.ets | arkts | Listener for callbacks when doing gestures on the chart. | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/OnChartGestureListener.ets#L23-L23 | 3a0296ae4770bada73cde0e8a467067f64a901bf | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | getNextBirthday | 获取下一个生日
@param birthDate 出生日期
@param referenceDate 参考日期,默认为今天
@returns 下一个生日日期 | static getNextBirthday(birthDate: Date, referenceDate: Date = new Date()): Date {
const thisYear = referenceDate.getFullYear();
let nextBirthday = new Date(thisYear, birthDate.getMonth(), birthDate.getDate());
// 如果今年的生日已经过了,返回明年的生日
if (nextBirthday < referenceDate) {
nextBirthday.setFullYear... | AST#method_declaration#Left static getNextBirthday AST#parameter_list#Left ( AST#parameter#Left birthDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left referenceDate : AST#type_annotation#Left AST#primary_type#Left Date AS... | static getNextBirthday(birthDate: Date, referenceDate: Date = new Date()): Date {
const thisYear = referenceDate.getFullYear();
let nextBirthday = new Date(thisYear, birthDate.getMonth(), birthDate.getDate());
if (nextBirthday < referenceDate) {
nextBirthday.setFullYear(thisYear + 1);
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L288-L298 | e058a4ede37b3b6ff323be1461685e77f2781a55 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets | arkts | onSelectItem | 选择子菜单
@param item
@param hasInputText | async onSelectItem(item: TaskData): Promise<void> {
if (item.task !== undefined) {
this.currentTask = item.task;
}
if (item.text !== undefined) {
this.cancelOkText = item.text
}
this.originBM = await copyPixelMap(this.pixelMap!) // 拷贝
// 保存到队列
this.pixelMapQueue.push(this.originB... | AST#method_declaration#Left async onSelectItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TaskData 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#Lef... | async onSelectItem(item: TaskData): Promise<void> {
if (item.task !== undefined) {
this.currentTask = item.task;
}
if (item.text !== undefined) {
this.cancelOkText = item.text
}
this.originBM = await copyPixelMap(this.pixelMap!)
this.pixelMapQueue.push(this.originBM);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets#L109-L119 | 39f6175a4c764ab7995090a0885686fb9dcd64f2 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.TreeView.d.ets | arkts | once | Event registration and processing.
After the event is processed once, it will be destroyed.
@param { type } event Registered Events.
@param { callback }.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Event registration and processing.
After the event is processed once, it will be destroyed.
@param { type } ev... | once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void; | AST#method_declaration#Left once AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ... | once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L155-L155 | 348723362c86dc94596d1af175f5f30b84effea7 | gitee |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets | arkts | Font controls options applied when drawing and measuring text.
@syscap SystemCapability.Graphics.Drawing
@since 11 | export class Font {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | AST#export_declaration#Left export AST#class_declaration#Left class Font AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parameter_list#Ri... | export class Font {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L816-L817 | 51d093d0f1db0001bdcf9f7f955810e85d7d68cd | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.DialogV2.d.ets | arkts | TipsDialogV2 | Declare CustomDialog TipsDialogV2
@struct { TipsDialogV2 }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @ComponentV2
export declare struct TipsDialogV2 {
/**
* Sets the TipsDialogV2 imageRes.
*
* @type { ResourceStr | PixelMap }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Require
@Param
imageRes: ResourceStr | PixelMap;
/**
* Sets the ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct TipsDialogV2 AST#component_body#Left { /**
* Sets the TipsDialogV2 imageRes.
*
* @type { ResourceStr | PixelMap }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @... | @ComponentV2
export declare struct TipsDialogV2 {
@Require
@Param
imageRes: ResourceStr | PixelMap;
@Param
imageSize?: SizeOptions;
@Param
imageBorderColor?: ColorMetrics;
@Param
imageBorderWidth?: LengthMetrics;
@Param
title?: ResourceStr;
@Param
content?: ResourceStr;
... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L264-L387 | 764f452cbf9a3c144afdff9b6bf93c1ad4027052 | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets | arkts | getDeviceImage | 返回设备图片 | private getDeviceImage(device: any) {
if (!DigitalConstants.DeviceTypeMap.has(device.typeId)) {
return $r("app.media.icon_fraction_phone_online") // 需要做一张默认的位置设备图片
}
if (device.state == DigitalConstants.OnlineState) {
return DigitalConstants.DeviceTypeMap.get(device.typeId).onLineImage
} el... | AST#method_declaration#Left private getDeviceImage AST#parameter_list#Left ( AST#parameter#Left device : AST#type_annotation#Left AST#primary_type#Left any 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 ... | private getDeviceImage(device: any) {
if (!DigitalConstants.DeviceTypeMap.has(device.typeId)) {
return $r("app.media.icon_fraction_phone_online")
}
if (device.state == DigitalConstants.OnlineState) {
return DigitalConstants.DeviceTypeMap.get(device.typeId).onLineImage
} else {
return... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets#L95-L105 | 9077df827c513d329713ce174dc0cb84f3f374ad | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/viewmodel/PrivacyPolicyViewModel.ets | arkts | @file 隐私政策页面 ViewModel
@author Joker.X | @ObservedV2
export default class PrivacyPolicyViewModel extends BaseViewModel {
} | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class PrivacyPolicyViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { } AST#class_body#Ri... | @ObservedV2
export default class PrivacyPolicyViewModel extends BaseViewModel {
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/viewmodel/PrivacyPolicyViewModel.ets#L7-L9 | d4121b5e085ac5748356084b8bb0546d4e2ccf58 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBarV2.d.ets | arkts | Declare enum ToolBarV2ItemState
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export declare enum ToolBarV2ItemState {
/**
* Enable type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
ENABLE = 1,
/**
* Disable type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum ToolBarV2ItemState AST#enum_body#Left { /**
* Enable type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/ AST#enum_member#Left ENABLE = AST#expres... | export declare enum ToolBarV2ItemState {
ENABLE = 1,
DISABLE = 2,
ACTIVATE = 3
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L32-L60 | b76372e73dc574bbef4c4004075da39caba60f6f | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets | arkts | MonthViewItem | 时间计算工具类
月视图子组件 | @Component
export struct MonthViewItem {
// 月视图日期数据
@State monthDays: Day[][] = [];
// 年月信息
@Link @Watch('updateMonthData') yearMonth: string;
// 当前选中的日期
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0); // 当前选中的日期
// 当前选中的日期,... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MonthViewItem AST#component_body#Left { // 月视图日期数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right monthDays : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Day [ ] [ ... | @Component
export struct MonthViewItem {
@State monthDays: Day[][] = [];
@Link @Watch('updateMonthData') yearMonth: string;
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0);
,格式'year-month-date-week'
@Link @Watch('OnChan... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets#L25-L83 | 1698b67713a45056760d6a0bb256644b613c2e7e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/Index.ets | arkts | aboutToAppear | 页面生命周期 - 页面即将出现 | aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Index page aboutToAppear');
this.initializePage();
} | 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 hilog AST#expression#Right . info AST#member_expre... | aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Index page aboutToAppear');
this.initializePage();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L29-L32 | 33164aada49218395685c8b3efd16ccc95d3db5f | github |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/viewmodel/Message/MessageDataSource.ets | arkts | Caching logic: 1. Always caching the latest 100 messages. 2. When the message list is updated, the new messages will be added to the cache, and the oldest messages will be removed. 3. When user scrolls | export class MessageDataSource implements IDataSourcePrefetching {
public sortedMessages: SortedHashMap<number, Message> = new SortedHashMap<number, Message>();
private listeners: DataChangeListener[] = [];
public setMessages(messages: Message[]): void {
for (let i = 0; i < messages.length; i++) {
this... | AST#export_declaration#Left export AST#class_declaration#Left class MessageDataSource AST#implements_clause#Left implements IDataSourcePrefetching AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left public sortedMessages : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | export class MessageDataSource implements IDataSourcePrefetching {
public sortedMessages: SortedHashMap<number, Message> = new SortedHashMap<number, Message>();
private listeners: DataChangeListener[] = [];
public setMessages(messages: Message[]): void {
for (let i = 0; i < messages.length; i++) {
this... | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Message/MessageDataSource.ets#L12-L146 | 07898ed18bf079a899343fd9f81566b2ea15e668 | github | |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/ui/layout/CollectedUrlItemLayout.ets | arkts | CollectedUrlItemLayout | article和banner布局 | @Component
export struct CollectedUrlItemLayout {
index: number
item: ICollectedUrl
onDelete: (index: number, collectedUrl: ICollectedUrl) => void
private theme: Wanthemes.IWanTheme = globalVM_Setting.getTheme()
onItemClick: (link: string) => void
build() {
Flex({ direction: FlexDirection.Row }) {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CollectedUrlItemLayout AST#component_body#Left { AST#property_declaration#Left index : AST#ERROR#Left number item : ICollectedUrl
onDelete : AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left AST#parame... | @Component
export struct CollectedUrlItemLayout {
index: number
item: ICollectedUrl
onDelete: (index: number, collectedUrl: ICollectedUrl) => void
private theme: Wanthemes.IWanTheme = globalVM_Setting.getTheme()
onItemClick: (link: string) => void
build() {
Flex({ direction: FlexDirection.Row }) {
... | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/ui/layout/CollectedUrlItemLayout.ets#L9-L74 | dc9661272238b6e96b5c25070cca0b9ec6d67334 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/CategorySample/entry/src/main/ets/common/bean/DetailListItem.ets | arkts | Detail list item info. | export class DetailListItem {
/**
* Detail list item title.
*/
title: Resource;
/**
* Detail list grid item data.
*/
gridItemData: Array<GridItemData>;
} | AST#export_declaration#Left export AST#class_declaration#Left class DetailListItem AST#class_body#Left { /**
* Detail list item title.
*/ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right ... | export class DetailListItem {
title: Resource;
gridItemData: Array<GridItemData>;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategorySample/entry/src/main/ets/common/bean/DetailListItem.ets#L6-L16 | c2643a01aa6cd3efdf1418ed3ddbf79f9e80f5f9 | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/plan/plan.ets | arkts | day | 标题和时间 | @Builder
day()
{
Row()
{
Column()
{
Text("第"+Math.floor(this.registerTime/7+1)+"周计划")
.width('50%')
.fontSize(20)
.fontWeight(900)
.fontColor('#ffffff')
.textAlign(TextAlign.Start)
.height('40%')
.margin(15)
Ro... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right day AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AS... | @Builder
day()
{
Row()
{
Column()
{
Text("第"+Math.floor(this.registerTime/7+1)+"周计划")
.width('50%')
.fontSize(20)
.fontWeight(900)
.fontColor('#ffffff')
.textAlign(TextAlign.Start)
.height('40%')
.margin(15)
Ro... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L197-L240 | 762ce23af98c2bee16ac32d88214014a85989dd1 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/RdbHelper.ets | arkts | 数据库操作工具类 | export interface RdbHelper {
/**
* 获取数据库的名称。
* 返回数据库名称
*/
getDbName(): string;
/**
* 获取RDB。
* @param context - 表示应用程序或功能的上下文。
* @返回RDB。
*/
getRdb(context: Context): Promise<RdbHelper>;
/**
* 在数据库中执行SQL语句。
* @param sql - 表示要执行的SQL语句。
*/
executeSql(sql: string): Promise<void>;
... | AST#export_declaration#Left export AST#interface_declaration#Left interface RdbHelper AST#object_type#Left { /**
* 获取数据库的名称。
* 返回数据库名称
*/ AST#type_member#Left getDbName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_a... | export interface RdbHelper {
getDbName(): string;
getRdb(context: Context): Promise<RdbHelper>;
executeSql(sql: string): Promise<void>;
createTable(tableName: string, columns: Array<ColumnInfo>): Promise<void>;
deleteTable(tableName: string): Promise<void>;
addTableColumn(tableName: s... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbHelper.ets#L6-L94 | 0928e117035d3c468c65af0cdf09739c97cf0384 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/empty/Empty.ets | arkts | Empty | @file 通用缺省页组件(基于 IBestEmpty 封装)
@author Joker.X | @ComponentV2
export struct Empty {
/**
* 描述文案
*/
@Param
description: ResourceStr = $r("app.string.empty_error");
/**
* 占位图资源
*/
@Param
@Require
imageRes: ResourceStr = "";
/**
* 操作按钮文案(仅当 onAction 存在时展示)
*/
@Param
actionText: ResourceStr = $r("app.string.click_retry");
/**
* 操... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct Empty AST#component_body#Left { /**
* 描述文案
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_t... | @ComponentV2
export struct Empty {
@Param
description: ResourceStr = $r("app.string.empty_error");
@Param
@Require
imageRes: ResourceStr = "";
@Param
actionText: ResourceStr = $r("app.string.click_retry");
@Param
onAction: (() => void) | undefined = undefined;
build(): void {
Col... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/empty/Empty.ets#L8-L86 | 10daa1576d8ae693856ab1ef2d5d00608b239a7b | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/model/CommonModel.ets | arkts | getLocationName | 获取地理为位置名称 | public async getLocationName():Promise<string> {
const permissions: Permissions[] = ['ohos.permission.APPROXIMATELY_LOCATION','ohos.permission.LOCATION'];
let addressParam:string = '';
const allowGetPosition = await PermissionUtil.requestPermissions(permissions);
this.allowGetPosition = allowGetPosition... | AST#method_declaration#Left public async getLocationName 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 string AST#primary_type#Right AST#type_annotation#Right > ... | public async getLocationName():Promise<string> {
const permissions: Permissions[] = ['ohos.permission.APPROXIMATELY_LOCATION','ohos.permission.LOCATION'];
let addressParam:string = '';
const allowGetPosition = await PermissionUtil.requestPermissions(permissions);
this.allowGetPosition = allowGetPosition... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/model/CommonModel.ets#L36-L58 | 7216c528c4a9999d65f93085a9b899561439b0aa | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/settings/LanguageSettingsPage.ets | arkts | buildHeader | 构建头部 | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back();
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back();
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/settings/LanguageSettingsPage.ets#L55-L91 | 16e5b9f4cec1214e13ec12694def109eb9f98875 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets | arkts | off | 取消订阅
@param event 事件名称
@param handler 要移除的处理器(不传则移除该事件所有处理器) | static off(event: string, handler?: Function): void {
// 从常规监听器移除
if (SimpleEventBus.listeners.has(event)) {
if (!handler) {
SimpleEventBus.listeners.delete(event);
} else {
const handlers = SimpleEventBus.listeners.get(event)!;
const newHandlers = handlers.filter(h => h !== ... | AST#method_declaration#Left static off AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler ? : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type... | static off(event: string, handler?: Function): void {
if (SimpleEventBus.listeners.has(event)) {
if (!handler) {
SimpleEventBus.listeners.delete(event);
} else {
const handlers = SimpleEventBus.listeners.get(event)!;
const newHandlers = handlers.filter(h => h !== handler);
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets#L93-L115 | b206f89a08fabda2b77f29f6ba4cda0921177792 | github |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | src/main/ets/pages/WeeklyTaskPage.ets | arkts | clearAllTasks | 清空所有任务 | private clearAllTasks(): void {
this.weeklyTaskTimeRangeList = [];
console.log('已清空所有任务');
} | AST#method_declaration#Left private clearAllTasks 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 ... | private clearAllTasks(): void {
this.weeklyTaskTimeRangeList = [];
console.log('已清空所有任务');
} | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L180-L183 | 110b622f8c1694897146f106347965342b0f5470 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/flow_sensitive/loop_stmt/for_006_F.ets | arkts | Introduction 循环结构-for | export function for_005_T(taint_src : string) {
let res = ""
let i = 0
for (; i < 1; taint.Sink(res)) {
res = taint_src
}
} | AST#export_declaration#Left export AST#function_declaration#Left function for_005_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS... | export function for_005_T(taint_src : string) {
let res = ""
let i = 0
for (; i < 1; taint.Sink(res)) {
res = taint_src
}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/flow_sensitive/loop_stmt/for_006_F.ets#L6-L12 | 2a533fb6407be5bac4448ad7f4588be929f673af | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customanimationtab/src/main/ets/view/SkeletonLayout.ets | arkts | SkeletonLayout | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
@Reusable
export struct SkeletonLayout {
isMine: boolean = false;
aboutToReuse(params: Record<string, object>): void {
}
build() {
Row() {
Column() {
Column({ space: 4 }) {
// 标题
textArea($r("app.float.custom_animation_tab_ske_card_title_height"))
// ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right AST#decorator#Left @ Reusable AST#decorator#Right export struct SkeletonLayout AST#component_body#Left { AST#property_declaration#Left isMine : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_... | @Component
@Reusable
export struct SkeletonLayout {
isMine: boolean = false;
aboutToReuse(params: Record<string, object>): void {
}
build() {
Row() {
Column() {
Column({ space: 4 }) {
textArea($r("app.float.custom_animation_tab_ske_card_title_height"))
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/view/SkeletonLayout.ets#L16-L85 | 4479b547b7535a85fdc8b5e371082e05b0c124c4 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/DataImportExportService.ets | arkts | importFromExcel | 从Excel文件导入联系人 | async importFromExcel(onProgress?: ImportProgressCallback): Promise<ImportResult> {
try {
hilog.info(0x0000, 'DataImportExportService', 'Starting Excel import...');
if (onProgress) {
onProgress({
totalRecords: 0,
processedRecords: 0,
currentOperation: '选择Excel文件...... | AST#method_declaration#Left async importFromExcel AST#parameter_list#Left ( AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ImportProgressCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#... | async importFromExcel(onProgress?: ImportProgressCallback): Promise<ImportResult> {
try {
hilog.info(0x0000, 'DataImportExportService', 'Starting Excel import...');
if (onProgress) {
onProgress({
totalRecords: 0,
processedRecords: 0,
currentOperation: '选择Excel文件...... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L214-L265 | 97ff51258d0a9f502a74ad6d3c7cc6addff12f85 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/KvUtil.ets | arkts | backup | 以指定名称备份数据库
@param file 备份数据库的指定名称。
@returns | static async backup(file: string): Promise<void> {
let kvStore = await KvUtil.getKvStore();
return kvStore.backup(file);
} | AST#method_declaration#Left static async backup AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left... | static async backup(file: string): Promise<void> {
let kvStore = await KvUtil.getKvStore();
return kvStore.backup(file);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L167-L170 | 341b68abacae0ccf24b9ba0a563ce389547f5246 | gitee |
huaweicloud/huaweicloud-iot-device-sdk-arkts.git | 72954bea19e7e7f93567487b036c0664457bdaf3 | huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets | arkts | onPropertiesGet | 属性查询回调,由SDK自动调用
@param requestId 请求id
@param propsGet 属性查询请求 | public onPropertiesGet(requestId: string, propsGet: PropsGet): void {
let serviceProperties: ServiceProperty[] = [];
// 查询所有
if (propsGet.service_id === null || propsGet.service_id === undefined) {
this.services.forEach((service: AbstractService, serviceId: string) => {
const deviceService = ... | AST#method_declaration#Left public onPropertiesGet AST#parameter_list#Left ( AST#parameter#Left requestId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left propsGet : AST#type_annotation#Left AST#primary_type#Left PropsGet A... | public onPropertiesGet(requestId: string, propsGet: PropsGet): void {
let serviceProperties: ServiceProperty[] = [];
if (propsGet.service_id === null || propsGet.service_id === undefined) {
this.services.forEach((service: AbstractService, serviceId: string) => {
const deviceService = this.ge... | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L160-L191 | c2fe8bc280e27fe51a614ec5ca363b8b0a6cb59c | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isAnyArrayBuffer | Check whether the entered value is of arraybuffer or sharedarraybuffer type.
@param { Object } value - A ArrayBuffer or SharedArrayBuffer value
@returns { boolean } Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@sinc... | isAnyArrayBuffer(value: Object): boolean; | AST#method_declaration#Left isAnyArrayBuffer AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ... | isAnyArrayBuffer(value: Object): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1133-L1133 | 31cbde05af50ac1100107719f8300a2ec662afdf | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/todo/TodoService.ets | arkts | addDays | 添加天数 | private addDays(date: Date, days: number): Date {
const result = new Date(date);
result.setDate(result.getDate() + days);
return result;
} | 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 {
const result = new Date(date);
result.setDate(result.getDate() + days);
return result;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L144-L148 | bd69d4dba0a22da7341343fbcad0cf3b6352e136 | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/SearchSchedule.ets | arkts | getSchedules | allSchedules 或 getSchedules 改变时触发。
根据关键字搜索相关日程。 | private getSchedules(): void {
this.schedules = ArrayUtil.subArray(this.allSchedules,
(value: Schedule): boolean => value.username === this.username
&& (value.scheduleName.includes(this.searchValue)
|| value.description.includes(this.searchValue)));
} | AST#method_declaration#Left private getSchedules 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 A... | private getSchedules(): void {
this.schedules = ArrayUtil.subArray(this.allSchedules,
(value: Schedule): boolean => value.username === this.username
&& (value.scheduleName.includes(this.searchValue)
|| value.description.includes(this.searchValue)));
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/SearchSchedule.ets#L439-L444 | 0800c14b20139ef1dde35228347fe36734bfa2a8 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | getAxisMaxLabels | The maximum number of labels on the axis | public getAxisMaxLabels(): number {
return this.mAxisMaxLabels;
} | AST#method_declaration#Left public getAxisMaxLabels 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 getAxisMaxLabels(): number {
return this.mAxisMaxLabels;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L165-L167 | 5dd181b2ae762e8f9425691114b99324c0947ef9 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets | arkts | wantParams:图片+文本消息 | export class ImageTextMessage extends MessageBody {
toString(): string {
return this.msg + ' ' +
this.height + ' ' + this.width + ' ' + this.image;
}
constructor(height: number, width: number, image: string | Resource, msg: string) {
super();
this.height = height;
this.width = width;
th... | AST#export_declaration#Left export AST#class_declaration#Left class ImageTextMessage extends AST#type_annotation#Left AST#primary_type#Left MessageBody AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left toString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#t... | export class ImageTextMessage extends MessageBody {
toString(): string {
return this.msg + ' ' +
this.height + ' ' + this.width + ' ' + this.image;
}
constructor(height: number, width: number, image: string | Resource, msg: string) {
super();
this.height = height;
this.width = width;
th... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets#L110-L128 | a893d241f1808e454bf654e9c574b86a76dd0e82 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/auth/AuthUtil.ets | arkts | @Author csx
@DateTime 2024/2/2 21:33
@TODO AuthUtil 权限相关工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui | export class AuthUtil {
/**
* 检查是否授权
* @param permission 待检查权限
* @returns 授权状态
*/
private static checkAccessToken(permission: Permissions): abilityAccessCtrl.GrantStatus {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantSt... | AST#export_declaration#Left export AST#class_declaration#Left class AuthUtil AST#class_body#Left { /**
* 检查是否授权
* @param permission 待检查权限
* @returns 授权状态
*/ AST#method_declaration#Left private static checkAccessToken AST#parameter_list#Left ( AST#parameter#Left permission : AST#type_annotation#Left AST#prim... | export class AuthUtil {
private static checkAccessToken(permission: Permissions): abilityAccessCtrl.GrantStatus {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
let ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/auth/AuthUtil.ets#L29-L144 | f691444849174db4d09915816db151e0d8d44be5 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GlobalTypes.ets | arkts | 文件上传配置接口 | export interface FileUploadConfig {
maxSize: number;
allowedTypes: string[];
quality?: number;
width?: number;
height?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface FileUploadConfig AST#object_type#Left { AST#type_member#Left maxSize : 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 allowedTypes : AST#type_a... | export interface FileUploadConfig {
maxSize: number;
allowedTypes: string[];
quality?: number;
width?: number;
height?: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L87-L93 | 99f36a0120184036e9f3696ba27432d49c7146dc | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/launch/LaunchNavigator.ets | arkts | toSplash | 跳转到启动页
@returns {void} 无返回值 | static toSplash(): void {
navigateTo(LaunchRoutes.Splash);
} | AST#method_declaration#Left static toSplash 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_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expr... | static toSplash(): void {
navigateTo(LaunchRoutes.Splash);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/launch/LaunchNavigator.ets#L14-L16 | a76ccac985f0c99c43c6af07fe6c797cfff14abe | github |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/pages/Index.ets | arkts | sendCommand | 发送指令 | private async sendCommand(nickname: string, command: string): Promise<void> {
try {
const resp = await this.asf.send(command);
this.isProcessing = false;
this.handleResponse(nickname, resp);
} catch (err) {
Logger.error(this.LOG_TAG, `<sendCommand> 错误, ${... | AST#method_declaration#Left private async sendCommand AST#parameter_list#Left ( AST#parameter#Left nickname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left command : AST#type_annotation#Left AST#primary_type#Left string AS... | private async sendCommand(nickname: string, command: string): Promise<void> {
try {
const resp = await this.asf.send(command);
this.isProcessing = false;
this.handleResponse(nickname, resp);
} catch (err) {
Logger.error(this.LOG_TAG, `<sendCommand> 错误, ${... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L100-L112 | 3dd6928919e6807f7f359d7e60918d45d975bbf5 | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/model/ImageKnifeData.ets | arkts | load检查时间点 | export interface TimeInfo {
requestStartTime?: number,
requestEndTime?: number,
requestCancelTime?: number,
memoryCheckStartTime?: number,
memoryCheckEndTime?: number,
diskCheckStartTime?: number,
diskCheckEndTime?: number,
netRequestStartTime?: number,
netRequestEndTime?: number,
decodeStartTime?: ... | AST#export_declaration#Left export AST#interface_declaration#Left interface TimeInfo AST#object_type#Left { AST#type_member#Left requestStartTime ? : 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 requestEndTime ? : AST... | export interface TimeInfo {
requestStartTime?: number,
requestEndTime?: number,
requestCancelTime?: number,
memoryCheckStartTime?: number,
memoryCheckEndTime?: number,
diskCheckStartTime?: number,
diskCheckEndTime?: number,
netRequestStartTime?: number,
netRequestEndTime?: number,
decodeStartTime?: ... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/model/ImageKnifeData.ets#L57-L69 | d976c2eaf6b614f5db484a8287c1df5a9ef8e7f1 | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/subheaderv2/source/subheaderv2.ets | arkts | getStringByResource | get resource string
@param resourceId resource id
@param defaultString default value
@returns resource string | public static getStringByResource(resourceId: number, defaultString: string): string {
try {
let resourceString: string = getContext().resourceManager.getStringSync(resourceId);
if (resourceString === '') {
return defaultString;
} else {
return resourceString;
}
} catch (... | AST#method_declaration#Left public static getStringByResource AST#parameter_list#Left ( AST#parameter#Left resourceId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultString : AST#type_annotation#Left AST#primary_typ... | public static getStringByResource(resourceId: number, defaultString: string): string {
try {
let resourceString: string = getContext().resourceManager.getStringSync(resourceId);
if (resourceString === '') {
return defaultString;
} else {
return resourceString;
}
} catch (... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/subheaderv2/source/subheaderv2.ets#L1291-L1305 | a2b0f80c7a63915c51556cf9ef61a3e7aac58834 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/Functions.ets | arkts | 绘制 Canvas 大小和填充颜色
@param { CanvasCreateRectangleType } canvasInfo - canvas一些信息详见 CanvasCreateRectangleType | export function CanvasCreateRectangle(canvasInfo: CanvasCreateRectangleType) {
// CanvasRenderingContext2D
let ctx = canvasInfo.context;
// canvas 宽度
let cW = canvasInfo.context.width;
// canvas 高度
let cH = canvasInfo.context.height;
ctx.clearRect(0, 0, cW, cH);
ctx.beginPath()
ctx.moveTo(0, 0)
ctx... | AST#export_declaration#Left export AST#function_declaration#Left function CanvasCreateRectangle AST#parameter_list#Left ( AST#parameter#Left canvasInfo : AST#type_annotation#Left AST#primary_type#Left CanvasCreateRectangleType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Rig... | export function CanvasCreateRectangle(canvasInfo: CanvasCreateRectangleType) {
let ctx = canvasInfo.context;
let cW = canvasInfo.context.width;
let cH = canvasInfo.context.height;
ctx.clearRect(0, 0, cW, cH);
ctx.beginPath()
ctx.moveTo(0, 0)
ctx.lineTo(cW, 0)
ctx.lineTo(cW, cH)
ctx.lineTo(0,... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/Functions.ets#L74-L92 | 972da9df01ec36aeeb5b70110ee8a3c11926a58b | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/basedb/Types.ets | arkts | 表结构定义类型 | export interface TableSchema {
tableName: string;
createSQL: string;
indexes?: string[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TableSchema AST#object_type#Left { AST#type_member#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left createSQL : AST#type_annotat... | export interface TableSchema {
tableName: string;
createSQL: string;
indexes?: string[];
} | 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/basedb/Types.ets#L5-L9 | 13846d131b7e58fe9f16d6200af9cb8ab060a755 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | getValueLinePart2Length | When valuePosition is OutsideSlice, indicates length of second half of the line
@Override | public getValueLinePart2Length(): number {
return this.mValueLinePart2Length;
} | AST#method_declaration#Left public getValueLinePart2Length 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#... | public getValueLinePart2Length(): number {
return this.mValueLinePart2Length;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L241-L243 | 624ce06c32715464f7153e968616903770132fde | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ProgressButton.d.ets | arkts | ProgressButton | Declare Component ProgressButton
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare Component ProgressButton
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @Component
export declare struct ProgressButton {
/**
* Sets the ProgressButton progress.
* @type { number }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the ProgressButton progress.
* @type { number }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ProgressButton AST#component_body#Left { /**
* Sets the ProgressButton progress.
* @type { number }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**... | @Component
export declare struct ProgressButton {
@Prop progress: number;
@Prop content: ResourceStr;
progressButtonWidth?: Length;
clickCallback: () => void;
@Prop enable: boolean;
@Prop colorOptions?: ProgressButtonColorOptions;
@Prop progressButtonRadius?:... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ProgressButton.d.ets#L32-L137 | 2bdb40a27f0042ff4e92d4398dc4fed99cc092e2 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/chat/PrivateChatComponent.ets | arkts | openImagePreview | 点击列表图片:打开预览 | openImagePreview(url: string) {
this.currentPreviewUrl = url;
this.isPreviewShow = true;
} | AST#method_declaration#Left openImagePreview 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#builder_function_body#Left { AST#expression_statement#Left AST#express... | openImagePreview(url: string) {
this.currentPreviewUrl = url;
this.isPreviewShow = true;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L353-L356 | 9f996d0ba578f1515cb2d6fd3573c208f538218c | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinCard/entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | onCastToNormalForm | 添加卡片生命周期函数 call事件 onAddForm(want: Want) { // 获取当前添加到桌面的卡片id let formId: string = want.parameters![formInfo.FormParam.IDENTITY_KEY].toString() console.log(`dxin =>formId ${formId}`) // 准备一个临时数据结构 存放formId 和数字 interface FromData { formId: string, count: number } // 准备初始化数据 let formData: FromData = { formId: formId, coun... | onCastToNormalForm(formId: string) {
// 卡片使用方将临时卡片转换为常态卡片触发,提供方需要做相应的处理。
// 1、临时卡、常态卡是卡片使用方的概念。
// 2、临时卡是短期存在的,在特定事件或用户行为后显示,完成后自动消失。
// 3、常态卡是持久存在的,在用户未进行清除或更改的情况下,会一直存在,平时开发的功能卡片属于常态卡。
// 4、目前手机上没有地方会使用临时卡。
console.log(`dxin =>onCastToNormalForm ${formId}`)
} | AST#method_declaration#Left onCastToNormalForm AST#parameter_list#Left ( AST#parameter#Left formId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 卡片使用方将临时卡片转换为常态卡片触发,提供方需要做相应的处理。 ... | onCastToNormalForm(formId: string) {
console.log(`dxin =>onCastToNormalForm ${formId}`)
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinCard/entry/src/main/ets/entryformability/EntryFormAbility.ets#L44-L51 | fc8215e1d6d7748495dc5fda32605f97a5bda8ba | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 祝福语场合枚举 | export enum GreetingOccasion {
BIRTHDAY = 'birthday', // 生日
ANNIVERSARY = 'anniversary', // 纪念日
HOLIDAY = 'holiday', // 节日
NEW_YEAR = 'new_year', // 新年
SPRING_FESTIVAL = 'spring_festival', // 春节
VALENTINE = 'valentine', // 情人节
MOTHER_DAY = 'mother_day', // ... | AST#export_declaration#Left export AST#enum_declaration#Left enum GreetingOccasion AST#enum_body#Left { AST#enum_member#Left BIRTHDAY = AST#expression#Left 'birthday' AST#expression#Right AST#enum_member#Right , // 生日 AST#enum_member#Left ANNIVERSARY = AST#expression#Left 'anniversary' AST#expression#Right AST#enum_mem... | export enum GreetingOccasion {
BIRTHDAY = 'birthday',
ANNIVERSARY = 'anniversary',
HOLIDAY = 'holiday',
NEW_YEAR = 'new_year',
SPRING_FESTIVAL = 'spring_festival',
VALENTINE = 'valentine',
MOTHER_DAY = 'mother_day',
FATHER_DAY = 'father_day', ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L75-L89 | 91a59238191c6015de8b2b1f7904ca9da944b0fb | github | |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/crypto/huksUtils.ets | arkts | Auth Access Policy | export const PARAMS_AUTH_ATL1: PurposeParams = [
{ tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD },
{ tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NONE },
{ tag: huks.HuksTag.HUKS_TAG_US... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PARAMS_AUTH_ATL1 : AST#type_annotation#Left AST#primary_type#Left PurposeParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left ... | export const PARAMS_AUTH_ATL1: PurposeParams = [
{ tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD },
{ tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NONE },
{ tag: huks.HuksTag.HUKS_TAG_US... | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/crypto/huksUtils.ets#L63-L73 | d445e2969a1faf9eafed3e763351e95626c8a9b5 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/listener/ChartTouchListener.ets | arkts | setLastHighlighted | Sets the last value that was highlighted via touch.
@param high | public setLastHighlighted(high: Highlight) {
this.mLastHighlighted = high;
} | AST#method_declaration#Left public setLastHighlighted AST#parameter_list#Left ( AST#parameter#Left high : 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#builder_function_body#Left { AST#expression_statement#Lef... | public setLastHighlighted(high: Highlight) {
this.mLastHighlighted = high;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/listener/ChartTouchListener.ets#L102-L104 | 0f9e7c3a9cf83b098c93d362803bd26b6a88c5cb | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.app.d.ets | arkts | setImageFileCacheSize | Set image file cache size in bytes on disk before decode.
if not set, the application will cache 100MB image files on disk.
@param { number } value - capacity of raw image data size in bytes.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 7
Set image file cache size in bytes on disk before decode.
if not set, the ... | static setImageFileCacheSize(value: number): void; | AST#method_declaration#Left static setImageFileCacheSize AST#parameter_list#Left ( AST#parameter#Left value : 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#pr... | static setImageFileCacheSize(value: number): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.app.d.ets#L352-L352 | 7def027ad5333aa027d6844741bcc1668a2bdcdf | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/form.ets | arkts | validateAddress | 验证地址 | private validateAddress() {
if (this.formData.address.length < 10) {
this.validation.address = { valid: false, message: '请填写详细地址,至少10个字符' }
} else {
this.validation.address = { valid: true, message: '' }
}
} | AST#method_declaration#Left private validateAddress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_ex... | private validateAddress() {
if (this.formData.address.length < 10) {
this.validation.address = { valid: false, message: '请填写详细地址,至少10个字符' }
} else {
this.validation.address = { valid: true, message: '' }
}
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/form.ets#L161-L167 | 4cb28cea4fdb7ea0ae8f2851e6e5188988a6c619 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/SmsLoginViewModel.ets | arkts | login | 登录按钮点击
@returns {void} 无返回值 | login(): void {
} | AST#method_declaration#Left login 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#builder_function_body#Right AST#method_declaration#Right | login(): void {
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/SmsLoginViewModel.ets#L37-L38 | e5cd0edff405c0ed34461b53966e0c79678448a8 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/networks/HttpUtils.ets | arkts | Http 参数名: | export class Param {
// 请求的分页参数名称
static readonly page: string = "page";
} | AST#export_declaration#Left export AST#class_declaration#Left class Param AST#class_body#Left { // 请求的分页参数名称 AST#property_declaration#Left static readonly page : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "page" AST#expression#Right ; AST... | export class Param {
static readonly page: string = "page";
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/HttpUtils.ets#L47-L51 | 15223ba4f1d6660e25b914077631f7d12704b9e8 | github | |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | global data key | export const GLOBAL_KEY: string = 'global'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GLOBAL_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'global' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declara... | export const GLOBAL_KEY: string = 'global'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L143-L143 | ab4ef937b03dde100d95ec054b459e4592a9b43d | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/nativeprogressnotify/src/main/ets/view/NativeProgressNotify.ets | arkts | NativeProgressNotifyComponent | 功能描述: 本示例介绍如何通过自定义native侧下载方法startDownload将Native的进度信息实时同步到ArkTS侧的功能。
推荐场景: Native侧进度信息需要实时同步到ArkTS侧的场景
核心组件:
1. 自定义native侧下载方法startDownload
实现步骤:
1. 前端进度条使用Progress绘制。
2. JS侧调用Native侧方法,并传入用于接收下载进度的回调函数,在该回调函数中更改状态变量。
3. Naitive侧使用std::thread创建子线程执行模拟下载的任务。
4. Native侧模拟下载的线程中,每100ms执行一次uv_queue_work;向eventloop事件堆栈p... | @Component
export struct NativeProgressNotifyComponent {
private START_DOWNLOAD: string = "Start Download";
private DOWNING: string = "Downloading";
private PROGRESS_START: number = 0;
private PROGRESS_END: number = 100;
@State progress: number = 0;
@State buttonEnabled: boolean = true;
@State buttonText:... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NativeProgressNotifyComponent AST#component_body#Left { AST#property_declaration#Left private START_DOWNLOAD : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = A... | @Component
export struct NativeProgressNotifyComponent {
private START_DOWNLOAD: string = "Start Download";
private DOWNING: string = "Downloading";
private PROGRESS_START: number = 0;
private PROGRESS_END: number = 100;
@State progress: number = 0;
@State buttonEnabled: boolean = true;
@State buttonText:... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeprogressnotify/src/main/ets/view/NativeProgressNotify.ets#L34-L81 | 497db3a42ff8fdea30e560f24faa96575a1c51b9 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | ColumnSpaceAroundEnd | 纵向环绕分布 + 水平末尾 | @ComponentV2
export struct ColumnSpaceAroundEnd {
/**
* Column 构造参数
*/
@Param
options: ColumnOptions | ColumnOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceAroundEnd AST#component_body#Left { /**
* Column 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#prima... | @ComponentV2
export struct ColumnSpaceAroundEnd {
@Param
options: ColumnOptions | ColumnOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Pa... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L1185-L1260 | 96bf3a254315e45b556be064ede4bb4dd3c6470f | github |
batiluoxuanwan/MomentFlow.git | e57aa461223abca74f48893afc2ccf7c2d73e9b8 | frontend/entry/src/main/ets/api/AIApi.ets | arkts | AI 返回的选择项 | export interface AiChoice {
index: number;
message: AiMessage;
finish_reason: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AiChoice AST#object_type#Left { AST#type_member#Left index : 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 message : AST#type_annotation#Left ... | export interface AiChoice {
index: number;
message: AiMessage;
finish_reason: string;
} | https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/AIApi.ets#L11-L15 | 6e81c38a2e229611620d01485024843a00d7e03b | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageresizable/src/main/ets/components/ProductItemComp.ets | arkts | sale | 售价和销量展示,通过Text中内嵌2个Span实现富文本效果 | @Builder sale(price: number, sales: string) {
Text() {
Span(`¥${price}`)
.fontColor(Color.Red)
Span(` ${CommonConstants.PRODUCT_SALE_TEXT}${sales}`)
.fontSize($r('app.integer.imageresizable_product_sale_font_size'))
.fontColor(Color.Gray)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right sale AST#parameter_list#Left ( AST#parameter#Left price : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sales : AST#type_annotation#Left AST#prim... | @Builder sale(price: number, sales: string) {
Text() {
Span(`¥${price}`)
.fontColor(Color.Red)
Span(` ${CommonConstants.PRODUCT_SALE_TEXT}${sales}`)
.fontSize($r('app.integer.imageresizable_product_sale_font_size'))
.fontColor(Color.Gray)
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageresizable/src/main/ets/components/ProductItemComp.ets#L68-L75 | cb629cc8f1cef91105fa1f7db51c6d57570c62ff | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/view/AboutPage.ets | arkts | 构建关于我们页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "关于我们",
viewModel: this.vm
}) {
this.AboutContent();
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "关于我们" AST#expression#Right AST#component_parameter#Right , AST#component_... | build() {
AppNavDestination({
title: "关于我们",
viewModel: this.vm
}) {
this.AboutContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/AboutPage.ets#L20-L27 | 06d192dfa096f7f05bb179662c15d8a9c274bd61 | github | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/PodcastService.ets | arkts | addPodcastFromSearchResult | 从搜索结果中直接添加播客(不立刻抓取 RSS) | async addPodcastFromSearchResult(source: Podcast): Promise<Podcast> {
const podcast = new Podcast();
podcast.id = source.id || this.generateId();
podcast.title = source.title;
podcast.author = source.author;
podcast.description = source.description;
podcast.imageUrl = source.imageUrl;
podcas... | AST#method_declaration#Left async addPodcastFromSearchResult AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left Podcast AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g... | async addPodcastFromSearchResult(source: Podcast): Promise<Podcast> {
const podcast = new Podcast();
podcast.id = source.id || this.generateId();
podcast.title = source.title;
podcast.author = source.author;
podcast.description = source.description;
podcast.imageUrl = source.imageUrl;
podcas... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PodcastService.ets#L50-L68 | 44c39390a679fd8ad3c3ad82229f08cfc1f04d07 | github |
sea5241/PictureSelector | 09bac407ebd61100d1ccbf6e6d3b6349cb0013d7 | entry/src/main/ets/constants/Constants.ets | arkts | 填充尺寸 | export const MATCH = '100%' | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MATCH = AST#expression#Left '100%' AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right | export const MATCH = '100%' | https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/entry/src/main/ets/constants/Constants.ets#L4-L4 | 9d8641e8f6fd8b343d67a9b44b8de4b28392ae95 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.FormMenu.d.ets | arkts | Defines the form menu item style.
@interface FormMenuItemStyle
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export interface FormMenuItemStyle {
/**
* Defines options of the form menu.
*
* @type { ?MenuItemOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
options?: MenuItemOptions;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface FormMenuItemStyle AST#object_type#Left { /**
* Defines options of the form menu.
*
* @type { ?MenuItemOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left options ? : AS... | export interface FormMenuItemStyle {
options?: MenuItemOptions;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FormMenu.d.ets#L33-L43 | 15fe07e2f26eface03365bbe4b150b2767421b59 | gitee | |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/data/Repository.ets | arkts | onPlaybackProgress | 播放进度
@param id
@param position
@param playing
@returns | public onPlaybackProgress(id: string, position: number, playing: boolean): Promise<void> {
return this.requireApi().onPlaybackProgress(id, position,playing)
} | AST#method_declaration#Left public onPlaybackProgress AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left position : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | public onPlaybackProgress(id: string, position: number, playing: boolean): Promise<void> {
return this.requireApi().onPlaybackProgress(id, position,playing)
} | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L181-L183 | 096e2ae120572294774fc062bfa4cdfe2553c608 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/OperateRDBInTaskPool.ets | arkts | queryRDB | 查询数据库数据组装数据源 | queryRDB() {
taskPoolExecuteQuery(context).then((contact: Array<Contact>) => {
this.dataArray = contact.reduce((accumulator, item) => {
// 如果类别不存在,则创建一个新的数组
if (!accumulator[item.category]) {
accumulator[item.category] = [];
}
// 将当前项添加到相应类别的数组中
accumulator[it... | AST#method_declaration#Left queryRDB AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left taskPoolExecuteQuery ( AST#expression#Left context AST#expression#Right ) AST#ui_component#Right AST#modifier_chai... | queryRDB() {
taskPoolExecuteQuery(context).then((contact: Array<Contact>) => {
this.dataArray = contact.reduce((accumulator, item) => {
if (!accumulator[item.category]) {
accumulator[item.category] = [];
}
accumulator[item.category].push(item);
retur... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/OperateRDBInTaskPool.ets#L90-L112 | b302d324526f703fc846cd778e2a607c989d60a9 | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/common/utils/ASF.ets | arkts | setASFPassword | 设置全局 ASF 密码 | setASFPassword(asfPassword: string) {
this.asfPassword = asfPassword;
Logger.debug(this.LOG_TAG, `当前ASF密码: ${this.asfPassword}`);
} | AST#method_declaration#Left setASFPassword AST#parameter_list#Left ( AST#parameter#Left asfPassword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#e... | setASFPassword(asfPassword: string) {
this.asfPassword = asfPassword;
Logger.debug(this.LOG_TAG, `当前ASF密码: ${this.asfPassword}`);
} | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/ASF.ets#L24-L27 | 84110f07847a9a78eab76df3b562549500523a1b | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/src/main/ets/attribute/LicensePlateAttribute.d.ets | arkts | @keepTs @ts-nocheck | export declare class LicensePlateAttribute {
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class LicensePlateAttribute AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right | export declare class LicensePlateAttribute {
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/src/main/ets/attribute/LicensePlateAttribute.d.ets#L3-L4 | 4e57d875303ca3cf6443a8d44f7a6f2409cf06ed | github | |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/utils/StorageUtils.ets | arkts | get | 获取值
@param key
@param defaultValue
@param preferenceName
@returns | static async get(key: string, defaultValue: ValueType = "", preferenceName: string = defaultPreferenceName) {
// 获取实例
let preferences = await this.getPreferences(preferenceName)
return preferences.get(key, defaultValue)
} | AST#method_declaration#Left static async get 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 defaultValue : AST#type_annotation#Left AST#primary_type#Left ValueType AST#prim... | static async get(key: string, defaultValue: ValueType = "", preferenceName: string = defaultPreferenceName) {
let preferences = await this.getPreferences(preferenceName)
return preferences.get(key, defaultValue)
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/utils/StorageUtils.ets#L39-L43 | e8e087ee5601df5003cce2b95b990697b0b7a245 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/ArkTSComponents/entry/src/main/ets/view/Home.ets | arkts | Home | Home tab content | @Component
export default struct Home {
private swiperController: SwiperController = new SwiperController();
build() {
Scroll() {
Column({ space: CommonConstants.COMMON_SPACE }) {
Column(){
Text($r('app.string.mainPage_tabTitles_home'))
.fontWeight(FontWeight.Medium)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Home AST#component_body#Left { AST#property_declaration#Left private swiperController : AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right = AST#ex... | @Component
export default struct Home {
private swiperController: SwiperController = new SwiperController();
build() {
Scroll() {
Column({ space: CommonConstants.COMMON_SPACE }) {
Column(){
Text($r('app.string.mainPage_tabTitles_home'))
.fontWeight(FontWeight.Medium)
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ArkTSComponents/entry/src/main/ets/view/Home.ets#L23-L112 | bbfe9982580fb0ab859cef2b1bb753c3eef1f0f5 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/authorizedControl/SaveControl.ets | arkts | saveImage | 点击保存图片 | saveImage() {
try {
context.resourceManager.getMediaContent(this.imageUri.id, async (error, value) => {
if (error) {
Logger.error(`error is ${error}`);
} else {
let media = value.buffer;
let helper = photoAccessHelper.getPhotoAccessHelper(context);
let u... | AST#method_declaration#Left saveImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expr... | saveImage() {
try {
context.resourceManager.getMediaContent(this.imageUri.id, async (error, value) => {
if (error) {
Logger.error(`error is ${error}`);
} else {
let media = value.buffer;
let helper = photoAccessHelper.getPhotoAccessHelper(context);
let u... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/authorizedControl/SaveControl.ets#L32-L56 | 97cfedbe30e42f9cdcf4a7cb496469756dcf71bc | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets | arkts | 聊天配置类:单例模式 | export class ChatConfig {
private static _instance: ChatConfig | null = null;
// 获取对象函数
public static getInstance() {
if (!ChatConfig._instance) {
ChatConfig._instance = new ChatConfig();
}
return ChatConfig._instance
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ChatConfig AST#class_body#Left { AST#property_declaration#Left private static _instance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChatConfig AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union... | export class ChatConfig {
private static _instance: ChatConfig | null = null;
public static getInstance() {
if (!ChatConfig._instance) {
ChatConfig._instance = new ChatConfig();
}
return ChatConfig._instance
}
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets#L11-L21 | ddf7d2badc2c65d1d62cb2c4b7ae8909839e47ed | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.advertising.AdComponent.d.ets | arkts | The method to build ad component.
@syscap SystemCapability.Advertising.Ads
@since 11
The method to build ad component.
@syscap SystemCapability.Advertising.Ads
@atomicservice
@since 12 | build(): void;
}
export { AdComponent } | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ; } export AST#ERROR#Right AST#build_body#Left { AST#expression_statement#Left AST#expression#Left AdComponent AST#expression#Right AST#expression_statement#Right } AST#b... | build(): void;
}
export { AdComponent } | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.advertising.AdComponent.d.ets#L94-L96 | 9ddb6104774e2756d0661dd094079c7e06cdb59b | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | exit | 主动退出整个应用;调用该方法后,任务中心的任务默认不会清理,如需清理,需要配置removeMissionAfterTerminate为true。 | static exit() {
App.terminate()
AppUtils.getContext().terminateSelf()
AppUtils.getContext().getApplicationContext().killAllProcesses()
} | AST#method_declaration#Left static exit 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 App AST#expression#Right . terminate AST#member_expr... | static exit() {
App.terminate()
AppUtils.getContext().terminateSelf()
AppUtils.getContext().getApplicationContext().killAllProcesses()
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L68-L72 | 524202dedcdad0ace66b5f8652958b5521929d13 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isMap | Check whether the entered value is of map type.
@param { Object } value - A Map value
@returns { boolean } Returns true if the value is a built-in Map instance.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20 | isMap(value: Object): boolean; | AST#method_declaration#Left isMap AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST... | isMap(value: Object): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1268-L1268 | afcf772bed76203892e9009e05dbcbc97fba7114 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/social/UserProfilePage.ets | arkts | buildUserInfo | 构建用户信息 | @Builder
buildUserInfo() {
if (!this.userProfile) return;
Column({ space: 16 }) {
// 头像和基本信息
Row({ space: 16 }) {
Stack() {
if (this.userProfile.avatar) {
Image(this.userProfile.avatar)
.width(80)
.height(80)
.borderRadius(40... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expr... | @Builder
buildUserInfo() {
if (!this.userProfile) return;
Column({ space: 16 }) {
Row({ space: 16 }) {
Stack() {
if (this.userProfile.avatar) {
Image(this.userProfile.avatar)
.width(80)
.height(80)
.borderRadius(40)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/UserProfilePage.ets#L149-L196 | fdc03dfa3a57e8f1e590863d4f37b8c8f51ebf1d | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarCalendar.ets | arkts | getLeapMonthDays | 获取闰月的天数 | private getLeapMonthDays(year: number): number {
if (this.getLeapMonth(year) === 0) return 0;
if (year < 1900 || year > 2100) return 29;
const yearInfo = this.lunarInfo[year - 1900];
return (yearInfo & 0x10000) ? 30 : 29;
} | AST#method_declaration#Left private getLeapMonthDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#prima... | private getLeapMonthDays(year: number): number {
if (this.getLeapMonth(year) === 0) return 0;
if (year < 1900 || year > 2100) return 29;
const yearInfo = this.lunarInfo[year - 1900];
return (yearInfo & 0x10000) ? 30 : 29;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarCalendar.ets#L203-L209 | 80585433425f3ae370f4d55788c29c9a2cac0010 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | getSliceSpace | @Override | public getSliceSpace(): number {
return this.mSliceSpace;
} | AST#method_declaration#Left public getSliceSpace 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_exp... | public getSliceSpace(): number {
return this.mSliceSpace;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L102-L104 | 25ea3ff4b2cee626a1c8531df00182fb73f98f12 | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/controlPage/common/utils/controlPageUtil.ets | arkts | getHumidityThresholdCommand | 获取智能加湿器阈值设置
@return Command | static getHumidityThresholdCommand(humidityHig:number):DeviceCommandModel {
let param = {}
param["HumidityHig"] = humidityHig;
return new DeviceCommandModel("SetHumidityThreshold", "SmartHumidifier", JSON.stringify(param));
} | AST#method_declaration#Left static getHumidityThresholdCommand AST#parameter_list#Left ( AST#parameter#Left humidityHig : 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... | static getHumidityThresholdCommand(humidityHig:number):DeviceCommandModel {
let param = {}
param["HumidityHig"] = humidityHig;
return new DeviceCommandModel("SetHumidityThreshold", "SmartHumidifier", JSON.stringify(param));
} | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/controlPage/common/utils/controlPageUtil.ets#L43-L47 | d25313268302fd9136acb740ea53742b9d4a7369 | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | setZoomRatioFn | 变焦 | setZoomRatioFn(zoomRatio: number): void {
Logger.info(TAG, `setZoomRatioFn value ${zoomRatio}`);
// 获取支持的变焦范围
try {
let zoomRatioRange = this.getZoomRatioRange();
Logger.info(TAG, `getZoomRatioRange success: ${JSON.stringify(zoomRatioRange)}`);
} catch (error) {
let err = error as Busi... | AST#method_declaration#Left setZoomRatioFn AST#parameter_list#Left ( AST#parameter#Left zoomRatio : 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... | setZoomRatioFn(zoomRatio: number): void {
Logger.info(TAG, `setZoomRatioFn value ${zoomRatio}`);
try {
let zoomRatioRange = this.getZoomRatioRange();
Logger.info(TAG, `getZoomRatioRange success: ${JSON.stringify(zoomRatioRange)}`);
} catch (error) {
let err = error as BusinessError;
... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L276-L294 | c32a7600f8b1682b915ccf7d70c470fa640ddf13 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/MonthDataSource.ets | arkts | pushData | 添加数据。
@param {CustomDataType} data - 需要添加的数据。 | public pushData(data: Month): void {
this.dataArray.push(data);
this.notifyDataAdd(this.dataArray.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Month 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#Righ... | public pushData(data: Month): void {
this.dataArray.push(data);
this.notifyDataAdd(this.dataArray.length - 1);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/MonthDataSource.ets#L174-L177 | 97cd9efe3b02924f13667fdfc6a295520c5f1f2c | gitee |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/utils/PreferenceModel.ets | arkts | setPassword | 写入date日期对应的浏览历史 | setPassword(userAccount:string,password:string) {
this.putPreference(userAccount,password);
} | AST#method_declaration#Left setPassword AST#parameter_list#Left ( AST#parameter#Left userAccount : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | setPassword(userAccount:string,password:string) {
this.putPreference(userAccount,password);
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L89-L91 | b236bf22476399c52ea4fb4e7a7d424e98580b83 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | syncLimitRect | Whether crop rect change, sync limit rect size.
@param limit | syncLimitRect(limit: RectF) {
this.limitRect.set(limit.left, limit.top, limit.right, limit.bottom);
this.enlargeCropArea();
} | AST#method_declaration#Left syncLimitRect AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressio... | syncLimitRect(limit: RectF) {
this.limitRect.set(limit.left, limit.top, limit.right, limit.bottom);
this.enlargeCropArea();
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L85-L88 | f8ca8254d23278d21f47d5a9db8e3a669ca341ca | gitee |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/FolderDialog.ets | arkts | aboutToAppear | 获取文件夹信息。 | public aboutToAppear(): void {
PreferencesUtil.getPreferences(CommonConstants.FOLDER_PREFERENCES, [])
.then((value: string) => {
this.allFolders = JSON.parse(value) as Array<Folder>;
});
} | AST#method_declaration#Left public aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#exp... | public aboutToAppear(): void {
PreferencesUtil.getPreferences(CommonConstants.FOLDER_PREFERENCES, [])
.then((value: string) => {
this.allFolders = JSON.parse(value) as Array<Folder>;
});
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/FolderDialog.ets#L43-L48 | 92ff2853bb18dc31838573316dc19bd8870e24f0 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/dialog/BaseCustomDialog.ets | arkts | initCustomContent | 自定义弹框,按钮,初始化参数 | private initCustomContent(options: IBaseContentOptions | IBaseInputOptions) {
if (!options.contentBuilder && !options.backgroundImage && !options.title && !options.buttons &&
!options.primaryTitle && !options.secondaryTitle) {
console.error('【CustomDialog】contentBuilder is null 请设置自定义内容builder 或标题、或按钮、或... | AST#method_declaration#Left private initCustomContent AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left IBaseContentOptions AST#primary_type#Right | AST#primary_type#Left IBaseInputOptions AST#primary_type#Right AST#union_type#Right AST#type_annota... | private initCustomContent(options: IBaseContentOptions | IBaseInputOptions) {
if (!options.contentBuilder && !options.backgroundImage && !options.title && !options.buttons &&
!options.primaryTitle && !options.secondaryTitle) {
console.error('【CustomDialog】contentBuilder is null 请设置自定义内容builder 或标题、或按钮、或... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/BaseCustomDialog.ets#L31-L75 | 679e537a0bedb054ae5ac67bb5fb489ee2372457 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pendingitems/src/main/ets/model/ToDo.ets | arkts | ToDo | 表示待办事项类型。
@class | @Observed
export class ToDo {
key: string = util.generateRandomUUID(true); // 生成随机uuid
name: string;
isFinished: boolean = false;
/**
* 创建一个新的待办事项实例。
* @param {string} name - 待办事项名称
*/
constructor(name: string) {
this.name = name;
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ToDo AST#class_body#Left { AST#property_declaration#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#ex... | @Observed
export class ToDo {
key: string = util.generateRandomUUID(true);
name: string;
isFinished: boolean = false;
constructor(name: string) {
this.name = name;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pendingitems/src/main/ets/model/ToDo.ets#L22-L35 | 77b57e002308a6d5b3a14d488fd392f2f378beb7 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets | arkts | getSandboxList | 获取沙箱保留信息 | async getSandboxList(): Promise<void> {
try {
let res: Array<dlpPermission.RetentionSandboxInfo> = await dlpPermission.getRetentionSandboxList(); // 获取沙箱保留列表
Logger.info(TAG, 'res', JSON.stringify(res));
promptAction.showToast({ message: 'getSandboxList:' + decodeURIComponent(JSON.stringify(res)),... | AST#method_declaration#Left async getSandboxList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | async getSandboxList(): Promise<void> {
try {
let res: Array<dlpPermission.RetentionSandboxInfo> = await dlpPermission.getRetentionSandboxList();
Logger.info(TAG, 'res', JSON.stringify(res));
promptAction.showToast({ message: 'getSandboxList:' + decodeURIComponent(JSON.stringify(res)), duration: ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets#L106-L114 | 9c7eba75369c5945b504e1813ddaa1abc87343c6 | gitee |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/utils/DateUtil.ets | arkts | isToday | 判断是否是今天 | static isToday(date: Date): boolean {
const today = new Date()
return date.getDate() === today.getDate() &&
date.getMonth() === today.getMonth() &&
date.getFullYear() === today.getFullYear()
} | AST#method_declaration#Left static isToday 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_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig... | static isToday(date: Date): boolean {
const today = new Date()
return date.getDate() === today.getDate() &&
date.getMonth() === today.getMonth() &&
date.getFullYear() === today.getFullYear()
} | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L114-L119 | fa0626665abf3464a481be827a13e2459a6d34cf | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/eraser/src/main/ets/constants/Contants.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 Constants {
static readonly NODE_CONTAINER_ID = 'canvas'; // 组件NodeContainer的id
static readonly INIT_LINE_STROKE_WIDTH: number = 40; // 画笔初始线宽
static readonly DIVIDER_STROKE_WIDTH: number = 1; // 分割线宽度
static readonly LAYOUT_WEIGHT: number = 1; // 组件自动分配剩余空间的layoutWeight值
static readonly THRESHOL... | AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly NODE_CONTAINER_ID = AST#expression#Left 'canvas' AST#expression#Right ; AST#property_declaration#Right // 组件NodeContainer的id AST#property_declaration#Left static readonly INI... | export class Constants {
static readonly NODE_CONTAINER_ID = 'canvas';
static readonly INIT_LINE_STROKE_WIDTH: number = 40;
static readonly DIVIDER_STROKE_WIDTH: number = 1;
static readonly LAYOUT_WEIGHT: number = 1;
static readonly THRESHOLD: number = 30;
static readonly CONTAINER_ID: string = '__c... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eraser/src/main/ets/constants/Contants.ets#L16-L26 | 566fc175f569b9412976ca3f780c77f19052b370 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets | arkts | aboutToAppear | 视频列表图片数组 | aboutToAppear() {
for (let i = 0; i < 4; i++) {
this.arr.push(i)
}
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#vari... | aboutToAppear() {
for (let i = 0; i < 4; i++) {
this.arr.push(i)
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets#L31-L35 | 819e64111880f04f4a01634215e7a8dc4a280765 | gitee |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/ImageKnife.ets | arkts | getCacheImage | 从内存或文件缓存中获取图片数据
@param url 图片地址url
@param cacheType 缓存策略
@returns 图片数据
@param signature key自定义信息 | getCacheImage(loadSrc: string,
cacheType: CacheStrategy = CacheStrategy.Default, signature?: string): Promise<ImageKnifeData | undefined> {
let option: ImageKnifeOption = {
loadSrc: loadSrc,
signature:signature
}
let engineKeyImpl: IEngineKey = this.getEngineKeyImpl();
retur... | AST#method_declaration#Left getCacheImage AST#parameter_list#Left ( AST#parameter#Left loadSrc : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cacheType : AST#type_annotation#Left AST#primary_type#Left CacheStrategy AST#pr... | getCacheImage(loadSrc: string,
cacheType: CacheStrategy = CacheStrategy.Default, signature?: string): Promise<ImageKnifeData | undefined> {
let option: ImageKnifeOption = {
loadSrc: loadSrc,
signature:signature
}
let engineKeyImpl: IEngineKey = this.getEngineKeyImpl();
retur... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L235-L253 | 20e8df0f3617d996f6fb526fadc604422cd85c20 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/common/constants/HomeConstants.ets | arkts | The constant of GoodsItemComponent. | export class GoodsListItem {
/**
* The container height of goods name.
*/
static readonly CONTAINER_GOODS_NAME_HEIGHT: number = 40;
/**
* The max line of goods name.
*/
static readonly MAX_LINE_GOODS_NAME: number = 2;
/**
* The margin of goods discounts.
*/
static readonly MARGIN_DISCOUN... | AST#export_declaration#Left export AST#class_declaration#Left class GoodsListItem AST#class_body#Left { /**
* The container height of goods name.
*/ AST#property_declaration#Left static readonly CONTAINER_GOODS_NAME_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_ann... | export class GoodsListItem {
static readonly CONTAINER_GOODS_NAME_HEIGHT: number = 40;
static readonly MAX_LINE_GOODS_NAME: number = 2;
static readonly MARGIN_DISCOUNTS: number = 5;
static readonly GOODS_IMAGE_SIZE: number = 130;
static readonly GOODS_IMAGE_MARGIN_TOP: number = 10;
st... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/HomeConstants.ets#L90-L165 | e7985cb736f256d97f20c27de6d1eb33d8e956f7 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | customConfig1 | 统一配置一 | customConfig1() {
DialogHelper.setDefaultConfig((config) => {
config.autoCancel = false; //点击遮障层时,是否关闭弹窗,true表示关闭弹窗。
config.backCancel = false; //点击返回键或手势返回时,是否关闭弹窗;实现onWillDismiss函数时,该参数不起作用。
config.actionCancel = true; //点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。
config.alignment = DialogAlignment.Cente... | AST#method_declaration#Left customConfig1 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 DialogHelper AST#expression#Right . setDefaultConf... | customConfig1() {
DialogHelper.setDefaultConfig((config) => {
config.autoCancel = false;
config.backCancel = false;
config.actionCancel = true;
config.alignment = DialogAlignment.Center;
config.offset = { dx: 0, dy: 0 };
config.maskColor = 0x11000000;
config.backgroun... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L62-L100 | 27316095f084ea35c5a3d58100e274da845355cf | gitee |
Autumnker/ArkTS_FreeKnowledgeChat.git | cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7 | entry/src/main/ets/model/addressBookTopBar.ets | arkts | 好友列表顶栏 | export const AddressBookList:IaddressBookTopBarItem[] = [
{
icon:$r('app.media.new_friend'),
title:'新朋友',
bgColor:'#FA9E3B'
},
{
icon:$r('app.media.chat_only'),
title:'仅聊天的朋友',
bgColor:'#FA9E3B'
},
{
icon:$r('app.media.group_chat'),
title:'群聊',
bgColor:'#07C160'
},
{
... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left AddressBookList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IaddressBookTopBarItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_litera... | export const AddressBookList:IaddressBookTopBarItem[] = [
{
icon:$r('app.media.new_friend'),
title:'新朋友',
bgColor:'#FA9E3B'
},
{
icon:$r('app.media.chat_only'),
title:'仅聊天的朋友',
bgColor:'#FA9E3B'
},
{
icon:$r('app.media.group_chat'),
title:'群聊',
bgColor:'#07C160'
},
{
... | https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/model/addressBookTopBar.ets#L9-L35 | b5236af8f8811eb635903a682f3c19a919c223d6 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseManager.ets | arkts | checkAndFixTableStructure | 检查并修复表结构 | private async checkAndFixTableStructure(): Promise<void> {
if (!this.rdbStore) {
return;
}
try {
// 获取contacts表的实际结构
const result = await this.rdbStore.querySql('PRAGMA table_info(contacts)');
const existingColumns = new Set<string>();
if (result.goToFirstRow()) {
do ... | AST#method_declaration#Left private async checkAndFixTableStructure 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... | private async checkAndFixTableStructure(): Promise<void> {
if (!this.rdbStore) {
return;
}
try {
const result = await this.rdbStore.querySql('PRAGMA table_info(contacts)');
const existingColumns = new Set<string>();
if (result.goToFirstRow()) {
do {
const c... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseManager.ets#L136-L148 | 919b5382247e0a3f10ca7d69492869143bf9d549 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/groupavatar/src/main/ets/utils/ImageCombination.ets | arkts | RowComponent | 群组头像横向列表组件
@param imageArray | @Builder
function RowComponent(imageArray: GroupAvatarModel[]) {
Row({ space: 2 }) {
ForEach(imageArray, (item: GroupAvatarModel) => {
Image(item.src)
.height(item.height)
.width(item.width)
})
}
.width($r('app.integer.group_avatar_custom_loading_drawing_size'))
.justifyContent(Fle... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function RowComponent AST#parameter_list#Left ( AST#parameter#Left imageArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GroupAvatarModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation... | @Builder
function RowComponent(imageArray: GroupAvatarModel[]) {
Row({ space: 2 }) {
ForEach(imageArray, (item: GroupAvatarModel) => {
Image(item.src)
.height(item.height)
.width(item.width)
})
}
.width($r('app.integer.group_avatar_custom_loading_drawing_size'))
.justifyContent(Fle... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/utils/ImageCombination.ets#L67-L78 | d057ed5fb9104c671d9e880d204796d5970c0a6f | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/wordcard/WordCardsView.ets | arkts | saveLearn | 保存学习进度 | async saveLearn(){
await SearchManager.shared.incrementLearnTimesForWord(this.word)
//记忆曲线保存记录
if (this.plan && this.dayOf && this.word.idx) {
this.plan?.saveLearned(this.word.idx, this.dayOf)
}
} | AST#method_declaration#Left async saveLearn AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left A... | async saveLearn(){
await SearchManager.shared.incrementLearnTimesForWord(this.word)
if (this.plan && this.dayOf && this.word.idx) {
this.plan?.saveLearned(this.word.idx, this.dayOf)
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardsView.ets#L650-L658 | 6ee40c2a3916d99eaa6b43fce38fa3e071e70039 | github |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | entry/src/main/ets/pages/Model/TaskStore.ets | arkts | saveToDisk | 把 this.taskStore 序列化为 JSON -> 写入 Preferences | private async saveToDisk() {
try {
if (!this.pref) {
if (!this.context) return;
this.pref = await dataPreferences.getPreferences(this.context, TaskStore.PREF_NAME);
}
const obj: Record<string, TaskPlain[]> = {};
for (const entry of this.taskStore.entries()) {
const ke... | AST#method_declaration#Left private async saveToDisk AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left A... | private async saveToDisk() {
try {
if (!this.pref) {
if (!this.context) return;
this.pref = await dataPreferences.getPreferences(this.context, TaskStore.PREF_NAME);
}
const obj: Record<string, TaskPlain[]> = {};
for (const entry of this.taskStore.entries()) {
const ke... | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/pages/Model/TaskStore.ets#L69-L89 | 08a0596ef5bbd6efbe62afc7e174ae5210e4d1bc | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement03_api12/entry/src/main/ets/MainAbility/common/Log.ets | arkts | showInfo | print info level log
@param {string} tag - Page or class tag
@param {string} log - Log needs to be printed | static showInfo(tag, log) {
console.info(`${TAG} tag: ${tag} --> ${log}`);
} | AST#method_declaration#Left static showInfo AST#parameter_list#Left ( AST#parameter#Left tag AST#parameter#Right , AST#parameter#Left log AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#mem... | static showInfo(tag, log) {
console.info(`${TAG} tag: ${tag} --> ${log}`);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement03_api12/entry/src/main/ets/MainAbility/common/Log.ets#L30-L32 | 71d3bd53b17a76581adee428f6976665db1a0c4d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isFunction | 判断是否是函数类型 | static isFunction(value: Object): boolean {
return typeof value === 'function';
} | AST#method_declaration#Left static isFunction AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty... | static isFunction(value: Object): boolean {
return typeof value === 'function';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L87-L89 | f4113e7112b0c106147e46945b3d5ad4b7869c5d | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/launch/LaunchNavigator.ets | arkts | toGuide | 跳转到引导页
@param {boolean} [fromSettings] - 是否从设置页进入
@returns {void} 无返回值 | static toGuide(fromSettings?: boolean): void {
if (fromSettings !== undefined) {
const params: LaunchGuideParam = { fromSettings };
navigateTo(LaunchRoutes.Guide, params);
return;
}
navigateTo(LaunchRoutes.Guide);
} | AST#method_declaration#Left static toGuide AST#parameter_list#Left ( AST#parameter#Left fromSettings ? : 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... | static toGuide(fromSettings?: boolean): void {
if (fromSettings !== undefined) {
const params: LaunchGuideParam = { fromSettings };
navigateTo(LaunchRoutes.Guide, params);
return;
}
navigateTo(LaunchRoutes.Guide);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/launch/LaunchNavigator.ets#L23-L30 | 863c097f74d26e7794afae434dcd145732788ce2 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.