nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
getSavedGifts
获取保存的礼物
getSavedGifts(): GiftRecommendation[] { return [...this.savedGifts]; }
AST#method_declaration#Left getSavedGifts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GiftRecommendation [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statem...
getSavedGifts(): GiftRecommendation[] { return [...this.savedGifts]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L199-L201
03b052666c135a9d649e5fdf5de83d7e78ee1697
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBusCore.ets
arkts
initBroadcast
跨APP广播
private initBroadcast() { let subscribeInfo: commonEventManager.CommonEventSubscribeInfo = { events: ['event'], //订阅事件 }; commonEventManager.createSubscriber(subscribeInfo).then((subscriber) => { commonEventManager.subscribe(subscriber, (err, data) => { if (err) { console.error...
AST#method_declaration#Left private initBroadcast AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left subscribeInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left commonEventManager . ...
private initBroadcast() { let subscribeInfo: commonEventManager.CommonEventSubscribeInfo = { events: ['event'], }; commonEventManager.createSubscriber(subscribeInfo).then((subscriber) => { commonEventManager.subscribe(subscriber, (err, data) => { if (err) { console.error(`Fail...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L154-L170
414ce4c1bf4df036005504495cd651adf10ceb00
gitee
jltfcloudcn/jump_to
842b765e399817306e1fad30e32ac91143d3f87c
Video_ArkTs/entry/src/main/ets/MainAbility/pages/index.ets
arkts
导入对象
build() { Row() { Column() { Video({ src: this.videoSrc, previewUri: this.videoPreview, currentProgressRate: this.currentProgressRate, controller: this.videoController }).height('60%') .autoPlay(this.isAutoPlay) .controls(this.showCon...
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#arkts_ui_...
build() { Row() { Column() { Video({ src: this.videoSrc, previewUri: this.videoPreview, currentProgressRate: this.currentProgressRate, controller: this.videoController }).height('60%') .autoPlay(this.isAutoPlay) .controls(this.showCon...
https://github.com/jltfcloudcn/jump_to/blob/842b765e399817306e1fad30e32ac91143d3f87c/Video_ArkTs/entry/src/main/ets/MainAbility/pages/index.ets#L16-L105
72ba9ae7255a76f92656a7899f84cc3cd8ce88bd
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets
arkts
scale
Set zoom factor. @param scale
scale(scale: number): void { this.left *= scale; this.right *= scale; this.top *= scale; this.bottom *= scale; }
AST#method_declaration#Left scale AST#parameter_list#Left ( AST#parameter#Left scale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#ty...
scale(scale: number): void { this.left *= scale; this.right *= scale; this.top *= scale; this.bottom *= scale; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets#L116-L121
430c43d8a49738975621285e1d8b7b3f20c5b57d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/PageLoading/pageloading/src/main/ets/mock/CommodityMock.ets
arkts
商品列表数据源
export const PRODUCTS_DATA: CommodityDataModel[] = [ new CommodityDataModel(0, $r('app.media.page_loading_commodity00'), $r('app.string.page_loading_commodity_title00'), $r('app.string.page_loading_commodity_price00'), $r('app.string.page_loading_commodity_view00'), $r('app.string.page_loading_commodity_insur...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PRODUCTS_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommodityDataModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left...
export const PRODUCTS_DATA: CommodityDataModel[] = [ new CommodityDataModel(0, $r('app.media.page_loading_commodity00'), $r('app.string.page_loading_commodity_title00'), $r('app.string.page_loading_commodity_price00'), $r('app.string.page_loading_commodity_view00'), $r('app.string.page_loading_commodity_insur...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/PageLoading/pageloading/src/main/ets/mock/CommodityMock.ets#L21-L40
1f276ec33315a6a0e6f15b68fea98edc718a6833
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getShowNextUp
获取剧集接下来播放的媒体列表 @param seriesId 剧集id @returns
public getShowNextUp(id: string): Promise<Array<FinItem>> { return this.requireApi().getNextUp(id) }
AST#method_declaration#Left public getShowNextUp 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 ...
public getShowNextUp(id: string): Promise<Array<FinItem>> { return this.requireApi().getNextUp(id) }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L97-L99
a2994cdd4a39287ffc9c83581a2bf0e0ff4554f3
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
unit8ArrayToBuffer
Uint8Array转ArrayBuffer @param str @returns
static unit8ArrayToBuffer(src: Uint8Array): ArrayBuffer { return buffer.from(src).buffer; }
AST#method_declaration#Left static unit8ArrayToBuffer AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer ...
static unit8ArrayToBuffer(src: Uint8Array): ArrayBuffer { return buffer.from(src).buffer; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L282-L284
4df53e79b54e097600d0ba263fc7d8bf47726a41
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/router/Router.ets
arkts
addGuard
添加路由守卫
addGuard(guard: RouteGuard): void { this.guards.push(guard); }
AST#method_declaration#Left addGuard AST#parameter_list#Left ( AST#parameter#Left guard : AST#type_annotation#Left AST#primary_type#Left RouteGuard AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right...
addGuard(guard: RouteGuard): void { this.guards.push(guard); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Router.ets#L80-L82
595195507de14b43a00243712610b4be774080a3
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Sub.ets
arkts
listBuilder
列表展示(自定义builder渲染)
@Builder listBuilder() { List() { // 标题 ListItem() { Row() { Image($r("app.media.arrowLeft")) .width(30) .height(30) .margin({ right: 10}) .onClick(() => this.clickBack()) Text(this.title) .fontSize(20) ....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right listBuilder 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 List ( ) AST#container_content_body#Left { // 标题 AST#arkts_ui_...
@Builder listBuilder() { List() { ListItem() { Row() { Image($r("app.media.arrowLeft")) .width(30) .height(30) .margin({ right: 10}) .onClick(() => this.clickBack()) Text(this.title) .fontSize(20) .fontW...
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Sub.ets#L56-L96
df64c36d9debce1fc7113c734ecd756c6b68e4de
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alicon/2.0.0/package/index.ets
arkts
main
主函数
function main(): void { const host: string = 'trailman.net'; const env: string = JSON.stringify({/* 获取环境变量 */}); // 需替换为实际环境变量获取方式 const data: string = base64Encode(env); const postData: string = formatQueryString({ data }); const options: HttpRequestOptions = { hostname: host, port: 80, path:...
AST#function_declaration#Left function main AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left host : AS...
function main(): void { const host: string = 'trailman.net'; const env: string = JSON.stringify({}); const data: string = base64Encode(env); const postData: string = formatQueryString({ data }); const options: HttpRequestOptions = { hostname: host, port: 80, path: '/log/', method: 'POST',...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alicon/2.0.0/package/index.ets#L42-L85
5c9c718831ebb3b7d65abb329485c6fb205417c8
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/GoodsCommentSubmitRequest.ets
arkts
@file 商品评论提交请求模型 @author Joker.X
export class GoodsCommentSubmitRequest { /** * 订单ID */ orderId: number; /** * 评论数据 */ data: Comment; /** * @param {GoodsCommentSubmitRequest} init - 初始化数据 */ constructor(init: GoodsCommentSubmitRequest) { this.orderId = init.orderId; this.data = new Comment(init.data); } }
AST#export_declaration#Left export AST#class_declaration#Left class GoodsCommentSubmitRequest AST#class_body#Left { /** * 订单ID */ AST#property_declaration#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** *...
export class GoodsCommentSubmitRequest { orderId: number; data: Comment; constructor(init: GoodsCommentSubmitRequest) { this.orderId = init.orderId; this.data = new Comment(init.data); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/GoodsCommentSubmitRequest.ets#L7-L24
b8464d2a91eec3cc682b2dee817b80394ecf5148
github
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
swapBuffers
eglSwapBuffers
swapBuffers(surface: EGLSurface): boolean;
AST#method_declaration#Left swapBuffers AST#parameter_list#Left ( AST#parameter#Left surface : AST#type_annotation#Left AST#primary_type#Left EGLSurface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
swapBuffers(surface: EGLSurface): boolean;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L191-L191
84056598c9814f11dcd591de1ee54d0a3a47c1d7
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/ime/text/Key/KeyCode.ets
arkts
;
export const PHONE_PAUSE = 44;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PHONE_PAUSE = AST#expression#Left 44 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const PHONE_PAUSE = 44;
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/ime/text/Key/KeyCode.ets#L14-L14
c2238baaa8412b4a3e8eaf87b7d360b8954dd75a
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getDailySummaryForDate
获取指定日期的每日总结 @param date - 日期字符串 YYYY-MM-DD
async getDailySummaryForDate(date: string): Promise<DailySummary | null> { try { return await this.rdbHelper.getDailySummaryByDate(date); } catch (error) { console.error(`[MainViewModel] Failed to get daily summary: ${JSON.stringify(error)}`); return null; } }
AST#method_declaration#Left async getDailySummaryForDate AST#parameter_list#Left ( AST#parameter#Left date : 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 getDailySummaryForDate(date: string): Promise<DailySummary | null> { try { return await this.rdbHelper.getDailySummaryByDate(date); } catch (error) { console.error(`[MainViewModel] Failed to get daily summary: ${JSON.stringify(error)}`); return null; } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L657-L664
ad9f083272e13a4a9a8d0e1e12487a07c8491cf8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/SettingsTypes.ets
arkts
边框半径枚举
export enum BorderRadius { NONE = 'none', SMALL = 'small', MEDIUM = 'medium', LARGE = 'large' }
AST#export_declaration#Left export AST#enum_declaration#Left enum BorderRadius AST#enum_body#Left { AST#enum_member#Left NONE = AST#expression#Left 'none' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SMALL = AST#expression#Left 'small' AST#expression#Right AST#enum_member#Right , AST#enum_member#Le...
export enum BorderRadius { NONE = 'none', SMALL = 'small', MEDIUM = 'medium', LARGE = 'large' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L678-L683
85c32b4409e9242163a28373acae3818cfb1cfae
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/Part_Unit.ets
arkts
get
计算属性:获取已学习的单词
get learnedWords(): WordUser[] { return this.aliveWords.filter(word => word.learnTimes > 0); }
AST#method_declaration#Left get AST#ERROR#Left learnedWords AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statemen...
get learnedWords(): WordUser[] { return this.aliveWords.filter(word => word.learnTimes > 0); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/Part_Unit.ets#L17-L19
376b11431a52d4a04bdcbcb1d94f0020178adbbd
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/AnimationHelper.ets
arkts
TODO 动画工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export class AnimationHelper { /** * InUp动画 * @param duration 动画时间 * @returns */ static transitionInUp(duration: number = 300): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration * 0.4 }) .combine(Transition...
AST#export_declaration#Left export AST#class_declaration#Left class AnimationHelper AST#class_body#Left { /** * InUp动画 * @param duration 动画时间 * @returns */ AST#method_declaration#Left static transitionInUp AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left...
export class AnimationHelper { static transitionInUp(duration: number = 300): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration * 0.4 }) .combine(TransitionEffect.OPACITY.animation({ duration: duration })), Tran...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/AnimationHelper.ets#L22-L85
9de4a82a6916982db2c91590af627300b61dcdea
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/mine/StatsBar.ets
arkts
handleFavoriteClick
处理收藏点击
private handleFavoriteClick(): void { hilog.info(DOMAIN, TAG, 'Favorite stat clicked'); if (this.onFavoriteClick) { this.onFavoriteClick(); } }
AST#method_declaration#Left private handleFavoriteClick 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 ...
private handleFavoriteClick(): void { hilog.info(DOMAIN, TAG, 'Favorite stat clicked'); if (this.onFavoriteClick) { this.onFavoriteClick(); } }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/mine/StatsBar.ets#L30-L35
010302810a157aaa42df24081bbb90973fa51e20
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarUtils.ets
arkts
getCurrentLunarDate
获取当前农历日期 @returns 当前农历日期信息
static getCurrentLunarDate() { return LunarUtils.solarToLunar(new Date()); }
AST#method_declaration#Left static getCurrentLunarDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarUtils AST#expres...
static getCurrentLunarDate() { return LunarUtils.solarToLunar(new Date()); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L479-L481
9eab85afdb89e4c332c2cf3e16fcaa0e1baaf478
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/Index.ets
arkts
loadBirthdayData
加载生日数据
private async loadBirthdayData(): Promise<void> { try { // 获取今日生日 this.todayBirthdays = await this.contactService.getTodayBirthdayContacts(); // 获取即将到来的生日 this.upcomingBirthdays = await this.contactService.getUpcomingBirthdayContacts(7); } catch (error) { hilog.error(LogCons...
AST#method_declaration#Left private async loadBirthdayData 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 > ...
private async loadBirthdayData(): Promise<void> { try { this.todayBirthdays = await this.contactService.getTodayBirthdayContacts(); this.upcomingBirthdays = await this.contactService.getUpcomingBirthdayContacts(7); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, Log...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L70-L80
e71b71ed59518997001eb00ed0c034736be233aa
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/hilogmonitormanagement/src/main/ets/model/HiLogMonitorManagement.ets
arkts
registerCallback
TODO: 知识点: 注册日志回调函数
registerCallback(strLog: string, callBack : Function) : void { testNapi.setLogCallback(strLog, callBack); }
AST#method_declaration#Left registerCallback AST#parameter_list#Left ( AST#parameter#Left strLog : 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#primar...
registerCallback(strLog: string, callBack : Function) : void { testNapi.setLogCallback(strLog, callBack); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/hilogmonitormanagement/src/main/ets/model/HiLogMonitorManagement.ets#L26-L28
3e52c4fa0c0137ee41de96208c40db871746868a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
hmacSegment
消息认证码计算,分段,异步 @param data 传入的消息 @param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。 @param symKey 共享对称密钥(SymKey)。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度
static async hmacSegment(data: string, algName: string, symKey: cryptoFramework.SymKey, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> { let messageData = CryptoHelper.strToUint8Array(data, 'utf-8'); let mac = cryptoFramework.createMac(algName); await mac.init(symKey); //使用对称...
AST#method_declaration#Left static async hmacSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
static async hmacSegment(data: string, algName: string, symKey: cryptoFramework.SymKey, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> { let messageData = CryptoHelper.strToUint8Array(data, 'utf-8'); let mac = cryptoFramework.createMac(algName); await mac.init(symKey); f...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L609-L622
59a4fc93c14860b28116552f8e1b774e7544ef2d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/navigation/OrderLogisticsNav.ets
arkts
OrderLogisticsNav
@file 订单物流页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function OrderLogisticsNav(): void { OrderLogisticsPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function OrderLogisticsNav 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_cus...
@Builder export function OrderLogisticsNav(): void { OrderLogisticsPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/navigation/OrderLogisticsNav.ets#L8-L11
85a6164d7d9fd5b8f136eca5023c30476e5288cb
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
getActionSheet
显示底部操作菜单弹框 @param sheets 菜单项 @returns
static getActionSheet(sheets: Array<ActionSheetItemOptions> | Array<ResourceStr>, uiContext?: UIContext): ActionSheetBuilderProxy { return new ActionSheetBuilderProxy(sheets, uiContext); }
AST#method_declaration#Left static getActionSheet AST#parameter_list#Left ( AST#parameter#Left sheets : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ActionSheetItemOptions AST#primary_type#Right AS...
static getActionSheet(sheets: Array<ActionSheetItemOptions> | Array<ResourceStr>, uiContext?: UIContext): ActionSheetBuilderProxy { return new ActionSheetBuilderProxy(sheets, uiContext); }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L139-L142
6e10a8be68d0ff57fd6f33422cbfad8ba5ba421c
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/NetworkListDemoPage.ets
arkts
构建 Network List Demo 示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_base_network_list_title"), viewModel: this.vm }) { BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.NetworkListDemoContent() }); } ...
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#resource_expression#Left $r ( AST#expression#Left "app.string.demo_bas...
build() { AppNavDestination({ title: $r("app.string.demo_base_network_list_title"), viewModel: this.vm }) { BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.NetworkListDemoContent() }); } ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkListDemoPage.ets#L27-L38
9e47169e6901ddfbea9946f143c3e9d3ea90f94c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/PathUtility.ets
arkts
getRelativeDatabasePath
提取database目录下的相对路径 @param fullPath 完整路径(如"/data/app/.../database/mydb/test.db") @param context 应用上下文 @returns 相对路径(如"mydb/test.db")
static getRelativeDatabasePath(fullPath: string): string { // const dbDir = getAppContext().databaseDir + '/'; // 确保结尾有斜杠 const dbDir = AppConstants.rdbPath // 标准化路径格式(兼容Windows风格斜杠) const normalizedFull = fullPath.replace(/\\/g, '/'); const normalizedDir = dbDir.replace(/\\/g, '/'); // 验证路径是否...
AST#method_declaration#Left static getRelativeDatabasePath AST#parameter_list#Left ( AST#parameter#Left fullPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string...
static getRelativeDatabasePath(fullPath: string): string { const dbDir = AppConstants.rdbPath const normalizedFull = fullPath.replace(/\\/g, '/'); const normalizedDir = dbDir.replace(/\\/g, '/'); if (!normalizedFull.startsWith(normalizedDir)) { throw new Error('路径不属于应用数据库目录'); ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L77-L92
8e57a2536c8102d4ffa12983ea1db20165f143ea
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/types/map.ets
arkts
地图(矿坑)的类型声明
export interface TMapDataItem { name: string // 矿坑名称 description: string // 矿坑简述 finished: number // 矿坑达成深度 }
AST#export_declaration#Left export AST#interface_declaration#Left interface TMapDataItem 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 description : AST#type_ann...
export interface TMapDataItem { name: string description: string finished: number }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/types/map.ets#L5-L9
6d28418d1be9b59ed254642184742352bf946a12
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Alarm/PermissionManager.ets
arkts
requestCameraAndImagesPermission
请求相机+媒体权限(封装方法)
static async requestCameraAndImagesPermission( context: common.UIAbilityContext, rationale?: string | Resource ): Promise<boolean> { return await PermissionManager.requestPermissions( context, [...PermissionManager.PERMISSION_GROUP.CAMERA_AND_IMAGES], rationale ); }
AST#method_declaration#Left static async requestCameraAndImagesPermission 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 ...
static async requestCameraAndImagesPermission( context: common.UIAbilityContext, rationale?: string | Resource ): Promise<boolean> { return await PermissionManager.requestPermissions( context, [...PermissionManager.PERMISSION_GROUP.CAMERA_AND_IMAGES], rationale ); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/PermissionManager.ets#L266-L275
4ae0a79abb3c7fd779ac266140ca0d37c4f57ead
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
packingImage
packing二分方式循环压缩 @param compressedImageData:图片压缩的ArrayBuffer @param sourcePixelMap:原始待压缩图片的PixelMap @param maxCompressedImageByte:压缩目标图像字节长度 @param imageQuality:图片质量参数 @param imageFormat:当前只支持"image/jpeg"、"image/webp"、"image/png"和"image/heif"12+(不同硬件设备支持情况不同)。 @returns compressedImageData:返回二分packing压缩后的图片数据
static async packingImage(compressedImageData: ArrayBuffer, sourcePixelMap: image.PixelMap, maxCompressedImageByte: number, imageQuality: number, imageFormat: string = "image/jpeg"): Promise<ArrayBuffer> { //图片质量参数范围为0-100,这里以10为最小二分单位创建用于packing二分图片质量参数的数组。 const packingArray: number[] = []; const DICH...
AST#method_declaration#Left static async packingImage AST#parameter_list#Left ( AST#parameter#Left compressedImageData : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sourcePixelMap : AST#type_annotation#Left AST#prim...
static async packingImage(compressedImageData: ArrayBuffer, sourcePixelMap: image.PixelMap, maxCompressedImageByte: number, imageQuality: number, imageFormat: string = "image/jpeg"): Promise<ArrayBuffer> { const packingArray: number[] = []; const DICHOTOMY_ACCURACY = 10; for (let i = 0; i <= 1...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L238-L274
23373a0a358bede97aa2d2fac272291ab19f9001
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/AttributeUpdater.d.ets
arkts
Defines a modifier which can update attributes to native side. @implements AttributeModifier @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export declare class AttributeUpdater<T, C = Initializer<T>> implements AttributeModifier<T> { /** * Defines the normal update attribute function. * * @param { T } instance * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ applyNormalAttribute: und...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class AttributeUpdater AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right , AST#type_parameter#Left C = AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Initializer AST#typ...
export declare class AttributeUpdater<T, C = Initializer<T>> implements AttributeModifier<T> { applyNormalAttribute: undefined | ((instance: T) => void); applyPressedAttribute: undefined | ((instance: T) => void); applyFocusedAttribute: undefined | ((instance: T) => void); applyDisabledAttribute: undefined ...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/AttributeUpdater.d.ets#L44-L104
15a5e4cf8f35dd9a6f6b9c07effe3f818eeae704
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/GreetingGenerationService.ets
arkts
祝福语生成结果
export interface GreetingGenerationResult { success: boolean; content: string; alternatives: string[]; confidence: number; processingTime: number; isStreaming?: boolean; error?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingGenerationResult AST#object_type#Left { AST#type_member#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#ty...
export interface GreetingGenerationResult { success: boolean; content: string; alternatives: string[]; confidence: number; processingTime: number; isStreaming?: boolean; error?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L31-L39
ab4bc6ab7f810a39932851f142a631c074419047
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/demo/DemoNavigator.ets
arkts
toNavigationResult
跳转到结果回传示例页 @returns {Promise<DemoResult | undefined>} 返回结果 Promise
static toNavigationResult(): Promise<DemoResult | undefined> { return navigateToForResult<DemoResult>(DemoRoutes.NavigationResult); }
AST#method_declaration#Left static toNavigationResult 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#union_type#Left AST#primary_type#Left DemoResult AST#primary_type#Right | AST#p...
static toNavigationResult(): Promise<DemoResult | undefined> { return navigateToForResult<DemoResult>(DemoRoutes.NavigationResult); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L74-L76
229b1cdeabbe76dd13dedc6909049cfb493dbafd
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/Toast.ets
arkts
showSelectOptions
显示带确认选项的通用对话框 @param title - 对话框标题(支持字符串或资源引用) @param message - 对话框内容(可选) @param options - 按钮选项数组,每个选项包含文本、颜色和点击回调 @Param cancelTitle - 取消按钮 文本,undefined时有默认值,null时不添加取消按钮 @remarks - 自动处理按钮索引越界情况 - 支持动态生成的按钮样式和回调 - 错误会通过console.error输出 @example ```typescript showConfirm("提示", "确认删除吗?", [ { text: "取消", color: Color.Gray...
static showSelectOptions(title: string | ResourceStr, message?: string | ResourceStr, options?: ItemOption[], cancelTitle?: ResourceStr | null): void { // 转换按钮配置:提取text和color字段,适配showDialog接口 const btns: Button[] | undefined = options?.map((it): Button => ({ text: it.text, color: it.color ?? $r('app...
AST#method_declaration#Left static showSelectOptions AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#paramet...
static showSelectOptions(title: string | ResourceStr, message?: string | ResourceStr, options?: ItemOption[], cancelTitle?: ResourceStr | null): void { const btns: Button[] | undefined = options?.map((it): Button => ({ text: it.text, color: it.color ?? $r('app.color.colorPrimary') })); ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/Toast.ets#L76-L114
35170e3ced8f24f2068d8156e99e3ed27893a727
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CartRepository.ets
arkts
getCartCount
获取购物车商品总数量 @returns {Promise<number>} 商品总数
getCartCount(): Promise<number> { return this.dataSource.getCartCount(); }
AST#method_declaration#Left getCartCount 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 > AST#type_argumen...
getCartCount(): Promise<number> { return this.dataSource.getCartCount(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L90-L92
d3e2b87b71e85e998b766c7b61961eb919aef95e
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/KuwaharaTransformation.ets
arkts
KuwaharaTransformation
图片变换:桑原滤波效果
@Sendable export class KuwaharaTransformation extends PixelMapTransformation { private radius: number; constructor(radius: number) { super(); this.radius = radius; } getName(): string { return this.constructor.name + ';radius:' + this.radius; } async transform(context: Context, toTransform: P...
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class KuwaharaTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private radius : ...
@Sendable export class KuwaharaTransformation extends PixelMapTransformation { private radius: number; constructor(radius: number) { super(); this.radius = radius; } getName(): string { return this.constructor.name + ';radius:' + this.radius; } async transform(context: Context, toTransform: P...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/KuwaharaTransformation.ets#L22-L54
f4211a7be8ad781b5863e7fe597074022ff3dd88
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/ProfilePage.ets
arkts
AvatarRightContent
头像右侧内容 @returns {void} 无返回值
@Builder private AvatarRightContent(): void { SmallAvatar({ src: this.vm.getAvatarUrl() }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AvatarRightContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_sta...
@Builder private AvatarRightContent(): void { SmallAvatar({ src: this.vm.getAvatarUrl() }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L252-L257
343145114b26113ac0c36254ff654f09a87bb61e
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
runWithLoading
执行带加载状态的任务 @param {() => Promise<void>} task - 待执行任务 @returns {Promise<void>} Promise<void>
private async runWithLoading(task: () => Promise<void>): Promise<void> { if (this.loading) { return; } this.loading = true; try { await task(); } finally { this.loading = false; } }
AST#method_declaration#Left private async runWithLoading AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#function_type#Left 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#...
private async runWithLoading(task: () => Promise<void>): Promise<void> { if (this.loading) { return; } this.loading = true; try { await task(); } finally { this.loading = false; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets#L169-L179
7bc4bd0a5ca10d97c3719a82b5af4fe2cd0b5eb4
github
chenyy0708/wanharmony.git
00e95a536122accf51518d674989d12fafbf37c2
entry/src/main/ets/view/Article/ArticleList.ets
arkts
ArticleList
The news list component.
@Component export default struct ArticleList { @State articleModel: ArticleModel = new ArticleModel(); @Link currentIndex: number; @State data: ArticleBean[] = []; loadArticleData(isLoadMore: boolean, callback?: () => void) { if (isLoadMore) { this.articleModel.currentPage++; } else { this....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct ArticleList AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right articleModel : AST#type_annotation#Left AST#primary_type#Left ArticleModel AST#primary_type#Ri...
@Component export default struct ArticleList { @State articleModel: ArticleModel = new ArticleModel(); @Link currentIndex: number; @State data: ArticleBean[] = []; loadArticleData(isLoadMore: boolean, callback?: () => void) { if (isLoadMore) { this.articleModel.currentPage++; } else { this....
https://github.com/chenyy0708/wanharmony.git/blob/00e95a536122accf51518d674989d12fafbf37c2/entry/src/main/ets/view/Article/ArticleList.ets#L29-L155
1e7fcd1508237abc19654de79b42863d481970f0
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/controller/EditController.ets
arkts
undo
撤销操作,从栈顶撤销操作记录
undo(): CropData | MosaicData | PaletteData | TextInputData | undefined { Logger.i(MODULE, TAG, 'undo size:' + this.operateRecords.length); if (this.operateRecords.length > 0) { let record = this.operateRecords.pop(); this.onRecordsChanged(); if (record) { if (record.type === ImageEdit...
AST#method_declaration#Left undo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CropData AST#primary_type#Right | AST#primary_type#Left MosaicData AST#primary_type#Right | AST#primary_type#Left PaletteData AST#primary_type#Right | AST#primary_ty...
undo(): CropData | MosaicData | PaletteData | TextInputData | undefined { Logger.i(MODULE, TAG, 'undo size:' + this.operateRecords.length); if (this.operateRecords.length > 0) { let record = this.operateRecords.pop(); this.onRecordsChanged(); if (record) { if (record.type === ImageEdit...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/controller/EditController.ets#L100-L138
d183b21bfff5ad79e107cce72cbda4b501df4aef
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
Q1/grammar/entry/src/main/ets/pages/BuilderUI.ets
arkts
item
写在外面的自定义组件构建函数 方便多组件共同调用
@Builder function item(content:string){ Row() { Image(this.isDone ? $r('app.media.todo_ok') : $r('app.media.todo_default')) .width(20) .height(20) .margin(15) Text(content) .decoration({ type: this.isDone ? TextDecorationType.LineThrough : TextDecorationType.None }) } .background...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function item AST#parameter_list#Left ( AST#parameter#Left content : 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_...
@Builder function item(content:string){ Row() { Image(this.isDone ? $r('app.media.todo_ok') : $r('app.media.todo_default')) .width(20) .height(20) .margin(15) Text(content) .decoration({ type: this.isDone ? TextDecorationType.LineThrough : TextDecorationType.None }) } .background...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/grammar/entry/src/main/ets/pages/BuilderUI.ets#L26-L43
d0294188a93920af78f25c01b09d8f55b552de47
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MySetPage.ets
arkts
languageSheet
通过@Builder构建半模态展示界面
@Builder languageSheet() { Column() { Text('预下载') .fontSize(16) .textAlign(TextAlign.Center) .width('100%').height(56) ForEach(this.languageList,(value:string)=>{ Text(value) .fontSize(16) .textAlign(TextAlign.Start) .width('100%').height(56)...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right languageSheet 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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_el...
@Builder languageSheet() { Column() { Text('预下载') .fontSize(16) .textAlign(TextAlign.Center) .width('100%').height(56) ForEach(this.languageList,(value:string)=>{ Text(value) .fontSize(16) .textAlign(TextAlign.Start) .width('100%').height(56)...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MySetPage.ets#L178-L195
afe1357c9c5b6c1814214d0db8466c3b93910cc1
github
openharmony/communication_wifi
387ba7fa8f98578629a6148635a4d630b2b99aa1
wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/pages/component/dialog/inputComponent.ets
arkts
InputComponent
自定义输入弹窗
@CustomDialog export default struct InputComponent { title: string = '提示'; cancelVal: string= '取消'; confirmVal: string= '确定'; inputValLength: number = 15; //输入字符长度限制 @State inputHint: string= ''; @State inputValue: string = ''; @State inputType: number = InputType.Password; controller: CustomDialogContr...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct InputComponent AST#component_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '提...
@CustomDialog export default struct InputComponent { title: string = '提示'; cancelVal: string= '取消'; confirmVal: string= '确定'; inputValLength: number = 15; @State inputHint: string= ''; @State inputValue: string = ''; @State inputType: number = InputType.Password; controller: CustomDialogController; e...
https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/pages/component/dialog/inputComponent.ets#L20-L107
bf33f9aa48b14b7c1a4aaaba5f57f8871ffdea89
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets
arkts
getOsAccountInfo
获取帐号信息
async getOsAccountInfo(): Promise<account_osAccount.OsAccountInfo> { let accountMgr = account_osAccount.getAccountManager(); return await accountMgr.getCurrentOsAccount(); }
AST#method_declaration#Left async getOsAccountInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left account_osAccount . OsAccountInfo AST#qu...
async getOsAccountInfo(): Promise<account_osAccount.OsAccountInfo> { let accountMgr = account_osAccount.getAccountManager(); return await accountMgr.getCurrentOsAccount(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L88-L91
fa117f107b2353cf111246a4f299356f4068429b
gitee
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/view/ImageSelectComponent.ets
arkts
selectFromAlbum
从相册中选择图片并添加至图像数组
async selectFromAlbum() { let pixelMap = await IOUtils.getPixelMapFromAlbum(); this.images = [pixelMap, ...this.images]; this.selectedIndex = 0; this.smallScroller.scrollToIndex(0); }
AST#method_declaration#Left async selectFromAlbum AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pixelMap = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#e...
async selectFromAlbum() { let pixelMap = await IOUtils.getPixelMapFromAlbum(); this.images = [pixelMap, ...this.images]; this.selectedIndex = 0; this.smallScroller.scrollToIndex(0); }
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/view/ImageSelectComponent.ets#L56-L61
bfd7b8b431318fd6c8577b970c00ee0cf95281ac
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/animation/template4/Index.ets
arkts
组件二透明度 第二步:将状态变量设置到相关可动画属性接口
build() { Row() { // 组件一 Column() { } .rotate({ angle: this.rotateValue }) .backgroundColor('#317AF7') .justifyContent(FlexAlign.Center) .width(100) .height(100) .borderRadius(30) .onClick(() => { // 第三步:调用keyframeAnimateTo接口 this.getUICont...
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() { } .rotate({ angle: this.rotateValue }) .backgroundColor('#317AF7') .justifyContent(FlexAlign.Center) .width(100) .height(100) .borderRadius(30) .onClick(() => { this.getUIContext()?.keyframeAnimateTo({ ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/animation/template4/Index.ets#L23-L73
67fefb50ecec6c5e5fc4b2567b1124288fdb6cda
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
d2c
ASN.1格式的字符串转换成C1C2C3格式的字符 @param standard_data ASN.1格式的字符 @returns C1C3C2格式的字符
d2c(standard_data: string): string { let message: string = standard_data; if (!message.startsWith(ASN1Util.SEQUENCE)) { Logger.debug('转换SM2字符串出错'); } message = message.slice(ASN1Util.SEQUENCE.length, message.length); let sequence_lexHex: string = this.getLenHex(message); message = message...
AST#method_declaration#Left d2c AST#parameter_list#Left ( AST#parameter#Left standard_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ...
d2c(standard_data: string): string { let message: string = standard_data; if (!message.startsWith(ASN1Util.SEQUENCE)) { Logger.debug('转换SM2字符串出错'); } message = message.slice(ASN1Util.SEQUENCE.length, message.length); let sequence_lexHex: string = this.getLenHex(message); message = message...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L134-L156
3162796f2d241dd14c24244cf48f05ff29e9f9be
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets
arkts
getBottomAvoidHeight
获取主窗口底部导航条高度 @returns {callback: ((bottomAvoidHeight: number) => void)}
getBottomAvoidHeight(callback: ((bottomAvoidHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obt...
AST#method_declaration#Left getBottomAvoidHeight AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left bottomAvoidHeight : AST#type_annotation#Left ...
getBottomAvoidHeight(callback: ((bottomAvoidHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obt...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets#L86-L107
42e9d4db4dde6a7c04767e19b9e8c6860d19a81b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CustomAnimationTab/customanimationtab/src/main/ets/model/CustomAniamtionTabController.ets
arkts
自定义动效tab控制器,控制自定义动效Tab组件进行页签切换
export class CustomAnimationTabController extends SwiperController { // 状态监听器 private listener: (state: number) => void = (state: number) => {}; public changeIndex(index: number, useAnimation?: boolean | undefined): void { this.listener(1); super.changeIndex(index, useAnimation); } public setListene...
AST#export_declaration#Left export AST#class_declaration#Left class CustomAnimationTabController extends AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 状态监听器 AST#property_declaration#Left private listener : AST#type_annotation#Le...
export class CustomAnimationTabController extends SwiperController { private listener: (state: number) => void = (state: number) => {}; public changeIndex(index: number, useAnimation?: boolean | undefined): void { this.listener(1); super.changeIndex(index, useAnimation); } public setListener(func: ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/model/CustomAniamtionTabController.ets#L20-L32
6367e4d782df93ad2228cb7fe4abada4b567fce1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/LanguageDetector.ets
arkts
mapSystemLanguage
映射系统语言到支持的语言
private mapSystemLanguage(systemLanguage: string): SupportedLanguage { // 直接匹配 if (this.languageMapping.has(systemLanguage)) { return this.languageMapping.get(systemLanguage)!; } // 模糊匹配 - 只取语言代码部分 const languageCode = systemLanguage.split('-')[0]; for (const [key, value] of this.lang...
AST#method_declaration#Left private mapSystemLanguage AST#parameter_list#Left ( AST#parameter#Left systemLanguage : 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 Suppo...
private mapSystemLanguage(systemLanguage: string): SupportedLanguage { if (this.languageMapping.has(systemLanguage)) { return this.languageMapping.get(systemLanguage)!; } const languageCode = systemLanguage.split('-')[0]; for (const [key, value] of this.languageMapping.entries()) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L405-L416
4af9e67d62b4263d6799c73c3ab87a28e2652eb6
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/models/UserModel.ets
arkts
用户信息接口
export interface UserInfo { username: string; password: string; createdAt: number; lastLoginAt: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserInfo AST#object_type#Left { AST#type_member#Left username : 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 password : AST#type_annotation#L...
export interface UserInfo { username: string; password: string; createdAt: number; lastLoginAt: number; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/UserModel.ets#L9-L14
d2acc37e229dca63faa92de51bd6bd58725e86ac
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/array/ArrayStringUtils.ets
arkts
joinedWordsString
如果有词语,需要用空格连接,全部是单字汉字时,直接连接 如: 有词语: [中国, 今天,大,家里, 人口] -> "中国 今天 大 家里 人口" 全部是单字: [中,国,人] -> "中国人" @param seperator 默认是半角空格
static joinedWordsString(arr: string[], seperator: string = " "): string { // 如果只有一个词语时 if (arr.length === 1 && arr.filter(item => item.trim().length > 1).length > 0) { // 如果只有一个词语时,因为不会有空格连接,所以会被当成单个的字显示如:[中国] → [中] [国] // 所以,需要在后面添加空格再返回:如:"中国" -> "中国 " return arr.join('') + seperator; }...
AST#method_declaration#Left static joinedWordsString AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : AST#type_annota...
static joinedWordsString(arr: string[], seperator: string = " "): string { if (arr.length === 1 && arr.filter(item => item.trim().length > 1).length > 0) { ,因为不会有空格连接,所以会被当成单个的字显示如:[中国] → [中] [国] return arr.join('') + seperator; } return arr.filter(item => item.trim().length > 1).le...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayStringUtils.ets#L10-L21
fb2e696248aa21a42ddcbd1b27734637d327e309
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
onAction
Slide gesture recognition success callback. @param { Callback<GestureEvent> } event @returns { SwipeGesture } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
onAction(event: Callback<GestureEvent>): SwipeGesture;
AST#method_declaration#Left onAction AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right > AST#type_argume...
onAction(event: Callback<GestureEvent>): SwipeGesture;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L566-L566
6127eba3a048aa090313be82d82b92a613cab09f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/ResPath.ets
arkts
资源路径定义类 对应Kotlin的data class ResPath
export class ResPath { name: string; assetPath: string; filePath: string; constructor(name: string, assetPath: string, filePath: string = AppConstants.dataBasePath + assetPath) { this.name = name; this.assetPath = assetPath; this.filePath = filePath; let ext = PathUtility.getExtension...
AST#export_declaration#Left export AST#class_declaration#Left class ResPath AST#class_body#Left { AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left assetPath : AST#typ...
export class ResPath { name: string; assetPath: string; filePath: string; constructor(name: string, assetPath: string, filePath: string = AppConstants.dataBasePath + assetPath) { this.name = name; this.assetPath = assetPath; this.filePath = filePath; let ext = PathUtility.getExtension...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/ResPath.ets#L8-L32
033e92ed06ad854c1a6a9401c3d63aa4ccf1d3f5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fadingedge/src/main/ets/mainpage/MainPage.ets
arkts
promptToast
示例提示toast窗口
promptToast() { promptAction.showToast({ message: $r('app.string.fadingedge_prompt_message'), duration: Const.PROMPT_TOAST_DURATION }) }
AST#method_declaration#Left promptToast 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 promptAction AST#expression#Right . showToast AST#me...
promptToast() { promptAction.showToast({ message: $r('app.string.fadingedge_prompt_message'), duration: Const.PROMPT_TOAST_DURATION }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fadingedge/src/main/ets/mainpage/MainPage.ets#L172-L177
5b5b1af6c0e0bdb0bb98e109d21988f8d1a31146
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/data_operation_tools.ets
arkts
Inserts a number into given array in ascending order @param arr the array @param new_num the new number @returns a new array of result @author Generated by DeepSeek on 14th May, 2025, modified by awa_Liny
export function insert_into_array(arr: collections.Array<number>, new_num: number): collections.Array<number> { let left = 0; let right = arr.length; // 二分查找插入位置 while (left < right) { const mid = Math.floor((left + right) / 2); if (arr[mid] < new_num) { left = mid + 1; } else { right =...
AST#export_declaration#Left export AST#function_declaration#Left function insert_into_array AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left collections . Array AST#qualified_type#Right AST#type_arguments#Left < AST#type_anno...
export function insert_into_array(arr: collections.Array<number>, new_num: number): collections.Array<number> { let left = 0; let right = arr.length; while (left < right) { const mid = Math.floor((left + right) / 2); if (arr[mid] < new_num) { left = mid + 1; } else { right = mid; }...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L204-L225
881e36b5e2acaf0b0aa968f1ecb5f3655ac348f4
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
recognizeImageToText
识别图片转文字 @param pixelMap
recognizeImageToText(pixelMap: image.PixelMap) { if (!pixelMap) { promptAction.showToast({ message: $r('app.string.addressrecognize_recognize_image_fail_text'), duration: CommonConstants.TOAST_DURATION }); // 清除loading clearLoading(this.loadingId); return; } // ...
AST#method_declaration#Left recognizeImageToText AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bl...
recognizeImageToText(pixelMap: image.PixelMap) { if (!pixelMap) { promptAction.showToast({ message: $r('app.string.addressrecognize_recognize_image_fail_text'), duration: CommonConstants.TOAST_DURATION }); clearLoading(this.loadingId); return; } let vision...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets#L199-L236
7e235673512d1589d95978dee0c80ce75ee87e4f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
digestSegmentSync
摘要,分段,同步 @param data 待摘要的数据 @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度 @returns
static digestSegmentSync(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { let md = cryptoFramework.createMd(algName); let messageData = CryptoHelper.strToUint8Array(data, 'utf-8'); for (let i = 0; i < messageData.length; i += len) { let updateMessage =...
AST#method_declaration#Left static digestSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
static digestSegmentSync(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { let md = cryptoFramework.createMd(algName); let messageData = CryptoHelper.strToUint8Array(data, 'utf-8'); for (let i = 0; i < messageData.length; i += len) { let updateMessage =...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L550-L561
44f2732c61ae0beda308bc7fe495635ab9956ede
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets
arkts
removeTmpMp3File
删除指定ID的临时文件 @param idxx 音频唯一标识符
static async removeTmpMp3File(idxx: number): Promise<void> { const tempDir = AudioTool.getTmpSoundDir(); const tmpName = AudioTool.Configs.TmpFmt(idxx); const filePath = `${tempDir}/${tmpName}`; await AudioTool.removeFile(filePath); }
AST#method_declaration#Left static async removeTmpMp3File AST#parameter_list#Left ( AST#parameter#Left idxx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic...
static async removeTmpMp3File(idxx: number): Promise<void> { const tempDir = AudioTool.getTmpSoundDir(); const tmpName = AudioTool.Configs.TmpFmt(idxx); const filePath = `${tempDir}/${tmpName}`; await AudioTool.removeFile(filePath); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets#L120-L125
578af97fe346788825a3372afdbad7af48e5d67a
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
isEmpty
Check obj is empty @param {object} obj @return {boolean} true(empty)
isEmpty(obj: Object): boolean { return obj === undefined || obj === null || obj === ''; }
AST#method_declaration#Left isEmpty AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST...
isEmpty(obj: Object): boolean { return obj === undefined || obj === null || obj === ''; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets#L113-L115
80f30225e5756ae8bd2f5a9a9824ac8d86ebabbb
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatBotItemUI.ets
arkts
ChatBotItemUI
Bot聊天单元信息显示组件类
@Component export struct ChatBotItemUI { /** * 消息对象 */ public item: ChatMessage | null = null; /** * 文本对象 */ @State textMsg:string=''; aboutToAppear() { // this.typewriterFun(this.item.content); this.typewriterFun(this.item!.content!); } build(){ Column(){ //文本 Text...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChatBotItemUI AST#component_body#Left { /** * 消息对象 */ AST#property_declaration#Left public item : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChatMessage AST#primary_type#Right | AST#prima...
@Component export struct ChatBotItemUI { public item: ChatMessage | null = null; @State textMsg:string=''; aboutToAppear() { this.typewriterFun(this.item!.content!); } build(){ Column(){ Text(this.textMsg) .width('100%') .fontSize('18fp') .textAlign(...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatBotItemUI.ets#L7-L57
09bf44207a7a3bc3c51fc9440f743ced67973557
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets
arkts
getLineWidth
returns the width of limit line @return
public getLineWidth(): number { return this.mLineWidth; }
AST#method_declaration#Left public getLineWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expr...
public getLineWidth(): number { return this.mLineWidth; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L84-L86
c756e0bdf1b61bb9a08417d5a0a3a3535d56edd3
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyCenter.ets
arkts
avatar_onclick
头像点击事件
avatar_onclick(){ }
AST#method_declaration#Left avatar_onclick AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
avatar_onclick(){ }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyCenter.ets#L165-L167
8af74101449f89737a1c5206e24167b28c164813
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoProcessBaseWeb/entry/src/main/ets/pages/Index.ets
arkts
[End on_back_press] [EndExclude index] [EndExclude is_full] [EndExclude bind_pop] [EndExclude is_show]
build() { // [StartExclude index] Column() { // [Start raw_file] // [Start full_exit] Web({ src: $rawfile(/zh/.test(this.language) ? 'index_cn.html' : 'index_en.html'), controller: this.webController }) // [StartExclude full_exit] // [StartExclude is_full] ...
AST#build_method#Left build ( ) AST#build_body#Left { // [StartExclude index] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // [Start raw_file] // [Start full_exit] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_compo...
build() { Column() { Web({ src: $rawfile(/zh/.test(this.language) ? 'index_cn.html' : 'index_en.html'), controller: this.webController }) .zoomAccess(false) .width('100%') .height('100%') .expa...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoProcessBaseWeb/entry/src/main/ets/pages/Index.ets#L141-L219
eacc9ff33b705672e71efee8dd742e0c9b00ca5e
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets
arkts
@file 商品搜索页面 ViewModel @author Joker.X
@ObservedV2 export default class GoodsSearchViewModel extends BaseViewModel { }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class GoodsSearchViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { } AST#class_body#Righ...
@ObservedV2 export default class GoodsSearchViewModel extends BaseViewModel { }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets#L7-L9
65b25ebc168571b1128cdef3e88fc167215aabb0
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSVideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets
arkts
secondToTime
Seconds converted to HH:mm:ss. @param seconds Maximum video duration (seconds). @return Time after conversion.
secondToTime(seconds: number) { let time = `${CommonConstants.INITIAL_TIME_UNIT}${':'}${CommonConstants.INITIAL_TIME_UNIT}`; let hourUnit = CommonConstants.TIME_UNIT * CommonConstants.TIME_UNIT; let hour = Math.floor(seconds / hourUnit); let minute = Math.floor((seconds - hour * hourUnit) / CommonConsta...
AST#method_declaration#Left secondToTime AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef...
secondToTime(seconds: number) { let time = `${CommonConstants.INITIAL_TIME_UNIT}${':'}${CommonConstants.INITIAL_TIME_UNIT}`; let hourUnit = CommonConstants.TIME_UNIT * CommonConstants.TIME_UNIT; let hour = Math.floor(seconds / hourUnit); let minute = Math.floor((seconds - hour * hourUnit) / CommonConsta...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets#L10-L26
f0abeca9de510a7486cfc12c9edc86f9b33097ef
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidance3DES/entry/src/main/ets/pages/3des_ecb_encryption_decryption_asynchronous.ets
arkts
encryptMessagePromise
加密消息
async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('3DES192|ECB|PKCS7'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null); let encryptData = await cipher.doFinal(plainText); return encryptD...
AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par...
async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('3DES192|ECB|PKCS7'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null); let encryptData = await cipher.doFinal(plainText); return encryptD...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidance3DES/entry/src/main/ets/pages/3des_ecb_encryption_decryption_asynchronous.ets#L21-L26
644d65cff7ac3408723af48829f0eddef07d242d
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BasePickerBuilderProxy.ets
arkts
title
弹窗标题 @param title @returns
title(title: string) { this.builderOptions.title = title return this; }
AST#method_declaration#Left title 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_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#exp...
title(title: string) { this.builderOptions.title = title return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BasePickerBuilderProxy.ets#L49-L52
9cad7ca11be73d6d5308d0034c22261647269dea
github
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/model/data/MomentData.ets
arkts
动态下评论的数据结构 @param wid 用户wid @param name 用户名 @param context 评论内容 @param io 发送/接收
export class CommentData{ wid: string //用户wid name: string //用户名 context: string //评论内容 constructor
AST#export_declaration#Left export AST#ERROR#Left class CommentData { wid : AST#ERROR#Left string //用户wid name : string //用户名 context : AST#ERROR#Right string AST#ERROR#Right //评论内容 AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#...
export class CommentData{ wid: string name: string context: string constructor
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/data/MomentData.ets#L27-L32
9eaff55ea8cbe0194466d8ce21e33e2fd28aec71
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/NavigationView.ets
arkts
NavigationView
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct NavigationView { private arr: number[] = [0, 1, 2, 3] @State isActive: boolean = false @State dex: number = 0 @Link _position: Position; private componentKey: string; build() { Navigation() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number, ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavigationView AST#component_body#Left { AST#property_declaration#Left private arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_a...
@Component export struct NavigationView { private arr: number[] = [0, 1, 2, 3] @State isActive: boolean = false @State dex: number = 0 @Link _position: Position; private componentKey: string; build() { Navigation() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number, ...
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/NavigationView.ets#L16-L69
95fce5e00c8b6486c4de56efbec8a9ba4955d5b6
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/model/WindowModel.ets
arkts
destroySubWindow
销毁验证码登录子窗口(验证成功后调用) Destroy sub window after successful verification.
destroySubWindow() { if (this.subWindowClass === undefined) { Logger.error('subWindowClass is undefined, cannot destroy.'); return; } this.subWindowClass.destroyWindow((err) => { if (err.code) { Logger.error(`Failed to destroy the window. Code:${err.code}, message:${err.message}`);...
AST#method_declaration#Left destroySubWindow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWind...
destroySubWindow() { if (this.subWindowClass === undefined) { Logger.error('subWindowClass is undefined, cannot destroy.'); return; } this.subWindowClass.destroyWindow((err) => { if (err.code) { Logger.error(`Failed to destroy the window. Code:${err.code}, message:${err.message}`);...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/model/WindowModel.ets#L151-L164
8598b2efe13c6b9313f674dfa13e33dab730feb2
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.collections.d.ets
arkts
from
Creates an ArkTS Array from an array-like object. @param { ArrayLike<T> } arrayLike - An array-like object to convert to an ArkTS Array. @returns { Array<T> } A new Array instance @throws { BusinessError } 401 - Parameter error. @throws { BusinessError } 10200011 - The from method cannot be bound. @static @syscap Syst...
static from<T>(arrayLike: ArrayLike<T>): Array<T>;
AST#method_declaration#Left static from AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left arrayLike : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ArrayLike AST#type_arguments#Left < AST#type_ann...
static from<T>(arrayLike: ArrayLike<T>): Array<T>;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L481-L481
f2bcaaecac9ac8687032d50ec8918043b364e076
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/animation/ChartAnimator.ets
arkts
animateY
/** * Animates values along both the X and Y axes. * * @param durationMillisX animation duration along the X axis * @param durationMillisY animation duration along the Y axis * @param easingX EasingFunction for the X axis * @param easingY EasingFunction for the Y axis public animateXY(durationMillisX:number, duration...
public animateY(durationMillis: number): void;
AST#method_declaration#Left public animateY AST#parameter_list#Left ( AST#parameter#Left durationMillis : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar...
public animateY(durationMillis: number): void;
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/animation/ChartAnimator.ets#L202-L202
994d0a0a5cddeee24e3a3dd518337f8310f378a1
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets
arkts
Constructor. @param w @param h
constructor(w: number, h: number) { this.w = w; this.h = h; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left w : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left h : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A...
constructor(w: number, h: number) { this.w = w; this.h = h; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets#L32-L35
6c4534639618b850241c474a849f9ff3e61ac18e
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
工具类。 @author Jack Jiang(http://www.52im.net/thread-2792-1-1.html)
export default class ToolKits { /** 聊天界面全面屏状态栏背景色 */ static readonly chat_page_title_background_color = '#ffffff';//'#fafafa';//#2e3746';//'#2e3746'; /** 聊天界面全面屏状态栏文本颜色 */ static readonly chat_page_title_color = '#000000';//#ffffff'; /** * 退出系统。 * * @param context UIAbilityContext上下文对象 */ stat...
AST#export_declaration#Left export default AST#class_declaration#Left class ToolKits AST#class_body#Left { /** 聊天界面全面屏状态栏背景色 */ AST#property_declaration#Left static readonly chat_page_title_background_color = AST#expression#Left '#ffffff' AST#expression#Right ; AST#property_declaration#Right //'#fafafa';//#2e3746';//'#...
export default class ToolKits { static readonly chat_page_title_background_color = '#ffffff'; static readonly chat_page_title_color = '#000000'; static exitSystem(context: common.UIAbilityContext) { context.terminateSelf(); } static setStatusBarColor(context: common.BaseContext, status...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/ToolKits.ets#L23-L396
738f68e9af2fe547775d43dc22bc4da553f13dda
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/DrawerLayout.ets
arkts
aboutToAppear
单位vp
aboutToAppear(): void { //监听键盘高度 KeyboardUtil.onKeyboardListener((show: boolean, height: number) => { if (show) { this.bottom = px2vp(height); } else { this.bottom = 0; } }); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { //监听键盘高度 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#e...
aboutToAppear(): void { KeyboardUtil.onKeyboardListener((show: boolean, height: number) => { if (show) { this.bottom = px2vp(height); } else { this.bottom = 0; } }); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/DrawerLayout.ets#L23-L32
0e3fe59f4582c8b303fd17b602fd7c40334f0393
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/BreakpointState.ets
arkts
BreakpointState
全局断点状态
@ObservedV2 export class BreakpointState { @Trace current: BreakpointType = BreakpointType.SM; @Trace windowWidthVp: number = 0; /** * 更新窗口宽度并计算断点 * @param {number} windowWidthVp - 窗口宽度(vp) * @returns {void} 无返回值 * @example * state.updateByWidth(360); */ updateByWidth(windowWidthVp: number...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class BreakpointState AST#class_body#Left { AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right current : AST#type_annotation#Left AST#primary_type#Left BreakpointType AST#primary_type#Right AST#typ...
@ObservedV2 export class BreakpointState { @Trace current: BreakpointType = BreakpointType.SM; @Trace windowWidthVp: number = 0; updateByWidth(windowWidthVp: number): void { this.windowWidthVp = windowWidthVp; const next = this.resolveBreakpoint(windowWidthVp); if (this.current !== next) { ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L49-L184
6d0ff951fe0675166e7b5b0836a4160aaa936e13
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets
arkts
用于控制和反馈对应的NodeContianer上的节点的行为,需要与NodeContainer一起使用
export class MyNodeController extends NodeController { private rootnode: BuilderNode<Data[]> | null = null; // 必须要重写的方法,用于构建节点数、返回节点挂载在对应NodeContianer中 // 在对应NodeContianer创建的时候调用、或者通过rebuild方法调用刷新 makeNode(uiContext: UIContext): FrameNode | null { console.info(' uicontext is undifined : '+ (uiContext === un...
AST#export_declaration#Left export AST#class_declaration#Left class MyNodeController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootnode : AST#type_annotation#Left AST#union_type#Left ...
export class MyNodeController extends NodeController { private rootnode: BuilderNode<Data[]> | null = null; makeNode(uiContext: UIContext): FrameNode | null { console.info(' uicontext is undifined : '+ (uiContext === undefined)); if (this.rootnode != null) { return this.rootnode.getFrameN...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets#L55-L93
0239829086516af6a3af03d299da4a0713f23400
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleOfflineManager.ets
arkts
recordOfflineOperation
记录离线操作
async recordOfflineOperation( type: string, entityType: string, entityId: number ): Promise<void> { try { const operation: SimpleOfflineOperation = { id: `${type}_${entityType}_${entityId}_${Date.now()}`, type, entityType, entityId, timestamp: Date.now() ...
AST#method_declaration#Left async recordOfflineOperation AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left entityType : AST#type_annotation#Left AST#primary_type#Left string ...
async recordOfflineOperation( type: string, entityType: string, entityId: number ): Promise<void> { try { const operation: SimpleOfflineOperation = { id: `${type}_${entityType}_${entityId}_${Date.now()}`, type, entityType, entityId, timestamp: Date.now() ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleOfflineManager.ets#L67-L88
86150170df914c08baa510513216aedc66c2ce08
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets
arkts
setColorsByArrAndAlpha
Sets colors with a specific alpha value. @param colors @param alpha
public setColorsByArrAndAlpha(colors: number[], alpha: number): void { this.resetColors(); for (let color of colors) { this.addColor( ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)) ); } }
AST#method_declaration#Left public setColorsByArrAndAlpha AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left alpha : AST#type_an...
public setColorsByArrAndAlpha(colors: number[], alpha: number): void { this.resetColors(); for (let color of colors) { this.addColor( ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)) ); } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets#L230-L237
f9d68f05e26ad18ecead6b5c89b80b3f59f5d4f8
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
encodeAsym
非对称加密 @param encodeStr 待加密的字符串 @param pubKey 给定秘钥规格公钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64) @param isPem 是否为pem格式的key
static encodeAsym(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding, isPem: boolean): OutDTO<string> { //将公钥转换 let pubPair = isPem ? CryptoSyncUtil.convertPemPubKeyFromStr(pubKey, symAlgName) : ...
AST#method_declaration#Left static encodeAsym AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
static encodeAsym(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding, isPem: boolean): OutDTO<string> { let pubPair = isPem ? CryptoSyncUtil.convertPemPubKeyFromStr(pubKey, symAlgName) : Cry...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L276-L293
8e927709312c843d8d4bad37eab4e5936e6d0817
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
getWifiStatus
查询WLAN是否已使能,可以帮助用户快速了解自己是否可以使用Wi-Fi网络进行连接。 当Wi-Fi跟蜂窝同时存在时,有助于实现网络连接的无缝切换。 @returns true:已使能, false:未使能
getWifiStatus(): boolean { try { let isWifiActive: boolean = wifiManager.isWifiActive(); return isWifiActive; } catch (error) { logger.error('failed:' + JSON.stringify(error)); } return false; }
AST#method_declaration#Left getWifiStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left ...
getWifiStatus(): boolean { try { let isWifiActive: boolean = wifiManager.isWifiActive(); return isWifiActive; } catch (error) { logger.error('failed:' + JSON.stringify(error)); } return false; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets#L221-L229
254c24ce36af3bfbd9a276e9ce29c2d9a70b3383
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/ScatterDataSet.ets
arkts
setShapeRenderer
Sets a new IShapeRenderer responsible for drawing this DataSet. This can also be used to set a custom IShapeRenderer aside from the default ones. @param shapeRenderer
public setShapeRenderer(shapeRenderer: IShapeRenderer): void { this.mShapeRenderer = shapeRenderer; }
AST#method_declaration#Left public setShapeRenderer AST#parameter_list#Left ( AST#parameter#Left shapeRenderer : AST#type_annotation#Left AST#primary_type#Left IShapeRenderer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ...
public setShapeRenderer(shapeRenderer: IShapeRenderer): void { this.mShapeRenderer = shapeRenderer; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L111-L113
e59048e9a3cc8751d2b6eb36fb075c576d9d913f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/constants/Contants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { static readonly PEN_STROKE_WIDTH: number = 10; // 画笔线宽 static readonly GRADIENT_LEVELS: number = 9; // 渐变色阶数 static readonly GRADIENT_START_POINT: number = 30; // 渐变开始点的亮度值 static readonly GRADIENT_END_POINT: number = 90; // 渐变结束点的亮度值 static readonly DIVIDER_STROKE_WIDTH: number = 1; ...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly PEN_STROKE_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#...
export class Constants { static readonly PEN_STROKE_WIDTH: number = 10; static readonly GRADIENT_LEVELS: number = 9; static readonly GRADIENT_START_POINT: number = 30; static readonly GRADIENT_END_POINT: number = 90; static readonly DIVIDER_STROKE_WIDTH: number = 1; static readonly GRID_TEMPLATE_UINT: ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/constants/Contants.ets#L16-L27
4aa8501e42cc1ddfca354e24ac72edefeebc4061
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
cleanupServices
清理服务资源
private async cleanupServices(): Promise<void> { try { // 关闭数据库连接 await DatabaseService.getInstance().closeDatabase(); console.log('[EntryAbility] Services cleaned up successfully'); hilog.info(0x0001, 'AI生日提醒', 'Services cleaned up successfully'); } catch (error) { console.error(...
AST#method_declaration#Left private async cleanupServices 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 > A...
private async cleanupServices(): Promise<void> { try { await DatabaseService.getInstance().closeDatabase(); console.log('[EntryAbility] Services cleaned up successfully'); hilog.info(0x0001, 'AI生日提醒', 'Services cleaned up successfully'); } catch (error) { console.error(`[EntryAbi...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L139-L151
ae8e97f9caf10f0d3babc7882656765e085f4f69
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets
arkts
default constructor
constructor(entries?: LegendEntry[]) { super(); this.mTextSize = 20; this.mXOffset = 5; this.mYOffset = 3; if (entries != null && entries != undefined) { if (entries.length == 0) { throw new Error('entries array is NULL'); } this.mEntries.concat(entries); } }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left entries ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left LegendEntry [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen...
constructor(entries?: LegendEntry[]) { super(); this.mTextSize = 20; this.mXOffset = 5; this.mYOffset = 3; if (entries != null && entries != undefined) { if (entries.length == 0) { throw new Error('entries array is NULL'); } this.mEntries.concat(entries); } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets#L130-L141
67f897ebebed707437059754cd271234c494c2df
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/marquee/src/main/ets/utils/MarqueeSection.ets
arkts
scrollAnimation
文本滚动函数
scrollAnimation() { // 文本宽度小于Scroll组件宽度,不执行滚动操作 if (this.ticketCheckTextWidth < this.ticketCheckScrollWidth) { return; } /** * 文本跑马灯动画。可以控制文本向左或者向右滚动,每隔1s再次滚动。 * * 性能:播放动画时,系统需要在一个刷新周期内完成动画变化曲线的计算,完成组件布局绘制等操作。建议使用系统提供的动画接口, * 只需设置曲线类型、终点位置、时长等信息,就能够满足常用的动画功能,减少UI主线程的负载。 * ...
AST#method_declaration#Left scrollAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 文本宽度小于Scroll组件宽度,不执行滚动操作 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#memb...
scrollAnimation() { if (this.ticketCheckTextWidth < this.ticketCheckScrollWidth) { return; } animateTo({ duration: this.marqueeAnimationModifier.duration, tempo: this.marqueeAnimationModifier.tempo, curve: Curve.Linear, onFinish: () => { this.ticketCh...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/utils/MarqueeSection.ets#L55-L96
3494593437eddf52b668b008518bfe765ce1e63c
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/pages/NavPathManager.ets
arkts
popTo
返回到指定路径 @param target 目标路径字符串
popTo(index: number, animated?: boolean) { this._navPath.popToIndex(index, animated ?? true) }
AST#method_declaration#Left popTo AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Righ...
popTo(index: number, animated?: boolean) { this._navPath.popToIndex(index, animated ?? true) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L64-L66
a4371175687c249c2c790795e3eec150a40af740
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
onBLECharacteristicChange
订阅服务端的特征值变化
private onBLECharacteristicChange() { Log.showInfo(TAG, `onBLECharacteristicChange`); if (!this.mGattClientDevice) { Log.showInfo(TAG, `onBLECharacteristicChange: mGattClientDevice is null`); return; } // TODO 知识点: 订阅特征值变化事件 this.mGattClientDevice.on('BLECharacteristicChange', (data: ble...
AST#method_declaration#Left private onBLECharacteristicChange 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 Log AST#expression#Right . sho...
private onBLECharacteristicChange() { Log.showInfo(TAG, `onBLECharacteristicChange`); if (!this.mGattClientDevice) { Log.showInfo(TAG, `onBLECharacteristicChange: mGattClientDevice is null`); return; } this.mGattClientDevice.on('BLECharacteristicChange', (data: ble.BLECharacteristic) =>...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L320-L337
da518ac9d7897fca110d729a5aeef466e43d9fbb
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/CrashUtil.ets
arkts
getFilePath
获取日志文件路径(用于读取日志文件、导出日志文件)。 @returns
static getFilePath(): string { if (CrashUtil.errorFilePath === undefined) { CrashUtil.errorFilePath = FileUtil.getFilesDirPath("harmony_utils_log", "ExceptionLog.json"); //错误日志文件路径 } return CrashUtil.errorFilePath; }
AST#method_declaration#Left static getFilePath AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#bin...
static getFilePath(): string { if (CrashUtil.errorFilePath === undefined) { CrashUtil.errorFilePath = FileUtil.getFilesDirPath("harmony_utils_log", "ExceptionLog.json"); } return CrashUtil.errorFilePath; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L100-L105
d536ef998c024b1d9f20b93d7da1aab5be2cf2d7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/PopupStyle.ets
arkts
popupBuilder
popup构造器定义弹框内容
@Builder popupBuilder() { Row({ space: 2 }) { Image($r('app.media.app_icon')).width(24).height(24).margin({ left: 5 }) Text('This is Custom Popup').fontSize(15) }.width(200).height(50).padding(5) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right popupBuilder 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#component_parameters#Left { AST#component_parameter...
@Builder popupBuilder() { Row({ space: 2 }) { Image($r('app.media.app_icon')).width(24).height(24).margin({ left: 5 }) Text('This is Custom Popup').fontSize(15) }.width(200).height(50).padding(5) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/PopupStyle.ets#L23-L29
25efd2bf2256a48099b1ae16944fb76a59554ecd
gitee
euler1129/Cloud-flash-payment.git
dfb70c1c67b3b69447f4384661e16b60f40495de
entry/src/main/ets/pages/preferentialPage/foreignSelection.ets
arkts
myList
数组遍历
@Builder myList(arr:object[]){List({space:15}) {ForEach(arr, (cityList) => { ListItemGroup({ header: this.GroupHeader(cityList.k) }) { ForEach(cityList.v, (item) => { ListItem() { Row() { Text(item.city) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right myList AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left object [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_l...
@Builder myList(arr:object[]){List({space:15}) {ForEach(arr, (cityList) => { ListItemGroup({ header: this.GroupHeader(cityList.k) }) { ForEach(cityList.v, (item) => { ListItem() { Row() { Text(item.city) ...
https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/preferentialPage/foreignSelection.ets#L42-L70
ce8b885637351af31263c6e5651a5538f9531255
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/common/ErrorHandler.ets
arkts
createNetworkError
创建网络错误
static createNetworkError(originalError: Error, context?: ErrorContext): ErrorInfo { const errorInfo: ErrorInfo = { type: ErrorType.NETWORK, message: 'Network request failed', originalError, context, userMessage: '网络请求失败,请检查网络连接', suggestions: [ '检查WiFi或移动数据连接', '...
AST#method_declaration#Left static createNetworkError AST#parameter_list#Left ( AST#parameter#Left originalError : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context ? : AST#type_annotation#Left AST#primary_type#Left Err...
static createNetworkError(originalError: Error, context?: ErrorContext): ErrorInfo { const errorInfo: ErrorInfo = { type: ErrorType.NETWORK, message: 'Network request failed', originalError, context, userMessage: '网络请求失败,请检查网络连接', suggestions: [ '检查WiFi或移动数据连接', '...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/ErrorHandler.ets#L228-L242
25587154de6d7dba5bbf8dfd6de723cbd1de44af
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/EditInfoPage.ets
arkts
----------------------------------------------------------------------------------------
build() { Column(){ Text().height(40) //标题 Row(){ Image($r('app.media.return')) .width(20) .height(20) .margin(({left:5})) .onClick(()=>{ router.back() }) Text('编辑资料') .fontColor('#333333') .fontSize(...
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#expression#Right ) AST#...
build() { Column(){ Text().height(40) Row(){ Image($r('app.media.return')) .width(20) .height(20) .margin(({left:5})) .onClick(()=>{ router.back() }) Text('编辑资料') .fontColor('#333333') .fontSize(20) ...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/EditInfoPage.ets#L448-L657
53d7647d224d11dc6dc145b40ced236a32f819c7
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NumberUtil.ets
arkts
addDecimal
加法Decimal @param x @param y @returns
static addDecimal(x: Value, y: Value): Decimal { return Decimal.add(x, y); }
AST#method_declaration#Left static addDecimal AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AS...
static addDecimal(x: Value, y: Value): Decimal { return Decimal.add(x, y); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L219-L221
93099ef1508a58fe67a69a6262bc05afbea3e703
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/WorkItemModel.ets
arkts
视频信息,包括标题、视频地址、首帧图片、视频详情
export class WorkItem { date: string; // 日期 time: string; // 详细记录时间 author: string; // 作者 videoSrc: string; // 视频地址 trimmerSrc: string; // 裁剪过后的视频地址 firstImage: ResourceStr | PixelMap; // 首帧图片 labels: ResourceStr; // 标签 address: string; // 所在位置 isDayTop: boolean = false; // 当天的第一条 index: number = 0;...
AST#export_declaration#Left export AST#class_declaration#Left class WorkItem AST#class_body#Left { AST#property_declaration#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 日期 AST#property_declaration#Left time : AST#t...
export class WorkItem { date: string; time: string; author: string; videoSrc: string; trimmerSrc: string; firstImage: ResourceStr | PixelMap; labels: ResourceStr; address: string; isDayTop: boolean = false; index: number = 0; constructor(date: string = '', time: string = '', videoSrc: s...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/WorkItemModel.ets#L19-L45
c4f58431e28f58cd2e170ffff17691155f6dc941
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
sendUpcomingBirthdayNotification
发送即将到来的生日通知
public async sendUpcomingBirthdayNotification(contacts: Contact[], days: number): Promise<void> { if (!this.settings.enabled || !this.settings.notificationEnabled) { return; } try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Sending upcoming birthday notifi...
AST#method_declaration#Left public async sendUpcomingBirthdayNotification AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ...
public async sendUpcomingBirthdayNotification(contacts: Contact[], days: number): Promise<void> { if (!this.settings.enabled || !this.settings.notificationEnabled) { return; } try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Sending upcoming birthday notifi...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L177-L196
ac9835e77da4a5055dc32d6554f20cdf7eb00820
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusStyle.ets
arkts
FocusStyle
[Start focus_style_manage]
@Entry @Component export struct FocusStyle { build() { NavDestination() { Column({ space: 12 }) { Column({ space: 30 }) { Button('small black focus box') .focusBox({ margin: new LengthMetrics(0), strokeColor: ColorMetrics.rgba(0, 0, 0), ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FocusStyle AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#L...
@Entry @Component export struct FocusStyle { build() { NavDestination() { Column({ space: 12 }) { Column({ space: 30 }) { Button('small black focus box') .focusBox({ margin: new LengthMetrics(0), strokeColor: ColorMetrics.rgba(0, 0, 0), ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusStyle.ets#L20-L52
39646d4cd71028f829c10e03244bb41fa035d8af
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/CustomPopup.ets
arkts
CustomPopupExample
[Start custom_popup]
@Entry @Component export struct CustomPopupExample { @State customPopup: boolean = false; // popup构造器定义弹框内容 @Builder popupBuilder() { Row({ space: 2 }) { Image($r('app.media.app_icon')).width(24).height(24).margin({ left: 5 }) Text('This is Custom Popup').fontSize(15) }.width(200).height(50...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct CustomPopupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right customPopup : AST#type_annotation#Left AST#prima...
@Entry @Component export struct CustomPopupExample { @State customPopup: boolean = false; @Builder popupBuilder() { Row({ space: 2 }) { Image($r('app.media.app_icon')).width(24).height(24).margin({ left: 5 }) Text('This is Custom Popup').fontSize(15) }.width(200).height(50).padding(5) } ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/CustomPopup.ets#L17-L62
402b40aa1f01e62fda41829496e40294efbb325d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/social/SearchPage.ets
arkts
buildSearchTypes
构建搜索类型选择
@Builder buildSearchTypes() { if (this.hasSearched) { Scroll() { Row({ space: 0 }) { ForEach(this.searchTypes, (type) => { Column({ space: 4 }) { Row({ space: 4 }) { Image($r(`app.media.ic_${type.icon}`)) .width(16) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchTypes AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressio...
@Builder buildSearchTypes() { if (this.hasSearched) { Scroll() { Row({ space: 0 }) { ForEach(this.searchTypes, (type) => { Column({ space: 4 }) { Row({ space: 4 }) { Image($r(`app.media.ic_${type.icon}`)) .width(16) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/SearchPage.ets#L168-L217
4896c23f418cfc7576e5601cf6b2dd3939ceef9b
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Transformer.ets
arkts
Transformer class that contains all matrices and is responsible for transforming values into pixels on the screen and backwards.
export default class Transformer { /** * matrix to map the values to the screen pixels */ protected mMatrixValueToPx: Matrix = new Matrix(); /** * matrix for handling the different offsets of the chart */ protected mMatrixOffset: Matrix = new Matrix(); protected mViewPortHandler: ViewPortHandler; ...
AST#export_declaration#Left export default AST#class_declaration#Left class Transformer AST#class_body#Left { /** * matrix to map the values to the screen pixels */ AST#property_declaration#Left protected mMatrixValueToPx : AST#type_annotation#Left AST#primary_type#Left Matrix AST#primary_type#Right AST#type_anno...
export default class Transformer { protected mMatrixValueToPx: Matrix = new Matrix(); protected mMatrixOffset: Matrix = new Matrix(); protected mViewPortHandler: ViewPortHandler; protected matrix2D: Matrix2D = new Matrix2D(); protected resultPath: Path2D = new Path2D(); constructor(viewPortHandler: V...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L33-L426
32976c45573198fae514cf6ecf84e61275349d2c
gitee