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
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/contants/Constants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { // font family static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi'; static readonly HARMONY_HEI_TI_MEDIUM_FONT_FAMILY = 'HarmonyHeiTi-Medium'; static readonly HARMONY_HEI_TI_BOLD_FONT_FAMILY = 'HarmonyHeiTi-Bold'; // StatusBarContentColor static readonly StatusBarContentWhit...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { // font family AST#property_declaration#Left static readonly HARMONY_HEI_TI_FONT_FAMILY = AST#expression#Left 'HarmonyHeiTi' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static read...
export class Constants { static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi'; static readonly HARMONY_HEI_TI_MEDIUM_FONT_FAMILY = 'HarmonyHeiTi-Medium'; static readonly HARMONY_HEI_TI_BOLD_FONT_FAMILY = 'HarmonyHeiTi-Bold'; static readonly StatusBarContentWhiteColor: string = '#ffffff'; static r...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/contants/Constants.ets#L16-L93
50ca0c131c59ccf6eebbc17e661c4d2fe019f6af
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
JSCrash/entry/src/main/ets/pages/utils.ets
arkts
showDebug
Outputs debug-level logs. @param tag Identifies the log tag. @param format Indicates the log format string. @param args Indicates the log parameters. @since 7
static showDebug(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.DEBUG)) { hilog.debug(DOMAIN, TAG, tag + SYMBOL + format, args); } }
AST#method_declaration#Left static showDebug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static showDebug(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.DEBUG)) { hilog.debug(DOMAIN, TAG, tag + SYMBOL + format, args); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L36-L40
cbd45b0541b0efdf944e06023ae06384f0c29ff6
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
系统限制的最大快捷方式数量
private constructor() { this.initializeShortcuts(); }
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right ...
private constructor() { this.initializeShortcuts(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L46-L48
63c10d205db5242f322df452e53214d0b390015e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets
arkts
用于控制和反馈对应的NodeContainer上的节点的行为,需要与NodeContainer一起使用
export class MyNodeController extends NodeController { private builderNode: BuilderNode<[Data]> | null | undefined = null; private webController : webview.WebviewController | null | undefined = null; private rootNode : FrameNode | null = null; constructor(builderNode : BuilderNode<[Data]> | undefined, webContr...
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 builderNode : AST#type_annotation#Left AST#union_type#Le...
export class MyNodeController extends NodeController { private builderNode: BuilderNode<[Data]> | null | undefined = null; private webController : webview.WebviewController | null | undefined = null; private rootNode : FrameNode | null = null; constructor(builderNode : BuilderNode<[Data]> | undefined, webContr...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets#L48-L87
40fac3927549a676801027d155418ae4f0dbf852
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets
arkts
handleSuccess
处理成功响应 @param {NetworkPageData<T>} data - 分页数据 @returns {void} 无返回值
protected handleSuccess(data: NetworkPageData<T> | null): void { const pageData: NetworkPageData<T> = new NetworkPageData<T>(data ?? undefined); const list: Array<T> = pageData.list ?? []; const hasNextPage: boolean = this.calculateHasMore(pageData); if (this.currentPage === 1) { this.listData = ...
AST#method_declaration#Left protected handleSuccess AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left NetworkPageData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_anno...
protected handleSuccess(data: NetworkPageData<T> | null): void { const pageData: NetworkPageData<T> = new NetworkPageData<T>(data ?? undefined); const list: Array<T> = pageData.list ?? []; const hasNextPage: boolean = this.calculateHasMore(pageData); if (this.currentPage === 1) { this.listData = ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L90-L107
ddfc59311717676938aa940579cd4f90c0fae209
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
isDbInitialized
检查数据库是否已初始化
isDbInitialized(): boolean { return this.isInitialized; }
AST#method_declaration#Left isDbInitialized AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express...
isDbInitialized(): boolean { return this.isInitialized; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L73-L75
9b04441fa0779bb813456390d25ed9a2945659a2
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DatabaseService.ets
arkts
搜索结果
export class EpisodeSearchResult { episodes: Episode[] = []; total: number = 0; constructor(episodes: Episode[], total: number) { this.episodes = episodes; this.total = total; } }
AST#export_declaration#Left export AST#class_declaration#Left class EpisodeSearchResult AST#class_body#Left { AST#property_declaration#Left episodes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Episode [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Lef...
export class EpisodeSearchResult { episodes: Episode[] = []; total: number = 0; constructor(episodes: Episode[], total: number) { this.episodes = episodes; this.total = total; } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DatabaseService.ets#L8-L16
50f8563b84b693b2e7964b6099f7f62af842d2de
github
zhangyuhang0914/ArkTs-HarmonyOs.git
c9773cad7ebeee413f98ee1a57cc8fba91fecf7d
entry/src/main/ets/http/AxiosHttp.ets
arkts
定义接口响应包装类
export interface BaseResponse { //wanAndroid-API响应体 code: number msg: string //拓展xxx-API响应体 }
AST#export_declaration#Left export AST#interface_declaration#Left interface BaseResponse AST#object_type#Left { //wanAndroid-API响应体 AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left msg : AST#type...
export interface BaseResponse { code: number msg: string }
https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/http/AxiosHttp.ets#L15-L20
1aef0d50fd57d99cd9e7984aefd3ef38c7634bbd
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbilityForResult/entry/src/main/ets/pages/Login.ets
arkts
login
TODO 登录函数
login() { if (this.userName.trim().length > 0 && this.userName.match(/^\S*$/)&&this.passWord.trim().length > 0 && this.passWord.match(/^\S*$/)) { let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; // UIAbilityContext const RESULT_CODE: number = 1001; ...
AST#method_declaration#Left login AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left...
login() { if (this.userName.trim().length > 0 && this.userName.match(/^\S*$/)&&this.passWord.trim().length > 0 && this.passWord.match(/^\S*$/)) { let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; const RESULT_CODE: number = 1001; let abilityRe...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbilityForResult/entry/src/main/ets/pages/Login.ets#L56-L77
b602f6ceedce7b3da6c4b323e3cbc581a61b769a
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
interfaces/ets/ani/animator/ets/@ohos.animator.ets
arkts
native
set and get onFrame
private native setOnFrame(value: (progress: number) => void) : void;
AST#method_declaration#Left private native AST#ERROR#Left setOnFrame AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A...
private native setOnFrame(value: (progress: number) => void) : void;
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/interfaces/ets/ani/animator/ets/@ohos.animator.ets#L93-L93
34844a8cf7d7d9d70351f845b69aa424c2f87736
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setAxisMaxValue
Use setAxisMaximum(...) instead. @param max
public setAxisMaxValue(max: number): void { this.setAxisMaximum(max); }
AST#method_declaration#Left public setAxisMaxValue AST#parameter_list#Left ( AST#parameter#Left max : 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_ty...
public setAxisMaxValue(max: number): void { this.setAxisMaximum(max); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L766-L768
d098c0b5b2cdc1191fe250dcd8d1e68b95129623
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/LanguageDetector.ets
arkts
detectRegionLanguage
检测地区语言
async detectRegionLanguage(): Promise<LanguageDetectionResult> { try { const region = await this.getSystemRegion(); const mappedLanguage = this.regionMapping.get(region) || SupportedLanguage.EN_US; return { detectedLanguage: mappedLanguage, confidence: 0.6, source: D...
AST#method_declaration#Left async detectRegionLanguage 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 LanguageDetectionResult AST#primary_type#Right AST#type_anno...
async detectRegionLanguage(): Promise<LanguageDetectionResult> { try { const region = await this.getSystemRegion(); const mappedLanguage = this.regionMapping.get(region) || SupportedLanguage.EN_US; return { detectedLanguage: mappedLanguage, confidence: 0.6, source: D...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L257-L280
0406aa1b91cef115aa0a0949636ef4d87799af5a
github
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
initializeDeviceStatus
初始化设备状态 - 将所有设备设为关闭状态
initializeDeviceStatus(): void { console.info('初始化所有设备为关闭状态'); // 遍历设备,将所有设备设为关闭状态 this.deviceStatus.forEach(device => { device.isOn = false; }); }
AST#method_declaration#Left initializeDeviceStatus 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...
initializeDeviceStatus(): void { console.info('初始化所有设备为关闭状态'); this.deviceStatus.forEach(device => { device.isOn = false; }); }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L138-L144
3a9dde8449a8c0f26d4836dae5ff22b112b99b1e
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/IntroductionPage.ets
arkts
scrollToTop
Click the up arrow scroll to the beginning.
scrollToTop() { if (this.listPosition !== Const.LIST_POSITION_BEGIN) { this.scrollerForList.scrollTo({ xOffset: 0, yOffset: Const.SCROLL_UP_TOP_THRESHOLD, animation: { duration: this.offsetSum / Const.OFFSET_DIVIDE_RATIO, curve: Curve.Linear, } }) ...
AST#method_declaration#Left scrollToTop 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Lef...
scrollToTop() { if (this.listPosition !== Const.LIST_POSITION_BEGIN) { this.scrollerForList.scrollTo({ xOffset: 0, yOffset: Const.SCROLL_UP_TOP_THRESHOLD, animation: { duration: this.offsetSum / Const.OFFSET_DIVIDE_RATIO, curve: Curve.Linear, } }) ...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/IntroductionPage.ets#L280-L295
3d343be8a2c3c0d3fdca4f3a1461dfcc7e81d631
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/pages/Resource.ets
arkts
[EndExclude compile_resource_allocation_information]
export interface ResourceConfig { urlList: Array<string>, type: webview.OfflineResourceType, responseHeaders: Array<Header>, localPath: string, // 本地资源存放在rawfile目录下的路径 }
AST#export_declaration#Left export AST#interface_declaration#Left interface ResourceConfig AST#object_type#Left { AST#type_member#Left urlList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
export interface ResourceConfig { urlList: Array<string>, type: webview.OfflineResourceType, responseHeaders: Array<Header>, localPath: string, }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/pages/Resource.ets#L23-L28
65ca7a6bc4390efe37b3cace2d7c6392ad0291e8
gitee
fourseas1998/hos.RankingDemo.git
5a98167826252c3c2b5ac58fa9a3db29d5f49d02
entry/src/main/ets/view/ListItemComponent.ets
arkts
CircleText
排行-前三个的容器样式
@Builder CircleText(){ Row(){ Text(this.index.toString()) .fontSize(FontSize.SMALL) .fontWeight(FontWeight.Bold) .fontColor(Color.White) } .size( { width:ListItemComponentStyle.CIRCLE_RANKING_SIZE, height:ListItemComponentStyle.CIRCLE_RANKING_SIZE } ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CircleText AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#...
@Builder CircleText(){ Row(){ Text(this.index.toString()) .fontSize(FontSize.SMALL) .fontWeight(FontWeight.Bold) .fontColor(Color.White) } .size( { width:ListItemComponentStyle.CIRCLE_RANKING_SIZE, height:ListItemComponentStyle.CIRCLE_RANKING_SIZE } ...
https://github.com/fourseas1998/hos.RankingDemo.git/blob/5a98167826252c3c2b5ac58fa9a3db29d5f49d02/entry/src/main/ets/view/ListItemComponent.ets#L61-L77
c18e11eddccf344685546ec00a8e3a2efa204856
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets
arkts
VerifyCodeViewComponent
验证码组件:禁用选中、复制、光标
@Component export struct VerifyCodeViewComponent { popRouter: () => void = () => {}; build() { Column() { VerifyCodeComponentWithoutCursor({ popRouter: this.popRouter }) } .height('100%') .width('100%') .justifyContent(FlexAlign.Center) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VerifyCodeViewComponent AST#component_body#Left { AST#property_declaration#Left popRouter : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#L...
@Component export struct VerifyCodeViewComponent { popRouter: () => void = () => {}; build() { Column() { VerifyCodeComponentWithoutCursor({ popRouter: this.popRouter }) } .height('100%') .width('100%') .justifyContent(FlexAlign.Center) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets#L178-L189
5a75f7bdc9d7eebcc367b0030e8b443b1d279710
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/Renderer.ets
arkts
Abstract baseclass of all Renderers. @author Philipp Jahoda
export default abstract class Renderer { /** * the component that handles the drawing area of the chart and it's offsets */ protected mViewPortHandler: ViewPortHandler; constructor(viewPortHandler: ViewPortHandler) { this.mViewPortHandler = viewPortHandler; } }
AST#export_declaration#Left export default AST#class_declaration#Left abstract class Renderer AST#class_body#Left { /** * the component that handles the drawing area of the chart and it's offsets */ AST#property_declaration#Left protected mViewPortHandler : AST#type_annotation#Left AST#primary_type#Left ViewPortH...
export default abstract class Renderer { protected mViewPortHandler: ViewPortHandler; constructor(viewPortHandler: ViewPortHandler) { this.mViewPortHandler = viewPortHandler; } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/Renderer.ets#L22-L31
97c3ac3ba56fb66aa5d638c6c75d30a86e05971e
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/permission.ets
arkts
requestPermissions
第一次申请
async requestPermissions(list: Permissions[]) { // requestPermissionsFromUser // 权限能力控制 模块 let ctx = AppStorage.get<Context>('context') let manager = abilityAccessCtrl.createAtManager() // 创建实例 权限管理实例 if (ctx) { let res = await manager.requestPermissionsFromUser(ctx, list) // res.authRe...
AST#method_declaration#Left async requestPermissions AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_state...
async requestPermissions(list: Permissions[]) { let ctx = AppStorage.get<Context>('context') let manager = abilityAccessCtrl.createAtManager() if (ctx) { let res = await manager.requestPermissionsFromUser(ctx, list) return res.authResults.every(item => { return item == ...
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/permission.ets#L5-L22
5c64a2a53f255e2530f44dfffbf07b658628dbdb
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/base/BaseInputOptions.ets
arkts
TODO Base输入弹出框,参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export interface BaseInputOptions extends BaseContentOptions { text: string; //设置输入框当前的文本内容。 fontColor?: ResourceColor; //字体颜色 fontSize?: Length; //字体大小 placeholder?: ResourceStr; //设置无输入时的提示文本。 placeholderColor ?: ResourceColor //设置placeholder文本颜色。 inputBackgroundColor?: ResourceColor; //输入框背景 inputBord...
AST#export_declaration#Left export AST#interface_declaration#Left interface BaseInputOptions AST#extends_clause#Left extends BaseContentOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Rig...
export interface BaseInputOptions extends BaseContentOptions { text: string; fontColor?: ResourceColor; fontSize?: Length; placeholder?: ResourceStr; placeholderColor ?: ResourceColor inputBackgroundColor?: ResourceColor; inputBorder?: BorderOptions; inputHeight?: Length; defaultFocus?: bool...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/base/BaseInputOptions.ets#L26-L45
4a9282379dfcec5808457b659aa45d405be702f9
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/sns/hw/HWLoginManager.ets
arkts
login
核心登录方法(完全使用 async/await 模式)
async login(): Promise<SnsOneUser> { try { // 先尝试静默登录 return await this.silentLogin(); } catch (silentError) { hilog.warn(0x0000, this.TAG, `静默登录失败,拉起显式界面: ${JSON.stringify(silentError)}`); return await this.explicitLogin(); // 尝试显式登录 } }
AST#method_declaration#Left async login 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 SnsOneUser AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
async login(): Promise<SnsOneUser> { try { return await this.silentLogin(); } catch (silentError) { hilog.warn(0x0000, this.TAG, `静默登录失败,拉起显式界面: ${JSON.stringify(silentError)}`); return await this.explicitLogin(); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/sns/hw/HWLoginManager.ets#L23-L31
9ee332da350b5e94faa174ba46a6f99ed12bcbb7
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
AnimatorParams @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare class AnimatorParams { /** * Animate duration * * @type { ?number } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ duration?: number; /** * Animate curve * * @type { ?Curve | ICurve | string } ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class AnimatorParams AST#class_body#Left { /** * Animate duration * * @type { ?number } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */...
export declare class AnimatorParams { duration?: number; curve?: Curve | ICurve | string; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L461-L480
8b511dfc9492952155d736a8851c73e62fcd26a8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/DragAndExchange/casesfeature/dragandexchange/Index.ets
arkts
Launcher
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { Launcher } from './src/main/ets/pages/Launcher'
AST#export_declaration#Left export { Launcher } from './src/main/ets/pages/Launcher' AST#export_declaration#Right
export { Launcher } from './src/main/ets/pages/Launcher'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/DragAndExchange/casesfeature/dragandexchange/Index.ets#L16-L16
1c0100d748cc07aef642be88decb1cb3ff4f657d
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPicture/features/pictureView/src/main/ets/pages/PictureViewIndex.ets
arkts
PictureViewIndex
预览器主页
@Entry @Preview @Component export struct PictureViewIndex { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_MD; @State selectedPhoto: Resource = $r('app.media.photo'); build() { Column() { Flex({ direction: FlexDirection.Column, alignItems: I...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct PictureViewIndex AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expressio...
@Entry @Preview @Component export struct PictureViewIndex { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_MD; @State selectedPhoto: Resource = $r('app.media.photo'); build() { Column() { Flex({ direction: FlexDirection.Column, alignItems: I...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/features/pictureView/src/main/ets/pages/PictureViewIndex.ets#L11-L51
41449923c8f476812efd4bc5a1328b2bd7bf71fc
gitee
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/common/entity/CroppedImage.ets
arkts
定义一个名为CroppedImage的类,用于表示裁剪后的图像
export default class CroppedImage { public pixelMap: PixelMap; // pixelMap属性存储裁剪后的图像 public index: number; // index属性存储切割图像对应的索引 // 构造函数,接受一个PixelMap对象和一个整数索引作为参数 constructor(pixelMap: PixelMap, index: number) { this.pixelMap = pixelMap; this.index = index; } }
AST#export_declaration#Left export default AST#class_declaration#Left class CroppedImage AST#class_body#Left { AST#property_declaration#Left public pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // pixelMap属性存储裁剪后的图像 A...
export default class CroppedImage { public pixelMap: PixelMap; public index: number; constructor(pixelMap: PixelMap, index: number) { this.pixelMap = pixelMap; this.index = index; } }
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/entity/CroppedImage.ets#L2-L11
11212e897d45f73f86163c0950ce8a54ab7f4d5d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
流式输出状态接口
export interface StreamState { isStreaming: boolean; currentText: string; fullText: string; progress: number; wordIndex: number; estimatedTimeRemaining: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface StreamState AST#object_type#Left { AST#type_member#Left isStreaming : 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 currentText : AST#type_an...
export interface StreamState { isStreaming: boolean; currentText: string; fullText: string; progress: number; wordIndex: number; estimatedTimeRemaining: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L579-L586
de7f22af352367259db967896df6c3eea9936f5f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/BaseMsg.ets
arkts
动态信息
export class Trends { user: UserInfo; contents: ContentsType; dateTime: string; likeCount: number; commentCount: number; shareCount: number; constructor(user: UserInfo, contents: ContentsType, dateTime: string, linkCount: number, comentCount: number, shareCount: number) { this.user = user; this.c...
AST#export_declaration#Left export AST#class_declaration#Left class Trends AST#class_body#Left { AST#property_declaration#Left user : AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left contents : AST#typ...
export class Trends { user: UserInfo; contents: ContentsType; dateTime: string; likeCount: number; commentCount: number; shareCount: number; constructor(user: UserInfo, contents: ContentsType, dateTime: string, linkCount: number, comentCount: number, shareCount: number) { this.user = user; this.c...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/BaseMsg.ets#L47-L63
ecade47462e47539fd605063ad4d7e706a8c5326
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/multinavigation/source/multinavigation.ets
arkts
device info util
export class DeviceHelper { static readonly TYPE_DEFAULT = 'default'; static readonly TYPE_PHONE = 'phone'; static readonly TYPE_TABLET = 'tablet'; static readonly DEVICE_TYPE = deviceInfo.deviceType; /** * whether the device type is phone * * @returns true if is phone */ static isPhone(): bool...
AST#export_declaration#Left export AST#class_declaration#Left class DeviceHelper AST#class_body#Left { AST#property_declaration#Left static readonly TYPE_DEFAULT = AST#expression#Left 'default' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TYPE_PHONE = AST#expressio...
export class DeviceHelper { static readonly TYPE_DEFAULT = 'default'; static readonly TYPE_PHONE = 'phone'; static readonly TYPE_TABLET = 'tablet'; static readonly DEVICE_TYPE = deviceInfo.deviceType; static isPhone(): boolean { return (DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_PHONE || Dev...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/multinavigation/source/multinavigation.ets#L27-L106
1581146c220427e8b939cc33ec2b127aeba20eb6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/common/Utils.ets
arkts
展示按钮的toast告警弹窗
export function showCaseOnly() { promptAction.showToast({ message: $r('app.string.navdialog_show_case_only'), duration: Consts.WARN_TOAST_DURATION }) }
AST#export_declaration#Left export AST#function_declaration#Left function showCaseOnly AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi...
export function showCaseOnly() { promptAction.showToast({ message: $r('app.string.navdialog_show_case_only'), duration: Consts.WARN_TOAST_DURATION }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/common/Utils.ets#L21-L26
63c4e8cfc27ec911d6c0108aaf06478298cd924a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
数据导入导出格式枚举
export enum DataFormat { JSON = 'json', CSV = 'csv', EXCEL = 'excel' }
AST#export_declaration#Left export AST#enum_declaration#Left enum DataFormat AST#enum_body#Left { AST#enum_member#Left JSON = AST#expression#Left 'json' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CSV = AST#expression#Left 'csv' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left EXC...
export enum DataFormat { JSON = 'json', CSV = 'csv', EXCEL = 'excel' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L111-L115
fbc00d786f3f86ebdb6ac55aac0e64937561bf54
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsShippingServiceCard.ets
arkts
GoodsShippingServiceCard
@file 发货与服务卡片组件 @author Joker.X
@ComponentV2 export struct GoodsShippingServiceCard { /** * 构建发货与服务卡片 * @returns {void} 无返回值 */ build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium"), } }) { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsShippingServiceCard AST#component_body#Left { /** * 构建发货与服务卡片 * @returns {void} 无返回值 */ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#...
@ComponentV2 export struct GoodsShippingServiceCard { build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium"), } }) { IBestCellGroup({ inset: true, r...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsShippingServiceCard.ets#L9-L61
25bc01b3434a2a2a4a8d060cc054bf3c58a2f394
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/marquee/src/main/ets/model/DataSource.ets
arkts
getData
获取指定数据项
getData(index: number): TripDataType { return this.tripData[index]; }
AST#method_declaration#Left getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TripDataType AST#primary_type#Ri...
getData(index: number): TripDataType { return this.tripData[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/model/DataSource.ets#L89-L91
913cda4c28e79c71b88d8eb71fe656b9697fefed
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/argument_passing/argument_passing_006_F.ets
arkts
Introduction 参数传递-rest参数
export function argument_passing_006_F(taint_src : string) { let _t = taint_src; f("a","b","_"); }
AST#export_declaration#Left export AST#function_declaration#Left function argument_passing_006_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem...
export function argument_passing_006_F(taint_src : string) { let _t = taint_src; f("a","b","_"); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/argument_passing/argument_passing_006_F.ets#L6-L9
14cc82c11101479f9cb37a3c8b8ddc7e7120b8cf
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/ChatPage.ets
arkts
aboutToDisappear
界面被销毁时被调用。
aboutToDisappear() { // 取消事件通知 this.removeEvents(); }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 取消事件通知 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . removeEve...
aboutToDisappear() { this.removeEvents(); }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/ChatPage.ets#L75-L78
6397f11b9d16e04c75469cb32bc4908eece0ef54
github
Puiching-Memory/HOMOAPP_Q5.git
53e36a21984de7bf41b6fafc840fde013236b9d2
entry/src/main/ets/components/AudioCard.ets
arkts
getButtonColor
获取按钮背景色
private getButtonColor(): string { switch (this.state) { case PlaybackState.PLAYING: return '#FF6B6B'; // 红色表示播放中 case PlaybackState.LOADING: return '#FFD93D'; // 黄色表示加载中 case PlaybackState.PAUSED: return '#4CAF50'; // 绿色表示暂停 default: return '#4CAF50'; // 默认绿色...
AST#method_declaration#Left private getButtonColor 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#...
private getButtonColor(): string { switch (this.state) { case PlaybackState.PLAYING: return '#FF6B6B'; case PlaybackState.LOADING: return '#FFD93D'; case PlaybackState.PAUSED: return '#4CAF50'; default: return '#4CAF50'; } }
https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/components/AudioCard.ets#L22-L33
d73c4055dbe3821a9511db2fbda1befa4f890fe8
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
sharePdf
分享PDF文件 @param pdfPath - PDF文件路径 @param title - 分享标题(可选) @param summary - 分享描述(可选)
static sharePdf(pdfPath: string, title?: string, summary?: string): void { // 转换文件路径为URI格式 const uri = fileUri.getUriFromPath(pdfPath); // 创建PDF类型分享数据 const data = new systemShare.SharedData({ utd: utd.UniformDataType.PDF, // 明确PDF类型 uri: uri, title: title || '分享PDF文件' // 默认标题 })...
AST#method_declaration#Left static sharePdf AST#parameter_list#Left ( AST#parameter#Left pdfPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static sharePdf(pdfPath: string, title?: string, summary?: string): void { const uri = fileUri.getUriFromPath(pdfPath); const data = new systemShare.SharedData({ utd: utd.UniformDataType.PDF, uri: uri, title: title || '分享PDF文件' }); data.addRecord({ utd: utd.Un...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L51-L78
eb5436230ecfc4f999329687544983a26bf38132
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/auth/src/main/ets/view/LoginPage.ets
arkts
LoginPage
@file 登录页视图 @author Joker.X
@ComponentV2 export struct LoginPage { /** * 登录页 ViewModel */ @Local private vm: LoginViewModel = new LoginViewModel(); /** * 构建登录页 * @returns {void} 无返回值 */ build() { AppNavDestination({ title: $r("app.string.login_title"), viewModel: this.vm }) { this.LoginContent()...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct LoginPage AST#component_body#Left { /** * 登录页 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left LoginViewMode...
@ComponentV2 export struct LoginPage { @Local private vm: LoginViewModel = new LoginViewModel(); build() { AppNavDestination({ title: $r("app.string.login_title"), viewModel: this.vm }) { this.LoginContent(); } } @Builder private LoginContent() { MediumPaddingVer...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/auth/src/main/ets/view/LoginPage.ets#L10-L54
ac5b040165a18f547d2c3d0be7c8846303b7bb50
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
BptaUseResources/entry/src/main/ets/pages/Https.ets
arkts
onForeground
...
onForeground(): void { // Create an HTTP request based on the service requirements at the foreground let httpRequest: http.HttpRequest = http.createHttp(); // ... }
AST#method_declaration#Left onForeground 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 { // Create an HTTP request based on the service requirements at the foreground AST#statement#Left...
onForeground(): void { let httpRequest: http.HttpRequest = http.createHttp(); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseResources/entry/src/main/ets/pages/Https.ets#L12-L16
b4cef132bc1cfb1ff0ba53007bc25e7e486090f9
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseViewModel.ets
arkts
onDidBuild
组件构建完成(API 12+) @returns {void} 无返回值
onDidBuild(): void { }
AST#method_declaration#Left onDidBuild AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
onDidBuild(): void { }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseViewModel.ets#L25-L26
5f7fb912d834692c82ce155e2798d61c0154edaf
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
rebuildDatabase
重建数据库(生产环境不插入示例数据)
async rebuildDatabase(): Promise<void> { this.checkInitialization(); await this.dbManager.rebuildDatabase(); // 生产环境:不重新插入示例数据 // await this.insertSampleDataIfEmpty(); console.info('[DatabaseService] Database rebuilt (production mode - no sample data)'); }
AST#method_declaration#Left async rebuildDatabase AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_...
async rebuildDatabase(): Promise<void> { this.checkInitialization(); await this.dbManager.rebuildDatabase(); console.info('[DatabaseService] Database rebuilt (production mode - no sample data)'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L303-L309
452ba2f3d0dc941cbcad45789c3d72b71dd4f60f
github
Leeson-Wong/ark-layer.git
9efa3553414a6b1eee890e3858c8cdcb308535d7
core/Scene.ets
arkts
业务入口单元——场景 当前可以想到的场景有:首页、通话、会议、 功能的最小集,初始化功能模块集合是整体应用初始化树的子树 在不同设备商上,相同场景的表现形式不同,故包含的功能集合页不同 使用 Phase 配置支持灵活的阶段加载策略
export interface Scene { phase: Phase // 阶段配置,决定加载顺序和等待策略 sceneList: AppPropagation[] // 该阶段包含的服务列表 }
AST#export_declaration#Left export AST#interface_declaration#Left interface Scene AST#object_type#Left { AST#type_member#Left phase : AST#type_annotation#Left AST#primary_type#Left Phase AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 阶段配置,决定加载顺序和等待策略 AST#type_member#Left sceneList : AST#type_...
export interface Scene { phase: Phase sceneList: AppPropagation[] }
https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/Scene.ets#L11-L14
2a505157b4e9b5f4755cdd5d6958fd6bde335e42
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
cancel
取消升级
async cancel(): Promise<void> { this.setUpdateState(UpdateState.CHECK_SUCCESS); this.setDownloadProgress(0); await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); this.updateManager.cancel(); }
AST#method_declaration#Left async cancel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments...
async cancel(): Promise<void> { this.setUpdateState(UpdateState.CHECK_SUCCESS); this.setDownloadProgress(0); await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); this.updateManager.cancel(); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L208-L213
fffb891ff7299f1cda89b0a255668a6a196d95bc
gitee
texiwustion/chinese-herbal-shopping--arkts.git
3f71338f3c6d88bc74342e0322867f3a0c2c17d1
entry/src/main/ets/database/Rdb.ets
arkts
insertData
插入数据的方法,入参为表格的存储键值对,和回调函数
insertData(data: relationalStore.ValuesBucket, callback: Function = () => { }) { // 如果回调函数为空、或undefined 打印错误日志,退出方法 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'insertData() has no callback!'); return; } // 创建结果标识局部变量,默...
AST#method_declaration#Left insertData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : A...
insertData(data: relationalStore.ValuesBucket, callback: Function = () => { }) { if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'insertData() has no callback!'); return; } let resFlag: boolean = false; const...
https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/database/Rdb.ets#L74-L100
79564ca2ebf7f3a9a1327de9195835a6efaec368
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/products/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
如果UIAbility已在后台运行,在收到Router事件后会触发onNewWant生命周期回调
public onNewWant(want: Want): void { this.handleWantInfo(want); }
AST#method_declaration#Left public onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
public onNewWant(want: Want): void { this.handleWantInfo(want); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/products/entry/src/main/ets/entryability/EntryAbility.ets#L16-L18
0fa2762c9c9533cbb42a3e52bfb34053ad294168
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Box.ets
arkts
hashString
字符串哈希辅助方法 @param str - 输入字符串
private hashString(str: string): number { let hash = 0; if (str.length === 0) return hash; for (let i = 0; i < str.length; i++) { const char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; // 转换为32位整数 } return hash; }
AST#method_declaration#Left private hashString 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_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
private hashString(str: string): number { let hash = 0; if (str.length === 0) return hash; for (let i = 0; i < str.length; i++) { const char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; } return hash; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L100-L111
c529bf686e0fbde7f93f05a568172ca89212fb80
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
calculateAverageScore
计算考试平均分 @returns
calculateAverageScore(): number { if (this.mockExamCount === 0) { return 0; } return Math.ceil(this.mockExamScore.reduce((pre, next) => pre + next) / this.mockExamCount); }
AST#method_declaration#Left calculateAverageScore 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#if_statement#Left if ( AST#expression#Left AST#binary_expressi...
calculateAverageScore(): number { if (this.mockExamCount === 0) { return 0; } return Math.ceil(this.mockExamScore.reduce((pre, next) => pre + next) / this.mockExamCount); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L121-L126
987c84b1287e273669118e47188bd2708c997277
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/TaskManagement/ReminderAgentManager/entry/src/main/ets/util/TimeConversion.ets
arkts
dateToMillisecond
Converts the time units obtained in the date selection component to milliseconds
dateToMillisecond(year: number, month: number, day: number, hour: number, minute: number) { let nowTime: Date = new Date; let nowAllTime: number = nowTime.getFullYear() * YEAR_SECONDS + (nowTime.getMonth() + 1) * MONTH_SECONDS + nowTime.getDate() * DAY_SECONDS + nowTime.getHours() * HOUR_SECONDS + nowTime...
AST#method_declaration#Left dateToMillisecond AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
dateToMillisecond(year: number, month: number, day: number, hour: number, minute: number) { let nowTime: Date = new Date; let nowAllTime: number = nowTime.getFullYear() * YEAR_SECONDS + (nowTime.getMonth() + 1) * MONTH_SECONDS + nowTime.getDate() * DAY_SECONDS + nowTime.getHours() * HOUR_SECONDS + nowTime...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/TaskManagement/ReminderAgentManager/entry/src/main/ets/util/TimeConversion.ets#L39-L49
267f9401d6c06c46c5f51d7fd80a6c874ef3de64
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/LinkText.ets
arkts
---------- 组件构建 ----------
build() { // 使用Text作为根容器,内部嵌套Span实现多片段文本 Text() { ForEach(this.getLinkParts(), (item: TextSegment) => { // 使用三元表达式实现条件渲染 Span(item.text) .fontColor(item.isLink ? this.linkColor : this.normalColor) // 条件设置颜色 .fontSize(this.textStyle.fontSize) .decoration( ...
AST#build_method#Left build ( ) AST#build_body#Left { // 使用Text作为根容器,内部嵌套Span实现多片段文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#ERROR#Left ) AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ...
build() { Text() { ForEach(this.getLinkParts(), (item: TextSegment) => { Span(item.text) .fontColor(item.isLink ? this.linkColor : this.normalColor) .fontSize(this.textStyle.fontSize) .decoration( item.isLink && this.isLinkUnderline ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/LinkText.ets#L103-L127
4e44167680616e843b451541e927c696528b5b83
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DialogUtils.ets
arkts
initDialogDefault
初始化DialogOptions参数 @param options
private static initDialogDefault(options: DialogOptions) { options.title = options.title ?? DialogUtils.defaultConfig.title; options.subtitle = options.subtitle ?? DialogUtils.defaultConfig.subtitle; options.alignment = options.alignment ?? DialogUtils.defaultConfig.alignment; options.offset = options.o...
AST#method_declaration#Left private static initDialogDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression...
private static initDialogDefault(options: DialogOptions) { options.title = options.title ?? DialogUtils.defaultConfig.title; options.subtitle = options.subtitle ?? DialogUtils.defaultConfig.subtitle; options.alignment = options.alignment ?? DialogUtils.defaultConfig.alignment; options.offset = options.o...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L179-L223
99a6259b37340fea6bf0c65d2a03415563147fd5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
用户行为数据接口
export interface UserBehaviorData { userId: string; actions: UserAction[]; preferences: UserPreferences; interactions: InteractionHistory[]; demographics: UserDemographics; contextualFactors: ContextualFactors; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserBehaviorData AST#object_type#Left { AST#type_member#Left userId : 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 actions : AST#type_annotat...
export interface UserBehaviorData { userId: string; actions: UserAction[]; preferences: UserPreferences; interactions: InteractionHistory[]; demographics: UserDemographics; contextualFactors: ContextualFactors; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L69-L76
b2cec1e17f4974c79ab0f1525917050d688ba722
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/validation/ValidationUtil.ets
arkts
isValidPassword
验证密码是否有效(长度至少6位) @param {string} password - 密码 @returns {boolean} 是否有效
static isValidPassword(password: string): boolean { return password.length >= 6; }
AST#method_declaration#Left static isValidPassword AST#parameter_list#Left ( AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#pr...
static isValidPassword(password: string): boolean { return password.length >= 6; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/validation/ValidationUtil.ets#L78-L80
41c7a493eb1481f8a05ee376c64ccf01ff98f6d9
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets
arkts
isNotEmpty
判断字符串是否为非空。true为非空空,否则false @param str @returns
static isNotEmpty(str: string | undefined | null): boolean { return false === StringUtil.isEmpty(str); }
AST#method_declaration#Left static isNotEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Ri...
static isNotEmpty(str: string | undefined | null): boolean { return false === StringUtil.isEmpty(str); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets#L37-L39
b46f2e176f40c4043cb87ae4b9f68353a04b94aa
github
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/view/worker/WorkerListCard.ets
arkts
getAvatarColor
--- 辅助样式函数 ---
private getAvatarColor(status: WorkerStatus): string { if (status === WorkerStatus.DANGER) return '#FF4D4F'; if (status === WorkerStatus.FATIGUE) return '#FAAD14'; return '#007DFF'; // 正常蓝色 }
AST#method_declaration#Left private getAvatarColor AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left WorkerStatus 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...
private getAvatarColor(status: WorkerStatus): string { if (status === WorkerStatus.DANGER) return '#FF4D4F'; if (status === WorkerStatus.FATIGUE) return '#FAAD14'; return '#007DFF'; }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/view/worker/WorkerListCard.ets#L101-L105
dc927656960221c1529200fad95da2598f4a8502
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/UserUpdate.ets
arkts
handle
应用规则10:使用具体类型替代any
handle(data: Object): UpdateResult { // 规则10:参数需要显式类型标注 const client = this.client; if (client.user) { // 应用规则30:使用as进行类型断言 if ((client.user as any).equals(data)) { // 规则10:临时使用any处理动态方法 return { old: client.user, updated: client.user, }; } // 应用规则24...
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left data : 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 UpdateResult AST#primary_type#Righ...
handle(data: Object): UpdateResult { const client = this.client; if (client.user) { if ((client.user as any).equals(data)) { return { old: client.user, updated: client.user, }; } const oldUser = Util.cloneObject(client.user); client.u...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/UserUpdate.ets#L13-L39
9768c54c32c1e695a2f96361edb64f91607eaecf
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
handleBackAfterPayment
处理支付后的返回逻辑 @param {boolean} isPaySuccess - 是否支付成功 @returns {void} 无返回值
private handleBackAfterPayment(isPaySuccess: boolean): void { if (this.from === "confirm") { navigateBack(); OrderNavigator.toDetail(this.orderId); return; } if (isPaySuccess) { const result: RefreshResult = { refresh: true }; navigateBackWithResult(result); return; ...
AST#method_declaration#Left private handleBackAfterPayment AST#parameter_list#Left ( AST#parameter#Left isPaySuccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v...
private handleBackAfterPayment(isPaySuccess: boolean): void { if (this.from === "confirm") { navigateBack(); OrderNavigator.toDetail(this.orderId); return; } if (isPaySuccess) { const result: RefreshResult = { refresh: true }; navigateBackWithResult(result); return; ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets#L126-L140
f089f7cb85da3faa0b7fd460c84464a3b25baeb0
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseSameLayerRender/entry/src/main/ets/pages/DrawXCompAVPBtn.ets
arkts
videoBuilder
@Builder中为动态组件的具体组件内容。
@Builder function videoBuilder(params: Params) { VideoComponent({ params: params }) .backgroundColor(Color.Gray) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function videoBuilder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Params AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#b...
@Builder function videoBuilder(params: Params) { VideoComponent({ params: params }) .backgroundColor(Color.Gray) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseSameLayerRender/entry/src/main/ets/pages/DrawXCompAVPBtn.ets#L133-L137
a471a569e5590ba0799584b8bf25f00111501a41
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/swipercomponent/src/main/ets/utils/SwiperSection.ets
arkts
getOffSetX
计算偏移量 @param index:索引值 @returns
getOffSetX(index: number): number { const offsetIndex: number = this.getImgCoefficients(index); const tempOffset: number = Math.abs(offsetIndex); let offsetX: number = 0; if (tempOffset === 1) { // 根据图片层级系数来决定左右偏移量 offsetX = CommonConstants.SWIPER_OFFSET_X * offsetIndex; } return off...
AST#method_declaration#Left getOffSetX AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
getOffSetX(index: number): number { const offsetIndex: number = this.getImgCoefficients(index); const tempOffset: number = Math.abs(offsetIndex); let offsetX: number = 0; if (tempOffset === 1) { offsetX = CommonConstants.SWIPER_OFFSET_X * offsetIndex; } return offsetX; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/utils/SwiperSection.ets#L107-L116
4d34bad5cc36790e718562b32b732ee9f2474bb7
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/BookGroupType.ets
arkts
@author 2008 @datetime 2024/7/24 22:03 @className: BookGroupType
export interface BookGroupTypeParams { //类型 0 小说;1 漫画;2 有声书; type?: number, show?: boolean }
AST#export_declaration#Left export AST#interface_declaration#Left interface BookGroupTypeParams AST#object_type#Left { //类型 0 小说;1 漫画;2 有声书; AST#type_member#Left type ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left s...
export interface BookGroupTypeParams { type?: number, show?: boolean }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/BookGroupType.ets#L6-L10
32aa1ba3f635cbb794ae5baefc6fc78dde98ae32
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusScopePriority.ets
arkts
FocusScopePriority
[Start focus_scope_navigation]
@Entry @Component export struct FocusScopePriority { @State inputValue: string = ''; build() { NavDestination() { Column({ space: 12 }) { Scroll() { Row({ space: 20 }) { Column({ space: 20 }) { // 标记为Column1 Column({ space: 5 }) { Button('Grou...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FocusScopePriority AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right inputValue : AST#type_annotation#Left AST#primar...
@Entry @Component export struct FocusScopePriority { @State inputValue: string = ''; build() { NavDestination() { Column({ space: 12 }) { Scroll() { Row({ space: 20 }) { Column({ space: 20 }) { Column({ space: 5 }) { Button('Group1') ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusScopePriority.ets#L20-L149
7c760f9fba1814f273b7bb22da366f5b50916799
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/SettingsTypes.ets
arkts
AI设置接口(为AISettings别名)
export interface AISettings extends AIGreetingConfig { // 继承AIGreetingConfig的所有属性 }
AST#export_declaration#Left export AST#interface_declaration#Left interface AISettings AST#extends_clause#Left extends AIGreetingConfig AST#extends_clause#Right AST#object_type#Left { // 继承AIGreetingConfig的所有属性 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface AISettings extends AIGreetingConfig { }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L177-L179
cb842060f6c6aeb6d201e8a7560a8a2d3525064c
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
$_instantiate
Set the value. @param { function } factory @param { SwipeGestureHandlerOptions } value @returns { SwipeGesture } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
static $_instantiate(factory: () => SwipeGesture, value?: SwipeGestureHandlerOptions): SwipeGesture;
AST#method_declaration#Left static $_instantiate AST#parameter_list#Left ( AST#parameter#Left factory : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left SwipeGesture AST#primary_type#Right AST#type_annotation#Right AST...
static $_instantiate(factory: () => SwipeGesture, value?: SwipeGestureHandlerOptions): SwipeGesture;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L554-L554
3207c4b551cbf2ed5e5f86ef441cd9c2bacf36a6
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarSolarMappingService.ets
arkts
getSolarDatesInLunarMonth
获取指定农历月份的所有日期
async getSolarDatesInLunarMonth(year: number, lunarMonth: number): Promise<LunarSolarMapping[]> { await this.ensureYearMapping(year); const yearData = this.mappingCache.get(year); if (!yearData) return []; const result: LunarSolarMapping[] = []; for (const mapping of yearData.mappings.values()) {...
AST#method_declaration#Left async getSolarDatesInLunarMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lunarMonth : AST#type_annotation#Left AST#primary_type#Left numb...
async getSolarDatesInLunarMonth(year: number, lunarMonth: number): Promise<LunarSolarMapping[]> { await this.ensureYearMapping(year); const yearData = this.mappingCache.get(year); if (!yearData) return []; const result: LunarSolarMapping[] = []; for (const mapping of yearData.mappings.values()) {...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L263-L278
c5438012c9bebc8c9933fccc6c3eecdaa058733c
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets
arkts
The status of hover mode. @interface HoverStatus @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface HoverModeStatus { /** * The fold status of devices. * * @type { display.FoldStatus } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ foldStatus: display.FoldStatus; /** * Is the app currently in hover mode? * In hover mod...
AST#export_declaration#Left export AST#interface_declaration#Left interface HoverModeStatus AST#object_type#Left { /** * The fold status of devices. * * @type { display.FoldStatus } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left ...
export interface HoverModeStatus { foldStatus: display.FoldStatus; isHoverMode: boolean; appRotation: number; windowStatusType: window.WindowStatusType; }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets#L237-L282
c87589fc065439ef196f773c58f41308548e790a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets
arkts
实现TabDataSource接口的对象,用于tabs加载数据
export class TabDataSource extends BasicDataSource<TabDataModel> { private dataArray: TabDataModel[] = []; /** * 获取数据总数 * @returns */ public totalCount(): number { return this.dataArray.length; } /** * 获取索引对应的数据 * @param index 数组索引 * @returns */ public getData(index: number): TabD...
AST#export_declaration#Left export AST#class_declaration#Left class TabDataSource extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BasicDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TabDataModel AST#primary_type#Right AST#type_annotation#Right > AST#type...
export class TabDataSource extends BasicDataSource<TabDataModel> { private dataArray: TabDataModel[] = []; public totalCount(): number { return this.dataArray.length; } public getData(index: number): TabDataModel { return this.dataArray[index]; } public addData(index: number, data: TabDa...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets#L63-L99
fb0af8ba3624df99761ed25be088a353f52aad43
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
buildSwitchItem
构建开关项
@Builder buildSwitchItem(label: string, value: boolean, onChange: (value: boolean) => void) { Row() { Text(label) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_primary')) .layoutWeight(1) Toggle({ type: ToggleType.Switch, isOn: value }) .onChange(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSwitchItem AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Le...
@Builder buildSwitchItem(label: string, value: boolean, onChange: (value: boolean) => void) { Row() { Text(label) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_primary')) .layoutWeight(1) Toggle({ type: ToggleType.Switch, isOn: value }) .onChange(...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L705-L719
799e11a5901f4c199e3620753dc2b81234590ff4
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
startGame
开始游戏
async startGame(gameType: GameType, userId: string = 'default'): Promise<GameSession> { try { const config = this.gameConfigs.get(gameType); if (!config) { throw new Error(`Game config not found: ${gameType}`); } // 检查能量是否足够 // TODO: 检查虚拟货币中的能量 const session: GameSessio...
AST#method_declaration#Left async startGame AST#parameter_list#Left ( AST#parameter#Left gameType : AST#type_annotation#Left AST#primary_type#Left GameType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
async startGame(gameType: GameType, userId: string = 'default'): Promise<GameSession> { try { const config = this.gameConfigs.get(gameType); if (!config) { throw new Error(`Game config not found: ${gameType}`); } const session: GameSession = { id: `game_${Date...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L228-L262
a31df6da2a8d1059278f5a50945b2d201c173856
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Camera/entry/src/main/ets/pages/Camera.ets
arkts
resolutionChange
分辨率改变监听方法
resolutionChange() { Logger.info(TAG, `resolutionChange begin ${this.resolution}`); // 不支持 则为默认800*600 if (this.resolution == 0) { Logger.info(TAG, `resolutionChange ${this.resolution}`); this.cameraModel.setVideoFrameWH(VideoFrame.VIDEOFRAME_1920_1080); } else if (this.resolution == 1) { ...
AST#method_declaration#Left resolutionChange 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 Logger AST#expression#Right . info AST#member_e...
resolutionChange() { Logger.info(TAG, `resolutionChange begin ${this.resolution}`); if (this.resolution == 0) { Logger.info(TAG, `resolutionChange ${this.resolution}`); this.cameraModel.setVideoFrameWH(VideoFrame.VIDEOFRAME_1920_1080); } else if (this.resolution == 1) { Logger.info(TA...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Camera/entry/src/main/ets/pages/Camera.ets#L83-L102
376ecf5730bb87f8c9e4b5dcd2ac56fb6f83ac9c
gitee
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/views/dialog/BuiPopup.ets
arkts
用于代理dialog的打开和关闭
export interface BuiPopupController { open: () => void close: () => void }
AST#export_declaration#Left export AST#interface_declaration#Left interface BuiPopupController AST#object_type#Left { AST#type_member#Left open : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
export interface BuiPopupController { open: () => void close: () => void }
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/views/dialog/BuiPopup.ets#L10-L13
058bdfc0e424c7398712b20f72a8034141e3c08f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/filemanager/fileio/FileIoManager.ets
arkts
getFreeSize
剩余空间
async getFreeSize(): Promise<string> { let freeSize: number; try { freeSize = await storageStatistics.getFreeSize(); Logger.info(TAG, `getFreeSize successed, freeSize is ${freeSize}`); } catch (err) { let error: BusinessError = err as BusinessError; Logger.error(TAG, `getFreeSize fai...
AST#method_declaration#Left async getFreeSize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async getFreeSize(): Promise<string> { let freeSize: number; try { freeSize = await storageStatistics.getFreeSize(); Logger.info(TAG, `getFreeSize successed, freeSize is ${freeSize}`); } catch (err) { let error: BusinessError = err as BusinessError; Logger.error(TAG, `getFreeSize fai...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/filemanager/fileio/FileIoManager.ets#L69-L89
902b20403d5ca0d041f966fc56bae5cd736e9d14
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
queryAlarmsTasker
Refresh alarm task. @param callback (alarms: Array<AlarmItem>) => void
public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) { let that = this; that.queryDatabaseAlarms(callback); let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; preference.addPreferencesListener({ onDataChanged() { that.queryDatabaseA...
AST#method_declaration#Left public queryAlarmsTasker AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left alarms : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type...
public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) { let that = this; that.queryDatabaseAlarms(callback); let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; preference.addPreferencesListener({ onDataChanged() { that.queryDatabaseA...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets#L69-L78
41c11c61a02a84583e2db0d44e394373400f480b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets
arkts
CustomSearch
搜索视图
@Builder CustomSearch() { Row() { Image($r('app.media.video_list_autoplay_drawer_filled')) .width($r('app.integer.video_list_autoplay_custom_search_image')) .height($r('app.integer.video_list_autoplay_custom_search_image')) .onClick(() => { // 调用Toast显示提示:此样式仅为案例展示 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CustomSearch AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_elemen...
@Builder CustomSearch() { Row() { Image($r('app.media.video_list_autoplay_drawer_filled')) .width($r('app.integer.video_list_autoplay_custom_search_image')) .height($r('app.integer.video_list_autoplay_custom_search_image')) .onClick(() => { promptAction.showToast...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets#L70-L119
098056d740058190b372d26f1b41e9722c5138eb
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BubbleData.ets
arkts
setHighlightCircleWidth
Sets the width of the circle that surrounds the bubble when highlighted for all DataSet objects this data object contains, in vp. @param width
public setHighlightCircleWidth(width: number): void { if (this.mDataSets) { let dataSource = this.mDataSets.dataSource; for (let sets of dataSource) { sets.setHighlightCircleWidth(width); } } }
AST#method_declaration#Left public setHighlightCircleWidth AST#parameter_list#Left ( AST#parameter#Left width : 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#...
public setHighlightCircleWidth(width: number): void { if (this.mDataSets) { let dataSource = this.mDataSets.dataSource; for (let sets of dataSource) { sets.setHighlightCircleWidth(width); } } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BubbleData.ets#L31-L39
66d141c8cd84953035ed05cee54f3421f3afc733
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets
arkts
isSpecSelected
判断规格是否选中
isSpecSelected(goodsId: number, specId: number): boolean { const specs = this.selectedItems.get(goodsId); return specs ? specs.has(specId) : false; }
AST#method_declaration#Left isSpecSelected AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
isSpecSelected(goodsId: number, specId: number): boolean { const specs = this.selectedItems.get(goodsId); return specs ? specs.has(specId) : false; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets#L270-L273
203a65daecb5b2c7eff2c6924c67a274c0cbdcea
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/QuizManager.ets
arkts
get
获取单例实例 类似Swift的static let shared = QuizManager()
public static get shared(): QuizManager { if (!QuizManager.instance) { QuizManager.instance = new QuizManager(); } return QuizManager.instance; }
AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left QuizManager AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_state...
public static get shared(): QuizManager { if (!QuizManager.instance) { QuizManager.instance = new QuizManager(); } return QuizManager.instance; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/QuizManager.ets#L76-L81
830f0f9cf70511a6f7ba608005f8385d1668d2ce
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FoldableGuilde/entry/src/main/ets/modules/PinchText.ets
arkts
PinchText
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct PinchText { text: string = '亲近大海,领悟海,体会到了海的心声,海自然与你共鸣,无需可以强求,也无需费力搜寻,海,始终都会以潮声与你相亲,已其海色伴你舒适。'; @State textFontSize: number = 26; build() { Column() { Text(this.text).fontSize(this.textFontSize) } .gesture(PinchGesture({ fingers: 2 }).onActionUpdate((event: GestureEv...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PinchText AST#component_body#Left { AST#property_declaration#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '亲近大海,领悟海,体会到了海的心声,...
@Component export struct PinchText { text: string = '亲近大海,领悟海,体会到了海的心声,海自然与你共鸣,无需可以强求,也无需费力搜寻,海,始终都会以潮声与你相亲,已其海色伴你舒适。'; @State textFontSize: number = 26; build() { Column() { Text(this.text).fontSize(this.textFontSize) } .gesture(PinchGesture({ fingers: 2 }).onActionUpdate((event: GestureEv...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/modules/PinchText.ets#L16-L36
aa0bff1a20fdc88bf3211945f7e9a555fe605aa8
gitee
linhanlove/hormany-os-notion
a65f47bfc1a2bbce531b9af97831eb1ba934c2f8
entry/src/main/ets/common/utils.ets
arkts
some utils function 非空验证 param [string | string[]] return [boolean false 未通过 true 通过]
export const nonNullValidation = (params:string|string[]):boolean => { let validation:boolean = false if ( typeof params === 'object' && Array.isArray(params)) { params.forEach(item=>{ validation = item===''?false:true }) }else{ validation = params===''?false:true } return validation }
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left nonNullValidation = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST...
export const nonNullValidation = (params:string|string[]):boolean => { let validation:boolean = false if ( typeof params === 'object' && Array.isArray(params)) { params.forEach(item=>{ validation = item===''?false:true }) }else{ validation = params===''?false:true } return validation }
https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/common/utils.ets#L11-L21
672cd5d2509c72d4c6e6ecb9200574d553434674
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/validation/ValidationUtil.ets
arkts
@file 验证工具类 @author Joker.X
export class ValidationUtil { /** * 手机号校验正则 */ private static readonly PHONE_REGEX: RegExp = /^1[3-9]\d{9}$/; /** * 邮箱校验正则 */ private static readonly EMAIL_REGEX: RegExp = /^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$/; /** * 验证手机号是否有效 * @param {string} phone - 手机号 * @returns {boolean} 是否有效 */ ...
AST#export_declaration#Left export AST#class_declaration#Left class ValidationUtil AST#class_body#Left { /** * 手机号校验正则 */ AST#property_declaration#Left private static readonly PHONE_REGEX : AST#type_annotation#Left AST#primary_type#Left RegExp AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#...
export class ValidationUtil { private static readonly PHONE_REGEX: RegExp = /^1[3-9]\d{9}$/; private static readonly EMAIL_REGEX: RegExp = /^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$/; static isValidPhone(phone: string): boolean { return phone.length === 11 && ValidationUtil.PHONE_REGEX.test(phone); } ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/validation/ValidationUtil.ets#L5-L81
d8c4395b45c9bf6748b242e21b45df2da301847c
github
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/view/ImageSelectComponent.ets
arkts
onPageShow
生命周期钩子函数,当页面显示时调用
onPageShow() { // 缩略图滑动到当前选择图片 this.smallScroller.scrollToIndex(this.selectedIndex); }
AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 缩略图滑动到当前选择图片 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expres...
onPageShow() { this.smallScroller.scrollToIndex(this.selectedIndex); }
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/view/ImageSelectComponent.ets#L35-L38
76eb93cc4d796e5f08085f533197a9a5e8ebae2e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/model/AttributeModifier.ets
arkts
TranslateItemModifier
声明被添加的gridItem动态属性
@Observed export class TranslateItemModifier extends AttributeUpdater<ColumnAttribute> { /** * 定义组件普通状态时的样式 * @param instance */ initializeModifier(instance: ColumnAttribute): void { instance.translate({ x: 0, y: 0 }) .visibility(Visibility.Visible); } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class TranslateItemModifier extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeUpdater AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnAttribute AST#primary_ty...
@Observed export class TranslateItemModifier extends AttributeUpdater<ColumnAttribute> { initializeModifier(instance: ColumnAttribute): void { instance.translate({ x: 0, y: 0 }) .visibility(Visibility.Visible); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/AttributeModifier.ets#L40-L50
71dc4a47720faaddec098a613add8eb1cb882280
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/web_actions.ets
arkts
Should be called when a new window is called. @param con The tab_info_packed. @param event The OnWindowNewEvent.
export function on_new_window(storage: LocalStorage, event: OnWindowNewEvent) { // TODO: Find out why this triggers twice when click once let new_target_url = event.targetUrl; console.info(`[Meow][onWindowNew] isAlert=${event.isAlert}, targetUrl=${event.targetUrl}`); let need_new_tab = true; if (!is_web_page...
AST#export_declaration#Left export AST#function_declaration#Left function on_new_window AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left event : AST#type_annotation...
export function on_new_window(storage: LocalStorage, event: OnWindowNewEvent) { let new_target_url = event.targetUrl; console.info(`[Meow][onWindowNew] isAlert=${event.isAlert}, targetUrl=${event.targetUrl}`); let need_new_tab = true; if (!is_web_page(new_target_url)) { console.log('[meowWebView] I...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L399-L426
b4f9ff72e121d5029edb960c40266ea881166902
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowAppSettings.ets
arkts
visibility_of_menu_side
Kinda constants
visibility_of_menu_side(side: string) { if (!this.tablet_mode) { // Non tablet mode NO vertical menu! return Visibility.None; } let status = this.preferred_hand_left_or_right == side; if (this.preferred_hand_reverse_settings_menu) { status = !status; } return status ? Visibilit...
AST#method_declaration#Left visibility_of_menu_side AST#parameter_list#Left ( AST#parameter#Left side : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Lef...
visibility_of_menu_side(side: string) { if (!this.tablet_mode) { return Visibility.None; } let status = this.preferred_hand_left_or_right == side; if (this.preferred_hand_reverse_settings_menu) { status = !status; } return status ? Visibility.Visible : Visibility.None; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowAppSettings.ets#L1745-L1755
8a11fe4d89898f093e604318ac3f08c1448c24cc
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_ecb_encryption_decryption/sm4_ecb_encryption_decryption_synchronous.ets
arkts
decryptMessage
解密消息
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|ECB|PKCS7'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null); let decryptData = decoder.doFinalSync(cipherText); return decryptData; }
AST#function_declaration#Left function decryptMessage 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#parameter#Left c...
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|ECB|PKCS7'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null); let decryptData = decoder.doFinalSync(cipherText); return decryptData; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_ecb_encryption_decryption/sm4_ecb_encryption_decryption_synchronous.ets#L29-L34
91315c8cb0c93ad4c584559bdfdf0edc1558492c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PermissionUtil.ets
arkts
requestPermissionOnSettingEasy
二次向用户申请授权(多个权限建议使用该方法)。 @param permissions 需要授权的权限集合
static async requestPermissionOnSettingEasy(permissions: Array<Permissions>): Promise<boolean> { for (let i = 0; i < permissions.length; i++) { let check = await PermissionUtil.checkPermissions(permissions[i]); //判断是否授权。 if (!check) { //未授权,二次向用户申请授权。 let grant = await PermissionUtil.requestPerm...
AST#method_declaration#Left static async requestPermissionOnSettingEasy AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#ty...
static async requestPermissionOnSettingEasy(permissions: Array<Permissions>): Promise<boolean> { for (let i = 0; i < permissions.length; i++) { let check = await PermissionUtil.checkPermissions(permissions[i]); if (!check) { let grant = await PermissionUtil.requestPermissionOnSetting(permissio...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L117-L128
6075dc8b386e54afa2b21d336ea4d25086d39c33
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets
arkts
saveDbInfoMeta
MARK: - BookDb Meta functions 保存 BookDb 的 Meta
public saveDbInfoMeta(info: CMetaInfo): void { this.cmetaInfoManager.saveMetaInfo(info); }
AST#method_declaration#Left public saveDbInfoMeta AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left CMetaInfo 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...
public saveDbInfoMeta(info: CMetaInfo): void { this.cmetaInfoManager.saveMetaInfo(info); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets#L238-L240
bcd58a1d554848d774c25dfc81359d11129b5afc
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
搜索热词 @param date @returns
export function getHotSearchKeys() { return axiosClient.get<HotSearchKeysModel[]>({ url: `hotkey/json`, }) }
AST#export_declaration#Left export AST#function_declaration#Left function getHotSearchKeys 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#e...
export function getHotSearchKeys() { return axiosClient.get<HotSearchKeysModel[]>({ url: `hotkey/json`, }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L29-L33
554405982a4a63d2a25216553315fc6429454e0f
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
arkts
encryptCBC
加密(CBC模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @returns
static async encryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec): Promise<cryptoFramework.DataBlob> { return SM4.encrypt(data, symKey, ivParams, 'SM4_128|CBC|PKCS7'); }
AST#method_declaration#Left static async encryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym...
static async encryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec): Promise<cryptoFramework.DataBlob> { return SM4.encrypt(data, symKey, ivParams, 'SM4_128|CBC|PKCS7'); }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L105-L108
aa845ac48cb782cf6c07aa38c498476c68065002
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/common/constants/StyleConstants.ets
arkts
Style constants for all features.
export default class StyleConstants { /** * Common left the percentage of the 6.7. */ static readonly COMMON_MARGIN_LEFT: string = '6.7%'; /** * Details common margin size the percentage of the 1.5. */ static readonly DETAILS_COMMON_MARGIN: string = '1.5%'; /** * Column details width the percen...
AST#export_declaration#Left export default AST#class_declaration#Left class StyleConstants AST#class_body#Left { /** * Common left the percentage of the 6.7. */ AST#property_declaration#Left static readonly COMMON_MARGIN_LEFT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_...
export default class StyleConstants { static readonly COMMON_MARGIN_LEFT: string = '6.7%'; static readonly DETAILS_COMMON_MARGIN: string = '1.5%'; static readonly COLUMN_DETAILS_WIDTH: string = '93.4%'; static readonly STARRING_TEXT_WIDTH: string = '76.6%'; static readonly COMMON_MARGIN_TOP: st...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/common/constants/StyleConstants.ets#L19-L108
e4840b8aa3006e11c114e0a8eb7fb4f68c08ecce
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/array/SectionDatas.ets
arkts
addSection
========== 添加数据 ==========
addSection(section: K): boolean { if (this.sectionMap.has(section)) return false; this.sectionMap.set(section, []); this.sectionOrder.push(section); this.invalidateCache(); return true; }
AST#method_declaration#Left addSection AST#parameter_list#Left ( AST#parameter#Left section : AST#type_annotation#Left AST#primary_type#Left K 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 A...
addSection(section: K): boolean { if (this.sectionMap.has(section)) return false; this.sectionMap.set(section, []); this.sectionOrder.push(section); this.invalidateCache(); return true; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/SectionDatas.ets#L27-L34
fac06f1f516f3199f0f566578dffe52da8463510
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FileUploadAndDownloadSlow/entry/src/main/ets/pages/ZipUploadPage.ets
arkts
createSandboxFile
[End zip_upload_page]
async createSandboxFile() { const context = this.getUIContext().getHostContext() as common.UIAbilityContext; const dirPath = context.filesDir + '/myFiles'; this.filePath = dirPath + '/data.txt'; try { await fileIo.access(dirPath); } catch { await fileIo.mkdir(dirPath); } try { ...
AST#method_declaration#Left async createSandboxFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#ex...
async createSandboxFile() { const context = this.getUIContext().getHostContext() as common.UIAbilityContext; const dirPath = context.filesDir + '/myFiles'; this.filePath = dirPath + '/data.txt'; try { await fileIo.access(dirPath); } catch { await fileIo.mkdir(dirPath); } try { ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FileUploadAndDownloadSlow/entry/src/main/ets/pages/ZipUploadPage.ets#L73-L91
3997e48431bf66f1cf609ad3340f6f557698f912
gitee
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/view_models/ArtistDetailModel.ets
arkts
ArtistDetailModel
export class ArtistDetailModel { id: number; name: string; picUrl: string; musicSize: number; albumSize: number; briefDesc: string; formJson(json: any): ArtistDetailModel { this.id = json['id']; this.name = json['name']; this.picUrl = json['picUrl']; this.musicSize = json['musicSize']; ...
AST#export_declaration#Left export AST#class_declaration#Left class ArtistDetailModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left name : AST#...
export class ArtistDetailModel { id: number; name: string; picUrl: string; musicSize: number; albumSize: number; briefDesc: string; formJson(json: any): ArtistDetailModel { this.id = json['id']; this.name = json['name']; this.picUrl = json['picUrl']; this.musicSize = json['musicSize']; ...
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/ArtistDetailModel.ets#L7-L24
9352d8b1cfcac13237a07fec211fc50a98a94e21
github
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
createEmptyFormBindingData
创建对应 formID 的空 FormData
private createEmptyFormBindingData(formID: string): formBindingData.FormBindingData { const formData: FormData = new FormData(formID, false); return formBindingData.createFormBindingData(formData); }
AST#method_declaration#Left private createEmptyFormBindingData AST#parameter_list#Left ( AST#parameter#Left formID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#...
private createEmptyFormBindingData(formID: string): formBindingData.FormBindingData { const formData: FormData = new FormData(formID, false); return formBindingData.createFormBindingData(formData); }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/CommonUtils.ets#L210-L214
1ebb204875d047984cd751428b9075a34c437e00
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
创建祝福语历史参数接口
export interface CreateGreetingHistoryParams { contactId: string; greetingId?: string; content: string; occasion: GreetingOccasion; style: GreetingStyle; method: GreetingMethod; status: GreetingStatus; sentAt?: string; metadata?: Record<string, string | number | boolean>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CreateGreetingHistoryParams AST#object_type#Left { AST#type_member#Left contactId : 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 greetingId ?...
export interface CreateGreetingHistoryParams { contactId: string; greetingId?: string; content: string; occasion: GreetingOccasion; style: GreetingStyle; method: GreetingMethod; status: GreetingStatus; sentAt?: string; metadata?: Record<string, string | number | boolean>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L227-L237
2cf0dab6e1adcabc3f3d21798155514f60fd92ed
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/todo/TodoService.ets
arkts
createTodo
创建代办事项
async createTodo(params: CreateTodoParams): Promise<Todo> { try { const now = new Date().toISOString(); const todo: Todo = { id: this.generateId(), title: params.title.trim(), description: params.description?.trim(), date: params.date, time: params.time, ...
AST#method_declaration#Left async createTodo AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateTodoParams 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 createTodo(params: CreateTodoParams): Promise<Todo> { try { const now = new Date().toISOString(); const todo: Todo = { id: this.generateId(), title: params.title.trim(), description: params.description?.trim(), date: params.date, time: params.time, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L153-L189
adceddf0a69e936fba69e21c033af245efa5b7fd
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
totalCount
The total amount of data from the data source
public totalCount(): number { return this.dataArray.length; }
AST#method_declaration#Left public totalCount 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_expres...
public totalCount(): number { return this.dataArray.length; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L74-L76
6c56a973997046e699e6f72a2c17b93b3782f6da
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagemosaic/src/main/ets/view/ImageMosaicView.ets
arkts
applyMosaic
图片马赛克处理函数
@Concurrent async function applyMosaic(dataArray: Uint8Array, imageWidth: number, imageHeight: number, blockSize: number, offMinX: number, offMinY: number, offMaxX: number, offMaxY: number): Promise<Uint8Array | undefined> { try { // 计算横排和纵排的块数 let xBlocks = Math.floor((Math.abs(offMaxX - offMinX)) / blockS...
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function applyMosaic AST#parameter_list#Left ( AST#parameter#Left dataArray : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#L...
@Concurrent async function applyMosaic(dataArray: Uint8Array, imageWidth: number, imageHeight: number, blockSize: number, offMinX: number, offMinY: number, offMaxX: number, offMaxY: number): Promise<Uint8Array | undefined> { try { let xBlocks = Math.floor((Math.abs(offMaxX - offMinX)) / blockSize); let...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagemosaic/src/main/ets/view/ImageMosaicView.ets#L39-L96
86b1a2a817fc8892d8380ac738dd746fc84ee51f
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets
arkts
setListener
设置回调
private setListener(cb:(result:speechRecognizer.SpeechRecognitionResult)=>void) { // 创建回调对象 let setListener: speechRecognizer.RecognitionListener = { // 开始识别成功回调 onStart(sessionId: string, eventMessage: string) { console.info("onStart sessionId: " + sessionId + "eventMessage: " + eventMessag...
AST#method_declaration#Left private setListener AST#parameter_list#Left ( AST#parameter#Left cb : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionResult AST#qu...
private setListener(cb:(result:speechRecognizer.SpeechRecognitionResult)=>void) { let setListener: speechRecognizer.RecognitionListener = { onStart(sessionId: string, eventMessage: string) { console.info("onStart sessionId: " + sessionId + "eventMessage: " + eventMessage); }, ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets#L34-L65
b906d40affaf3f3b8546282c07b589af8ff3d23c
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
JSCrash/entry/src/main/ets/pages/CannotReadPropertyXXXOfUndefinedCase.ets
arkts
[End updateGestureValue1]
build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center }...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expres...
build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center }...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/CannotReadPropertyXXXOfUndefinedCase.ets#L42-L57
38dda11d512c0d24d59a45774775aaf1fd85972b
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/menu/VHInviteDetailDialog.ets
arkts
VHInviteDetailDialog
我的邀请明细弹窗
@CustomDialog export struct VHInviteDetailDialog { controller: CustomDialogController @Require webinars: VHWebinarData; @Require selfDownloadSwitch: number; @State inviteDetails: VHMyInviteDetail[] = []; @State inviteDetailUrl: string = ''; aboutToAppear() { this.getMyInviteDetails(this.webinars?.webina...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct VHInviteDetailDialog AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST#...
@CustomDialog export struct VHInviteDetailDialog { controller: CustomDialogController @Require webinars: VHWebinarData; @Require selfDownloadSwitch: number; @State inviteDetails: VHMyInviteDetail[] = []; @State inviteDetailUrl: string = ''; aboutToAppear() { this.getMyInviteDetails(this.webinars?.webina...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/menu/VHInviteDetailDialog.ets#L8-L131
395d76a9e41bf268c082dc64933ba104b8b418fe
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AppUtils.ets
arkts
init
初始化方法,缓存全局变量,在UIAbility的onWindowStageCreate方法中初始化该方法。 @param windowStage 窗口管理器
static init(context: common.UIAbilityContext, windowStage: window.WindowStage) { AppUtils.context = context AppUtils.windowStage = windowStage }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowStage :...
static init(context: common.UIAbilityContext, windowStage: window.WindowStage) { AppUtils.context = context AppUtils.windowStage = windowStage }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L20-L23
1f67f60363d208eca32cd5f33614f1cd7d10c5e7
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BarEntry.ets
arkts
getNegativeSum
Returns the sum of all negative values this entry (if stacked) contains. (this is a positive number) @return
public getNegativeSum(): number { return this.mNegativeSum; }
AST#method_declaration#Left public getNegativeSum 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_ex...
public getNegativeSum(): number { return this.mNegativeSum; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarEntry.ets#L115-L117
9d6612fcbac24418cbf2fa9272b323f44b813ea8
gitee