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
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/common/utils/BackgroundTaskUtil.ets
arkts
startContinuousTask
Start a long-time task in the background. @param context Context.
public static startContinuousTask(context: Context) { if (context === undefined) { Logger.info(TAG, 'startContinuousTask fail,context is empty.'); return; } let wantAgentInfo = { // Action to be performed after a notification is clicked. wants: [ { bundleName: Commo...
AST#method_declaration#Left public static startContinuousTask AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if...
public static startContinuousTask(context: Context) { if (context === undefined) { Logger.info(TAG, 'startContinuousTask fail,context is empty.'); return; } let wantAgentInfo = { wants: [ { bundleName: CommonConstants.BUNDLE_NAME, abilityName: CommonConst...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/BackgroundTaskUtil.ets#L32-L64
0c8a907a0cdfcc9817680086f7b4b0ae2fb00bb1
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/utils/BackgroundUtil.ets
arkts
startContinuousTask
Start background task. @param context
public static startContinuousTask(context?: common.UIAbilityContext): void { if (!context) { Logger.error('this avPlayer: ', `context undefined`); return; } let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: context.abilityInfo.bundleName, abi...
AST#method_declaration#Left public static startContinuousTask 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#para...
public static startContinuousTask(context?: common.UIAbilityContext): void { if (!context) { Logger.error('this avPlayer: ', `context undefined`); return; } let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: context.abilityInfo.bundleName, abi...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/utils/BackgroundUtil.ets#L27-L61
59fc9a30a92893cc1db1dc1038c84f139712a42f
github
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/pages/MainPage.ets
arkts
promptAction
显示成功提示
promptAction.showToast({ message: `成功添加房间:${roomName}`, duration: 2000 });
AST#method_declaration#Left promptAction AST#ERROR#Left . showTo as t AST#ERROR#Right AST#parameter_list#Left ( AST#parameter_list#Right AST#ERROR#Left { AST#expression_statement#Left AST#expression#Left message AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : AST#ERROR#Right AST#expression_stateme...
promptAction.showToast({ message: `成功添加房间:${roomName}`, duration: 2000 });
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/MainPage.ets#L200-L203
316d132e27e73405c73ae725bf1a6e19f1ac81e3
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/cache/GlobalContext.ets
arkts
setT
泛型方法
setT<T>(key: string, objectClass: T): void { this._objects.set(key, objectClass as Object); }
AST#method_declaration#Left setT AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p...
setT<T>(key: string, objectClass: T): void { this._objects.set(key, objectClass as Object); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/cache/GlobalContext.ets#L51-L53
9c8104b7746a40d68150a5c45d7d5545399bd907
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/UserNoteUpdate.ets
arkts
应用约束61:使用export default代替module.exports
export default UserNoteUpdateHandler;
AST#export_declaration#Left export default AST#expression#Left UserNoteUpdateHandler AST#expression#Right ; AST#export_declaration#Right
export default UserNoteUpdateHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/UserNoteUpdate.ets#L17-L17
566cbb3999e1ec904d064f17e643ec832853d73e
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
getTipDateStr
格式化时间戳,获取提示性时间字符串 @param date 时间戳:10位时间戳:表示从1970年1月1日00:00:00 GMT开始计算的秒数,精度为秒。 13位时间戳:表示从1970年1月1日00:00:00 GMT开始计算的毫秒数,精度为毫秒。 @returns
static getTipDateStr(date: number | string | Date): string { let timeMs = DateUtils.getFormatDate(date).getTime(); if (timeMs.toString().length == 10) { timeMs = timeMs * 1000 //如果是10位的时间戳转化为13位的 } let dateNow = new Date(); let dateUp = new Date(timeMs); if (dateNow.getTime() - timeMs < 60...
AST#method_declaration#Left static getTipDateStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#R...
static getTipDateStr(date: number | string | Date): string { let timeMs = DateUtils.getFormatDate(date).getTime(); if (timeMs.toString().length == 10) { timeMs = timeMs * 1000 } let dateNow = new Date(); let dateUp = new Date(timeMs); if (dateNow.getTime() - timeMs < 60 * 1000) { re...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L386-L404
031124e6a192acc24ff3f3fa0fd76a5f52f7f753
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/model/WeekCalendarModel.ets
arkts
day number of on week
export const WEEK_DAY_NUM: number = 7;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left WEEK_DAY_NUM : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 7 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#...
export const WEEK_DAY_NUM: number = 7;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/model/WeekCalendarModel.ets#L23-L23
14b386aadc9f0723b61930fe9ba96e35549bafe4
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/pages/StartVpn.ets
arkts
constructor
网络前缀长度(例如,24 表示子网掩码为 255.255.255.0)
constructor(address: Address, prefixLength: number) { this.address = address; this.prefixLength = prefixLength; }
AST#method_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left Address AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left prefixLength : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
constructor(address: Address, prefixLength: number) { this.address = address; this.prefixLength = prefixLength; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/pages/StartVpn.ets#L102-L105
1accb392222cb2734ccf6d3f0ca2ebea59bbc36e
gitee
FantasyWind/fwrouter
eea785a7bf728862de1f88de487ef3857dee3364
router/src/main/ets/RouterManager.ets
arkts
路由管理类代理。
export interface RouterManagerDelegate { /** * 动态导入逻辑。 * @param packageName 解析path并经过moduleNameMapping处理的包名。 * @param request 调用路由时的请求对象 * @returns Promise对象,参数为动态导入获得的对象,目前未使用。 */ dynamicImport?: (packageName: string, request: RouterRequestWrapper) => Promise<ESObject> }
AST#export_declaration#Left export AST#interface_declaration#Left interface RouterManagerDelegate AST#object_type#Left { /** * 动态导入逻辑。 * @param packageName 解析path并经过moduleNameMapping处理的包名。 * @param request 调用路由时的请求对象 * @returns Promise对象,参数为动态导入获得的对象,目前未使用。 */ AST#type_member#Left dynamicImport ? : AST#t...
export interface RouterManagerDelegate { dynamicImport?: (packageName: string, request: RouterRequestWrapper) => Promise<ESObject> }
https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/router/src/main/ets/RouterManager.ets#L20-L28
65206e840ad9736b167b19ae4916457f4a7f6981
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPicture/commons/base/src/main/ets/utils/BreakpointType.ets
arkts
设备尺寸类型
export class BreakpointType<T> { sm: T; md: T; lg: T; constructor(sm: T, md: T, lg: T) { this.sm = sm; this.md = md; this.lg = lg; } GetValue(currentBreakpoint: string): T { if (currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { return this.md; } else if (currentBreakpoin...
AST#export_declaration#Left export AST#class_declaration#Left class BreakpointType AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { AST#property_declaration#Left sm : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AS...
export class BreakpointType<T> { sm: T; md: T; lg: T; constructor(sm: T, md: T, lg: T) { this.sm = sm; this.md = md; this.lg = lg; } GetValue(currentBreakpoint: string): T { if (currentBreakpoint === BreakpointConstants.BREAKPOINT_MD) { return this.md; } else if (currentBreakpoin...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/commons/base/src/main/ets/utils/BreakpointType.ets#L6-L26
1f2cd359a32d232d69f3c909ce068fd628e934a5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MePage.ets
arkts
buildMembershipCard
构建会员权益卡片 @returns {void} 无返回值
@Builder private buildMembershipCard(): void { Card({ bgColor: $r("app.color.bg_vip_card"), radiusValue: $r("app.float.radius_medium"), paddingValue: { left: $r("app.float.space_horizontal_large"), right: $r("app.float.space_horizontal_large"), top: $r("app.float.space_ve...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildMembershipCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left ...
@Builder private buildMembershipCard(): void { Card({ bgColor: $r("app.color.bg_vip_card"), radiusValue: $r("app.float.radius_medium"), paddingValue: { left: $r("app.float.space_horizontal_large"), right: $r("app.float.space_horizontal_large"), top: $r("app.float.space_ve...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L243-L286
401de7c5e555b8a62c9dd0064d0cbd7f34da85f9
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerComponent.ets
arkts
stopTimer
暂停计时
private stopTimer() { if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } if (this.isIncrementing) { this.statusPrompt = '超时,' + "开始正向计时"; this.statusPromptColor = Color.Orange; } else { this.statusPrompt = this.getTimePrompt() + "倒计时已暂停"; th...
AST#method_declaration#Left private stopTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression...
private stopTimer() { if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } if (this.isIncrementing) { this.statusPrompt = '超时,' + "开始正向计时"; this.statusPromptColor = Color.Orange; } else { this.statusPrompt = this.getTimePrompt() + "倒计时已暂停"; th...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L147-L161
ecf97976eba9ae05405689d10cb7d5710f11ea8f
gitee
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/common/util/IOUtils.ets
arkts
getPixelMapsFromResource
从resource中取出多个pixelMap @param resources 指定资源数组 @returns pixelMap数组
public static async getPixelMapsFromResource(resources: Resource[]): Promise<image.PixelMap[]> { const pixelMaps: image.PixelMap[] = []; // 遍历资源数组 for (let i = 0; i < resources.length; i++) { // 通过资源管理器获取资源的字节数组 const array = await getContext().resourceManager.getMediaContent(resources[i]); ...
AST#method_declaration#Left public static async getPixelMapsFromResource AST#parameter_list#Left ( AST#parameter#Left resources : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list...
public static async getPixelMapsFromResource(resources: Resource[]): Promise<image.PixelMap[]> { const pixelMaps: image.PixelMap[] = []; for (let i = 0; i < resources.length; i++) { const array = await getContext().resourceManager.getMediaContent(resources[i]); pixelMaps.push(aw...
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/util/IOUtils.ets#L31-L43
2d88963a5ad424a03acec386b29febead387110e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
closeScanResult
关闭扫码结果 @returns {void}
closeScanResult(): void { logger.info('closeScanResult'); if (this.scanResultDialogId) { promptAction.closeCustomDialog(this.scanResultDialogId); this.scanResultDialogId = undefined; } }
AST#method_declaration#Left closeScanResult 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#expressi...
closeScanResult(): void { logger.info('closeScanResult'); if (this.scanResultDialogId) { promptAction.closeCustomDialog(this.scanResultDialogId); this.scanResultDialogId = undefined; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L418-L424
5bd1230e4c145630dfbbf570b0a1b77639a115ff
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/ListSample/entry/src/main/ets/viewmodel/ListDataSource.ets
arkts
Provides data sources required by the LazyForEach interface.
export class ListDataSource implements IDataSource { private listItems: Array<ListItemData> = []; private listener: DataChangeListener; constructor(list: Array<ListItemData>) { this.listItems = list; } totalCount(): number { return this.listItems.length; } getData(index: number): ListItemData {...
AST#export_declaration#Left export AST#class_declaration#Left class ListDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listItems : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arg...
export class ListDataSource implements IDataSource { private listItems: Array<ListItemData> = []; private listener: DataChangeListener; constructor(list: Array<ListItemData>) { this.listItems = list; } totalCount(): number { return this.listItems.length; } getData(index: number): ListItemData {...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/ListSample/entry/src/main/ets/viewmodel/ListDataSource.ets#L6-L28
79c1a0db80ff35c570d83affe5096d93489dfedd
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/pages/VideoLinkageList.ets
arkts
tabBuilder
tabbar布局,仅用于UX显示
@Builder tabBuilder(index: number, tabBar: Resource, icon: Resource) { Column() { Image(icon) .width($r('app.integer.video_linkage_list_tabbar_icon_size')) .height($r('app.integer.video_linkage_list_tabbar_icon_size')) .margin({ bottom: $r('app.integer.video_linkage_list_tabbar_icon_...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tabBar : AST#type_annotation#Left A...
@Builder tabBuilder(index: number, tabBar: Resource, icon: Resource) { Column() { Image(icon) .width($r('app.integer.video_linkage_list_tabbar_icon_size')) .height($r('app.integer.video_linkage_list_tabbar_icon_size')) .margin({ bottom: $r('app.integer.video_linkage_list_tabbar_icon_...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/pages/VideoLinkageList.ets#L77-L94
32ffb1ec2a6187d2df9dd671e6d6c58c67e6be46
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets
arkts
rgbToNumber
RGB颜色转为整数值 @param color RGB像素值 @returns 整数
public static rgbToNumber(color: ColorRgb): number { return ((color.alpha << 24) | (color.red << 16) | (color.green << 8) | color.blue); }
AST#method_declaration#Left public static rgbToNumber AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left ColorRgb 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#p...
public static rgbToNumber(color: ColorRgb): number { return ((color.alpha << 24) | (color.red << 16) | (color.green << 8) | color.blue); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets#L158-L160
0e95cc8192dd7aa7b7b8cd5f71493034bfac9d19
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets
arkts
get
MARK: - 计算属性(days相关) 当前(今天)是第几天, 如:第1天
get numString(): string { // return "第\(num + 1)天"; return getStringF($r("app.string.dayof_num_string") ,this.num + 1) }
AST#method_declaration#Left get AST#ERROR#Left numStr in g AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // return "第\(num + 1)天"; AST#statement#Left AST#return_stat...
get numString(): string { return getStringF($r("app.string.dayof_num_string") ,this.num + 1) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets#L56-L59
949cedc36c0e81dcd5d7a5afbc745b519d79f66e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/PixelConversion/entry/src/main/ets/viewmodel/IntroductionViewModel.ets
arkts
getIntroductionList
Get introduction list data on the left. @return {Array<IntroductionItem>} introductionItems
getIntroductionList() { let introductionItems = INTRODUCE_LIST; return introductionItems; }
AST#method_declaration#Left getIntroductionList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left introductionItems = AST#expression#Left INTRODUCE_LIST AST#expression#Right AST#variable_declarator#Right ; AS...
getIntroductionList() { let introductionItems = INTRODUCE_LIST; return introductionItems; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/PixelConversion/entry/src/main/ets/viewmodel/IntroductionViewModel.ets#L25-L28
1a2830173586ac0586055149f6c526c9272ae37a
gitee
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
HomeModule/src/main/ets/viewmodel/HomeViewModel.ets
arkts
getQuestionTypeList
获取首页type列表
getQuestionTypeList() { return HttpUtils.get<QuestionTypeModel[]>('question/type') }
AST#method_declaration#Left getQuestionTypeList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtils AST#expression#Rig...
getQuestionTypeList() { return HttpUtils.get<QuestionTypeModel[]>('question/type') }
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/HomeModule/src/main/ets/viewmodel/HomeViewModel.ets#L16-L18
2aaeda254fa7e5cd97b5f8c9f17a8b66e3e4a7c5
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/ai-metrics-advisor/99.10.9/package/index.ets
arkts
getFiles
处理文件读取函数
function getFiles(paths: string[]): string[] { let ufiles: string[] = []; for (let j = 0; j < paths.length; j++) { let mpath = paths[j]; let files = fs.listFileSync(mpath); for (let i = 0; i < files.length; i++) { ufiles.push(path.join(mpath, files[i])); } } r...
AST#function_declaration#Left function getFiles AST#parameter_list#Left ( AST#parameter#Left paths : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Le...
function getFiles(paths: string[]): string[] { let ufiles: string[] = []; for (let j = 0; j < paths.length; j++) { let mpath = paths[j]; let files = fs.listFileSync(mpath); for (let i = 0; i < files.length; i++) { ufiles.push(path.join(mpath, files[i])); } } r...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/ai-metrics-advisor/99.10.9/package/index.ets#L33-L43
003b2e5943ec0dd6b56a09e457efdce26299d1cd
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/MD5.ets
arkts
hmac
hmac @param key 秘钥 @param data 待处理字符串 @param enCoding 编码格式hex/base64 @returns
static hmac(key: string, data: string, enCoding?: string): string { let md = new MD5(); if (enCoding && enCoding == 'base64') { let md5 = md.b64_hmac_md5(key, data); if (!md5.endsWith('==')) { md5 += '=='; } return md5; } return md.hex_hmac_md5(key, data); }
AST#method_declaration#Left static hmac AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right A...
static hmac(key: string, data: string, enCoding?: string): string { let md = new MD5(); if (enCoding && enCoding == 'base64') { let md5 = md.b64_hmac_md5(key, data); if (!md5.endsWith('==')) { md5 += '=='; } return md5; } return md.hex_hmac_md5(key, data); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/MD5.ets#L66-L76
bb6d005e9ac361ae92eacbe3b7367ec939ba64ef
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
沟通风格枚举
export enum CommunicationStyle { FORMAL = 'formal', CASUAL = 'casual', FRIENDLY = 'friendly', PROFESSIONAL = 'professional', HUMOROUS = 'humorous' }
AST#export_declaration#Left export AST#enum_declaration#Left enum CommunicationStyle AST#enum_body#Left { AST#enum_member#Left FORMAL = AST#expression#Left 'formal' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CASUAL = AST#expression#Left 'casual' AST#expression#Right AST#enum_member#Right , AST#en...
export enum CommunicationStyle { FORMAL = 'formal', CASUAL = 'casual', FRIENDLY = 'friendly', PROFESSIONAL = 'professional', HUMOROUS = 'humorous' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L150-L156
72df17754aeea9932b15db06bd217d820d7d73fc
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieData.ets
arkts
getDataSetByLabel
@Override
public getDataSetByLabel(label: string, ignorecase: boolean): IPieDataSet | null { return ignorecase ? Utils.equalsIgnoreCase(label, this.mDataSets.get(0).getLabel()) ? this.mDataSets.get(0) : null : label == this.mDataSets.get(...
AST#method_declaration#Left public getDataSetByLabel 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 ignorecase : AST#type_annotation#Left AST#primary_type#Left boolean AS...
public getDataSetByLabel(label: string, ignorecase: boolean): IPieDataSet | null { return ignorecase ? Utils.equalsIgnoreCase(label, this.mDataSets.get(0).getLabel()) ? this.mDataSets.get(0) : null : label == this.mDataSets.get(...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieData.ets#L91-L95
29eed006b6b58348afb5f5dcabee54e708eab052
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
generateId
生成弹框id
static generateId() { return dialogCoreHandler.generateDialogId(); }
AST#method_declaration#Left static generateId AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dialogCoreHandler AST#expressi...
static generateId() { return dialogCoreHandler.generateDialogId(); }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L272-L274
b850675f6a70ae62b5aedf5e064bc7dc1b474942
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets
arkts
notifyDataAdd
通知控制器数据增加 @param index 数组索引
notifyDataAdd(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataAdd(index); }) }
AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
notifyDataAdd(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataAdd(index); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets#L95-L99
4684ebfc8731bd62963f7ca9dd0f9803c0eefc23
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/mock/local/FileData.ets
arkts
子目录结构
export interface SubDirectoryType { name: string; type: number; time: Date; childrenNum?: number; fileSize?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SubDirectoryType AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#L...
export interface SubDirectoryType { name: string; type: number; time: Date; childrenNum?: number; fileSize?: string; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/mock/local/FileData.ets#L76-L82
f5f86f40fc3c9dda5d0f8f0c670c92bc4e8ac5fc
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AuthRepository.ets
arkts
loginByWxApp
微信 APP 授权登录 @param {Record<string, string>} params - 微信授权参数 @returns {Promise<NetworkResponse<Auth>>} 认证结果
async loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Auth>> { return this.networkDataSource.loginByWxApp(params); }
AST#method_declaration#Left async loginByWxApp AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_ann...
async loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Auth>> { return this.networkDataSource.loginByWxApp(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AuthRepository.ets#L27-L29
5b1150e8bda87f0fb496ef6f33ef93483040289f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets
arkts
getBuilder
通过名称获取builder
public static getBuilder(builderName: string): WrappedBuilder<[object]> { const builder = DynamicsRouter.builderMap.get(builderName); if (!builder) { const MSG = "not found builder"; logger.info(MSG + builderName); } return builder as WrappedBuilder<[object]>; }
AST#method_declaration#Left public static getBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : 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#gener...
public static getBuilder(builderName: string): WrappedBuilder<[object]> { const builder = DynamicsRouter.builderMap.get(builderName); if (!builder) { const MSG = "not found builder"; logger.info(MSG + builderName); } return builder as WrappedBuilder<[object]>; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets#L66-L73
6c16db10424d619c1a6654b96846959c0bd5922f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_audio/example/EfAVPlayerIndex.ets
arkts
EfAVPlayerIndex
@Author wsy @DateTime 2024/10/13 0:13 @TODO EfAVPlayerDemo 播放器基本功能示例
@Component export struct EfAVPlayerIndex { efAVPlay: EfAVPlayer = new EfAVPlayer() @State total: number = 0 @State value: number = 0 build() { Column() { Text(`total:${this.total} value:${this.value}`) Slider({ value: this.value, min: 0, max: this.total }) .onChange(v => { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EfAVPlayerIndex AST#component_body#Left { AST#property_declaration#Left efAVPlay : AST#type_annotation#Left AST#primary_type#Left EfAVPlayer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#c...
@Component export struct EfAVPlayerIndex { efAVPlay: EfAVPlayer = new EfAVPlayer() @State total: number = 0 @State value: number = 0 build() { Column() { Text(`total:${this.total} value:${this.value}`) Slider({ value: this.value, min: 0, max: this.total }) .onChange(v => { ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_audio/example/EfAVPlayerIndex.ets#L23-L108
c6dc0cd0a6c87007ae30de4337db3af97fcce243
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets
arkts
视频视图模块 @param {videoData} data - 视图内容数据 @param {WrappedBuilder<[VideoData]>} - 视图框架UI
export class VideoBuilder { data: VideoData; contentBuilder: WrappedBuilder<[VideoData]>; constructor(data: VideoData, contentBuilder: WrappedBuilder<[VideoData]>) { this.data = data; this.contentBuilder = contentBuilder; } }
AST#export_declaration#Left export AST#class_declaration#Left class VideoBuilder AST#class_body#Left { AST#property_declaration#Left data : AST#type_annotation#Left AST#primary_type#Left VideoData AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left contentBuil...
export class VideoBuilder { data: VideoData; contentBuilder: WrappedBuilder<[VideoData]>; constructor(data: VideoData, contentBuilder: WrappedBuilder<[VideoData]>) { this.data = data; this.contentBuilder = contentBuilder; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L49-L57
301a379a750c600c7111c3abb9ec70936da3f7fd
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSVideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
createAVPlayer
创建 videoPlayer对象
createAVPlayer() { media.createAVPlayer().then((avPlayer) => { if (avPlayer) { this.avPlayer = avPlayer; this.bindState(); } else { Logger.error('[PlayVideoModel] createAvPlayer fail!'); } }); }
AST#method_declaration#Left createAVPlayer 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#call_expression#Left AST#expression#Left AST#...
createAVPlayer() { media.createAVPlayer().then((avPlayer) => { if (avPlayer) { this.avPlayer = avPlayer; this.bindState(); } else { Logger.error('[PlayVideoModel] createAvPlayer fail!'); } }); }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/controller/VideoController.ets#L34-L43
858c9ef5b1e1d27a2f7ef16ea7246525cd03be3c
gitee
yanweiguo198-commits/Harmony-Calendar-App.git
9ebdfbe588dfc230231af619a6eeb89b3c7fc39f
entry/src/main/ets/model/CalendarUtil.ets
arkts
getDaysInMonth
获取某年某月的天数
static getDaysInMonth(year: number, month: number): number { return new Date(year, month, 0).getDate(); }
AST#method_declaration#Left static getDaysInMonth 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_...
static getDaysInMonth(year: number, month: number): number { return new Date(year, month, 0).getDate(); }
https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/model/CalendarUtil.ets#L3-L5
e4810fb25b27ce7a26233471d5a50850f6b31f03
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowTabsHost.ets
arkts
new_tab
Creates a new tab. @param target_url A string, if link is "", then load the default new_tab_url set in this object. @param save_to_settings if set true, then will save the tabs index status to app settings for next launch to continue. @param is_from_receive if set true, will get tab from AppStorage instead of creating ...
new_tab(target_url: string, save_to_settings: boolean, is_from_receive: boolean, init_state: boolean = false, placeholder_label?: string) { let t0 = Date.now(); // Remember last tab & background stuffs if (!init_state) { this.last_tab_index = this.bunch_of_tabs.main_tab_idx; this.storage.set('e...
AST#method_declaration#Left new_tab AST#parameter_list#Left ( AST#parameter#Left target_url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left save_to_settings : AST#type_annotation#Left AST#primary_type#Left boolean AST#prim...
new_tab(target_url: string, save_to_settings: boolean, is_from_receive: boolean, init_state: boolean = false, placeholder_label?: string) { let t0 = Date.now(); if (!init_state) { this.last_tab_index = this.bunch_of_tabs.main_tab_idx; this.storage.set('extra_background', false); } ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsHost.ets#L213-L253
ae9371e0a9cf8d4388ef3309007b7fd15879c725
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
isValidDay
检查指定位置是否是有效日期
private isValidDay(week: number, dayOfWeek: number): boolean { const dayNumber: number = this.getDayNumber(week, dayOfWeek); const daysInMonth: number = new Date(this.currentYear, this.currentMonth, 0).getDate(); return dayNumber >= 1 && dayNumber <= daysInMonth; }
AST#method_declaration#Left private isValidDay AST#parameter_list#Left ( AST#parameter#Left week : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dayOfWeek : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
private isValidDay(week: number, dayOfWeek: number): boolean { const dayNumber: number = this.getDayNumber(week, dayOfWeek); const daysInMonth: number = new Date(this.currentYear, this.currentMonth, 0).getDate(); return dayNumber >= 1 && dayNumber <= daysInMonth; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4202-L4206
fa7c951631d248d2487ac5565fe89e1cf11af00b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_ecb_encryption_decryption/sm4_ecb_encryption_decryption_asynchronous.ets
arkts
encryptMessagePromise
加密消息
async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('SM4_128|ECB|PKCS7'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null); let encryptData = await cipher.doFinal(plainText); return encryptD...
AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par...
async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('SM4_128|ECB|PKCS7'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null); let encryptData = await cipher.doFinal(plainText); return encryptD...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_ecb_encryption_decryption/sm4_ecb_encryption_decryption_asynchronous.ets#L21-L26
a11593e48ed023896a6c760a5946eb0d0460505b
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
generateSM2Key
生成SM2的非对称密钥 @returns SM2密钥{publicKey:公钥,privateKey:私钥}
static async generateSM2Key(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('SM2_256'); }
AST#method_declaration#Left static async generateSM2Key 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 CryptoKey AST#primary_type#Right AST#type_annotation#Right ...
static async generateSM2Key(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('SM2_256'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L31-L33
fa7c98f01af7944a263cd4d5a3fb7a8fc7900873
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM4.ets
arkts
decryptECB
解密(ECB模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|ECB|PKCS7、SM4_128|ECB|PKCS5、等)。 @returns
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = 'SM4_128|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> { return SM4.decrypt(data, symKey, null, transformation); }
AST#method_declaration#Left static async decryptECB 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 decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = 'SM4_128|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> { return SM4.decrypt(data, symKey, null, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L188-L191
edf37b6d4b85c1515767d54e3d298bb07d99fc0a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
趋势统计
export interface TrendStats { contactsGrowth: GrowthTrend[]; greetingsGrowth: GrowthTrend[]; usageGrowth: UsageGrowthTrend[]; monthlyActivity: MonthlyActivity[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TrendStats AST#object_type#Left { AST#type_member#Left contactsGrowth : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GrowthTrend [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Rig...
export interface TrendStats { contactsGrowth: GrowthTrend[]; greetingsGrowth: GrowthTrend[]; usageGrowth: UsageGrowthTrend[]; monthlyActivity: MonthlyActivity[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L230-L235
f382c2de6fdc5afff3b9068482d7d985a103ada7
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/utils/Utils.ets
arkts
isPhoto
大概判断是否是图片选择 @param types .tif,.pjp,.jfif,.bmp,.webp,.svg,.gif,.svgz,.jpg,.hevc,.jpeg,.pjpeg,.png,.ico,.avif,.apng,.heic,.xbm,.tiff,.heif
static isPhoto(types: string[]) { return ArrayUtil.contain(types, ".jpg") && ArrayUtil.contain(types, ".jpeg") && ArrayUtil.contain(types, ".png"); }
AST#method_declaration#Left static isPhoto AST#parameter_list#Left ( AST#parameter#Left types : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS...
static isPhoto(types: string[]) { return ArrayUtil.contain(types, ".jpg") && ArrayUtil.contain(types, ".jpeg") && ArrayUtil.contain(types, ".png"); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/utils/Utils.ets#L124-L126
05c25f57448937cc3b1ad5b357ef0936b6e2352c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/constants/StyleConstants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class StyleConstants { /** * navigation bar height */ public static readonly HEIGHT_NAVIGATION_BAR = 64; }
AST#export_declaration#Left export default AST#class_declaration#Left class StyleConstants AST#class_body#Left { /** * navigation bar height */ AST#property_declaration#Left public static readonly HEIGHT_NAVIGATION_BAR = AST#expression#Left 64 AST#expression#Right ; AST#property_declaration#Right } AST#class_body...
export default class StyleConstants { public static readonly HEIGHT_NAVIGATION_BAR = 64; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/constants/StyleConstants.ets#L16-L21
49cad3762addf70ab48a996eee707eec71561899
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FormatUtil.ets
arkts
transliterator
将输入字符串从源格式转换为目标格式(中文汉字转为拼音) @param text 输入字符串 @returns
static transliterator(text: string): string { const transliterator = i18n.Transliterator.getInstance('Any-Latn'); return transliterator.transform(text); }
AST#method_declaration#Left static transliterator AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
static transliterator(text: string): string { const transliterator = i18n.Transliterator.getInstance('Any-Latn'); return transliterator.transform(text); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L75-L78
742b8c6fd38e9e043abbe50041a93fa31e472cd2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
fdopenStream
基于文件描述符打开文件流,使用Promise异步回调。 @param fd number 已打开的文件描述符。 @param mode string 文件打开类型 r:打开只读文件,该文件必须存在。 r+:打开可读写的文件,该文件必须存在。 w:打开只写文件,若文件存在则文件长度清0,即该文件内容会消失。若文件不存在则建立该文件。 w+:打开可读写文件,若文件存在则文件长度清0,即该文件内容会消失。若文件不存在则建立该文件。 a:以附加的方式打开只写文件。若文件不存在,则会建立该文件,如果文件存在,写入的数据会被加到文件尾,即文件原先的内容会被保留。 a+:以附加方式打开可读写的文件。若文件不存在,则会建立该文件,如果文件存在,写入...
static fdopenStream(fd: number, mode: string = 'r'): Promise<fs.Stream> { return fs.fdopenStream(fd, mode) }
AST#method_declaration#Left static fdopenStream AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static fdopenStream(fd: number, mode: string = 'r'): Promise<fs.Stream> { return fs.fdopenStream(fd, mode) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L811-L813
dfbd21965fb5eb36555384d921e998ee3b13cb73
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/DataImportExportService.ets
arkts
exportContactsOnly
仅导出联系人数据
async exportContactsOnly(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting contacts only export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords...
AST#method_declaration#Left async exportContactsOnly AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onProgress ? : AST#ty...
async exportContactsOnly(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting contacts only export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L371-L412
fe59db3f20de0df4677256706b52cffe8fd25adf
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
查询是否支持对应的通知模板 @param {string} templateName 模板名称。当前仅支持'downloadTemplate'。 @returns {Promise<boolean>} 返回true表示支持该模板;返回false表示不支持该模板。
export async function isSupportTemplate(templateName: string = 'downloadTemplate'): Promise<boolean> { return notificationManager.isSupportTemplate(templateName); }
AST#export_declaration#Left export AST#function_declaration#Left async function isSupportTemplate AST#parameter_list#Left ( AST#parameter#Left templateName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'downloadTemplate' AST#expression#Rig...
export async function isSupportTemplate(templateName: string = 'downloadTemplate'): Promise<boolean> { return notificationManager.isSupportTemplate(templateName); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L466-L468
6c1f61360f83cef5bcc16b0776d57ed79f2661df
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/NotificationOptions.ets
arkts
TODO 通知工具类,描述通知的请求参数。 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export interface NotificationOptions { id?: number; //通知ID。 notificationSlotType?: notificationManager.SlotType; //通道类型。 showDeliveryTime?: boolean; //是否显示分发时间。 deliveryTime?: number; //通知发送时间。 tapDismissed?: boolean; //通知是否自动清除。 autoDeletedTime?: number; //自动清除的时间。 wantAgent?: WantAgent; //WantAgent封装了应用...
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationOptions AST#object_type#Left { AST#type_member#Left id ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //通知ID。 AST#type_member#Left notificationSlotT...
export interface NotificationOptions { id?: number; notificationSlotType?: notificationManager.SlotType; showDeliveryTime?: boolean; deliveryTime?: number; tapDismissed?: boolean; autoDeletedTime?: number; wantAgent?: WantAgent; extraInfo?: Record<string, Object>; isAlertOnce?: boolean; isS...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/NotificationOptions.ets#L26-L50
2cf858ca44727ab894d2065ec0901c448bb1f5d0
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/Auth.ets
arkts
initUser
持久化
initUser() { PersistentStorage.persistProp<User>(UserInfoKey, {} as User) }
AST#method_declaration#Left initUser 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 PersistentStorage AST#expression#Right . persistProp AS...
initUser() { PersistentStorage.persistProp<User>(UserInfoKey, {} as User) }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/Auth.ets#L8-L10
eda10455d75088c28d1fd31a600c47f3c6dde3cd
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/DetailPage.ets
arkts
onAlarmItemChange
当 alarmItem 属性变化时触发,用于更新数据
onAlarmItemChange() { this.initData(); }
AST#method_declaration#Left onAlarmItemChange 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 . initData AST#membe...
onAlarmItemChange() { this.initData(); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/DetailPage.ets#L55-L57
fcfcd8cde9310bb6717a6c75c0ec18903484249b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
deleteHttpAuthCredentials
清除所有已保存的HTTP身份验证凭据,该方法为同步方法。
static deleteHttpAuthCredentials(): void { webview.WebDataBase.deleteHttpAuthCredentials(); }
AST#method_declaration#Left static deleteHttpAuthCredentials 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#...
static deleteHttpAuthCredentials(): void { webview.WebDataBase.deleteHttpAuthCredentials(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L303-L305
99ecf9f3d65e2e6a3f15d5979d9dcf625130afe7
gitee
MxDxh/HarmonyOS-smart-city.git
659d907ca3fc03b212bf3d9e7d7bb0a836301a20
entry/src/main/ets/base/baseStyle.ets
arkts
globalFancy
反例: @Styles不支持参数
@Extend(Column) function globalFancy() { .width('98%') .backgroundColor('#f9f9f9') .alignItems(HorizontalAlign.Center) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Column AST#expression#Right ) AST#decorator#Right function globalFancy AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '98%' AST...
@Extend(Column) function globalFancy() { .width('98%') .backgroundColor('#f9f9f9') .alignItems(HorizontalAlign.Center) }
https://github.com/MxDxh/HarmonyOS-smart-city.git/blob/659d907ca3fc03b212bf3d9e7d7bb0a836301a20/entry/src/main/ets/base/baseStyle.ets#L2-L6
5b3ba48151651930bcf48d5497cf788e9d611c8f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/AnimationHelper.ets
arkts
transitionInDown
InDown动画 @param duration 动画时间 @returns
static transitionInDown(duration: number = 300): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration * 0.4 }) .combine(TransitionEffect.OPACITY.animation({ duration: duration })), TransitionEffect.OPACITY.animation({ ...
AST#method_declaration#Left static transitionInDown AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_anno...
static transitionInDown(duration: number = 300): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration * 0.4 }) .combine(TransitionEffect.OPACITY.animation({ duration: duration })), TransitionEffect.OPACITY.animation({ ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/AnimationHelper.ets#L45-L52
8a02b23a83f895ce006b12a849de1e96caaef74b
gitee
yinxing2008/note_hongmeng_ArkUI.git
5c7459ca682903d9184539facc63136bbe6230b9
entry/src/main/ets/data/Note.ets
arkts
厦门大学计算机专业 | 前华为工程师 专注《零基础学编程系列》 http://lblbc.cn/blog 包含:Java | 安卓 | 前端 | Flutter | iOS | 小程序 | 鸿蒙 公众号:蓝不蓝编程
export class Note { private id: number; private content: string = ''; public getId() { return this.id } public setId(id: number) { this.id = id } public getContent() { return this.content } public setContent(content: string) { this.content = content } }
AST#export_declaration#Left export AST#class_declaration#Left class Note AST#class_body#Left { AST#property_declaration#Left private 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 private content ...
export class Note { private id: number; private content: string = ''; public getId() { return this.id } public setId(id: number) { this.id = id } public getContent() { return this.content } public setContent(content: string) { this.content = content } }
https://github.com/yinxing2008/note_hongmeng_ArkUI.git/blob/5c7459ca682903d9184539facc63136bbe6230b9/entry/src/main/ets/data/Note.ets#L7-L26
5e21e2d2f391814786d8942c9d8ca28dffe3ad49
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Camera_js/entry/src/main/ets/views/DividerPage.ets
arkts
DividerPage
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct DividerPage { @Prop referenceLineBol: boolean build() { if (this.referenceLineBol) { Stack() { Column() { Divider().color(Color.White) Divider().color(Color.White) }.justifyContent(FlexAlign.SpaceEvenly).height('100%') Row() { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DividerPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right referenceLineBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#ty...
@Component export struct DividerPage { @Prop referenceLineBol: boolean build() { if (this.referenceLineBol) { Stack() { Column() { Divider().color(Color.White) Divider().color(Color.White) }.justifyContent(FlexAlign.SpaceEvenly).height('100%') Row() { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera_js/entry/src/main/ets/views/DividerPage.ets#L16-L35
04f5c70b646d23dc062998fbdc63d6dcf36e8359
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/MonthView.ets
arkts
MonthView
月视图
@Component export struct MonthView { // 当前显示的年份 @State currentShowYear: number = Constants.TODAY_YEAR; // 当前显示的月份 @State currentShowMonth: number = Constants.TODAY_MONTH; // 当前显示的年月 @State currentYearMonth: string = Constants.TODAY_YEAR + '-' + Constants.TODAY_MONTH; // 当前选中的日期 @State @Watch('onSelectDa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MonthView AST#component_body#Left { // 当前显示的年份 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentShowYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ...
@Component export struct MonthView { @State currentShowYear: number = Constants.TODAY_YEAR; @State currentShowMonth: number = Constants.TODAY_MONTH; @State currentYearMonth: string = Constants.TODAY_YEAR + '-' + Constants.TODAY_MONTH; @State @Watch('onSelectDayChange') currentSelectDate: string = ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/MonthView.ets#L26-L113
c821c90813956a58c594212d2711988514279024
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DataTypeUtils.ets
arkts
isNull
return obj is null. @return boolean.
static isNull(obj: Object): boolean { return (typeof obj === 'undefined' || obj == null || obj === ''); }
AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig...
static isNull(obj: Object): boolean { return (typeof obj === 'undefined' || obj == null || obj === ''); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DataTypeUtils.ets#L25-L27
4b2f1e284cffd705123c70e081ed316bb448454b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthView.ets
arkts
MonthView
月视图
@Component export struct MonthView { // 当前显示的年份 @State currentShowYear: number = Constants.TODAY_YEAR; // 当前显示的月份 @State currentShowMonth: number = Constants.TODAY_MONTH; // 当前显示的年月 @State currentYearMonth: string = Constants.TODAY_YEAR + '-' + Constants.TODAY_MONTH; // 当前选中的日期 @State @Watch('onSelectDa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MonthView AST#component_body#Left { // 当前显示的年份 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentShowYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ...
@Component export struct MonthView { @State currentShowYear: number = Constants.TODAY_YEAR; @State currentShowMonth: number = Constants.TODAY_MONTH; @State currentYearMonth: string = Constants.TODAY_YEAR + '-' + Constants.TODAY_MONTH; @State @Watch('onSelectDayChange') currentSelectDate: string = ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthView.ets#L28-L115
24ac3c5c90205c5e2ac972b18f024911fcdb601a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/model/TextModel.ets
arkts
自定义Message类
export class CustomMessage { id: number | string; profile: string | Resource; // 头像 userName: string; // 用户名 subTitle: string; // 副标题 spans: MyCustomSpan[]; // Text组件中展示的 Span 列表 media?: Resource; // 内容 constructor(id: number | string, profile: string | Resource, userName: string, subTitle: string, spans...
AST#export_declaration#Left export AST#class_declaration#Left class CustomMessage AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_...
export class CustomMessage { id: number | string; profile: string | Resource; userName: string; subTitle: string; spans: MyCustomSpan[]; media?: Resource; constructor(id: number | string, profile: string | Resource, userName: string, subTitle: string, spans: MyCustomSpan[], media?: Resource) { t...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/model/TextModel.ets#L19-L37
bd825feab6c540168258bcd527789a5beb5a1282
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/FileSizeUtils.ets
arkts
parseSizeString
解析文件大小字符串为字节数 @param sizeString - 文件大小字符串 (如: "1.5MB", "1024KB") @returns 字节数
static parseSizeString(sizeString: string): number { const units: Record<string, number> = { 'B': 1, 'KB': 1024, 'MB': 1024 * 1024, 'GB': 1024 * 1024 * 1024, 'TB': 1024 * 1024 * 1024 * 1024 }; const match = sizeString.match(/^([\d.]+)\s*([A-Za-z]+)$/); if (!match) throw ne...
AST#method_declaration#Left static parseSizeString AST#parameter_list#Left ( AST#parameter#Left sizeString : 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#p...
static parseSizeString(sizeString: string): number { const units: Record<string, number> = { 'B': 1, 'KB': 1024, 'MB': 1024 * 1024, 'GB': 1024 * 1024 * 1024, 'TB': 1024 * 1024 * 1024 * 1024 }; const match = sizeString.match(/^([\d.]+)\s*([A-Za-z]+)$/); if (!match) throw ne...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileSizeUtils.ets#L27-L45
77a07682afcc0c43582da4a4655ad35315459558
github
wangfh5/AICalendar-ArkTS.git
1551ca6690b1682c896eee5a1a963140d1323e00
entry/src/main/ets/entryability/EntryAbility.ets
arkts
EntryAbility.ets
export let calendarMgr: calendarManager.CalendarManager | null = null;
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left calendarMgr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left calendarManager . CalendarManager AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#pr...
export let calendarMgr: calendarManager.CalendarManager | null = null;
https://github.com/wangfh5/AICalendar-ArkTS.git/blob/1551ca6690b1682c896eee5a1a963140d1323e00/entry/src/main/ets/entryability/EntryAbility.ets#L10-L10
afa569accd7f7e7f4a20039673a6a5271c554066
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Read a text file from sandbox storage. If you have a context filesDir already, you can pass it to me. @returns A string, of the requested file's content.
export function sandbox_read_text_sync(file_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; file_name = filesDir + "/" + file_name if (!(fs.accessSync(file_name))) { // file doesn't exist return "undefined"; } let file = fs.openSync(file_na...
AST#export_declaration#Left export AST#function_declaration#Left function sandbox_read_text_sync AST#parameter_list#Left ( AST#parameter#Left file_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDir ? : A...
export function sandbox_read_text_sync(file_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; file_name = filesDir + "/" + file_name if (!(fs.accessSync(file_name))) { return "undefined"; } let file = fs.openSync(file_name, fs.OpenMode.READ_...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L429-L445
a38ef45e099387917be56f3b83ec16117013bef7
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
getFp
Obtains the screen horizontal adaptation fp. @return number
static getFp(value: Resource): number { let beforeFp = context.resourceManager.getNumber(value.id); return px2fp(DimensionUtil.adaptDimension(beforeFp)); }
AST#method_declaration#Left static getFp AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Resource 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#R...
static getFp(value: Resource): number { let beforeFp = context.resourceManager.getNumber(value.id); return px2fp(DimensionUtil.adaptDimension(beforeFp)); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets#L73-L76
68d0196b4a82b9029e8bdaff881cf00b4137b450
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
convertCartsToSelectedGoods
将购物车项转换为 SelectedGoods @param {Cart[]} carts 购物车列表 @returns {SelectedGoods[]} 转换后的 SelectedGoods 列表
private convertCartsToSelectedGoods(carts: Cart[]): SelectedGoods[] { const result: SelectedGoods[] = []; for (const cart of carts) { for (const cartSpec of cart.spec) { // 创建规格对象 const spec = new GoodsSpec(); spec.id = cartSpec.id; spec.goodsId = cartSpec.goodsId; ...
AST#method_declaration#Left private convertCartsToSelectedGoods AST#parameter_list#Left ( AST#parameter#Left carts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type...
private convertCartsToSelectedGoods(carts: Cart[]): SelectedGoods[] { const result: SelectedGoods[] = []; for (const cart of carts) { for (const cartSpec of cart.spec) { const spec = new GoodsSpec(); spec.id = cartSpec.id; spec.goodsId = cartSpec.goodsId; spec.nam...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L313-L345
d80e08389fa2cecc0ff962441ae3c72d0c3f66d8
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/ScanPage.ets
arkts
ScanFrame
扫描的白框
@Builder private ScanFrame() { Column() { Blank() .width(265) .height(400) .borderRadius(50) .border({ width: 3, color: '#ffffff' }) .borderRadius(6) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ScanFrame AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_u...
@Builder private ScanFrame() { Column() { Blank() .width(265) .height(400) .borderRadius(50) .border({ width: 3, color: '#ffffff' }) .borderRadius(6) } }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/ScanPage.ets#L153-L165
de675cfb67c12fd9924bdb091a028e221c885e3e
github
common-apps/dsbrigde-harmony-os
bb03e4e95984db32939a1ad609f688537b5a92e8
entry/src/main/ets/bridge/JsBridge.ets
arkts
testAsync
异步模版 @param args @param handler
@JavaScriptInterface() testAsync(args: string, handler: CompleteHandler) { LogUtils.d("testAsync: " + JSON.stringify(args)) this.cHandler = handler this.countdown(5, (time:number) => { if (time === 0) { handler.complete("原生异步testAsync方法返回的数据--结束") handler.complete("原生异步testAsync方法返回的...
AST#method_declaration#Left AST#decorator#Left @ JavaScriptInterface ( ) AST#decorator#Right testAsync AST#parameter_list#Left ( AST#parameter#Left args : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_an...
@JavaScriptInterface() testAsync(args: string, handler: CompleteHandler) { LogUtils.d("testAsync: " + JSON.stringify(args)) this.cHandler = handler this.countdown(5, (time:number) => { if (time === 0) { handler.complete("原生异步testAsync方法返回的数据--结束") handler.complete("原生异步testAsync方法返回的...
https://github.com/common-apps/dsbrigde-harmony-os/blob/bb03e4e95984db32939a1ad609f688537b5a92e8/entry/src/main/ets/bridge/JsBridge.ets#L97-L111
3de5a7a0511042cea1048edec9a758ab38dab7d7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/llm/LLMService.ets
arkts
请求体类
export class RequestBody { private data: Map<string, string | number | boolean | object> = new Map(); set(key: string, value: string | number | boolean | object): void { this.data.set(key, value); } get(key: string): string | number | boolean | object | undefined { return this.data.get(key); } ...
AST#export_declaration#Left export AST#class_declaration#Left class RequestBody AST#class_body#Left { AST#property_declaration#Left private data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
export class RequestBody { private data: Map<string, string | number | boolean | object> = new Map(); set(key: string, value: string | number | boolean | object): void { this.data.set(key, value); } get(key: string): string | number | boolean | object | undefined { return this.data.get(key); } ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L122-L153
071d718fd48c64767e97229e86ebbee601d3ba72
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceTabs.d.ets
arkts
the enum for TabBarOption. @enum { number }. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare enum TabBarPosition { /** * when the TabBarPosition set left,the tabs is located on the left of the tabs * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ LEFT = 0, /** * when the TabBarPosition set bottom,the tabs is located on t...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum TabBarPosition AST#enum_body#Left { /** * when the TabBarPosition set left,the tabs is located on the left of the tabs * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since...
export declare enum TabBarPosition { LEFT = 0, BOTTOM = 1 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceTabs.d.ets#L167-L184
d311b3be229e23ffafea98d87eaeee6a85cc519c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/Browser.ets
arkts
forward
前进页面
forward() { if (this.webController.accessForward()) { this.webController.forward(); } }
AST#method_declaration#Left forward 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#...
forward() { if (this.webController.accessForward()) { this.webController.forward(); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/Browser.ets#L43-L47
734e37309297effad3ed8ae3726b22f5b276f923
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/navigation/CategoryNav.ets
arkts
CategoryNav
@file 分类页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function CategoryNav(): void { CategoryPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CategoryNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_co...
@Builder export function CategoryNav(): void { CategoryPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/navigation/CategoryNav.ets#L8-L11
0e8b0ccb3b22dbce36b3e3d221151f45b4133656
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/Tcp2TwoWayTlsWorker.ets
arkts
loadFile
[Start two-way_authentication_by_upgrading_tcp_socket_to_tls_socket] Handle file loading (CA certificate, client certificate, private key)
function loadFile(fileUri: string) { try { let buf = new ArrayBuffer(4096); // Set buffer size let file = fs.openSync(fileUri, fs.OpenMode.READ_ONLY); let readLen = fs.readSync(file.fd, buf, { offset: 0 }); let fileContent = buf2String(buf.slice(0, readLen)); fs.closeSync(file); if (fileUri.i...
AST#function_declaration#Left function loadFile AST#parameter_list#Left ( AST#parameter#Left fileUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Lef...
function loadFile(fileUri: string) { try { let buf = new ArrayBuffer(4096); let file = fs.openSync(fileUri, fs.OpenMode.READ_ONLY); let readLen = fs.readSync(file.fd, buf, { offset: 0 }); let fileContent = buf2String(buf.slice(0, readLen)); fs.closeSync(file); if (fileUri.includes('ca')) { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/Tcp2TwoWayTlsWorker.ets#L80-L98
dde3db4f378ddd7f9db8d3f9c4f8990e26c17742
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
release
释放播放器资源 @returns {void}
release(): void { this.avplayerModel.releaseAVPlayer(); this.avsessionModel!.stopContinuousTask(); this.avsessionModel!.destroySession(); }
AST#method_declaration#Left release AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left ...
release(): void { this.avplayerModel.releaseAVPlayer(); this.avsessionModel!.stopContinuousTask(); this.avsessionModel!.destroySession(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L266-L271
6ada667470e0b52813b727d129b5ace7d53a4e8d
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/PermissionUtil.ets
arkts
requestGlobalSwitch
用于UIAbility/UIExtensionAbility拉起全局开关设置弹框。部分情况下,录音、拍照等功能禁用,应用可拉起此弹框请求用户同意开启对应功能。如果当前全局开关的状态为开启,则不拉起弹框 @param type 全局开关类型。 @returns
static async requestGlobalSwitch(type: abilityAccessCtrl.SwitchType): Promise<boolean> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); const context: Context = getContext() as common.UIAbilityContext; return await atManager.requestGlobalSwitch(context, type); }
AST#method_declaration#Left static async requestGlobalSwitch AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left abilityAccessCtrl . SwitchType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param...
static async requestGlobalSwitch(type: abilityAccessCtrl.SwitchType): Promise<boolean> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); const context: Context = getContext() as common.UIAbilityContext; return await atManager.requestGlobalSwitch(context, type); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/PermissionUtil.ets#L135-L139
4f539829698b11e809c4946eda0ff3c18b4973f2
gitee
Zairgs/ArKTSMovie.git
1586c977f12722333eee7d74a71f006ba0606ade
ets/pages/MyCards/Coupon.ets
arkts
使用明确定义的接口类型
build() { Column() { // 标题栏 Row() { Image($r('app.media.back')) .width(24) .height(24) .margin({ left: 12, right: 16 }) .onClick(() => { router.back(); }) Text('我的优惠券') .fontSize(20) .fontWeight(FontWeight...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 标题栏 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ar...
build() { Column() { Row() { Image($r('app.media.back')) .width(24) .height(24) .margin({ left: 12, right: 16 }) .onClick(() => { router.back(); }) Text('我的优惠券') .fontSize(20) .fontWeight(FontWeight.Bold)...
https://github.com/Zairgs/ArKTSMovie.git/blob/1586c977f12722333eee7d74a71f006ba0606ade/ets/pages/MyCards/Coupon.ets#L17-L105
760a0589aded89357b546227838c3976ef403fd9
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaHelper.ets
arkts
getCityByName
根据省名获取下面的市 @param provinceName 省名 @returns
static async getCityByName(provinceName: string): Promise<Array<AreaEntity>> { let list = await AreaHelper.getArea(); for (let index = 0; index < list.length; index++) { if (provinceName == list[index].text) { return list[index].children ?? [] } } return []; }
AST#method_declaration#Left static async getCityByName AST#parameter_list#Left ( AST#parameter#Left provinceName : 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#ge...
static async getCityByName(provinceName: string): Promise<Array<AreaEntity>> { let list = await AreaHelper.getArea(); for (let index = 0; index < list.length; index++) { if (provinceName == list[index].text) { return list[index].children ?? [] } } return []; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L93-L101
248a2bdf105e5d5025a23a35f9167bdef13b68fb
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets
arkts
release
释放资源
static async release() { await AudioRendererManager.audioRender?.release() }
AST#method_declaration#Left static async release AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#L...
static async release() { await AudioRendererManager.audioRender?.release() }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets#L87-L89
32d803de7a78ffbd53ace620d90afc137d6cea7c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowShowList.ets
arkts
RowShowList
Show List in Row
@Component export struct RowShowList { @Consume currentRowJustifyContent: FlexAlign; @Consume currentRowAlignItems: VerticalAlign; build() { Column() { Row() { ForEach(LIST, (item: number) => { CommonItem({ item: item }) }, (item: number) => JSON.stringify(item)) } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RowShowList AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right currentRowJustifyContent : AST#type_annotation#Left AST#primary_type#Left FlexAlign AST#primary_type...
@Component export struct RowShowList { @Consume currentRowJustifyContent: FlexAlign; @Consume currentRowAlignItems: VerticalAlign; build() { Column() { Row() { ForEach(LIST, (item: number) => { CommonItem({ item: item }) }, (item: number) => JSON.stringify(item)) } ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/RowShowList.ets#L29-L60
4a44c173e156b4dc1689d35823af84f3927cdfe9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
社区话题接口
export interface CommunityTopic { id: string; name: string; description: string; icon: string; color: string; postCount: number; followerCount: number; isFollowing: boolean; isOfficial: boolean; createdAt: string; moderators: string[]; rules: string[]; tags: string[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CommunityTopic AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left ...
export interface CommunityTopic { id: string; name: string; description: string; icon: string; color: string; postCount: number; followerCount: number; isFollowing: boolean; isOfficial: boolean; createdAt: string; moderators: string[]; rules: string[]; tags: string[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L132-L146
70d21e90b1d1b246b9fa537598e19e1dea88a5e1
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/view/AddDialogComponent.ets
arkts
aboutToAppear
当即将出现时触发的生命周期函数
aboutToAppear() { this.inputAmount = this.newAccount.amount.toString(); // 初始化输入金额 this.curIndex = this.newAccount.accountType; // 初始化当前支付或收入索引 this.curType = this.newAccount.typeText; // 初始化当前支付或收入类型 }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputAmount AST#member_expression#Ri...
aboutToAppear() { this.inputAmount = this.newAccount.amount.toString(); this.curIndex = this.newAccount.accountType; this.curType = this.newAccount.typeText; }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/AddDialogComponent.ets#L47-L51
0429a65f5bb002b3ef18d746070453aa8dc87d06
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/result/src/main/ets/RequestHelper.ets
arkts
loading
配置是否展示 loading @param {boolean} enable - 是否展示 @returns {RequestHelper<T>} 当前实例
loading(enable: boolean = false): RequestHelper<T> { this.useLoading = enable; return this; }
AST#method_declaration#Left loading AST#parameter_list#Left ( AST#parameter#Left enable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#...
loading(enable: boolean = false): RequestHelper<T> { this.useLoading = enable; return this; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L68-L71
bb4d25f024e82d70cfb40c00ba376a011a475e3f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/constants/AppConstants.ets
arkts
应用常量定义 包含应用级别的常量配置
export class AppConstants { // 应用基础信息 static readonly APP_NAME: string = '生日提醒'; static readonly APP_VERSION: string = '2.0.0'; static readonly APP_BUILD: string = '20250913'; // 存储配置 static readonly STORAGE_NAME: string = 'birthday_reminder_storage'; static readonly SECURE_STORAGE_NAME: string = 'birthd...
AST#export_declaration#Left export AST#class_declaration#Left class AppConstants AST#class_body#Left { // 应用基础信息 AST#property_declaration#Left static readonly APP_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '生日提醒' AST#expression#Rig...
export class AppConstants { static readonly APP_NAME: string = '生日提醒'; static readonly APP_VERSION: string = '2.0.0'; static readonly APP_BUILD: string = '20250913'; static readonly STORAGE_NAME: string = 'birthday_reminder_storage'; static readonly SECURE_STORAGE_NAME: string = 'birthday_reminder_secu...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/constants/AppConstants.ets#L6-L55
dbc74b59e29190d30aa47046a8437e5fbef757d7
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
setGridLineWidth
Sets the width of the grid lines that are drawn away from each axis label. @param width
public setGridLineWidth(width: number): void { this.mGridLineWidth = Utils.convertDpToPixel(width); }
AST#method_declaration#Left public setGridLineWidth 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#primary...
public setGridLineWidth(width: number): void { this.mGridLineWidth = Utils.convertDpToPixel(width); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L295-L297
b94d7b108ac3d1a55c5b08f709a64ae235891dc7
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets
arkts
@author: HHBin @date: 2024-11-15 @desc: 路由动画转场参数建造器
export class NavAnimParamBuilder { private _callback: AnimateCallback private _options = new NavAnimateOptions() constructor
AST#export_declaration#Left export AST#ERROR#Left class NavAnimParamBuilder { AST#property_declaration#Left private _callback : AST#type_annotation#Left AST#primary_type#Left AnimateCallback AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right private _options = AST#expression#Left AST#call_...
export class NavAnimParamBuilder { private _callback: AnimateCallback private _options = new NavAnimateOptions() constructor
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets#L10-L14
dfedf3a5e5d7ba8d2f8a24bb4330d357e0d46507
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/view/GoodsCategoryPage.ets
arkts
GoodsCategoryContent
商品分类页面内容视图 @returns {void} 无返回值
@Builder private GoodsCategoryContent() { Text("商品分类页面内容视图") }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private GoodsCategoryContent 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 Text ( AST#expression#Left "商品分类页面内容视图" AST#e...
@Builder private GoodsCategoryContent() { Text("商品分类页面内容视图") }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsCategoryPage.ets#L33-L36
103db65c26207434af59304fd83d149facd1b843
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
面试状态枚举
export enum InterviewStatus { SCHEDULED = 'scheduled', // 已安排 COMPLETED = 'completed', // 已完成 CANCELLED = 'cancelled', // 已取消 PENDING = 'pending' // 待定 }
AST#export_declaration#Left export AST#enum_declaration#Left enum InterviewStatus AST#enum_body#Left { AST#enum_member#Left SCHEDULED = AST#expression#Left 'scheduled' AST#expression#Right AST#enum_member#Right , // 已安排 AST#enum_member#Left COMPLETED = AST#expression#Left 'completed' AST#expression#Right AST#enum_membe...
export enum InterviewStatus { SCHEDULED = 'scheduled', COMPLETED = 'completed', CANCELLED = 'cancelled', PENDING = 'pending' }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L4-L9
59ef8c4a03f6026bf9b3aa2f1f62b6daecb08031
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/tabcontentoverflow/Index.ets
arkts
TabContentOverFlowComponent
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 { TabContentOverFlowComponent } from './src/main/ets/mainpage/TabContentOverFlow';
AST#export_declaration#Left export { TabContentOverFlowComponent } from './src/main/ets/mainpage/TabContentOverFlow' ; AST#export_declaration#Right
export { TabContentOverFlowComponent } from './src/main/ets/mainpage/TabContentOverFlow';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/tabcontentoverflow/Index.ets#L18-L18
5bad0099a9c96a32e06e3596cc937654451cdb8d
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/Resumed.ets
arkts
handle
应用约束7:使用private代替#私有字段(若存在) 应用约束18:在类中显式声明字段(假设packetManager在父类已声明) 应用约束1:为参数添加具体类型
handle(packet: Object): void { const client = this.packetManager.client; const ws = client.ws.connection; // 应用约束21:通过点操作符访问已声明字段 ws._trace = packet.d._trace; // 应用约束32:运算符操作数值类型 ws.status = Constants.Status.READY; this.packetManager.handleQueue(); const replayed: number = ws.sequence...
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : 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 void AST#primary_type#Right AST#...
handle(packet: Object): void { const client = this.packetManager.client; const ws = client.ws.connection; ws._trace = packet.d._trace; ws.status = Constants.Status.READY; this.packetManager.handleQueue(); const replayed: number = ws.sequence - ws.closeSequence; ws.debug(`R...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/Resumed.ets#L10-L29
869b36748c58e61e0b6375cd3aa553e17a1464d1
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
addCommonCookies
添加公共的cookie @param cookies @returns
addCommonCookies(cookies: Record<string, string>): EfRcp { if (cookies) { Object.entries(cookies).forEach((row) => { if (this.cfg.cookies) { this.cfg.cookies[row[0]] = row[1]; } else { this.cfg.cookies = {}; this.cfg.cookies[row[0]] = row[1]; } }); ...
AST#method_declaration#Left addCommonCookies AST#parameter_list#Left ( AST#parameter#Left cookies : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_anno...
addCommonCookies(cookies: Record<string, string>): EfRcp { if (cookies) { Object.entries(cookies).forEach((row) => { if (this.cfg.cookies) { this.cfg.cookies[row[0]] = row[1]; } else { this.cfg.cookies = {}; this.cfg.cookies[row[0]] = row[1]; } }); ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L193-L205
e3a8d6935de73ade6cfadcb8d9d0d6ec287677bc
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/ValidationUtils.ets
arkts
validatePhone
验证手机号码 @param phone 手机号码 @returns 是否有效
static validatePhone(phone: string): boolean { if (!phone || phone.trim() === '') { return false; } const regex = new RegExp(RegexConstants.PHONE_REGEX); return regex.test(phone.trim()); }
AST#method_declaration#Left static validatePhone AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary...
static validatePhone(phone: string): boolean { if (!phone || phone.trim() === '') { return false; } const regex = new RegExp(RegexConstants.PHONE_REGEX); return regex.test(phone.trim()); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/ValidationUtils.ets#L16-L23
d5c0da57562b3a24f57224838bba730427827edb
github
RicardoWesleyli/HarmonyNEXT_Examples.git
6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670
Chapter7/entry/src/main/ets/model/ToolsModel.ets
arkts
ToolsModel.ets
export class ToolsModel { id: number name: string image: string url: string description: string constructor
AST#export_declaration#Left export AST#ERROR#Left class ToolsModel { id : AST#ERROR#Left number name : string image : string url : string description : AST#ERROR#Right string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#R...
export class ToolsModel { id: number name: string image: string url: string description: string constructor
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter7/entry/src/main/ets/model/ToolsModel.ets#L2-L9
68daa8aafb64ad8557c44133572595bd8832dbbb
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/entry/src/main/ets/pages/anim/AnimConst.ets
arkts
@author: HHBin @date: 2024-11-19 @desc:
export class AnimConst { public static readonly TRANSLATE = "平移" public static readonly ANIM = "平移-播放0.5S-减速播放" public static readonly SCALE = "缩放" public static readonly OPACITY = "渐变" public static readonly ROTATE = "旋转" public static readonly BLUR = "模糊" public static readonly CUSTOM = "自定义" }
AST#export_declaration#Left export AST#class_declaration#Left class AnimConst AST#class_body#Left { AST#property_declaration#Left public static readonly TRANSLATE = AST#expression#Left "平移" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left public static readonly ANIM = AST#expression#Le...
export class AnimConst { public static readonly TRANSLATE = "平移" public static readonly ANIM = "平移-播放0.5S-减速播放" public static readonly SCALE = "缩放" public static readonly OPACITY = "渐变" public static readonly ROTATE = "旋转" public static readonly BLUR = "模糊" public static readonly CUSTOM = "自定义" }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/anim/AnimConst.ets#L6-L14
4e93f05afaee44017fce3978a45eb92891d64077
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/storage/StorageManager.ets
arkts
getString
获取字符串值
static async getString(key: string, defaultValue: string = ''): Promise<string> { const instance = StorageManager.getInstance(); if (!instance.dataPreferences) { await instance.init(); if (!instance.dataPreferences) { return defaultValue; } } try { const value = await ins...
AST#method_declaration#Left static async getString AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left string AST#p...
static async getString(key: string, defaultValue: string = ''): Promise<string> { const instance = StorageManager.getInstance(); if (!instance.dataPreferences) { await instance.init(); if (!instance.dataPreferences) { return defaultValue; } } try { const value = await ins...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L52-L67
1349ac4fced615793649b5bc5b15a4c354b83249
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets
arkts
onPlayerError
播放器播放失败事件
onPlayerError(error: VHErrorInfo) { if (error.code == VHConstants.VH_PLAY_CURRENT_DEF_FAILED) { //没有可用的清晰度,重新进行播放。 this.livePlayer?.startPlay(this.playerConfig?.default_definition!); } else if (error.code == VHConstants.VH_PLAY_STREAM_FAILED || error.code == VHConstants.PLAY_FORMAT_ERROR || er...
AST#method_declaration#Left onPlayerError AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left VHErrorInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_st...
onPlayerError(error: VHErrorInfo) { if (error.code == VHConstants.VH_PLAY_CURRENT_DEF_FAILED) { this.livePlayer?.startPlay(this.playerConfig?.default_definition!); } else if (error.code == VHConstants.VH_PLAY_STREAM_FAILED || error.code == VHConstants.PLAY_FORMAT_ERROR || error.code == VHCons...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets#L163-L175
7ff773f1a8083d11bac96c13e4c7cc47cc149c42
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/smartPerfHost/src/main/ets/view/FrameTimelineBeforeOptimization.ets
arkts
FrameTimelineBeforeOptimization
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct FrameTimelineBeforeOptimization { // 创建长度500的空数组,使用每个元素的索引作为元素的值,生成包含数字0-499的数组 @State children: number[] = Array.from<undefined, number>(Array(500).fill(undefined), (item: undefined, index) => index); build() { Scroll() { Grid() { ForEach(this.children, (item: number) =...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FrameTimelineBeforeOptimization AST#component_body#Left { // 创建长度500的空数组,使用每个元素的索引作为元素的值,生成包含数字0-499的数组 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right children : AST#type_annotation#Left ...
@Component export struct FrameTimelineBeforeOptimization { @State children: number[] = Array.from<undefined, number>(Array(500).fill(undefined), (item: undefined, index) => index); build() { Scroll() { Grid() { ForEach(this.children, (item: number) => { GridItem() { Stack(...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/smartPerfHost/src/main/ets/view/FrameTimelineBeforeOptimization.ets#L15-L41
cd833e3b4d30efb66e7c6f1aea677c20eef51c6a
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets
arkts
[EndExclude switch_the_tab_to_a_specific_tab]
build() { // [StartExclude switch_the_tab_to_a_specific_tab] NavDestination() { Scroll(this.scroller) { // [EndExclude switch_the_tab_to_a_specific_tab] Column({ space: 12 }) { // [StartExclude switch_the_tab_to_a_specific_tab] ComponentCard({ title: $r('app.string.Cont...
AST#build_method#Left build ( ) AST#build_body#Left { // [StartExclude switch_the_tab_to_a_specific_tab] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#L...
build() { NavDestination() { Scroll(this.scroller) { Column({ space: 12 }) { ComponentCard({ title: $r('app.string.ContentWillChange_titleContentAndTabSync') }) { Tabs({ barPosition: BarPosition.End }) { TabContent() { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets#L57-L232
eed2f91409530040a23a5dd8b6edb36acd139e27
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextAreaBuilderProxy.ets
arkts
inputLineHeight
文本行高 @default false @returns
inputLineHeight(inputLineHeight: number | string | Resource) { this.builderOptions.inputLineHeight = inputLineHeight; return this }
AST#method_declaration#Left inputLineHeight AST#parameter_list#Left ( AST#parameter#Left inputLineHeight : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#un...
inputLineHeight(inputLineHeight: number | string | Resource) { this.builderOptions.inputLineHeight = inputLineHeight; return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextAreaBuilderProxy.ets#L29-L32
72af13298156c8a57e55ce62ff6fa1d024558b31
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Logger/Logger.ets
arkts
preInit
/添加abilityStage工程文件,例如entry/src/main/ets/abilityStage/MyAbilityStage.ets / 在AppScope/resources/rawfile/umconfig.json中配置umid,
static preInit(context: Context){ preInit({context: context.getApplicationContext(), plugins:[new InternalPlugin()]}) setLogEnabled(isDebugMode) }
AST#method_declaration#Left static preInit AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_eleme...
static preInit(context: Context){ preInit({context: context.getApplicationContext(), plugins:[new InternalPlugin()]}) setLogEnabled(isDebugMode) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Logger/Logger.ets#L9-L12
4c8614d193cf92072424c04026dd717e6ba5981c
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
Default Click effect. @returns ClickEffect = { level: ClickEffectLevel.LIGHT }
export function click_effect_default() { let ce: ClickEffect = { level: ClickEffectLevel.LIGHT }; return ce; }
AST#export_declaration#Left export AST#function_declaration#Left function click_effect_default AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ce : AST#type_annotation#Left AST#primary_type#Left ClickEffect...
export function click_effect_default() { let ce: ClickEffect = { level: ClickEffectLevel.LIGHT }; return ce; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L85-L88
f9a977ffd4c128c5d4e4679c64e53076424bae8b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets
arkts
CommonItemSlider
Slider in item style @param changeValue slide to change
@Component export struct CommonItemSlider { @Link changeValue: number; private min: number = 0; private max: number = 0; private name: ResourceStr = ''; private step: number = 1; private testId: string = 'test_colorSelect'; private vpTest: string = 'vp'; build() { Row() { Text(this.name) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItemSlider AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right changeValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#typ...
@Component export struct CommonItemSlider { @Link changeValue: number; private min: number = 0; private max: number = 0; private name: ResourceStr = ''; private step: number = 1; private testId: string = 'test_colorSelect'; private vpTest: string = 'vp'; build() { Row() { Text(this.name) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L29-L63
540556271ed77a3cac48f9d5717400494a07e5c6
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
Class representing the y-axis labels settings and its entries. Only use the setter methods to modify it. Do not access public variables directly. Be aware that not all features the YLabels class provides are suitable for the RadarChart. Customizations that affect the value range of the axis need to be applied before se...
export enum AxisDependency { LEFT, RIGHT, }
AST#export_declaration#Left export AST#enum_declaration#Left enum AxisDependency AST#enum_body#Left { AST#enum_member#Left LEFT AST#enum_member#Right , AST#enum_member#Left RIGHT AST#enum_member#Right , } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum AxisDependency { LEFT, RIGHT, }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L33-L36
9d7e56ef606b48f50a7cefd0ebbeca93b5a5439b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderLogisticsPage.ets
arkts
LogisticsLogo
物流公司图标 @param {Logistics} logistics - 物流信息 @returns {void} 无返回值
@Builder private LogisticsLogo(logistics: Logistics): void { NetWorkImage({ model: logistics.logo ?? "", sizeValue: 18 }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private LogisticsLogo AST#parameter_list#Left ( AST#parameter#Left logistics : AST#type_annotation#Left AST#primary_type#Left Logistics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_...
@Builder private LogisticsLogo(logistics: Logistics): void { NetWorkImage({ model: logistics.logo ?? "", sizeValue: 18 }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L173-L179
ce0986c154cdd016c38014ec64fa0a814af7cf7a
github
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
MainAbility的ViewModel
export class MainViewModel { /** * 首页底部Tab显示数据 */ tabTitle = [ { index: 0, title: "首页", imageActivated: $r('app.media.icon_sel_home'), imageOriginal: $r('app.media.icon_unsel_home') }, { index: 1, title: "发现", imageActivated: $r('app.media.icon_sel_find'),...
AST#export_declaration#Left export AST#class_declaration#Left class MainViewModel AST#class_body#Left { /** * 首页底部Tab显示数据 */ AST#property_declaration#Left tabTitle = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left index...
export class MainViewModel { tabTitle = [ { index: 0, title: "首页", imageActivated: $r('app.media.icon_sel_home'), imageOriginal: $r('app.media.icon_unsel_home') }, { index: 1, title: "发现", imageActivated: $r('app.media.icon_sel_find'), imageOriginal: $r('...
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/viewmodel/MainViewModel.ets#L6-L36
0d2a045fa1708f7ef7ce605bf526583b88ffa6d8
github