nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
solarToLunar
公历转农历(主要方法) @param solarYear 公历年 @param solarMonth 公历月(1-12) @param solarDay 公历日 @returns 农历日期信息
static solarToLunar(solarYear: number, solarMonth: number, solarDay: number): LunarDate | null { // 检查输入有效性 if (!ComprehensiveLunarDatabase.isSupportedYear(solarYear) || solarMonth < 1 || solarMonth > 12 || solarDay < 1 || solarDay > 31) { return null; } const targetDate = new Dat...
AST#method_declaration#Left static solarToLunar AST#parameter_list#Left ( AST#parameter#Left solarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left solarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#...
static solarToLunar(solarYear: number, solarMonth: number, solarDay: number): LunarDate | null { if (!ComprehensiveLunarDatabase.isSupportedYear(solarYear) || solarMonth < 1 || solarMonth > 12 || solarDay < 1 || solarDay > 31) { return null; } const targetDate = new Date(solarYea...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L232-L265
a432a7f097a1b18937e815a74de4433f815037f2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/animation/template3/Index.ets
arkts
组件二透明度 第二步:将状态变量设置到相关可动画属性接口
build() { Row() { // 组件一 Column() { } .opacity(this.opacityValue) .rotate({ angle: this.rotateValue }) // 第三步:通过属性动画接口开启属性动画 .animation({ curve: curves.springMotion() }) .backgroundColor('#317AF7') .justifyContent(FlexAlign.Center) .width(100) .heigh...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 组件一 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { } AST#...
build() { Row() { Column() { } .opacity(this.opacityValue) .rotate({ angle: this.rotateValue }) .animation({ curve: curves.springMotion() }) .backgroundColor('#317AF7') .justifyContent(FlexAlign.Center) .width(100) .height(100) .borderRadius(...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/animation/template3/Index.ets#L27-L68
28cc7364df81d33464b391656eed0ab1ce1487f8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/TextBlockDrawing.ets
arkts
addDrawFunction
当前绘制函数的下标 添加绘制函数的接口
addDrawFunction(func: (canvas: drawing.Canvas) => void) { this.drawFunctions.push(func); }
AST#method_declaration#Left addDrawFunction AST#parameter_list#Left ( AST#parameter#Left func : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left canvas : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left drawing . Canvas AST#qualified_type#Right AST#prima...
addDrawFunction(func: (canvas: drawing.Canvas) => void) { this.drawFunctions.push(func); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/TextBlockDrawing.ets#L90-L92
ce44fa070eef4515afba21137ffe2fd14c854f11
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
设置变更历史接口
export interface SettingsChangeHistory { id: string; settingKey: string; oldValue: string | number | boolean | Record<string, string | number | boolean>; newValue: string | number | boolean | Record<string, string | number | boolean>; changedAt: string; source: SettingsChangeSource; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SettingsChangeHistory AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left settingKey : AST#type_ann...
export interface SettingsChangeHistory { id: string; settingKey: string; oldValue: string | number | boolean | Record<string, string | number | boolean>; newValue: string | number | boolean | Record<string, string | number | boolean>; changedAt: string; source: SettingsChangeSource; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L501-L508
d808a13c5a0da7a864b62eedca8ed4964f03224e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
getSerial
获取设备序列号。说明:可作为设备唯一识别码。示例:序列号随设备差异 需要权限:ohos.permission.sec.ACCESS_UDID (目前只限系统应用使用,不对三方应用开放)
static getSerial(): string { return deviceInfo.serial; }
AST#method_declaration#Left static getSerial AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express...
static getSerial(): string { return deviceInfo.serial; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L134-L136
e7c49175e4eade76bcb4ef56dfb301cbceac8751
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api11/entry/src/main/ets/MainAbility/common/Log.ets
arkts
Basic log class
export default class Log { /** * print info level log * * @param {string} tag - Page or class tag * @param {string} log - Log needs to be printed */ static showInfo(tag: string, log: string) { console.info(`${TAG} tag: ${tag} --> ${log}`); } /** * print debug level log * * @param {s...
AST#export_declaration#Left export default AST#class_declaration#Left class Log AST#class_body#Left { /** * print info level log * * @param {string} tag - Page or class tag * @param {string} log - Log needs to be printed */ AST#method_declaration#Left static showInfo AST#parameter_list#Left ( AST#paramet...
export default class Log { static showInfo(tag: string, log: string) { console.info(`${TAG} tag: ${tag} --> ${log}`); } static showDebug(tag: string, log: string) { console.debug(`${TAG} tag: ${tag} --> ${log}`); } static showError(tag: string, log: string) { console.error(`${TAG} tag: ...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api11/entry/src/main/ets/MainAbility/common/Log.ets#L21-L51
636ae27bcc5ffcc25798d2fb85e60d7e832d9c8d
gitee
xsdkhlgz/ATSOBJECT_OF_FIRST.git
8c14e875d7ec3f418bb7cdaae123a8fea87a7e76
entry/src/main/ets/model/RecordModel.ets
arkts
insert
insert(record:RecordPO): Promise<number>{ return DbUtil.insert(TABLE_NAME,record,COLUMNS) }
AST#method_declaration#Left insert AST#parameter_list#Left ( AST#parameter#Left record : AST#type_annotation#Left AST#primary_type#Left RecordPO 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 Promise ...
insert(record:RecordPO): Promise<number>{ return DbUtil.insert(TABLE_NAME,record,COLUMNS) }
https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/model/RecordModel.ets#L35-L37
ec3ed9746364f30a0a78cb4dbd9ed626ac66ecf4
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/util/WebUtil.ets
arkts
@Author csx @DateTime 2024/8/19 23:21 @TODO WebUtil
export class WebUtil { }
AST#export_declaration#Left export AST#class_declaration#Left class WebUtil AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class WebUtil { }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/util/WebUtil.ets#L22-L23
d77190b084d7442d96e167a1a7b0fe82ca191187
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets
arkts
图片组件宽度
export const IMAGE_THEFT_IMAGEKNIFE_COMPONENT_WIDTH: number = 360;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left IMAGE_THEFT_IMAGEKNIFE_COMPONENT_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 360 AST#expression#Right AST#variable_declarator#Right...
export const IMAGE_THEFT_IMAGEKNIFE_COMPONENT_WIDTH: number = 360;
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets#L26-L26
73395000ec7e9ab14bce85c0a24ee7e9417f0a97
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/TaskInfo.ets
arkts
TaskInfo @param id @param date @param taskID @param targetValue @param isAlarm @param startTime @param endTime @param frequency @param isDone @param doneValue @param isOpen
export default class TaskInfo { id: number; date: string; taskID: number; targetValue: string; isAlarm: boolean; startTime: string; endTime: string; frequency: string; isDone: boolean; finValue: string; isOpen: boolean; constructor(id: number, date: string, taskID: numbe...
AST#export_declaration#Left export default AST#class_declaration#Left class TaskInfo AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left date : AST#t...
export default class TaskInfo { id: number; date: string; taskID: number; targetValue: string; isAlarm: boolean; startTime: string; endTime: string; frequency: string; isDone: boolean; finValue: string; isOpen: boolean; constructor(id: number, date: string, taskID: numbe...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/TaskInfo.ets#L33-L60
041a2cf5e89cef4fba4c56adea7c8d8a30e52ea4
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/pages/VideoUpload.ets
arkts
getVideoFirstImage
获取视频第一张图片
async getVideoFirstImage(videoSrc: string): Promise<void> { let callBack: ICallBack = { // 回调函数 callBackResult: (code: number) => { if (code === 0) { let frameCallBack: IFrameCallBack = { callBackResult: async (data: ArrayBuffer, timeUs: number) => { const im...
AST#method_declaration#Left async getVideoFirstImage AST#parameter_list#Left ( AST#parameter#Left videoSrc : 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_...
async getVideoFirstImage(videoSrc: string): Promise<void> { let callBack: ICallBack = { callBackResult: (code: number) => { if (code === 0) { let frameCallBack: IFrameCallBack = { callBackResult: async (data: ArrayBuffer, timeUs: number) => { const imageSourc...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/pages/VideoUpload.ets#L70-L100
c9a5fcbd89983338aa6f54c306f67e2ba4c6e2db
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/network/ConnectionUtils.ets
arkts
isNetworkConnected
The method of checking whether the monitoring network is connected..
async isNetworkConnected(): Promise<boolean> { let result: boolean = false; await connection.getDefaultNet().then(async (data: connection.NetHandle) => { if (data.netId === 0) { hilog.info(0x0000, TAG, 'network error'); return; } await connection.getNetCapabilities(data).then( ...
AST#method_declaration#Left async isNetworkConnected AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST...
async isNetworkConnected(): Promise<boolean> { let result: boolean = false; await connection.getDefaultNet().then(async (data: connection.NetHandle) => { if (data.netId === 0) { hilog.info(0x0000, TAG, 'network error'); return; } await connection.getNetCapabilities(data).then( ...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/ConnectionUtils.ets#L19-L47
947652194153eb4473372179c004e7f499063228
gitee
Wu-Jackie/Swordsman-Duel.git
3107e9bb94c848fc31d3dd95754439eac0d60409
entry/src/main/ets/pages/Input.ets
arkts
onchange
全局变量
onchange(){ globalThis.num1; }
AST#method_declaration#Left onchange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left globalThis AST#expression#Right . num1 AST#member_expression#Right AST#expression#Right ; AST#expres...
onchange(){ globalThis.num1; }
https://github.com/Wu-Jackie/Swordsman-Duel.git/blob/3107e9bb94c848fc31d3dd95754439eac0d60409/entry/src/main/ets/pages/Input.ets#L7-L9
25d7c7090292cc5be7191b6f6f955504b662601f
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
在CommonTypes之后,定义辅助接口
export interface UserRequest { id: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserRequest AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right ...
export interface UserRequest { id: number; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L13-L15
955363a55a689af5f4392373dcf04fe46cd93b45
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/OnlineLunarService.ets
arkts
农历节日接口
export interface LunarFestival { name: string; lunarDate: string; solarDate: string; description: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LunarFestival AST#object_type#Left { AST#type_member#Left name : 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 lunarDate : AST#type_annotation...
export interface LunarFestival { name: string; lunarDate: string; solarDate: string; description: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/OnlineLunarService.ets#L48-L53
1d02a63b6e9573193c65dc3295125602f167bd89
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets
arkts
addOrUpdateInTransaction
====== 事务操作 ======
async addOrUpdateInTransaction(plan: DBPlan, pieces: DBPiece[], boxes: DBBox[]): Promise<void> { if (!plan.planId || !this.db) return; const sqlList: string[] = []; const paramsList: ParamType[][] = []; // Plan const planSqlObj = this.createSqlObjForPlan(plan); if (planSqlObj) { sqlList....
AST#method_declaration#Left async addOrUpdateInTransaction AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left DBPlan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pieces : AST#type_annotation#Left AST#primary_type#Left AST#array...
async addOrUpdateInTransaction(plan: DBPlan, pieces: DBPiece[], boxes: DBBox[]): Promise<void> { if (!plan.planId || !this.db) return; const sqlList: string[] = []; const paramsList: ParamType[][] = []; const planSqlObj = this.createSqlObjForPlan(plan); if (planSqlObj) { sqlList.push(pl...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L242-L282
cccc56992c825bff96f43dd936b34e9e99913ba4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBusCore.ets
arkts
once
注册单次事件监听 @param eventName 事件名 @param handler 监听回调 @param isSticky 是否粘性
once(eventName: string, handler: Function, isSticky = false): void { const onceHandler = (args: EventAllType) => { handler(args); this.off(eventName, onceHandler); }; this.on(eventName, onceHandler, isSticky); }
AST#method_declaration#Left once AST#parameter_list#Left ( AST#parameter#Left eventName : 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#Rig...
once(eventName: string, handler: Function, isSticky = false): void { const onceHandler = (args: EventAllType) => { handler(args); this.off(eventName, onceHandler); }; this.on(eventName, onceHandler, isSticky); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L53-L59
c2fb9f748b8369a277fbd9edec35b69f28101605
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/FullScreen.ets
arkts
设置状态栏的文字颜色 xx.setWindowSystemBarProperties
export class FullScreen { // 启动全屏 async enable() { try { const ctx = AppStorage.get<Context>('context') // 空安全 if (ctx) { const winObj = await window.getLastWindow(ctx) // 上层窗口对象 // 打开全屏 winObj.setWindowLayoutFullScreen(true) // 异步操作 // logger.info('FullScreen封...
AST#export_declaration#Left export AST#class_declaration#Left class FullScreen AST#class_body#Left { // 启动全屏 AST#method_declaration#Left async enable 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#Lef...
export class FullScreen { async enable() { try { const ctx = AppStorage.get<Context>('context') if (ctx) { const winObj = await window.getLastWindow(ctx) winObj.setWindowLayoutFullScreen(true) const statusBar = winObj.getWindowAvoidArea(...
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/FullScreen.ets#L16-L66
93bea710fc066f52dc581d80cd2c8199c93e9c46
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/TaoYao.ets
arkts
goToSettingPage
跳转到系统设置页面 @param context
static goToSettingPage(context: common.UIAbilityContext): Setting { return TaoYao.with(context).setting().goToSettingPage() }
AST#method_declaration#Left static goToSettingPage AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri...
static goToSettingPage(context: common.UIAbilityContext): Setting { return TaoYao.with(context).setting().goToSettingPage() }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L66-L68
273062f6f9bf0e2f856ea82ac555561a218a4047
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderDetailPage.ets
arkts
构建订单详情页面 @returns {void} 无返回值
build() { AppNavDestination({ title: this.getPageTitle(), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset } }) { this.PageContent(); } }
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#call_expression#Left AST#expression#Left AST#member_expression#Left AS...
build() { AppNavDestination({ title: this.getPageTitle(), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset } }) { this.PageContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L49-L61
5a07cd3dde4f3e1a4493c089a7570f599be22911
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getStringArrayValueSync
获取指定资源对应的字符串数组 @param resId 资源ID值/资源信息
static getStringArrayValueSync(resId: number | Resource): Array<string> { if (typeof resId === 'number') { return ResUtil.getResourceManager().getStringArrayValueSync(resId); } else { return ResUtil.getResourceManager().getStringArrayValueSync(resId); } }
AST#method_declaration#Left static getStringArrayValueSync AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#para...
static getStringArrayValueSync(resId: number | Resource): Array<string> { if (typeof resId === 'number') { return ResUtil.getResourceManager().getStringArrayValueSync(resId); } else { return ResUtil.getResourceManager().getStringArrayValueSync(resId); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L150-L156
f9bcf4f2e8530abdfe397a77101671f8659f4f76
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/entryability/EntryAbility.ets
arkts
requestPermissionsFn
Get permission
requestPermissionsFn(): void { let atManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(this.context, [ 'ohos.permission.CAMERA' ]).then((): void => { AppStorage.setOrCreate<boolean>('isShow', true); Logger.info(TAG, 'request Permissions success!'); })....
AST#method_declaration#Left requestPermissionsFn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left atMana...
requestPermissionsFn(): void { let atManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(this.context, [ 'ohos.permission.CAMERA' ]).then((): void => { AppStorage.setOrCreate<boolean>('isShow', true); Logger.info(TAG, 'request Permissions success!'); })....
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/entryability/EntryAbility.ets#L74-L84
5c05d0e4c891187967ebbadb304dfa4be68f72f8
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/component/TaskTimeRangeItem.ets
arkts
getPriorityText
获取优先级文本
private getPriorityText(): string { const priorityMap = { 1: '低', 2: '中', 3: '高' }; return priorityMap[this.taskItem.priority] || '未知'; }
AST#method_declaration#Left private getPriorityText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left...
private getPriorityText(): string { const priorityMap = { 1: '低', 2: '中', 3: '高' }; return priorityMap[this.taskItem.priority] || '未知'; }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/component/TaskTimeRangeItem.ets#L68-L75
5fd883a4600eb2e44a36545af3dc225833a5083a
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ToolBarV2.d.ets
arkts
ToolBarV2
Declare Component ToolBarV2 @struct { ToolBarV2 } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@ComponentV2 export declare struct ToolBarV2 { /** * Define toolbarV2 item list. * * @type { ToolBarV2Item[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ @Require @Param toolBarList: ToolBarV2Item[]; /** * Define toolbarV2 activate i...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ToolBarV2 AST#component_body#Left { /** * Define toolbarV2 item list. * * @type { ToolBarV2Item[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform ...
@ComponentV2 export declare struct ToolBarV2 { @Require @Param toolBarList: ToolBarV2Item[]; @Param activatedIndex?: number; @Param dividerModifier?: DividerModifier; @Param toolBarModifier?: ToolBarV2Modifier; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L602-L647
3872c5281f4857129b7cbfa667ea7ae584edaec5
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/CountDownTimer.ets
arkts
resume
恢复倒计时
resume(): void { if (this.isPaused && this.remainingTime > 0) { this.isPaused = false; } }
AST#method_declaration#Left resume AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression...
resume(): void { if (this.isPaused && this.remainingTime > 0) { this.isPaused = false; } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/CountDownTimer.ets#L100-L104
2429a656f98e27ad66b983a907ba82b191f2a8cb
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/lottieview/src/main/ets/view/LottieView.ets
arkts
aboutToDisappear
初始化点击次数 页面隐藏销毁动画
aboutToDisappear(): void { // TODO:知识点:页面销毁时需要调用lottie的资源回收 if (this.animateItem !== undefined) { this.animateItem.destroy(); } }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // TODO:知识点:页面销毁时需要调用lottie的资源回收 AST#ui_control_flow#Left AST#ui_if_statement#Left if ...
aboutToDisappear(): void { if (this.animateItem !== undefined) { this.animateItem.destroy(); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/lottieview/src/main/ets/view/LottieView.ets#L65-L70
b24c0fa6055d5e210baf1301cf7cbdeffbf1b90d
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
entry/src/main/ets/pages/components/ScrollerLog.ets
arkts
ScrollerLogComponent
Copyright 2024 Huawei Cloud IoT Authors 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, softwa...
@Component export struct ScrollerLogComponent { @State logArr: string[] = []; private scroller: Scroller = new Scroller(); // 创建一个滚动控制器 build() { Column() { Scroll(this.scroller) { // 绑定滚动控制器 Column() { ForEach(this.logArr, (log: string) => { // ForEach语法循环创建子组件 Text(log) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ScrollerLogComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right logArr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#ar...
@Component export struct ScrollerLogComponent { @State logArr: string[] = []; private scroller: Scroller = new Scroller(); build() { Column() { Scroll(this.scroller) { Column() { ForEach(this.logArr, (log: string) => { Text(log) .fontSize(12) ...
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/entry/src/main/ets/pages/components/ScrollerLog.ets#L18-L57
651821f2d8faa549cd5c0bcf1b54c47c056a85a9
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/BarLineScatterCandleBubbleRenderer.ets
arkts
isInBoundsX
Checks if the provided entry object is in bounds for drawing considering the current animation phase. @param e @param set @return
protected isInBoundsX(e: EntryOhos, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>): boolean { if (e == null) { return false; } let entryIndex = dataSet.getEntryIndexByEntry(e); if (e == null || entryIndex >= dataSet.getEntryCount() * this.mAnimator.getPhaseX()) { return false; ...
AST#method_declaration#Left protected isInBoundsX AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
protected isInBoundsX(e: EntryOhos, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>): boolean { if (e == null) { return false; } let entryIndex = dataSet.getEntryIndexByEntry(e); if (e == null || entryIndex >= dataSet.getEntryCount() * this.mAnimator.getPhaseX()) { return false; ...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/BarLineScatterCandleBubbleRenderer.ets#L104-L116
5f9413b9b073c4242872ff1fcc45b8800e8daa3d
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NdkDrawing/entry/src/main/ets/view/Index.ets
arkts
startDraw
Make a list of 1000 0-1 positions and draw circles at the corresponding positions
startDraw(): void { this.pointsToDraw = []; for (let index = 0; index < 1000; index++) { this.pointsToDraw.push([Math.random(), Math.random()]); } }
AST#method_declaration#Left startDraw AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left...
startDraw(): void { this.pointsToDraw = []; for (let index = 0; index < 1000; index++) { this.pointsToDraw.push([Math.random(), Math.random()]); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NdkDrawing/entry/src/main/ets/view/Index.ets#L27-L32
ee494a9ec31c2d6dea6857b2d03aac298219a2b7
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets
arkts
The constant of AddressComponent.
export class AddressPicker { /** * The size of image to show loaction. */ static readonly IMAGE_SIZE_LOCATION: number = 18; /** * The image size for more operations. */ static readonly IMAGE_SIZE_MORE: number = 14; /** * The max lines. */ static readonly MAX_LINES: number = 1; /** ...
AST#export_declaration#Left export AST#class_declaration#Left class AddressPicker AST#class_body#Left { /** * The size of image to show loaction. */ AST#property_declaration#Left static readonly IMAGE_SIZE_LOCATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#...
export class AddressPicker { static readonly IMAGE_SIZE_LOCATION: number = 18; static readonly IMAGE_SIZE_MORE: number = 14; static readonly MAX_LINES: number = 1; static readonly LAYOUT_WEIGHT_LEFT: string = '12%'; static readonly LAYOUT_WEIGHT_CENTER: string = '80%'; static readonl...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets#L49-L85
5b1cd7e54411f64a50a7c5e43269697d80969485
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets
arkts
The style of HomePage.
export class HomePageStyle { /** * The vertical padding. */ static readonly PADDING_VERTICAL: number = 8; /** * The horizontal padding. */ static readonly PADDING_HORIZONTAL: number = 16; /** * The height of blank. */ static readonly BLANK_HEIGHT: number = 15; };
AST#export_declaration#Left export AST#class_declaration#Left class HomePageStyle AST#class_body#Left { /** * The vertical padding. */ AST#property_declaration#Left static readonly PADDING_VERTICAL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expre...
export class HomePageStyle { static readonly PADDING_VERTICAL: number = 8; static readonly PADDING_HORIZONTAL: number = 16; static readonly BLANK_HEIGHT: number = 15; };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets#L145-L160
d2a546ae8fc2b409774feffba0149ebe433ab9c9
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/StepperItemView.ets
arkts
itemStyle
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Styles function itemStyle() { .width(336) .height(621) .margin({ top: 48, left: 12 }) .borderRadius(24) .backgroundColor('#FFFFFF') }
AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function itemStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 336 AST#expression#Right ) AST#modifier_chain_expression#Left ....
@Styles function itemStyle() { .width(336) .height(621) .margin({ top: 48, left: 12 }) .borderRadius(24) .backgroundColor('#FFFFFF') }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/StepperItemView.ets#L16-L22
bd64e00b041839a005274cc79bfbc913b8d32609
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/IBottomSheetOptions.ets
arkts
BottomSheet弹框参数
export interface IBottomSheetOptions extends IBaseDialogOptions { style?: IBottomActionSheetDialogStyle title?: ResourceStr; //弹框标题 cancelText?: ResourceStr; //取消按钮 sheets: Array<ActionSheetItemOptions> | Array<ResourceStr>; //BottomSheet弹出框操作区按钮。 // actionCancel?: boolean; //点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。默认值:...
AST#export_declaration#Left export AST#interface_declaration#Left interface IBottomSheetOptions AST#extends_clause#Left extends IBaseDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left style ? : AST#type_annotation#Left AST#primary_type#Left IBottomActionSheetDialogStyle AST#primary_type#...
export interface IBottomSheetOptions extends IBaseDialogOptions { style?: IBottomActionSheetDialogStyle title?: ResourceStr; cancelText?: ResourceStr; sheets: Array<ActionSheetItemOptions> | Array<ResourceStr>; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/IBottomSheetOptions.ets#L22-L35
8bad6c06132b416895faf26b72e2b51fca93ee9b
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/container/list_field_sensitive_001_T.ets
arkts
Introduction List域敏感
export function list_field_sensitive_001_T(taint_src : string) { let l = new List<string>(); l.add(taint_src); l.add("clean"); taint.Sink(l.get(0)); }
AST#export_declaration#Left export AST#function_declaration#Left function list_field_sensitive_001_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_st...
export function list_field_sensitive_001_T(taint_src : string) { let l = new List<string>(); l.add(taint_src); l.add("clean"); taint.Sink(l.get(0)); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/list_field_sensitive_001_T.ets#L7-L12
dd374bb777738fea353e845eaedabd4dbb9b8b39
github
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/ability/NaturalLanguageExtract.ets
arkts
parseHuaweiLink
解析华为应用链接
private static parseHuaweiLink(url: string): HuaweiLinkParseResult | null { const huaweiPrefix = "https://appgallery.huawei.com/app/detail?id="; if (!url.startsWith(huaweiPrefix)) { return null; } // 提取id参数值 const idPart = url.substring(huaweiPrefix.length); ...
AST#method_declaration#Left private static parseHuaweiLink 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#type_annotation#Left AST#union_type#Left AST#primary_t...
private static parseHuaweiLink(url: string): HuaweiLinkParseResult | null { const huaweiPrefix = "https://appgallery.huawei.com/app/detail?id="; if (!url.startsWith(huaweiPrefix)) { return null; } const idPart = url.substring(huaweiPrefix.length); ...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/ability/NaturalLanguageExtract.ets#L84-L130
6cc3b97dd9e2af3ffee669ac62c49f69bda6d9ed
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
getLimitLines
Returns the LimitLines of this axis. @return
public getLimitLines(): JArrayList<LimitLine> { return this.mLimitLines; }
AST#method_declaration#Left public getLimitLines AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left LimitLine AST#primary_type#Right AST#type_annotation#Right > AS...
public getLimitLines(): JArrayList<LimitLine> { return this.mLimitLines; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L485-L487
73ff4dc8d074600088d9bdcfae2f19736471f7b5
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/MineView.ets
arkts
ExamSwitchModule
构建题库切换模块
@Builder ExamSwitchModule() { Row() { Text('切换题库:') .fontSize(14) Text( this.guideService.guideData.licenseType !== undefined?licenseTypeName[this.guideService.guideData.licenseType]:'') .fontSize(14) .fontColor('#64BB5C') Image($r('app.media.right_triangle')) .wi...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ExamSwitchModule 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_el...
@Builder ExamSwitchModule() { Row() { Text('切换题库:') .fontSize(14) Text( this.guideService.guideData.licenseType !== undefined?licenseTypeName[this.guideService.guideData.licenseType]:'') .fontSize(14) .fontColor('#64BB5C') Image($r('app.media.right_triangle')) .wi...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/MineView.ets#L45-L63
f3c6047129fd8785622bf26401e3aeca90933f33
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
getNetworkStatus
获取网络状态,查询手机卡注册网络的运营商名称、是否处于漫游状态、设备的网络注册状态等信息
getNetworkStatus() { radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => { if (err) { logger.error(`getNetworkState failed, callback: err->${JSON.stringify(err)}`); } // regState字段表示设备的网络注册状态 // (REG_STATE_POWER_OFF,值为3)蜂窝无线电已关闭,modem下电,无法和网侧进行通信 logger.info...
AST#method_declaration#Left getNetworkStatus AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left radio AST#expression#Right . getNetworkState AS...
getNetworkStatus() { radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => { if (err) { logger.error(`getNetworkState failed, callback: err->${JSON.stringify(err)}`); } logger.info('Success getNetworkStatus:' + JSON.stringify(data)); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets#L186-L195
e1b35a0161cb0493d2057cc61e33ea378e62708a
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/AuthRepository.ets
arkts
构造函数 @param networkDataSource 可选的认证网络数据源实例
constructor(networkDataSource?: AuthNetworkDataSource) { this.networkDataSource = networkDataSource ?? new AuthNetworkDataSourceImpl(); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left AuthNetworkDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Le...
constructor(networkDataSource?: AuthNetworkDataSource) { this.networkDataSource = networkDataSource ?? new AuthNetworkDataSourceImpl(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/AuthRepository.ets#L18-L20
c47eaeafe40af5f91d9a9e44a68063eba75b4f6a
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/goods/GoodsListItem.ets
arkts
构建商品列表卡片 @returns {void} 无返回值
build(): void { Card({ onTap: (): void => this.onItemClick(this.goods.id) }) { Row() { NetWorkImage({ model: this.goods.mainPic, sizeValue: 100, imageFit: ImageFit.Cover, showBackground: true, cornerRadius: $r("app.float.radius_small") ...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( AST#component_parameters#Left { AST#component_parameter#Left onTap : AST#...
build(): void { Card({ onTap: (): void => this.onItemClick(this.goods.id) }) { Row() { NetWorkImage({ model: this.goods.mainPic, sizeValue: 100, imageFit: ImageFit.Cover, showBackground: true, cornerRadius: $r("app.float.radius_small") ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/goods/GoodsListItem.ets#L36-L89
088d69c8ff97bff42602d25ccc3a9a523be90c99
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
deleteTestResults
清空测试结果
async deleteTestResults(): Promise<void> { this.allWords.forEach(word => { word.correctedTimes = 0; word.wrangTimes = 0; word.lastResultType = SearchConstants.TEST_RESULT_NONE; }); await WordUserDbAccess.shared.clearTestResults(); }
AST#method_declaration#Left async deleteTestResults 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#typ...
async deleteTestResults(): Promise<void> { this.allWords.forEach(word => { word.correctedTimes = 0; word.wrangTimes = 0; word.lastResultType = SearchConstants.TEST_RESULT_NONE; }); await WordUserDbAccess.shared.clearTestResults(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L785-L792
73a5d8c5ec883e89ffe3750fdf098bc685fd6889
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/treeview/source/treeview.ets
arkts
Declare class TreeListenerManager. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare class TreeListenerManager. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export class TreeListenerManager { public static readonly APP_KEY_EVENT_BUS = 'app_key_event_bus'; private appEventBus: TreeListener; private constructor() { this.appEventBus = new TreeListener(); } /** * Get instance of treeListenerManager. * @return treeListenerManager instance. * @static ...
AST#export_declaration#Left export AST#class_declaration#Left class TreeListenerManager AST#class_body#Left { AST#property_declaration#Left public static readonly APP_KEY_EVENT_BUS = AST#expression#Left 'app_key_event_bus' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private appEv...
export class TreeListenerManager { public static readonly APP_KEY_EVENT_BUS = 'app_key_event_bus'; private appEventBus: TreeListener; private constructor() { this.appEventBus = new TreeListener(); } static getInstance(): TreeListenerManager { if (AppStorage.Get('app_key_event_bus') === undefin...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L924-L970
3c52282774c0d92b0de18c2f34351f5cb086ca36
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
majorVersion
Major版本号,随主版本更新增加。
static majorVersion() { return deviceInfo.majorVersion + '' }
AST#method_declaration#Left static majorVersion AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left deviceInfo AST#expression#...
static majorVersion() { return deviceInfo.majorVersion + '' }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L140-L142
04bf38ae9e3ade7332420b3e176c3663bbbc4b2b
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DeviceUtils.ets
arkts
getBatteryTemperature
获取当前设备电池的温度,单位0.1摄氏度。 @returns
static getBatteryTemperature(): number { return batteryInfo.batteryTemperature; }
AST#method_declaration#Left static getBatteryTemperature 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#me...
static getBatteryTemperature(): number { return batteryInfo.batteryTemperature; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DeviceUtils.ets#L200-L202
e96dee628dea0e290325314641d828c5de586279
gitee
triplesium/LibraryManangement_ArkTS.git
68c0fadbf324af164414d3f9a6008a13fbc95bcd
entry/src/main/ets/Data.ets
arkts
为了测试方便,这里表示多少秒会超时
constructor() { this.books = [ { id: '1', name: 'test1' }, { id: '2', name: 'test2' } ]; this.readers = [ { id: '1', name: '张三' }, { id: '2', name: '李四' } ]; this.records = []; this.maxBorrowTime = 10; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . books AST#member_exp...
constructor() { this.books = [ { id: '1', name: 'test1' }, { id: '2', name: 'test2' } ]; this.readers = [ { id: '1', name: '张三' }, { id: '2', name: '李四' } ]; this.records = []; this.maxBorrowTime = 10; }
https://github.com/triplesium/LibraryManangement_ArkTS.git/blob/68c0fadbf324af164414d3f9a6008a13fbc95bcd/entry/src/main/ets/Data.ets#L25-L36
759cf7f247db2f9ac96557bf58e43285c2fd7e0d
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/result/src/main/ets/RequestHelper.ets
arkts
repository
配置请求源仓库(Repository/API 返回的 Promise) @param {Promise<NetworkResponse<T>>} promise - 原始请求 Promise @returns {RequestHelper<T>} 链式助手实例
static repository<T>(promise: Promise<NetworkResponse<T>>): RequestHelper<T> { return new RequestHelper<T>(promise); }
AST#method_declaration#Left static repository AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left promise : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_a...
static repository<T>(promise: Promise<NetworkResponse<T>>): RequestHelper<T> { return new RequestHelper<T>(promise); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L41-L43
b5176f0a8a2999d132be26bf93ae7b5f79dd5879
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.mediaquery.d.ets
arkts
Defines the MediaQuery list info. @interface MediaQueryList @syscap SystemCapability.ArkUI.ArkUI.Full @since 3 Defines the MediaQuery list info. @interface MediaQueryList @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export interface MediaQueryList { /** * Serialized media query condition. * This parameter is read-only. * * @type { ?string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 */ /** * Serialized media query condition. * This parameter is read-only. * * @type { ?string } * ...
AST#export_declaration#Left export AST#interface_declaration#Left interface MediaQueryList AST#object_type#Left { /** * Serialized media query condition. * This parameter is read-only. * * @type { ?string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 */ /** * Serialized media query co...
export interface MediaQueryList { media?: string; matches?: boolean; onchange?: (matches: boolean) => void; addListener(callback: (event: MediaQueryEvent) => void): void; removeListener(callback: (event: MediaQueryEvent) => void): void; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.mediaquery.d.ets#L70-L161
98740656117c54d116347dca6d0c44dc1a9e945d
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinPoetry/entry/src/main/ets/model/PoetryMenuEssence.ets
arkts
精选诗单模型 拼音和 汉字 组成的诗单映射
export interface POETRY_TYPE_MAP { type: string typeName: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface POETRY_TYPE_MAP AST#object_type#Left { AST#type_member#Left type : 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 typeName : AST#type_annotation#...
export interface POETRY_TYPE_MAP { type: string typeName: string }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/model/PoetryMenuEssence.ets#L4-L7
a0d117b4358ce854f4d78d9d1b02fb47a060d254
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
keys
Called when a dictionary is sorted. @since 10
static keys(): IterableIterator<string> { return StorageMap.shared.keys() }
AST#method_declaration#Left static keys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type...
static keys(): IterableIterator<string> { return StorageMap.shared.keys() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L204-L206
93e77bfad85d54a4c484708360b15c8fb69d6cd7
gitee
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets
arkts
Enumerates clip operations. @enum { number } @syscap SystemCapability.Graphics.Drawing @since 12
export enum ClipOp { /** * Clips with difference. * @syscap SystemCapability.Graphics.Drawing * @since 12 */ DIFFERENCE = 0, /** * Clips with intersection. * @syscap SystemCapability.Graphics.Drawing * @since 12 */ INTERSECT = 1, }
AST#export_declaration#Left export AST#enum_declaration#Left enum ClipOp AST#enum_body#Left { /** * Clips with difference. * @syscap SystemCapability.Graphics.Drawing * @since 12 */ AST#enum_member#Left DIFFERENCE = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , /** * Clips ...
export enum ClipOp { DIFFERENCE = 0, INTERSECT = 1, }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L511-L524
4ff6620fb43bba4ccd30ecc2ef43310c026b7395
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets
arkts
clearData
清空数据
public clearData(): void { this.dataList = []; this.notifyDataReload(); }
AST#method_declaration#Left public clearData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#m...
public clearData(): void { this.dataList = []; this.notifyDataReload(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets#L56-L59
5205253b35995f0c4f961589717fb93776232478
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
getPrimarySlotId
获取主卡所在卡槽的索引号。使用Promise异步回调。 @returns
static async getPrimarySlotId(): Promise<number> { return radio.getPrimarySlotId(); }
AST#method_declaration#Left static async getPrimarySlotId 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 number AST#primary_type#Right AST#type_annotation#Right >...
static async getPrimarySlotId(): Promise<number> { return radio.getPrimarySlotId(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L334-L336
ec1e5564d3e5e13d0ed5d919ffa1946932724b81
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
wordIdsFor
/获取wordIds / 注意:这里获取的wordIds仅仅是此plan中的wordIds,有可能在words中处于deleted状态
wordIdsFor(dayOf: DayOf, distances: number[] | null = null): number[] { let pieceNos = dayOf.pieceNos(distances); let set = new Set(pieceNos); return this.pieces .filter((p) => set.has(p.pieceNo!)) .reduce<number[]>((acc, p) => acc.concat(p.wordIds ?? []), []); }
AST#method_declaration#Left wordIdsFor AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left distances : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#ar...
wordIdsFor(dayOf: DayOf, distances: number[] | null = null): number[] { let pieceNos = dayOf.pieceNos(distances); let set = new Set(pieceNos); return this.pieces .filter((p) => set.has(p.pieceNo!)) .reduce<number[]>((acc, p) => acc.concat(p.wordIds ?? []), []); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L262-L268
e5922043d92dd1ce2b623146277d4d6cf927ab43
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ImageUtil.ets
arkts
saveImageSource
保存ImageSource到本地 @param pixelMap PixelMap @param path 文件夹路径 @param name 文件名 @param format 目标格式。默认png。当前只支持jpg(image/jpeg)、webp和png(image/png)。 @returns
static async saveImageSource(source: image.ImageSource, path: string, name: string, format: string = 'image/png'): Promise<string> { if (!FileUtil.accessSync(path)) { FileUtil.mkdirSync(path) //如果文件夹不存在就创建 } let filePath = path + FileUtil.separator + name; let file = FileUtil.openSync(filePath) ...
AST#method_declaration#Left static async saveImageSource AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pat...
static async saveImageSource(source: image.ImageSource, path: string, name: string, format: string = 'image/png'): Promise<string> { if (!FileUtil.accessSync(path)) { FileUtil.mkdirSync(path) } let filePath = path + FileUtil.separator + name; let file = FileUtil.openSync(filePath) let packOpt...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L101-L111
9bfb9bb2a2c806038e632ce411fab3e02a1657cc
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
re_save_web_state
Re-save all web states, usually used to ensure the correct order of tab indices. Clears whatever was in sandbox filesDir/continue directory. @param start A number, all tabs with index greater or equal to start would re-save their web states to disk.
re_save_web_state(start: number, dir: string) { console.log('[Meow][bunch_of_tabs] Re_save_web_state! (' + this.my_id + ') (#' + window_index_of_id(this.my_id) + ') From ' + start + '.'); // Save for (let index = start; index < this.Tabs.length; index++) { this.Tabs[index].update_web_state(false); ...
AST#method_declaration#Left re_save_web_state AST#parameter_list#Left ( AST#parameter#Left start : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
re_save_web_state(start: number, dir: string) { console.log('[Meow][bunch_of_tabs] Re_save_web_state! (' + this.my_id + ') (#' + window_index_of_id(this.my_id) + ') From ' + start + '.'); for (let index = start; index < this.Tabs.length; index++) { this.Tabs[index].update_web_state(false); let ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L615-L625
ca459f240dac4ab2f75f3e0c1e9427c43d40bba1
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/ReminderService.ets
arkts
addReminder
Adding and modifying alarm reminders @param alarmItem ReminderItem @param callback callback
public addReminder(alarmItem: ReminderItem, callback?: (reminderId: number) => void) { let reminder = this.initReminder(alarmItem); reminderAgent.publishReminder(reminder, (err, reminderId) => { if (callback != null) { callback(reminderId); } }); }
AST#method_declaration#Left public addReminder AST#parameter_list#Left ( AST#parameter#Left alarmItem : AST#type_annotation#Left AST#primary_type#Left ReminderItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback ? : AST#type_annotation#Left AST#function_type#Left AST#p...
public addReminder(alarmItem: ReminderItem, callback?: (reminderId: number) => void) { let reminder = this.initReminder(alarmItem); reminderAgent.publishReminder(reminder, (err, reminderId) => { if (callback != null) { callback(reminderId); } }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/ReminderService.ets#L42-L49
256c4467b6b477386d1da90c9a77d2c08281381d
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/TitleBar.ets
arkts
TitleBar
Page title bar
@Component export struct TitleBar { private title: Resource = $r('app.media.ic_back'); build() { Column() { Row() { Image($r('app.media.ic_back')) .width(20) .height(20) .margin({ left: 26 }) .objectFit(ImageFit.Contain) .onClick(() => { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resou...
@Component export struct TitleBar { private title: Resource = $r('app.media.ic_back'); build() { Column() { Row() { Image($r('app.media.ic_back')) .width(20) .height(20) .margin({ left: 26 }) .objectFit(ImageFit.Contain) .onClick(() => { ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/TitleBar.ets#L19-L46
574d658d41d65fb91b06081dd43e4317fca87ae2
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/navigation/AuthGraph.ets
arkts
register
注册认证模块导航路由
register(): void { RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav)); RouteBuild.register(AuthRoutes.AccountLogin, wrapBuilder(AccountLoginNav)); RouteBuild.register(AuthRoutes.SmsLogin, wrapBuilder(SmsLoginNav)); RouteBuild.register(AuthRoutes.Register, wrapBuilder(RegisterNav)); RouteBu...
AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left...
register(): void { RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav)); RouteBuild.register(AuthRoutes.AccountLogin, wrapBuilder(AccountLoginNav)); RouteBuild.register(AuthRoutes.SmsLogin, wrapBuilder(SmsLoginNav)); RouteBuild.register(AuthRoutes.Register, wrapBuilder(RegisterNav)); RouteBu...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/navigation/AuthGraph.ets#L17-L23
d8fcc370f4963a9d0c8e45fb84e1b7f23c41f205
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/StatsManager.ets
arkts
removeEventListener
移除事件监听器
removeEventListener(event: string, callback: Function): void { const callbacks = this.listeners.get(event); if (callbacks) { const index = callbacks.indexOf(callback); if (index > -1) { callbacks.splice(index, 1); } } }
AST#method_declaration#Left removeEventListener AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#prim...
removeEventListener(event: string, callback: Function): void { const callbacks = this.listeners.get(event); if (callbacks) { const index = callbacks.indexOf(callback); if (index > -1) { callbacks.splice(index, 1); } } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L347-L355
7e5364017c019884a8cdbfc5599b521e1956e37a
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppFunctions.ets
arkts
not using, 没有效果,why by ko 2025.10.31 判断 icon 是否为 SVG(兼容 string 或 Resource) 说明: - 不使用 `any` / `unknown`。 - 不使用 `in` 操作符。 - 先判断 mimeType(若存在且表明 svg 则直接返回),否则按常见字段后缀判断。
export function isSvgIcon(icon?: string | Resource): boolean { if (!icon) return false; // 如果是字符串,直接根据后缀判断 if (typeof icon === 'string') { return icon.trim().toLowerCase().endsWith('.svg'); } // 显式地把 Resource 视为 ResourceLike(明确类型断言) const res = icon as ResourceLike; // 优先使用 mimeType(如果资源提供了该字段) i...
AST#export_declaration#Left export AST#function_declaration#Left function isSvgIcon AST#parameter_list#Left ( AST#parameter#Left icon ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type...
export function isSvgIcon(icon?: string | Resource): boolean { if (!icon) return false; if (typeof icon === 'string') { return icon.trim().toLowerCase().endsWith('.svg'); } const res = icon as ResourceLike; if (typeof res.mimeType === 'string' && res.mimeType.length > 0) { const mt = res.m...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppFunctions.ets#L111-L148
e8c42dc7e31710b094e06492e73c7f3ea06ea133
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
getSettings
获取当前通知设置
public getSettings(): NotificationSettings { return { enabled: this.settings.enabled, soundEnabled: this.settings.soundEnabled, vibrationEnabled: this.settings.vibrationEnabled, notificationEnabled: this.settings.notificationEnabled, dialogEnabled: this.settings.dialogEnabled, ba...
AST#method_declaration#Left public getSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NotificationSettings AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AS...
public getSettings(): NotificationSettings { return { enabled: this.settings.enabled, soundEnabled: this.settings.soundEnabled, vibrationEnabled: this.settings.vibrationEnabled, notificationEnabled: this.settings.notificationEnabled, dialogEnabled: this.settings.dialogEnabled, ba...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L76-L90
f06d1bdec522ab76a3704a13a382dea674967c17
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/common/Constants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class Constant { // 隐藏 titleBar public static readonly HIDE_TITLE_BAR: boolean = true; // 页面 title public static readonly WEB_PAGE_TITLE: string = 'Web页面长截图'; public static readonly COMPONENT_PAGE_TITLE: string = '滚动组件页面长截图'; // 屏幕与内容的外边距 public static readonly CARD_MARGIN_START: number = 1...
AST#export_declaration#Left export default AST#class_declaration#Left class Constant AST#class_body#Left { // 隐藏 titleBar AST#property_declaration#Left public static readonly HIDE_TITLE_BAR : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AS...
export default class Constant { public static readonly HIDE_TITLE_BAR: boolean = true; public static readonly WEB_PAGE_TITLE: string = 'Web页面长截图'; public static readonly COMPONENT_PAGE_TITLE: string = '滚动组件页面长截图'; public static readonly CARD_MARGIN_START: number = 12; public static readonly SNAP_W...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/common/Constants.ets#L16-L103
5053e2a48fd98589dc37e9e270d0d29c306c11b3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/skeletondiagram/src/main/ets/view/SkeletonDiagram.ets
arkts
loadList
加载网络数据
loadList() { // 正在加载状态 this.loadingCollectedStatus = LoadingStatus.LOADING; let httpRequest = http.createHttp(); // 设置发起请求可选参数 let options: http.HttpRequestOptions = { expectDataType: http.HttpDataType.OBJECT, // 可选,指定返回数据的类型 }; // TODO: 知识点:request(url: string, callback: AsyncCallback...
AST#method_declaration#Left loadList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 正在加载状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadingCollectedSt...
loadList() { this.loadingCollectedStatus = LoadingStatus.LOADING; let httpRequest = http.createHttp(); let options: http.HttpRequestOptions = { expectDataType: http.HttpDataType.OBJECT, }; httpRequest.request(REQUEST_URL, options, (err: Error, data: http.HttpResponse...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/skeletondiagram/src/main/ets/view/SkeletonDiagram.ets#L53-L80
6ee096392a9779b2dd49c7f5ef4e89aae5e0d02a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
setDataUriSync
将URI数据写入系统剪贴板。 @param uri URI内容 @returns
static setDataUriSync(uri: string) { PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_URI, uri); }
AST#method_declaration#Left static setDataUriSync AST#parameter_list#Left ( AST#parameter#Left uri : 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#ex...
static setDataUriSync(uri: string) { PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_URI, uri); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L193-L195
0bc7d7da5c6d6a815ae1095d260d977a4ac47462
gitee
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
128861bc002adae9c34c6ce8fbf12686c26e51ec
entry/src/main/ets/utils/PreferenceModel.ets
arkts
putPreference
设置 key-value
async putPreference(key: string, value: string) { await this.ensurePreferenceInitialized(); if (preference) { try { await preference.put(key, value); await preference.flush(); } catch (err) { console.error(`Failed to put preference [${key}]:`, err); } } else { ...
AST#method_declaration#Left async putPreference AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
async putPreference(key: string, value: string) { await this.ensurePreferenceInitialized(); if (preference) { try { await preference.put(key, value); await preference.flush(); } catch (err) { console.error(`Failed to put preference [${key}]:`, err); } } else { ...
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L35-L48
ee3f2c93930c84f785e813ca4a309f3c2ff7f269
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets
arkts
SubscribeCallBack
订阅公共事件回调
function SubscribeCallBack(err, data) { let msgData = data.data; let code = data.code; // 设置有序公共事件的结果代码 subscriber.setCode(code, SetCodeCallBack); // 设置有序公共事件的结果数据 subscriber.setData(msgData, SetDataCallBack); // 完成本次有序公共事件处理 subscriber.finishCommonEvent(FinishCommonEvent...
AST#function_declaration#Left function SubscribeCallBack AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left msgData = AS...
function SubscribeCallBack(err, data) { let msgData = data.data; let code = data.code; subscriber.setCode(code, SetCodeCallBack); subscriber.setData(msgData, SetDataCallBack); subscriber.finishCommonEvent(FinishCommonEventCallBack) that.score = data.parame...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L129-L140
8c34778a9318de90becd3771884f655a2ab4d81c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets
arkts
getData
获取索引对应的数据 @param index 数组索引 @returns
public getData(index: number): NewsItem { return this.dataList[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NewsItem AST#primary_type...
public getData(index: number): NewsItem { return this.dataList[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets#L33-L35
9f2c16e121bc1753dce0becdf49498a1e0eeac3f
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
Index.ets
arkts
FFmpegCommandBuilder
命令构建器(高级定制)
export { FFmpegCommandBuilder } from './src/main/ets/ffmpeg/FFmpegCommandBuilder';
AST#export_declaration#Left export { FFmpegCommandBuilder } from './src/main/ets/ffmpeg/FFmpegCommandBuilder' ; AST#export_declaration#Right
export { FFmpegCommandBuilder } from './src/main/ets/ffmpeg/FFmpegCommandBuilder';
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/Index.ets#L21-L21
7898480ed3824cada07c6db66c97f42d9bf0b04e
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Load intercept event when the resources loading is intercepted. @typedef OnLoadInterceptEvent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare interface OnLoadInterceptEvent { /** * Web resource request of event. * * @type { WebResourceRequest } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ data: WebResourceRequest; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnLoadInterceptEvent AST#object_type#Left { /** * Web resource request of event. * * @type { WebResourceRequest } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 ...
export declare interface OnLoadInterceptEvent { data: WebResourceRequest; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L304-L314
70687f5804f8c8a954d09267660a5b8ebde31040
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
playRingtonePreview
播放铃声预览
private playRingtonePreview(ringtoneName: string): void { promptAction.showToast({ message: `正在播放: ${ringtoneName}`, duration: 1000 }); // 这里应该调用HarmonyOS的音频播放API // 实际实现中可以使用@kit.AudioKit hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Playing ringtone preview: ${ringtoneNam...
AST#method_declaration#Left private playRingtonePreview AST#parameter_list#Left ( AST#parameter#Left ringtoneName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void ...
private playRingtonePreview(ringtoneName: string): void { promptAction.showToast({ message: `正在播放: ${ringtoneName}`, duration: 1000 }); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Playing ringtone preview: ${ringtoneName}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6302-L6311
e58aefde319479dd4c5e8e9f863336460f77f652
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ChatbotEngine.ets
arkts
processUserInput
处理用户输入
async processUserInput( input: string, context: ConversationContext ): Promise<AIResponse> { try { // 检查是否有活跃的对话流程 const activeFlow = this.activeFlows.get(context.sessionId); if (activeFlow && activeFlow.isActive) { return await this.processFlowInput(input, activeFlow, co...
AST#method_declaration#Left async processUserInput AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left ConversationCon...
async processUserInput( input: string, context: ConversationContext ): Promise<AIResponse> { try { const activeFlow = this.activeFlows.get(context.sessionId); if (activeFlow && activeFlow.isActive) { return await this.processFlowInput(input, activeFlow, context); }...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L168-L186
04d081f97eb4b397239179ee047b07c8d20f617d
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/SelectAgreementDialog.ets
arkts
当前选择项的内容
build() { Column() { Text(this.title) .fontSize(20) .fontColor($r('app.color.COLOR_E6000000')) .fontFamily($r('app.string.font_family')) .width('90%') .textAlign(TextAlign.Start) .margin({top: 14, bottom:14}) Column(){ Row(){ Text($r('ap...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left A...
build() { Column() { Text(this.title) .fontSize(20) .fontColor($r('app.color.COLOR_E6000000')) .fontFamily($r('app.string.font_family')) .width('90%') .textAlign(TextAlign.Start) .margin({top: 14, bottom:14}) Column(){ Row(){ Text($r('ap...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/SelectAgreementDialog.ets#L26-L157
c5849b5438c00247d581bc3c95facea11830add8
gitee
Puiching-Memory/HOMOAPP_Q5.git
53e36a21984de7bf41b6fafc840fde013236b9d2
entry/src/main/ets/model/AudioModel.ets
arkts
场景模型
export class Scene { id: number = 0; name: string = ''; description: string = ''; coverUrl: string = ''; tracks: Array<AudioItem> = []; }
AST#export_declaration#Left export AST#class_declaration#Left class Scene AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#prop...
export class Scene { id: number = 0; name: string = ''; description: string = ''; coverUrl: string = ''; tracks: Array<AudioItem> = []; }
https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/model/AudioModel.ets#L46-L52
19f4524ff3c5ae38a16b7668702d8457002c373a
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
attribute group enum
export const enum GROUP { MAIN_DIRECTION = 'MAIN_DIRECTION', WRAP_TYPE = 'WRAP_TYPE', MAIN_ALIGN = 'MAIN_ALIGN', AXI_ALIGN = 'AXI_ALIGN', ALIGN_TYPE = 'ALIGN_TYPE' };
AST#export_declaration#Left export AST#enum_declaration#Left const enum GROUP AST#enum_body#Left { AST#enum_member#Left MAIN_DIRECTION = AST#expression#Left 'MAIN_DIRECTION' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left WRAP_TYPE = AST#expression#Left 'WRAP_TYPE' AST#expression#Right AST#enum_member...
export const enum GROUP { MAIN_DIRECTION = 'MAIN_DIRECTION', WRAP_TYPE = 'WRAP_TYPE', MAIN_ALIGN = 'MAIN_ALIGN', AXI_ALIGN = 'AXI_ALIGN', ALIGN_TYPE = 'ALIGN_TYPE' };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L105-L111
eda038163b655476fece39ff15dd7a772508cdec
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
buildFilterOption
构建筛选选项
@Builder buildFilterOption(label: string, value: string, type: string) { Button(label) .type(ButtonType.Capsule) .fontSize(14) .fontColor((type === 'style' ? (this.selectedStyle === value) : (this.selectedOccasion === value)) ? '#ffffff' : '#666666') .backgroundColor((typ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilterOption AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#...
@Builder buildFilterOption(label: string, value: string, type: string) { Button(label) .type(ButtonType.Capsule) .fontSize(14) .fontColor((type === 'style' ? (this.selectedStyle === value) : (this.selectedOccasion === value)) ? '#ffffff' : '#666666') .backgroundColor((typ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L565-L580
5079f1ef028899a450bfbbc3005a3ce6dfe05483
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/components/VideoPanel.ets
arkts
VideoPanel
网络视频索引
@Component export struct VideoPanel { @State videoList: Resource[] = [$r('app.string.video_res_1'), $r('app.string.video_res_2'), $r('app.string.video_res_3')]; @State selectColor: boolean = true; @Link show: boolean; @Link videoSelect: number; // 当前选择项的索引 @StorageLink('avPlayManage') avPlayManage: avPlayMana...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoPanel AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right videoList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_t...
@Component export struct VideoPanel { @State videoList: Resource[] = [$r('app.string.video_res_1'), $r('app.string.video_res_2'), $r('app.string.video_res_3')]; @State selectColor: boolean = true; @Link show: boolean; @Link videoSelect: number; @StorageLink('avPlayManage') avPlayManage: avPlayManage = new av...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/components/VideoPanel.ets#L26-L158
daf899f1f2de488516259d855bbb88eddd846367
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/dialogv2/source/dialogv2.ets
arkts
getOperationAreaPadding
get operation area padding @returns padding
private getOperationAreaPadding(): Padding { if (this.isButtonVertical) { return { top: $r('sys.float.alert_button_top_padding'), right: $r('sys.float.alert_right_padding_vertical'), left: $r('sys.float.alert_left_padding_vertical'), bottom: $r('sys.float.alert_button_bottom_pa...
AST#method_declaration#Left private getOperationAreaPadding AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Padding AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#memb...
private getOperationAreaPadding(): Padding { if (this.isButtonVertical) { return { top: $r('sys.float.alert_button_top_padding'), right: $r('sys.float.alert_right_padding_vertical'), left: $r('sys.float.alert_left_padding_vertical'), bottom: $r('sys.float.alert_button_bottom_pa...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1374-L1390
fa81b0c8ff734c6069769112eaf8efc69c5166d5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderCommentPage.ets
arkts
RateSection
评分区域 @returns {void} 无返回值
@Builder private RateSection(): void { Column() { IBestRate({ value: this.vm.rating, count: 5, iconSize: 32, onChange: (value: number): void => this.vm.updateRating(value) }); SpaceVerticalSmall(); Text(this.getRatingText(this.vm.rating)) .fontSize...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RateSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e...
@Builder private RateSection(): void { Column() { IBestRate({ value: this.vm.rating, count: 5, iconSize: 32, onChange: (value: number): void => this.vm.updateRating(value) }); SpaceVerticalSmall(); Text(this.getRatingText(this.vm.rating)) .fontSize...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderCommentPage.ets#L101-L119
33b2fa4c50d97a903b52289dad13affdc4cd22d2
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdecoration/src/main/ets/components/MainPage.ets
arkts
MainPage
实现思路: 1. 添加自定义装饰器,并设置需要添加的方法名和绑定的组件ID 2. 编译工程,自动添加代码
@AutoAddInspector({ onDraw: 'onDraw', onLayout: 'onLayout', offDraw: 'offDraw', offLayout: 'offLayout', bindId: 'text' }) @Component export struct MainPage { build() { Column() { Text("Hello World") .id('text') } } textListener: inspector.ComponentObserver = inspector.createCompon...
AST#decorated_export_declaration#Left AST#decorator#Left @ AutoAddInspector ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onDraw AST#property_name#Right : AST#expression#Left 'onDraw' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left ...
@AutoAddInspector({ onDraw: 'onDraw', onLayout: 'onLayout', offDraw: 'offDraw', offLayout: 'offLayout', bindId: 'text' }) @Component export struct MainPage { build() { Column() { Text("Hello World") .id('text') } } textListener: inspector.ComponentObserver = inspector.createCompon...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdecoration/src/main/ets/components/MainPage.ets#L24-L63
927389774acecd29b0e316a6d1a45d4400dd85bd
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
removeByName
@deprecated @see {ZRouter.getInstance().removeByName} @param name
public static removeByName(name: string) { ZRouter.getRouterMgr().removeByName(name) }
AST#method_declaration#Left public static removeByName 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_list#Right AST#builder_function_body#Left { AST#expression_statement#Left ...
public static removeByName(name: string) { ZRouter.getRouterMgr().removeByName(name) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L551-L553
6e9feb512ed3c251976c3adb30b5ff8280377ae8
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Text('WaveCast') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor($r('app.color.text_primary')) Blank() // 搜索按钮 Button() { Text('🔍') .fontSize(20) } .width(40) .height(40) .background...
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() { Text('WaveCast') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor($r('app.color.text_primary')) Blank() Button() { Text('🔍') .fontSize(20) } .width(40) .height(40) .backgroundColor(C...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L487-L529
97c5269a81029ee564c501a7f14f8639e3610bb5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
getThemeTypeByColorTheme
辅助方法
private getThemeTypeByColorTheme(colorTheme: ColorTheme): ThemeType | null { const typeMap: Record<string, ThemeType> = { 'default_light': ThemeType.DEFAULT, 'spring_light': ThemeType.SPRING, 'summer_light': ThemeType.SUMMER, 'autumn_light': ThemeType.AUTUMN, 'winter_light': ThemeType....
AST#method_declaration#Left private getThemeTypeByColorTheme AST#parameter_list#Left ( AST#parameter#Left colorTheme : AST#type_annotation#Left AST#primary_type#Left ColorTheme AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left ...
private getThemeTypeByColorTheme(colorTheme: ColorTheme): ThemeType | null { const typeMap: Record<string, ThemeType> = { 'default_light': ThemeType.DEFAULT, 'spring_light': ThemeType.SPRING, 'summer_light': ThemeType.SUMMER, 'autumn_light': ThemeType.AUTUMN, 'winter_light': ThemeType....
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L837-L848
1a289d316c68ffaeeb605780129e0cf1e767ee1c
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/utils/JsonUtils.ets
arkts
Copyright (C) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default { _mapToJson(map: Map<string, object>): string { var obj = Object.create(null); var iterator = map.keys(); for (var i = 0; i < map.size; i++) { var key = iterator.next().value; obj[key] = map.get(key); } return JSON.stringify(obj); }, };
AST#export_declaration#Left export default AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left _mapToJson AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left map : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#L...
export default { _mapToJson(map: Map<string, object>): string { var obj = Object.create(null); var iterator = map.keys(); for (var i = 0; i < map.size; i++) { var key = iterator.next().value; obj[key] = map.get(key); } return JSON.stringify(obj); }, };
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/utils/JsonUtils.ets#L16-L27
577284af6eadd7e33eb2b25c4181fcf18740ad75
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextInputBuilderProxy.ets
arkts
文本输入弹窗代理
export class TextInputBuilderProxy extends BaseInputBuilderProxy<ITextInputOptions, TextInputDialog> implements IBuilderProxy { create(options: ITextInputOptions) { return new TextInputDialog(options); } /** * 输入框类型 * @default InputType.Normal 、InputType.Password */ inputType(inputType: InputType)...
AST#export_declaration#Left export AST#class_declaration#Left class TextInputBuilderProxy extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseInputBuilderProxy AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ITextInputOptions AST#primary_type#Right AST#type_annotati...
export class TextInputBuilderProxy extends BaseInputBuilderProxy<ITextInputOptions, TextInputDialog> implements IBuilderProxy { create(options: ITextInputOptions) { return new TextInputDialog(options); } inputType(inputType: InputType) { this.builderOptions.inputType = inputType; return this } ...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextInputBuilderProxy.ets#L9-L72
75daae6057d08e221569d3b6074576826a4a3f76
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/storage/StorageManager.ets
arkts
remove
删除键值
static async remove(key: string): Promise<void> { const instance = StorageManager.getInstance(); if (!instance.dataPreferences) { return; } try { await instance.dataPreferences.delete(key); await instance.dataPreferences.flush(); } catch (e) { Logger.error('StorageManager', `...
AST#method_declaration#Left static async remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
static async remove(key: string): Promise<void> { const instance = StorageManager.getInstance(); if (!instance.dataPreferences) { return; } try { await instance.dataPreferences.delete(key); await instance.dataPreferences.flush(); } catch (e) { Logger.error('StorageManager', `...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L160-L171
ae5baddaaa0a34258ffde21a5b274b7ef832d595
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/TextToSpeechService.ets
arkts
speak
播放文字 @param text - 要播放的文字 @param options - 播放选项
async speak(text: string, options?: TTSOptions): Promise<void> { this.logService.tts(`speak() 被调用,文本长度: ${text?.length || 0}`); // 检查是否启用TTS if (!this.isTTSEnabled) { this.logService.warn('TTS', 'TTS未启用,跳过播放'); return; } // 如果文本为空,直接返回 if (!text || text.trim().length === 0) { ...
AST#method_declaration#Left async speak AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left TTSOptions AST#primary_ty...
async speak(text: string, options?: TTSOptions): Promise<void> { this.logService.tts(`speak() 被调用,文本长度: ${text?.length || 0}`); if (!this.isTTSEnabled) { this.logService.warn('TTS', 'TTS未启用,跳过播放'); return; } if (!text || text.trim().length === 0) { this.logService.warn('TTS...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L175-L219
3cb1bc38f2090f705250c73ed01a1b9bca5c42d6
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/setting/DefaultSettingWant.ets
arkts
默认创建的want对象
export class DefaultSettingWant implements SettingWant { getWant(bundleName: string): Want { let wantInfo: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'application_info_entry', parameters: { pushParams: bundleName // 打...
AST#export_declaration#Left export AST#class_declaration#Left class DefaultSettingWant AST#implements_clause#Left implements SettingWant AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left getWant AST#parameter_list#Left ( AST#parameter#Left bundleName : AST#type_annotation#Left AST#primary_ty...
export class DefaultSettingWant implements SettingWant { getWant(bundleName: string): Want { let wantInfo: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'application_info_entry', parameters: { pushParams: bundleName ...
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/setting/DefaultSettingWant.ets#L7-L21
397072c435f20cf77c4c5ff3dadee46fdbd00bbf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/livedetectionandencryptiond/Index.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 * from './src/main/ets/pages/LiveDetectionAndEncryptionPage';
AST#export_declaration#Left export * from './src/main/ets/pages/LiveDetectionAndEncryptionPage' ; AST#export_declaration#Right
export * from './src/main/ets/pages/LiveDetectionAndEncryptionPage';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/livedetectionandencryptiond/Index.ets#L15-L15
5a010c9d28cc4f547116bd60c573a53985b7b2ed
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets
arkts
Enum for DownloadDescription @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export declare enum DownloadLayoutDirection { /** * Layout direction is HORIZONTAL. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ HORIZONTAL = 0, /** * Layout direction is VERTICAL. * * @syscap SystemCapabilit...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum DownloadLayoutDirection AST#enum_body#Left { /** * Layout direction is HORIZONTAL. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AS...
export declare enum DownloadLayoutDirection { HORIZONTAL = 0, VERTICAL = 1 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L140-L159
fc9035e0450c5d59912317c5d346e191e02e7dbe
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
getGoodsInfo
获取商品信息 @param id 商品ID @returns 商品详情
async getGoodsInfo(id: string): Promise<NetworkResponse<Goods>> { return this.networkDataSource.getGoodsInfo(id); }
AST#method_declaration#Left async getGoodsInfo AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr...
async getGoodsInfo(id: string): Promise<NetworkResponse<Goods>> { return this.networkDataSource.getGoodsInfo(id); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/GoodsRepository.ets#L38-L40
c8969a8b04c6fd5cd22beccab47f334a285da266
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/MockData.ets
arkts
mock动态列表数据
export let trendsList: Array<Array<Trends>> = [ [ new Trends( new UserInfo(0, $r('app.media.photo22'), "\u4e0d\u7f81\u7684\u5149", "\u77f3\u5bb6\u5e84", "\u5a31\u4e50\u535a\u4e3b"), new ContentsType("\u897f\u98ce\u5439\u9526\u6c34\uff0c\u671d\u5929\u8def\u3001\u5189\u5189\u4e24\u51eb\u98de\u3002", ...
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left trendsList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#typ...
export let trendsList: Array<Array<Trends>> = [ [ new Trends( new UserInfo(0, $r('app.media.photo22'), "\u4e0d\u7f81\u7684\u5149", "\u77f3\u5bb6\u5e84", "\u5a31\u4e50\u535a\u4e3b"), new ContentsType("\u897f\u98ce\u5439\u9526\u6c34\uff0c\u671d\u5929\u8def\u3001\u5189\u5189\u4e24\u51eb\u98de\u3002", ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/MockData.ets#L19-L210
543a01fcff94668c1c2ac4e401f1f1753372acc0
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/SearchPage.ets
arkts
buildTabItem
构建Tab项
@Builder buildTabItem(title: string, key: string, count: number) { Column({ space: 4 }) { Text(`${title}(${count})`) .fontSize(14) .fontColor(this.activeTab === key ? '#007AFF' : '#666666') .fontWeight(this.activeTab === key ? FontWeight.Medium : FontWeight.Normal) if (t...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AS...
@Builder buildTabItem(title: string, key: string, count: number) { Column({ space: 4 }) { Text(`${title}(${count})`) .fontSize(14) .fontColor(this.activeTab === key ? '#007AFF' : '#666666') .fontWeight(this.activeTab === key ? FontWeight.Medium : FontWeight.Normal) if (t...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L279-L297
c6359a4f26d7a58d5c34808295a497ee8934fb55
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets
arkts
unregisterDataChangeListener
注销改变数据的控制器 @param listener 数据控制器
unregisterDataChangeListener(listener: DataChangeListener): void { const pos = this.listeners.indexOf(listener); if (pos >= 0) { console.info('remove listener'); this.listeners.splice(pos, 1); } }
AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L...
unregisterDataChangeListener(listener: DataChangeListener): void { const pos = this.listeners.indexOf(listener); if (pos >= 0) { console.info('remove listener'); this.listeners.splice(pos, 1); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L91-L97
bc49df55c9f970d943d5c17a9c9504b7c49ff850
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
setSkipWebLineCount
Sets the number of web-lines that should be skipped on chart web before the next one is drawn. This targets the lines that come from the center of the RadarChart. @param count if count = 1 -> 1 line is skipped in between
public setSkipWebLineCount(count: number) { this.mSkipWebLineCount = Math.max(0, count); }
AST#method_declaration#Left public setSkipWebLineCount AST#parameter_list#Left ( AST#parameter#Left count : 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#builder_function_body#Left { AST#expression_statement#Left...
public setSkipWebLineCount(count: number) { this.mSkipWebLineCount = Math.max(0, count); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L321-L323
58c13e373b75b89a600b128cf3e4e77eaf07b171
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/Rect.ets
arkts
copyOrNull
Returns a copy of {@code r} if {@code r} is not {@code null}, or {@code null} otherwise. @hide
public static copyOrNull(r: MyRect): MyRect | null { return r == null ? null : new MyRect(r.left, r.top, r.right, r.bottom); }
AST#method_declaration#Left public static copyOrNull AST#parameter_list#Left ( AST#parameter#Left r : AST#type_annotation#Left AST#primary_type#Left MyRect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left...
public static copyOrNull(r: MyRect): MyRect | null { return r == null ? null : new MyRect(r.left, r.top, r.right, r.bottom); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L58-L60
3b735cf0c102f3a3ad66eff4a9f0827cc63a3903
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Tables/DayInfoApi.ets
arkts
insertData
插入数据
insertData(dayInfo: DayInfo, callback: Function): void { const valueBucket = generateBuket(dayInfo); RdbUtils.insert('dayInfo', valueBucket).then(result => { callback(result); }) }
AST#method_declaration#Left insertData AST#parameter_list#Left ( AST#parameter#Left dayInfo : AST#type_annotation#Left AST#primary_type#Left DayInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_ty...
insertData(dayInfo: DayInfo, callback: Function): void { const valueBucket = generateBuket(dayInfo); RdbUtils.insert('dayInfo', valueBucket).then(result => { callback(result); }) }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Tables/DayInfoApi.ets#L12-L17
8d1f7d98a9d0b7e553924c09c9f6413d411e6a9f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarService.ets
arkts
formatDate
工具方法:格式化日期
private formatDate(date: Date): string { const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}-${month}-${day}`; }
AST#method_declaration#Left private formatDate 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 string AST#primary_type#...
private formatDate(date: Date): string { const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}-${month}-${day}`; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarService.ets#L366-L371
fd2f8f3f7ba86db7c20a739264654ce87cad2382
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
groupBillsByDate
按日期分组账单
groupBillsByDate(bills: BillItem[]): Map<string, BillItem[]> { const grouped = new Map<string, BillItem[]>(); bills.forEach(bill => { console.info(`分组账单 - 日期:${bill.date}, 分类:${bill.category}, 金额:${bill.amount}, 类型:${bill.type}`); if (!grouped.has(bill.date)) { grouped.set(bill.date, []); ...
AST#method_declaration#Left groupBillsByDate AST#parameter_list#Left ( AST#parameter#Left bills : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left BillItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef...
groupBillsByDate(bills: BillItem[]): Map<string, BillItem[]> { const grouped = new Map<string, BillItem[]>(); bills.forEach(bill => { console.info(`分组账单 - 日期:${bill.date}, 分类:${bill.category}, 金额:${bill.amount}, 类型:${bill.type}`); if (!grouped.has(bill.date)) { grouped.set(bill.date, []); ...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L171-L190
beabf4874b54147fffec88dbfa73569d3a8595ff
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets
arkts
根据任务状态获取用户任务 @param userId 用户ID @param status 状态:0-待开始,1-进行中,2-已完成,3-已延期 @returns 任务列表
export function getTasksByStatus(userId: number, status: number): Promise<Task[]> { try { return request<Task[]>( RequestMethod.GET, `/tasks/user/${userId}/status/${status}` ); } catch (error) { console.error(`获取用户状态为${status}的任务失败: ${error instanceof Error ? error.message : String(error)}`)...
AST#export_declaration#Left export AST#function_declaration#Left function getTasksByStatus AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left status : AST#type_annotation#Le...
export function getTasksByStatus(userId: number, status: number): Promise<Task[]> { try { return request<Task[]>( RequestMethod.GET, `/tasks/user/${userId}/status/${status}` ); } catch (error) { console.error(`获取用户状态为${status}的任务失败: ${error instanceof Error ? error.message : String(error)}`)...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L57-L67
3551d52280d946a0ff93f97caddcd67910535cfb
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets
arkts
buildCartList
构建购物车列表 @param {OrderGoods[]} goodsList - 订单商品列表 @returns {Cart[]} 购物车列表
private buildCartList(goodsList: OrderGoods[]): Cart[] { const groupedMap = new Map<number, OrderGoods[]>(); for (const goods of goodsList) { const existingList = groupedMap.get(goods.goodsId); if (existingList) { existingList.push(goods); } else { groupedMap.set(goods.goodsId...
AST#method_declaration#Left private buildCartList AST#parameter_list#Left ( AST#parameter#Left goodsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left OrderGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann...
private buildCartList(goodsList: OrderGoods[]): Cart[] { const groupedMap = new Map<number, OrderGoods[]>(); for (const goods of goodsList) { const existingList = groupedMap.get(goods.goodsId); if (existingList) { existingList.push(goods); } else { groupedMap.set(goods.goodsId...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L170-L213
7d5bd2dbaf280a6338122111b2ac737dbe2cfb30
github