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
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets
arkts
getItemById
根据主键查询单条记录 @param {number} id - 记录主键 @returns {Promise<DemoEntity | undefined>} 匹配到的 Demo 或 undefined
async getItemById(id: number): Promise<DemoEntity | undefined> { const result: DemoEntity[] = this.orm.query(DemoEntity).where("id", id).find(); return result[0]; }
AST#method_declaration#Left async getItemById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pro...
async getItemById(id: number): Promise<DemoEntity | undefined> { const result: DemoEntity[] = this.orm.query(DemoEntity).where("id", id).find(); return result[0]; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets#L93-L96
4b62a9607e9c1c1021bf73df9e02fccfed8f23e2
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
encodeECB
加密-ECB模式 @param str 待加密的字符串 @param key 给定秘钥规格密钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64) @returns
static encodeECB(str: string, key: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding): OutDTO<string> { //转换key let symKey = CryptoSyncUtil.convertKeyFromStr(key, symAlgName, keyName, keyCoding); // 初始化加解密操作环境 l...
AST#method_declaration#Left static encodeECB AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static encodeECB(str: string, key: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding): OutDTO<string> { let symKey = CryptoSyncUtil.convertKeyFromStr(key, symAlgName, keyName, keyCoding); let mode = crypto.Cry...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L191-L209
8833d5aa3a72b947bb3398b09a15a86bab121ab8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
getStyleLabel
获取样式标签
private getStyleLabel(style: GreetingStyle): string { switch (style) { case GreetingStyle.WARM: return '温馨'; case GreetingStyle.FORMAL: return '正式'; case GreetingStyle.HUMOROUS: return '幽默'; case GreetingStyle.POETIC: return '诗意'; case GreetingStyle.SIMP...
AST#method_declaration#Left private getStyleLabel AST#parameter_list#Left ( AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left GreetingStyle AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#...
private getStyleLabel(style: GreetingStyle): string { switch (style) { case GreetingStyle.WARM: return '温馨'; case GreetingStyle.FORMAL: return '正式'; case GreetingStyle.HUMOROUS: return '幽默'; case GreetingStyle.POETIC: return '诗意'; case GreetingStyle.SIMP...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L626-L641
9a428987512198679c90c86a2d46e4572bdf883d
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFMpegUtils.ets
arkts
generateUUID32
生成32位 UUID @returns UUID 字符串
private static generateUUID32(): string { const chars = '0123456789abcdef'; let uuid = ''; for (let i = 0; i < 32; i++) { // 替换索引访问为 charAt() 方法 uuid += chars.charAt(Math.floor(Math.random() * 16)); } return uuid; }
AST#method_declaration#Left private static generateUUID32 AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarato...
private static generateUUID32(): string { const chars = '0123456789abcdef'; let uuid = ''; for (let i = 0; i < 32; i++) { uuid += chars.charAt(Math.floor(Math.random() * 16)); } return uuid; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFMpegUtils.ets#L128-L136
0921cf8d43102cd4f982bc2951f3be613c8f86d6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomNotification/entry/src/main/ets/components/TitleBar.ets
arkts
TitleBar
Page title bar
@Component export struct TitleBar { private title: Resource | undefined = undefined; build() { Row() { if (this.title !== undefined && this.title !== null) { Text(this.title) .fontSize(24) .fontWeight(700) .lineHeight(32) .margin({ left: 24 }) .fo...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left undefined AST...
@Component export struct TitleBar { private title: Resource | undefined = undefined; build() { Row() { if (this.title !== undefined && this.title !== null) { Text(this.title) .fontSize(24) .fontWeight(700) .lineHeight(32) .margin({ left: 24 }) .fo...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/entry/src/main/ets/components/TitleBar.ets#L17-L36
0073d9b071886248e46be58a64ff711fdf4d60f9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/GlobalContext.ets
arkts
[Start after_load_complete_call_to_change_page]
export class GlobalContext { private constructor() {} private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.instance;...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat...
export class GlobalContext { private constructor() {} private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.instance;...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/LoadPages/entry/src/main/ets/pages/GlobalContext.ets#L17-L36
10eca87cb25ae02b651aec756e630f39175fa7ce
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets
arkts
ThirdGoodsItem
TODO: 知识点:使用@Observed装饰器,为了做到类的嵌套也可以被观察到属性的变化
@Observed /** * 表示商品详细数据的类型,是嵌套类的第三层 * @class */ export class ThirdGoodsItem { imgSrc: Resource; // 商品图片 price: string; // 商品价格 constructor(imgSrc: Resource, price: string) { this.imgSrc = imgSrc; this.price = price; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right /** * 表示商品详细数据的类型,是嵌套类的第三层 * @class */ export class ThirdGoodsItem AST#class_body#Left { AST#property_declaration#Left imgSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Ri...
@Observed export class ThirdGoodsItem { imgSrc: Resource; price: string; constructor(imgSrc: Resource, price: string) { this.imgSrc = imgSrc; this.price = price; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets#L17-L30
21cd6365d53af2fe4d3f2ca6de9f39428ff6fbc9
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/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) Sl...
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) Sl...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L29-L63
ec1a77d9511b658fc2962198c78ee186adc60252
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/HomePage.ets
arkts
构建首页 @returns {void} 无返回值
build() { AppNavDestination({ viewModel: this.vm, hideTitleBar: true, }) { HomeTopBar(); BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.HomeContent() }); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Rig...
build() { AppNavDestination({ viewModel: this.vm, hideTitleBar: true, }) { HomeTopBar(); BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.HomeContent() }); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/HomePage.ets#L33-L45
6aacab16a7c673a718afa6d39f9b61a24c3cb7c8
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/ShareUtils.ets
arkts
shareVideoByUrl
分享网络视频 @param uri 视频uri
static shareVideoByUrl(uri: string, description: string = '来自--xxxAPP'): Promise<boolean> { // return DownloadApi.requestDownload({ url: url, mimeType: photoAccessHelper.PhotoType.VIDEO }).then((path) => { // let uri = fileUri.getUriFromPath(path); let shareData: systemShare.SharedData = new systemShare.S...
AST#method_declaration#Left static shareVideoByUrl AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
static shareVideoByUrl(uri: string, description: string = '来自--xxxAPP'): Promise<boolean> { let shareData: systemShare.SharedData = new systemShare.SharedData({ utd: utd.UniformDataType.VIDEO, uri: uri, description: description, }) return ShareUtils.systemShare(shareData) ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ShareUtils.ets#L30-L42
503800c24382ffe22c872848d19b4499e780be16
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets
arkts
getCartByGoodsId
根据商品ID获取购物车商品 @param {number} goodsId 商品ID @returns {Promise<Cart | undefined>} 匹配到的购物车商品
async getCartByGoodsId(goodsId: number): Promise<Cart | undefined> { const entity: CartEntity | undefined = this.findEntityByGoodsId(goodsId); return entity ? this.toModel(entity) : undefined; }
AST#method_declaration#Left async getCartByGoodsId AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ...
async getCartByGoodsId(goodsId: number): Promise<Cart | undefined> { const entity: CartEntity | undefined = this.findEntityByGoodsId(goodsId); return entity ? this.toModel(entity) : undefined; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets#L146-L149
7c40c683c3c8130f55b6fa5a5bafa55e588008db
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/MePage.ets
arkts
FunctionMenu
功能菜单
@Builder FunctionMenu() { Column() { Column() { this.MenuItem('优惠券', '🎫', '#6A9BE6') Divider().color(AppColors.divider) this.MenuItem('收货地址', '📍', '#66BB6A') Divider().color(AppColors.divider) this.MenuItem('在线客服', '👨‍💼', '#F87C7B') Divider().color(AppColo...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right FunctionMenu AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_ele...
@Builder FunctionMenu() { Column() { Column() { this.MenuItem('优惠券', '🎫', '#6A9BE6') Divider().color(AppColors.divider) this.MenuItem('收货地址', '📍', '#66BB6A') Divider().color(AppColors.divider) this.MenuItem('在线客服', '👨‍💼', '#F87C7B') Divider().color(AppColo...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/MePage.ets#L255-L283
80c1a04f939311903183fba9d0b5ba662910d770
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/view/AboutPage.ets
arkts
AboutLinks
关于页面链接区 @returns {void} 无返回值
@Builder private AboutLinks(): void { IBestCellGroup({ inset: true, outerMargin: 0 }) { ForEach(this.vm.links, (item: AboutLinkItem, index: number) => { IBestCell({ title: item.title, label: item.url, isLink: true, leftContentWidth: P90, hasBorder: i...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AboutLinks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_el...
@Builder private AboutLinks(): void { IBestCellGroup({ inset: true, outerMargin: 0 }) { ForEach(this.vm.links, (item: AboutLinkItem, index: number) => { IBestCell({ title: item.title, label: item.url, isLink: true, leftContentWidth: P90, hasBorder: i...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/AboutPage.ets#L103-L117
0aa75f73e5afdee8d3b7e35c6162c2268fe51047
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/FlawService.ets
arkts
分页参数接口
export interface FlawPageParam { pageNum: number; pageSize: number; taskId?: number; flawType?: string; confirmed?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface FlawPageParam AST#object_type#Left { AST#type_member#Left pageNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left pageSize : AST#type_annotati...
export interface FlawPageParam { pageNum: number; pageSize: number; taskId?: number; flawType?: string; confirmed?: boolean; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L30-L36
74ed878341b9240f781eaed059608420251eac1e
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/FlowItemNode.ets
arkts
FlowItemNode
自定义组件复用池瀑布流子组件
@Component export struct FlowItemNode { @State type: string = ''; @State data: ViewItem = new ViewItem(); @State itemHeight: number = 0; @State itemColor: Color = 0; @State builder: WrappedBuilder<ESObject> | null = null; private nodeItem: NodeItem = new NodeItem(); aboutToAppear(): void { this.nodeI...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlowItemNode AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati...
@Component export struct FlowItemNode { @State type: string = ''; @State data: ViewItem = new ViewItem(); @State itemHeight: number = 0; @State itemColor: Color = 0; @State builder: WrappedBuilder<ESObject> | null = null; private nodeItem: NodeItem = new NodeItem(); aboutToAppear(): void { this.nodeI...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/FlowItemNode.ets#L28-L48
a912bf75ab5158e537ed052c9e48559d8421cf3a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/data/ViewItem.ets
arkts
ViewItem
瀑布流子组件数据结构
@Observed export class ViewItem { id: string = ""; // 名字 name: string = ""; // 描述 des: string = ""; // 类型 type: number = 0; // 封面图片 image: string | Resource = ""; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ViewItem AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AS...
@Observed export class ViewItem { id: string = ""; name: string = ""; des: string = ""; type: number = 0; image: string | Resource = ""; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/data/ViewItem.ets#L17-L28
21fc3079d33af2838b5a1bdc4dd4fce39ce9d413
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/Constants.ets
arkts
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...
export default class Constants { // 不使用缓存数据 public static readonly CACHED_COUNT_0: number = 0; // 使用懒加载时,缓存数据的数量 public static readonly CACHED_COUNT: number = 10; // 从json中读取数据的数量 public static readonly DATA_MOCK_COUNT: number = 5000; // 聊天页面中,模拟数据的限制数量 public static readonly MOCK_ELEMENT_COUNT: number ...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // 不使用缓存数据 AST#property_declaration#Left public static readonly CACHED_COUNT_0 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#...
export default class Constants { public static readonly CACHED_COUNT_0: number = 0; public static readonly CACHED_COUNT: number = 10; public static readonly DATA_MOCK_COUNT: number = 5000; public static readonly MOCK_ELEMENT_COUNT: number = 120; public static readonly FRIEND_MOMENT_MOCK_DATA_CO...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/Constants.ets#L16-L27
63b05e3abd4d6ec1168ff830ae50aa4d83cb02bc
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/conditional_expression/conditional_expression_002_F.ets
arkts
Introduction 条件表达式
export function conditional_expression_002_F(taint_src : string) { let _t = taint_src; let clean = true ? "a" : "_"; taint.Sink(clean); }
AST#export_declaration#Left export AST#function_declaration#Left function conditional_expression_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_...
export function conditional_expression_002_F(taint_src : string) { let _t = taint_src; let clean = true ? "a" : "_"; taint.Sink(clean); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/conditional_expression/conditional_expression_002_F.ets#L6-L10
a69b7de92b54963950572985ef92d6a519b895dc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardSwiperComponent.ets
arkts
initBackground
初始化背景。
private async initBackground() { // TODO 知识点:初始化页面获取第一张图片的颜色 const context = getContext(this); const resourceMgr: resourceManager.ResourceManager = context.resourceManager; const fileData: Uint8Array = await resourceMgr.getMediaContent(this.cardsList[0].src as Resource); const buffer = fileData.buff...
AST#method_declaration#Left private async initBackground AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // TODO 知识点:初始化页面获取第一张图片的颜色 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#L...
private async initBackground() { const context = getContext(this); const resourceMgr: resourceManager.ResourceManager = context.resourceManager; const fileData: Uint8Array = await resourceMgr.getMediaContent(this.cardsList[0].src as Resource); const buffer = fileData.buffer as ArrayBuffer; cons...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardSwiperComponent.ets#L128-L143
7824e49fba09d64769a14f7077f573d941421826
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets
arkts
encodePKCS1Segment
加密-分段 @param str 待加密的字符串 @param pubKey RSA公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static encodePKCS1Segment(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.encodeAsymSegment(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, resultCoding, isPem); }
AST#method_declaration#Left static encodePKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
static encodePKCS1Segment(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.encodeAsymSegment(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, resultCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L69-L73
7c6a65d99cccb5d09f795f46969176012edaca45
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/DataImportExportService.ets
arkts
selectImportFile
选择导入文件
private async selectImportFile(): Promise<string | null> { try { const documentPicker = new picker.DocumentViewPicker(); const documentSelectOptions: picker.DocumentSelectOptions = { maxSelectNumber: 1, fileSuffixFilters: ['.json', '.txt', '.csv'] }; const result = await doc...
AST#method_declaration#Left private async selectImportFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#...
private async selectImportFile(): Promise<string | null> { try { const documentPicker = new picker.DocumentViewPicker(); const documentSelectOptions: picker.DocumentSelectOptions = { maxSelectNumber: 1, fileSuffixFilters: ['.json', '.txt', '.csv'] }; const result = await doc...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L566-L580
ab76625642b65fa0a054982c92db86f6b046eef1
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/model/PageRouterParam.ets
arkts
查看收藏榜中的每一项时跳转页面携带参数
export class RankListItemDetailParam{ rankListItem:RankListItem constructor
AST#export_declaration#Left export AST#ERROR#Left class RankListItemDetailParam { rankListItem : RankListItem AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class RankListItemDetailParam{ rankListItem:RankListItem constructor
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/model/PageRouterParam.ets#L16-L19
3e8a1e9bae28aa7989d4ba50a67461e460a05e1b
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/demo/DemoNavigator.ets
arkts
toNetworkListDemo
跳转到 Network List Demo 示例页 @returns {void} 无返回值
static toNetworkListDemo(): void { navigateTo(DemoRoutes.NetworkListDemo); }
AST#method_declaration#Left static toNetworkListDemo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#me...
static toNetworkListDemo(): void { navigateTo(DemoRoutes.NetworkListDemo); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L23-L25
93a7fcfff2ac560fe1c7694e9e7517f8e061806a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets
arkts
this
设置是否支持双击放大
this.model.setDoubleTapToZoomEnabled(false);
AST#method_declaration#Left this AST#ERROR#Left . model . setDoubleTapToZoomEnabled AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left false AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
this.model.setDoubleTapToZoomEnabled(false);
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets#L129-L129
da97e3827360de33441757aa2aa11f20aeb0c694
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/utils/AccountUtil.ets
arkts
错误处理
export function dealAllError(error: BusinessError | BusinessError<Object>): void { Logger.error('[AccountKit.dealAllError]', `Failed to auth. Code: ${error.code}, message: ${error.message}`); // 在应用登录涉及 UI 交互场景下,建议按照如下错误码指导提示用户 if (error.code === ErrorCode.ERROR_CODE_LOGIN_OUT) { // 用户未登录华为账号,请登录华为账号并重试或者尝试使用...
AST#export_declaration#Left export AST#function_declaration#Left function dealAllError AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BusinessError AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left BusinessError AST#type_argumen...
export function dealAllError(error: BusinessError | BusinessError<Object>): void { Logger.error('[AccountKit.dealAllError]', `Failed to auth. Code: ${error.code}, message: ${error.message}`); if (error.code === ErrorCode.ERROR_CODE_LOGIN_OUT) { } else if (error.code === ErrorCode.ERROR_CODE_NETWORK_ERROR)...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/AccountUtil.ets#L124-L142
f902a177614895286de78b4e4a4038a73a19d40d
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.TreeView.d.ets
arkts
Declare CallbackParam @typedef CallbackParam @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare CallbackParam @typedef CallbackParam @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export interface CallbackParam { /** * Get the currentNodeId. * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Get the currentNodeId. * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 ...
AST#export_declaration#Left export AST#interface_declaration#Left interface CallbackParam AST#object_type#Left { /** * Get the currentNodeId. * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Get the currentNodeId. * @type { number } * @syscap Sy...
export interface CallbackParam { currentNodeId: number, parentNodeId?: number, childIndex?: number }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L264-L309
85df2caa246d91bfd3c64c12ddeba28ec6dff520
gitee
yanweiguo198-commits/Harmony-Calendar-App.git
9ebdfbe588dfc230231af619a6eeb89b3c7fc39f
entry/src/main/ets/model/CalendarUtil.ets
arkts
getMonthViewDays
生成用于Grid展示的数据数组(包含空位填充)
static getMonthViewDays(year: number, month: number): number[] { let days: number[] = []; let firstDay = CalendarUtil.getFirstWeekDay(year, month); let totalDays = CalendarUtil.getDaysInMonth(year, month); // 填充月初的空白 for (let i = 0; i < firstDay; i++) { days.push(0); } // 填充日期 ...
AST#method_declaration#Left static getMonthViewDays 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#primar...
static getMonthViewDays(year: number, month: number): number[] { let days: number[] = []; let firstDay = CalendarUtil.getFirstWeekDay(year, month); let totalDays = CalendarUtil.getDaysInMonth(year, month); for (let i = 0; i < firstDay; i++) { days.push(0); } for (let i = 1; ...
https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/model/CalendarUtil.ets#L13-L31
825c1f380c321c5be3c54b8827dacd993297820f
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/detail/DetailCardsView.ets
arkts
playSound
/ [直接]播放 (汉字 or 词语的) 声音
async playSound(text: string | null) { if (!text) return; ///播放声音 await AudioPlayer.shared.play(text) logEvent("CardsView_playSound") //日志 }
AST#method_declaration#Left async playSound AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#pa...
async playSound(text: string | null) { if (!text) return; await AudioPlayer.shared.play(text) logEvent("CardsView_playSound") }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/detail/DetailCardsView.ets#L651-L658
42d3c8c0a5fea464095c74d90dd13a8d787c93cc
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/image/Avatar.ets
arkts
handleAvatarTap
处理头像点击 @returns {void} 无返回值
private handleAvatarTap(): void { if (this.onTap) { this.onTap(); } }
AST#method_declaration#Left private handleAvatarTap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#...
private handleAvatarTap(): void { if (this.onTap) { this.onTap(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/Avatar.ets#L42-L46
1e057bb8697e22b61dca4caa665d89974e4c3b9b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
getDaysBetween
计算两个日期之间的天数差 @param startDate 开始日期 @param endDate 结束日期 @returns 天数差(整数)
static getDaysBetween(startDate: string | Date, endDate: string | Date): number { const start = typeof startDate === 'string' ? new Date(startDate) : startDate; const end = typeof endDate === 'string' ? new Date(endDate) : endDate; if (isNaN(start.getTime()) || isNaN(end.getTime())) { return 0; ...
AST#method_declaration#Left static getDaysBetween AST#parameter_list#Left ( AST#parameter#Left startDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Rig...
static getDaysBetween(startDate: string | Date, endDate: string | Date): number { const start = typeof startDate === 'string' ? new Date(startDate) : startDate; const end = typeof endDate === 'string' ? new Date(endDate) : endDate; if (isNaN(start.getTime()) || isNaN(end.getTime())) { return 0; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L137-L147
45624b5e7c35e7606c29c4ecf9c86f7db24105e1
github
wuyuanwuhui999/harmony-arkts-movie-app-ui.git
d5e9bebe1dca2759cba417d2b6b402941d3bc273
entry/src/main/ets/components/MyComponent.ets
arkts
useUserMsgService
@description: 获取用户使用天数、访问记录数量等 @date: 2023-12-10 10:20 @author wuwenqiang
useUserMsgService() { getUserMsgService().then(res => { this.userMsg = res.data }) }
AST#method_declaration#Left useUserMsgService 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 getUserMsgService ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . then ( AST#expression#L...
useUserMsgService() { getUserMsgService().then(res => { this.userMsg = res.data }) }
https://github.com/wuyuanwuhui999/harmony-arkts-movie-app-ui.git/blob/d5e9bebe1dca2759cba417d2b6b402941d3bc273/entry/src/main/ets/components/MyComponent.ets#L61-L65
48d737cdc64f32f147810ae03edc0718f8cf6acb
github
tobias910903/komue-harmonyapp.git
cd4dd4e7859ec5b33a5140bdd1d050377f13175b
entry/src/main/ets/utils/request.ets
arkts
getToken
简单的token获取方法(仅保留基础逻辑,实际项目可根据存储方式修改) 注意:此处仅为请求拦截器添加token用,无其他token管理逻辑
async function getToken(): Promise<string | null> { // 实际项目中可从偏好设置、内存等位置获取token // 示例:从内存变量获取(仅作演示) // return globalThis.appToken || null; return "token_test_123456"; }
AST#function_declaration#Left async function getToken AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#prima...
async function getToken(): Promise<string | null> { return "token_test_123456"; }
https://github.com/tobias910903/komue-harmonyapp.git/blob/cd4dd4e7859ec5b33a5140bdd1d050377f13175b/entry/src/main/ets/utils/request.ets#L14-L19
01dcfe5edee70a664435ba02b73a8db9c21df8bf
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
logResponseError
打印响应错误日志 @param {AxiosError} error - 响应错误 @returns {void} 无返回值
function logResponseError(error: AxiosError): void { const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined; const response: AxiosResponse | undefined = error.response as AxiosResponse | undefined; const url: string = response ? buildRequestUrl(response.confi...
AST#function_declaration#Left function logResponseError AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left AxiosError 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...
function logResponseError(error: AxiosError): void { const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined; const response: AxiosResponse | undefined = error.response as AxiosResponse | undefined; const url: string = response ? buildRequestUrl(response.confi...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L103-L118
e57bbb84fe9d58bec11033147161de34cce8330f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
分享内容类型
export enum ShareContentType { TEXT = 'text', IMAGE = 'image', VIDEO = 'video', LINK = 'link', COMPOSITE = 'composite' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ShareContentType AST#enum_body#Left { AST#enum_member#Left TEXT = AST#expression#Left 'text' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left IMAGE = AST#expression#Left 'image' AST#expression#Right AST#enum_member#Right , AST#enum_membe...
export enum ShareContentType { TEXT = 'text', IMAGE = 'image', VIDEO = 'video', LINK = 'link', COMPOSITE = 'composite' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L32-L38
bef232af3aa069b99f91120376ce64dfd2b05290
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DateUtils.ets
arkts
addDays
增加天数 @param date 基准日期 @param daysToAdd 增加的天数 @returns 新日期对象
static addDays(date: Date, daysToAdd: number): Date { return new Date(date.getTime() + daysToAdd * 86400000); // 24 * 60 * 60 * 1000 }
AST#method_declaration#Left static addDays AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left daysToAdd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#...
static addDays(date: Date, daysToAdd: number): Date { return new Date(date.getTime() + daysToAdd * 86400000); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L72-L74
4c8aa749088bca697a33db0a12ea2755de86a961
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
notifyDataMove
通知LazyForEach组件将from索引和to索引处的子组件进行交换 @param {number} from - 起始值 @param {number} to - 终点值
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L127-L131
aace1220e61ad634f20ae84ec69c4ec8c5d17772
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/MenuSheetLayout.ets
arkts
MenuSheetBuilder
自定义半模态,底部菜单
@Builder export function MenuSheetBuilder(options: MenuSheetOptions) { MenuSheetLayout({ options: options, onItemClick: options.onItemClick }) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function MenuSheetBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left MenuSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parame...
@Builder export function MenuSheetBuilder(options: MenuSheetOptions) { MenuSheetLayout({ options: options, onItemClick: options.onItemClick }) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/MenuSheetLayout.ets#L8-L11
f33bcd88eb811ad4c542a372d78aae5f37d12d1d
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaHelper.ets
arkts
getDistrictByName
根据市名获取下面的区县 @param cityName 市名 @returns
static async getDistrictByName(cityName: string): Promise<Array<AreaEntity>> { let list = await AreaHelper.getArea(); for (let index = 0; index < list.length; index++) { let cityList = list[index].children ?? []; for (let i = 0; i < cityList.length; i++) { if (cityName == cityList[i].text) {...
AST#method_declaration#Left static async getDistrictByName AST#parameter_list#Left ( AST#parameter#Left cityName : 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 getDistrictByName(cityName: string): Promise<Array<AreaEntity>> { let list = await AreaHelper.getArea(); for (let index = 0; index < list.length; index++) { let cityList = list[index].children ?? []; for (let i = 0; i < cityList.length; i++) { if (cityName == cityList[i].text) {...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L127-L138
24ad3da07bd310fd6366f151325efbbf02c51e5a
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/subheader/source/subheader.ets
arkts
isResourceType
是否Resource类型 @param resource 资源 @returns true:Resource类型;false:非Resource类型
public static isResourceType(resource: ResourceStr | Resource | undefined): boolean { if (!resource) { return false; } if (typeof resource === 'string' || typeof resource === 'undefined') { return false; } return true; }
AST#method_declaration#Left public static isResourceType AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_typ...
public static isResourceType(resource: ResourceStr | Resource | undefined): boolean { if (!resource) { return false; } if (typeof resource === 'string' || typeof resource === 'undefined') { return false; } return true; }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/subheader/source/subheader.ets#L1196-L1204
49ced2ee0024cb2e10e9209f5564663c2c8ad784
gitee
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
knowledgeModule/src/main/ets/components/InterviewListView.ets
arkts
InterviewListView
@desc:面经列表 @author:hxy @time:2024/3/18
@Component export struct InterviewListView { mViewModel: InterviewViewModel = new InterviewViewModel() mDataSource = new LazyDataSource() @State page: number = 1 @State keyword: string = '' @Prop @Watch('onUpdate') sort: number onUpdate() { this.page = 1 this.getInterviewList() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InterviewListView AST#ERROR#Left { AST#property_declaration#Left mViewModel : AST#type_annotation#Left AST#primary_type#Left InterviewViewModel AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#exp...
@Component export struct InterviewListView { mViewModel: InterviewViewModel = new InterviewViewModel() mDataSource = new LazyDataSource() @State page: number = 1 @State keyword: string = '' @Prop @Watch('onUpdate') sort: number onUpdate() { this.page = 1 this.getInterviewList() }
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/knowledgeModule/src/main/ets/components/InterviewListView.ets#L14-L29
b2852541d4b93a9d8ea1d8b488104787c1971744
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ObjectPool.ets
arkts
get
Returns an instance of Poolable. If get() is called with an empty pool, the pool will be replenished. If the pool capacity is sufficiently large, this could come at a performance cost. @return An instance of Poolable object T
public get(): T { if (this.objectsPointer == -1 && this.replenishPercentage > 0.0) { this.refillPool(); } if (!this.objects) { this.objects = new Array<Poolable>(this.desiredCapacity); } let result: T = this.objects[this.objectsPointer] as T; result.currentOwnerId = Poolable.NO_OWN...
AST#method_declaration#Left public get AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expr...
public get(): T { if (this.objectsPointer == -1 && this.replenishPercentage > 0.0) { this.refillPool(); } if (!this.objects) { this.objects = new Array<Poolable>(this.desiredCapacity); } let result: T = this.objects[this.objectsPointer] as T; result.currentOwnerId = Poolable.NO_OWN...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ObjectPool.ets#L135-L149
ce495e24ecd17922650f339ab9d2872bcb217cce
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/form/src/main/ets/default/view/FormManagerComponent.ets
arkts
getCurrentFormInfo
Get current form information by bundle name.
private async getCurrentFormInfo() { this.mFormModel.getFormsInfoByBundleName(this.formAppInfo.bundleName); }
AST#method_declaration#Left private async getCurrentFormInfo 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#...
private async getCurrentFormInfo() { this.mFormModel.getFormsInfoByBundleName(this.formAppInfo.bundleName); }
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/form/src/main/ets/default/view/FormManagerComponent.ets#L79-L81
6b6ddb6ba004ef60a16066df4c78dbf8acb3f4d9
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets
arkts
setDataArray
Set water flow data array. @param {ProductItem[]} productDataArray Displaying water flow Data.
public setDataArray(productDataArray: MediaItem[]): void { this.dataArray = productDataArray; }
AST#method_declaration#Left public setDataArray AST#parameter_list#Left ( AST#parameter#Left productDataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MediaItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type...
public setDataArray(productDataArray: MediaItem[]): void { this.dataArray = productDataArray; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets#L37-L39
d8ff70e241becedea118d97a3214ab5838033ede
gitee
zqf-dev/WAndroidHOS.git
e2e560a7c96110c43d13eb232826707601172b6d
entry/src/main/ets/request/SquareReq.ets
arkts
请求体系数据
export function getTree(): Promise<ITree[]> { return new Promise((resolve: Function, reject: Function) => { get(API.tree).then((data: Response) => { if (data.errorCode === API.SERVER_CODE_SUCCESS) { resolve(data.data); } else { console.log('getTree failed', JSON.stringify(data)); ...
AST#export_declaration#Left export AST#function_declaration#Left function getTree AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ITree [ ] AST...
export function getTree(): Promise<ITree[]> { return new Promise((resolve: Function, reject: Function) => { get(API.tree).then((data: Response) => { if (data.errorCode === API.SERVER_CODE_SUCCESS) { resolve(data.data); } else { console.log('getTree failed', JSON.stringify(data)); ...
https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/request/SquareReq.ets#L8-L22
202638e516f79adcea026a27c66af4f4f448ae2b
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseEntry.ets
arkts
getIcon
Returns the icon of this Entry. @return
public getIcon(): ImagePaint { return this.mIcon; }
AST#method_declaration#Left public getIcon AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ImagePaint AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre...
public getIcon(): ImagePaint { return this.mIcon; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseEntry.ets#L60-L62
db428049a22aaea379b04a402ba5391df0c790a8
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/DayInfo.ets
arkts
DayInfo @param date @param targetTaskNum @param finTaskNum
export default class DayInfo { date: string; targetTaskNum: number; finTaskNum: number; constructor(date: string, targetTaskNum: number, finTaskNum: number) { this.date = date; this.targetTaskNum = targetTaskNum; this.finTaskNum = finTaskNum; } }
AST#export_declaration#Left export default AST#class_declaration#Left class DayInfo AST#class_body#Left { AST#property_declaration#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left targetTaskN...
export default class DayInfo { date: string; targetTaskNum: number; finTaskNum: number; constructor(date: string, targetTaskNum: number, finTaskNum: number) { this.date = date; this.targetTaskNum = targetTaskNum; this.finTaskNum = finTaskNum; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/DayInfo.ets#L23-L33
f0a9a2d7cb8f145d6fd5862d330c83e708b8f562
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/navdestinationdialog/Index.ets
arkts
NavDestinationDialog
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 { NavDestinationDialog } from './src/main/ets/mainpage/MainPage';
AST#export_declaration#Left export { NavDestinationDialog } from './src/main/ets/mainpage/MainPage' ; AST#export_declaration#Right
export { NavDestinationDialog } from './src/main/ets/mainpage/MainPage';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navdestinationdialog/Index.ets#L15-L15
144f92a9261c9b8c1644fd63e0a28a19a035297b
gitee
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
createPbufferSurface
创建离屏surface @param config @param attrib_list @returns
createPbufferSurface(config: EGLConfig, attrib_list?: number[]): EGLSurface | undefined;
AST#method_declaration#Left createPbufferSurface AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left EGLConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attrib_list ? : AST#type_annotation#Left AST#primary_type#Left AST#arr...
createPbufferSurface(config: EGLConfig, attrib_list?: number[]): EGLSurface | undefined;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L162-L162
d5f82f681b466751b853fca6373c30691deedb7b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildDateContentSummary
日期内容摘要
@Builder buildDateContentSummary() { Column({ space: 8 }) { // 生日显示 if (this.selectedDateDetail!.birthdays.length > 0) { Row({ space: 8 }) { Text('🎂') .fontSize(14) Text(`${this.selectedDateDetail!.birthdays.length}个生日`) .fontSize(12) .f...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDateContentSummary 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#component_parameters#Left { AST#compo...
@Builder buildDateContentSummary() { Column({ space: 8 }) { if (this.selectedDateDetail!.birthdays.length > 0) { Row({ space: 8 }) { Text('🎂') .fontSize(14) Text(`${this.selectedDateDetail!.birthdays.length}个生日`) .fontSize(12) .fontColo...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L2887-L2927
e5d63b5478f0efd8e2a0072889e6515b0a3c41ff
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets
arkts
VerifyCodeViewComponent
验证码组件:禁用选中、复制、光标
@Component export struct VerifyCodeViewComponent { popRouter: () => void = () => { }; build() { Column() { VerifyCodeComponentWithoutCursor({ popRouter: this.popRouter }) } .height('100%') .width('100%') .justifyContent(FlexAlign.Center) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VerifyCodeViewComponent AST#component_body#Left { AST#property_declaration#Left popRouter : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#L...
@Component export struct VerifyCodeViewComponent { popRouter: () => void = () => { }; build() { Column() { VerifyCodeComponentWithoutCursor({ popRouter: this.popRouter }) } .height('100%') .width('100%') .justifyContent(FlexAlign.Center) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets#L179-L192
8277fb69b59a3abb82ad60f9c5e3dc3128e85919
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
使用趋势数据接口
export interface UsageTrend { date: string; count: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UsageTrend AST#object_type#Left { AST#type_member#Left date : 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 count : AST#type_annotation#Left A...
export interface UsageTrend { date: string; count: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L76-L79
2183147588b09774f75b534737b1a408f9a130c1
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/AlarmSettingBean.ets
arkts
Alarm setting bean information.
export default class AlarmSettingBean { /** * Alarm setting title. */ public title: string; /** * Alarm setting content. */ public content: string; /** * Alarm setting type. */ public sType: AlarmSettingType; constructor(title: string, content: string, sType: AlarmSettingType){ th...
AST#export_declaration#Left export default AST#class_declaration#Left class AlarmSettingBean AST#class_body#Left { /** * Alarm setting title. */ AST#property_declaration#Left public title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declar...
export default class AlarmSettingBean { public title: string; public content: string; public sType: AlarmSettingType; constructor(title: string, content: string, sType: AlarmSettingType){ this.title = title; this.content = content; this.sType = sType; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/AlarmSettingBean.ets#L21-L42
61b5a57b36dff61a07b55c4ac06643c4e9d8fee2
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
getRooms
获取所有房间
getRooms(): RoomItem[] { return this.rooms; }
AST#method_declaration#Left getRooms AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RoomItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return...
getRooms(): RoomItem[] { return this.rooms; }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L228-L230
46875cc8f144d079fc11400380e827fee992bcb3
github
AlatusLee/HarmonyOS-Next-Weather-Assistant.git
d3c7060a8ff7f7656175e83fa32536b11e136556
alatus/src/main/ets/viewmodel/getWeatherUtil.ets
arkts
getWeathers
多个URL,一并返回结果
async getWeathers(cityCodes:Array<number>){ let promises:Array<Promise<weatherModel>> = []; let weatherModels:Array<weatherModel> = []; for (let i = 0; i < cityCodes.length; i++) { promises.push(this.getWeather(cityCodes[i])); } await Promise.all(promises).then(result => { weatherModels ...
AST#method_declaration#Left async getWeathers AST#parameter_list#Left ( AST#parameter#Left cityCodes : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async getWeathers(cityCodes:Array<number>){ let promises:Array<Promise<weatherModel>> = []; let weatherModels:Array<weatherModel> = []; for (let i = 0; i < cityCodes.length; i++) { promises.push(this.getWeather(cityCodes[i])); } await Promise.all(promises).then(result => { weatherModels ...
https://github.com/AlatusLee/HarmonyOS-Next-Weather-Assistant.git/blob/d3c7060a8ff7f7656175e83fa32536b11e136556/alatus/src/main/ets/viewmodel/getWeatherUtil.ets#L22-L32
7efceb01fd9ca4f88607b0f8defb1f13783bd342
github
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/UserService.ets
arkts
updateUserInfo
更新用户信息
async updateUserInfo(username: string, like?: string, phone?: number): Promise<boolean> { if (!this.currentUser) { return false; } this.currentUser.username = username; if (like) { this.currentUser.like = like; } if (phone) { this.currentUser.phone = phone; } ...
AST#method_declaration#Left async updateUserInfo AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left like ? : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
async updateUserInfo(username: string, like?: string, phone?: number): Promise<boolean> { if (!this.currentUser) { return false; } this.currentUser.username = username; if (like) { this.currentUser.like = like; } if (phone) { this.currentUser.phone = phone; } ...
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L92-L106
f63f60df128d9e527a3f4df31058652e27cf55f4
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets
arkts
capitalize
将字符串首字母转换为大写,剩下为小写 @param str 待转换的字符串 @returns 转换后的
static capitalize(str: string = ''): string { if (StringUtil.isNotEmpty(str)) { const firstChar = str.charAt(0).toUpperCase(); const restChars = str.slice(1).toLowerCase(); return firstChar + restChars; } return ''; }
AST#method_declaration#Left static capitalize AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ...
static capitalize(str: string = ''): string { if (StringUtil.isNotEmpty(str)) { const firstChar = str.charAt(0).toUpperCase(); const restChars = str.slice(1).toLowerCase(); return firstChar + restChars; } return ''; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets#L137-L144
13b4b7404926f1442ee936e718d199f7e3a89583
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customsafekeyboard/src/main/ets/model/Constants.ets
arkts
大写字母键盘数据,真实业务场景网络请求下发的数据
export const upperCaseKeyData: IKeyAttribute[] = [ { label: 'Q', value: 'Q', fontSize: 16, fontColor: Color.White, type: EKeyType.INPUT, backgroundColor: Color.Gray, position: [0, 0, 0, 1], }, { label: 'W', value: 'W', fontSize: 16, fontColor: Color.White, type: EKe...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left upperCaseKeyData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IKeyAttribute [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [...
export const upperCaseKeyData: IKeyAttribute[] = [ { label: 'Q', value: 'Q', fontSize: 16, fontColor: Color.White, type: EKeyType.INPUT, backgroundColor: Color.Gray, position: [0, 0, 0, 1], }, { label: 'W', value: 'W', fontSize: 16, fontColor: Color.White, type: EKe...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customsafekeyboard/src/main/ets/model/Constants.ets#L449-L726
ec33228d3b644c8e674ca9568d44bbc32d80b4f4
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/viewmodel/WorldClockViewModel.ets
arkts
世界时钟视图模型。
export default class WorldClockViewModel { static instant: WorldClockViewModel = new WorldClockViewModel(); static readonly mainCities: Array<CityItem> = [ { city: "巴黎", country: "法国", UTCOffset: 1 }, { city: "纽约", country: "美国", UTCOffset: -5 }, { city: "东京", country: "日本", UT...
AST#export_declaration#Left export default AST#class_declaration#Left class WorldClockViewModel AST#class_body#Left { AST#property_declaration#Left static instant : AST#type_annotation#Left AST#primary_type#Left WorldClockViewModel AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expressi...
export default class WorldClockViewModel { static instant: WorldClockViewModel = new WorldClockViewModel(); static readonly mainCities: Array<CityItem> = [ { city: "巴黎", country: "法国", UTCOffset: 1 }, { city: "纽约", country: "美国", UTCOffset: -5 }, { city: "东京", country: "日本", UT...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/WorldClockViewModel.ets#L11-L151
54bd5953cb1a346d9051463bb67fd557ef66efc8
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
onPayClick
支付按钮点击事件 @returns {void} 无返回值
onPayClick(): void { this.startAlipayPayment(); }
AST#method_declaration#Left onPayClick 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#Le...
onPayClick(): void { this.startAlipayPayment(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets#L51-L53
5bc1b337b00b050dee74a77581300010a44500f8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionAsync.ets
arkts
decryptMessagePromise
解密消息
async function decryptMessagePromise(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM2_256|SM3'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); let decryptData = await decoder.doFinal(cipherText); return d...
AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left privateKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST...
async function decryptMessagePromise(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM2_256|SM3'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); let decryptData = await decoder.doFinal(cipherText); return d...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionAsync.ets#L28-L33
1611bb3cdc443fa41ca84838f91bf06404fa50b0
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/CommonUtils.ets
arkts
通用工具类 提供防抖、节流、深拷贝等常用方法
export class CommonUtils { /** * 格式化日期 */ static formatDate(date: Date, format: string = 'YYYY-MM-DD HH:mm:ss'): string { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); const hours = String(date....
AST#export_declaration#Left export AST#class_declaration#Left class CommonUtils AST#class_body#Left { /** * 格式化日期 */ AST#method_declaration#Left static formatDate AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Righ...
export class CommonUtils { static formatDate(date: Date, format: string = 'YYYY-MM-DD HH:mm:ss'): string { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); const hours = String(date.getHours()).padStart...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/CommonUtils.ets#L5-L82
ff87256e689e6b3c9787eff82f3c66c1e8edea26
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getPluralStringByNameSync
根据指定数量获取指定资源名称表示的单复数字符串 @param resName 资源名称 @param num 数量值
static getPluralStringByNameSync(resName: string, num: number): string { return ResUtil.getResourceManager().getPluralStringByNameSync(resName, num); }
AST#method_declaration#Left static getPluralStringByNameSync AST#parameter_list#Left ( AST#parameter#Left resName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number ...
static getPluralStringByNameSync(resName: string, num: number): string { return ResUtil.getResourceManager().getPluralStringByNameSync(resName, num); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L218-L220
508d32c0386a89fc45902d401c508a1cb1b795c6
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/objects/HistoryDataSource.ets
arkts
registerDataChangeListener
该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { // console.info('add listener'); this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/HistoryDataSource.ets#L20-L25
5386c378a56ef08db5c414171e2f430b7a4a1f17
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/slider/sliderCustom.ets
arkts
SliderCustomBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function SliderCustomBuilder(name: string, param: Object) { SliderCustomExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SliderCustomBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p...
@Builder export function SliderCustomBuilder(name: string, param: Object) { SliderCustomExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/slider/sliderCustom.ets#L16-L19
c2956b14f3c4f4278fd638521568960aeb9be5bb
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/model/CustomParams.ets
arkts
静态参数集,包含工具项输入的必要参数
export class CustomParams { }
AST#export_declaration#Left export AST#class_declaration#Left class CustomParams AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CustomParams { }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/CustomParams.ets#L19-L21
bc9677760532fbfc2dc5404af168570b801b5e97
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/offset/NavRouterView.ets
arkts
NavRouterView
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 NavRouterView { @State isActive: boolean = false @State dex: number = 0 @Link _offset: Position; private componentKey: string; build() { NavRouter() { Row() { Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 }) Te...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavRouterView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isActive : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an...
@Component export struct NavRouterView { @State isActive: boolean = false @State dex: number = 0 @Link _offset: Position; private componentKey: string; build() { NavRouter() { Row() { Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 }) Te...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/offset/NavRouterView.ets#L16-L53
ba0ff016d7124a98e684b869e2a1a99d7fb16bf4
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppDataSecurity/entry/src/main/ets/pages/Index.ets
arkts
EncryptData
[End generate_aes_key] [Start encrypt_data]
async function EncryptData(): Promise<void> { let encryptProperties = GetAesEncryptProperties(); let options: huks.HuksOptions = { properties: encryptProperties, inData: StringToUint8Array(plainText) }; await huks.initSession(aesKeyAlias, options) .then((data) => { handle = data.handle; }...
AST#function_declaration#Left async function EncryptData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS...
async function EncryptData(): Promise<void> { let encryptProperties = GetAesEncryptProperties(); let options: huks.HuksOptions = { properties: encryptProperties, inData: StringToUint8Array(plainText) }; await huks.initSession(aesKeyAlias, options) .then((data) => { handle = data.handle; }...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppDataSecurity/entry/src/main/ets/pages/Index.ets#L222-L244
3a9f5ed5d4015d6a1dce5bafa1142014cc562bc9
gitee
Million-mo/tree-sitter-arkts.git
2fd0ad75e2d848709edcf4be038f27b178114ef6
examples/custom_builders.ets
arkts
settingItemBuilder
本地Builder方法 - 设置项Builder
@Builder settingItemBuilder(title: string, description: string, hasSwitch: boolean) { Row() { Column() { Text(title) .fontSize(16) .fontWeight(FontWeight.Bold) .textAlign(TextAlign.Start) Text(description) .fontSize(12) .fontColor(Co...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right settingItemBuilder AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_anno...
@Builder settingItemBuilder(title: string, description: string, hasSwitch: boolean) { Row() { Column() { Text(title) .fontSize(16) .fontWeight(FontWeight.Bold) .textAlign(TextAlign.Start) Text(description) .fontSize(12) .fontColor(Co...
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/custom_builders.ets#L229-L263
a006a1c3eefcd40ea5e9062c3d54a770b221363e
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/BoyerMoore.ets
arkts
contains
检查文本是否包含模式串 @param text 文本字符串 @param pattern 模式串 @returns 是否包含模式串
static contains(text: string, pattern: string): boolean { if (!text || !pattern || pattern.length === 0) { return false; } const badCharTable = BoyerMoore.buildBadCharTable(pattern); const goodSuffixTable = BoyerMoore.buildGoodSuffixTable(pattern); const m = pattern.length; const n = text...
AST#method_declaration#Left static contains AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
static contains(text: string, pattern: string): boolean { if (!text || !pattern || pattern.length === 0) { return false; } const badCharTable = BoyerMoore.buildBadCharTable(pattern); const goodSuffixTable = BoyerMoore.buildGoodSuffixTable(pattern); const m = pattern.length; const n = text...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/BoyerMoore.ets#L51-L78
b1ada30512a5beff87a24f6812067b48156a94de
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_key_shortcuts.ets
arkts
A class holding key shortcuts. @param no_init Will not load configuration from disk nor do anything else. Usually set true if this object is only created to sit the place of StorageLink initialization.
constructor(no_init?: boolean) { if (no_init == true) { return; } this.load_from_disk(); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left no_init ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left...
constructor(no_init?: boolean) { if (no_init == true) { return; } this.load_from_disk(); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L44-L49
516e5f2ad9c4e27c74b54776a1befd9e373e5159
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/TodoTypes.ets
arkts
创建代办事项参数
export interface CreateTodoParams { title: string; description?: string; date: string; time?: string; type?: TodoType; priority?: TodoPriority; tags?: string[]; isAllDay?: boolean; reminder?: boolean; reminderTime?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CreateTodoParams AST#object_type#Left { AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left description ? : AST#type_an...
export interface CreateTodoParams { title: string; description?: string; date: string; time?: string; type?: TodoType; priority?: TodoPriority; tags?: string[]; isAllDay?: boolean; reminder?: boolean; reminderTime?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L51-L62
f10a3c0d41eab2e79103bce4d332726b4ab29ea7
github
zkh110119/MyApplication.git
0bd00b735759c812a9f7c372f33137764dbd553b
entry/src/main/ets/pages/Index.ets
arkts
onResizeStart
统一的 Resize 处理逻辑
onResizeStart(event: GestureEvent) { if (!this.mainWindow) return; try { const properties = this.mainWindow.getWindowProperties(); this.initialWindowWidth = properties.windowRect.width; this.initialWindowHeight = properties.windowRect.height; this.resizeStartX = event.fingerList[0].globa...
AST#method_declaration#Left onResizeStart AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left i...
onResizeStart(event: GestureEvent) { if (!this.mainWindow) return; try { const properties = this.mainWindow.getWindowProperties(); this.initialWindowWidth = properties.windowRect.width; this.initialWindowHeight = properties.windowRect.height; this.resizeStartX = event.fingerList[0].globa...
https://github.com/zkh110119/MyApplication.git/blob/0bd00b735759c812a9f7c372f33137764dbd553b/entry/src/main/ets/pages/Index.ets#L60-L71
f2359faf35a23619108cb842997a720f5c3db3a7
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/common/DataModel.ets
arkts
showActionMenu---title|buttons测试参数且buttons为必填项
export class Model3 { public title?: Resource | string | number = undefined public buttonText?: string | Resource | number = undefined public buttonColor?: string | Resource | number = undefined constructor
AST#export_declaration#Left export AST#ERROR#Left class Model3 { AST#property_declaration#Left public title ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right A...
export class Model3 { public title?: Resource | string | number = undefined public buttonText?: string | Resource | number = undefined public buttonColor?: string | Resource | number = undefined constructor
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/common/DataModel.ets#L54-L59
a1f8e6ca2f2f0da9252584624c0ad78077453df8
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/appcenter/component.ets
arkts
AppGridLayout
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { AppGridLayout } from './src/main/ets/default/layout/AppGridLayout';
AST#export_declaration#Left export { AppGridLayout } from './src/main/ets/default/layout/AppGridLayout' ; AST#export_declaration#Right
export { AppGridLayout } from './src/main/ets/default/layout/AppGridLayout';
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/appcenter/component.ets#L16-L16
84a482a84f7445e93e50d0caac8676aa1a718bef
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
getEnableCustomYAxisLabels
Get whether to fully use custom labels @param numbers labels
public getEnableCustomYAxisLabels(): boolean { return this.enableCustomYAxisLabels; }
AST#method_declaration#Left public getEnableCustomYAxisLabels AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left ...
public getEnableCustomYAxisLabels(): boolean { return this.enableCustomYAxisLabels; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L183-L185
6aedda0f7ee5571a2b0a04c714339c57c8f0fd91
gitee
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
rdbplus/src/main/ets/core/MyWrapper.ets
arkts
getValue
获取所有占位符对应参数
getValue(): relationalStore.ValueType[] { return this.valueList }
AST#method_declaration#Left getValue AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValueType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left [ ] AST#ERROR#Right AST#block_statement#...
getValue(): relationalStore.ValueType[] { return this.valueList }
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/MyWrapper.ets#L41-L43
50f652690f6c61d940f921625c1f7df11f3e7d56
github
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/database/user.ets
arkts
createUserCard
UserCard
static async createUserCard(card: ICard): Promise<ICard | null> { if (!UserDatabaser.db) { await UserDatabaser.connect() } if (!UserDatabaser.db) { return null } const transaction = await UserDatabaser.db.createTransaction() try { await transaction.execute( 'insert i...
AST#method_declaration#Left static async createUserCard AST#parameter_list#Left ( AST#parameter#Left card : AST#type_annotation#Left AST#primary_type#Left ICard AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty...
static async createUserCard(card: ICard): Promise<ICard | null> { if (!UserDatabaser.db) { await UserDatabaser.connect() } if (!UserDatabaser.db) { return null } const transaction = await UserDatabaser.db.createTransaction() try { await transaction.execute( 'insert i...
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/database/user.ets#L463-L489
bcf1cd3e11bd3ecdfe184c614da1cf8fabcbbb03
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets
arkts
buildStyleSelector
构建样式选择器
@Builder buildStyleSelector() { Column() { // 背景遮罩 Row() .width('100%') .layoutWeight(1) .backgroundColor('rgba(0,0,0,0.3)') .onClick(() => { this.showStyleSelector = false; }) // 选择器内容 Column({ space: 16 }) { Text('选择祝福语风格')...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildStyleSelector 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 { // 背景遮罩 AS...
@Builder buildStyleSelector() { Column() { Row() .width('100%') .layoutWeight(1) .backgroundColor('rgba(0,0,0,0.3)') .onClick(() => { this.showStyleSelector = false; }) Column({ space: 16 }) { Text('选择祝福语风格') .fon...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L592-L638
f71ba9f6d48f8a9ccbd8e440d79426edd6f7b1c6
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
getBarData
@Override
public getBarData(): BarData | null { return this.mData; }
AST#method_declaration#Left public getBarData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BarData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Le...
public getBarData(): BarData | null { return this.mData; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L268-L270
ac71cdbbf5d8a0d2de351e39610e881efba6a6c4
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
updateLoopMode
更新播放循环模式(0:顺序,1:单曲循环,2:列表循环,3:随机循环)
updateLoopMode() { // 按顺序设置下一个循环模式 this.curLoopMode = (this.curLoopMode + 1) % CommonConstants.LOOP_MODE_TOTAL_NUM; // 跳过顺序模式,不启用 this.curLoopMode = this.curLoopMode ? this.curLoopMode : AVSessionManager.LoopMode.LOOP_MODE_SINGLE; this.avsessionModel?.updateCurState({ loopMode: this.curLoopMod...
AST#method_declaration#Left updateLoopMode 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 . curLoopMode AST#mem...
updateLoopMode() { this.curLoopMode = (this.curLoopMode + 1) % CommonConstants.LOOP_MODE_TOTAL_NUM; this.curLoopMode = this.curLoopMode ? this.curLoopMode : AVSessionManager.LoopMode.LOOP_MODE_SINGLE; this.avsessionModel?.updateCurState({ loopMode: this.curLoopMode } as AVSessionUpdateSt...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L343-L351
692946cf86d0a75988780764fddad42b4dcfe852
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets
arkts
this
设置柱状图的高亮范围是否为整个柱体,只在堆叠柱状图中有区别
this.model.setHighlightFullBarEnabled(false);
AST#method_declaration#Left this AST#ERROR#Left . model . setHighlightFullBarEnabled AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left false AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
this.model.setHighlightFullBarEnabled(false);
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets#L137-L137
24bfd7b1252b2d5dae7657681de8b368b27842b2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets
arkts
addArg
添加 @param dialogId @param componentContent
private addArg(dialogId: string, uiContext: UIContext, componentContent: ComponentContent<Object>) { const arg: ActionCoreArg = { dialogId: dialogId, uiContext: uiContext, componentContent: componentContent } this.caches.unshift(arg); }
AST#method_declaration#Left private addArg AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#prim...
private addArg(dialogId: string, uiContext: UIContext, componentContent: ComponentContent<Object>) { const arg: ActionCoreArg = { dialogId: dialogId, uiContext: uiContext, componentContent: componentContent } this.caches.unshift(arg); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L301-L304
05e0a78c89ddc6d619ff1f5c2e044700e106d963
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ProgressButtonV2.d.ets
arkts
Declare Color options interface of the ProgressButtonV2. @interface ProgressButtonV2ColorOptions @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @crossplatform @since 18
export declare interface ProgressButtonV2ColorOptions { /** * Set progress color of the ProgressButtonV2. * * @type { ?ColorMetrics }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @crossplatform * @since 18 */ progressColor?: ColorMetrics; /** * Set border color of t...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface ProgressButtonV2ColorOptions AST#object_type#Left { /** * Set progress color of the ProgressButtonV2. * * @type { ?ColorMetrics }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservic...
export declare interface ProgressButtonV2ColorOptions { progressColor?: ColorMetrics; borderColor?: ColorMetrics; textColor?: ColorMetrics; backgroundColor?: ColorMetrics; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ProgressButtonV2.d.ets#L193-L237
d7226bd0809bfe62a4e8a321651b0698a7f8bcd4
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/components/common/src/main/ets/utils/timeUtil.ets
arkts
日期格式化函数 @param date 日期对象 @param format 日期格式,默认为 YYYY-MM-DD HH:mm:ss
export const formatDate = (date: Date, format = 'YYYY-MM-DD HH:mm:ss') => { // 获取年月日时分秒,通过 padStart 补 0 const year = String(date.getFullYear()) const month = String(date.getMonth() + 1).padStart(2, '0') const day = String(date.getDate()).padStart(2, '0') const hours = String(date.getHours()).padStart(2, '0') ...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left formatDate = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parame...
export const formatDate = (date: Date, format = 'YYYY-MM-DD HH:mm:ss') => { const year = String(date.getFullYear()) const month = String(date.getMonth() + 1).padStart(2, '0') const day = String(date.getDate()).padStart(2, '0') const hours = String(date.getHours()).padStart(2, '0') const minutes = String(da...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/components/common/src/main/ets/utils/timeUtil.ets#L21-L38
7d13946b957db26309e41d69d0bcb6b9bdbaf3bd
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/immersive/src/main/ets/common/Constants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { static readonly NUMBER_1: number = 1; static readonly NUMBER_2: number = 1; static readonly NUMBER_6: number = 6; static readonly NUMBER_10: number = 10; static readonly NUMBER_20: number = 20; static readonly NUMBER_16: number = 16; static readonly NUMBER_17: number = 17; stati...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly NUMBER_1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_...
export class Constants { static readonly NUMBER_1: number = 1; static readonly NUMBER_2: number = 1; static readonly NUMBER_6: number = 6; static readonly NUMBER_10: number = 10; static readonly NUMBER_20: number = 20; static readonly NUMBER_16: number = 16; static readonly NUMBER_17: number = 17; stati...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/immersive/src/main/ets/common/Constants.ets#L16-L53
f5d3c69715c8d41b59235782c2f596bf9c6dc503
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets
arkts
getData
获取索引对应的数据 @param index 数组索引 @returns
public getData(index: number): SwiperModule { return this.dataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SwiperModule AST#primary_...
public getData(index: number): SwiperModule { return this.dataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets#L38-L40
5706ac9e130a652b35c5e19473157fb7f14c198e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
记忆卡片接口
export interface MemoryCard { id: string; content: string; image?: string; isFlipped: boolean; isMatched: boolean; position: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MemoryCard 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 content : AST#type_annotation#Left A...
export interface MemoryCard { id: string; content: string; image?: string; isFlipped: boolean; isMatched: boolean; position: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L162-L169
522c902d2cc22d14dbe4c32a101fbb3d3aa9e492
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
getYearInfo
获取指定年份的农历信息
static getYearInfo(year: number): number { if (year < 1900 || year > 2100) { return 0; } return ComprehensiveLunarDatabase.lunarData[year - 1900]; }
AST#method_declaration#Left static getYearInfo AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
static getYearInfo(year: number): number { if (year < 1900 || year > 2100) { return 0; } return ComprehensiveLunarDatabase.lunarData[year - 1900]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L124-L129
d6701d2d4ef58fa008c29d5acf347edd2c1964ec
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/ContactService.ets
arkts
enableTestContacts
启用测试联系人数据(公共方法,生产环境为空实现)
async enableTestContacts(): Promise<void> { // 生产环境不启用测试数据 hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Test contacts feature disabled in production mode`); }
AST#method_declaration#Left async enableTestContacts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#ty...
async enableTestContacts(): Promise<void> { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Test contacts feature disabled in production mode`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService.ets#L126-L129
2b2c43433989a2565e15806e2d60dee6c7c727b5
github
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
createPlatformWindowSurface
https://registry.khronos.org/EGL/sdk/docs/man/html/eglCreatePlatformWindowSurface.xhtml @param attrib_list EGL_GL_COLORSPACE / EGL_RENDER_BUFFER / EGL_VG_ALPHA_FORMAT / EGL_VG_COLORSPACE
createPlatformWindowSurface(config: EGLConfig, native_window_ptr?: string, attrib_list?: number[]): EGLSurface | undefined;
AST#method_declaration#Left createPlatformWindowSurface AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left EGLConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left native_window_ptr ? : AST#type_annotation#Left AST#primary_type...
createPlatformWindowSurface(config: EGLConfig, native_window_ptr?: string, attrib_list?: number[]): EGLSurface | undefined;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L237-L238
2c143d468e9ff6507af39485db50e90fe8497788
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/launch/LaunchNavigator.ets
arkts
@file 启动流程模块导航封装 @author Joker.X
export class LaunchNavigator { /** * 跳转到启动页 * @returns {void} 无返回值 */ static toSplash(): void { navigateTo(LaunchRoutes.Splash); } /** * 跳转到引导页 * @param {boolean} [fromSettings] - 是否从设置页进入 * @returns {void} 无返回值 */ static toGuide(fromSettings?: boolean): void { if (fromSettings !...
AST#export_declaration#Left export AST#class_declaration#Left class LaunchNavigator AST#class_body#Left { /** * 跳转到启动页 * @returns {void} 无返回值 */ AST#method_declaration#Left static toSplash AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
export class LaunchNavigator { static toSplash(): void { navigateTo(LaunchRoutes.Splash); } static toGuide(fromSettings?: boolean): void { if (fromSettings !== undefined) { const params: LaunchGuideParam = { fromSettings }; navigateTo(LaunchRoutes.Guide, params); return; } ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/launch/LaunchNavigator.ets#L9-L31
e9bc3b3bebc8c6db03c5bbe5795c2f97aa00d01d
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/data_operation_tools.ets
arkts
match_with_coefficient
Search and match Determines if a text matches with the keys given. Fuzzy to a hit rate of c. @param text The text. @param keys The keys. @param c The minimum hit rate. @returns A boolean stating they match or not.
function match_with_coefficient(text: string, keys: string[], c: number): boolean { let hits = 0; let miss = 0; for (let index = 0; index < keys.length; index++) { let hit = text.includes(keys[index]); hits += (hit ? 1 : 0); miss += (!hit ? 1 : 0); if (hits >= c * keys.length) { // console.l...
AST#function_declaration#Left function match_with_coefficient AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keys : AST#type_annotation#Left AST#primary_type#Left AST#arra...
function match_with_coefficient(text: string, keys: string[], c: number): boolean { let hits = 0; let miss = 0; for (let index = 0; index < keys.length; index++) { let hit = text.includes(keys[index]); hits += (hit ? 1 : 0); miss += (!hit ? 1 : 0); if (hits >= c * keys.length) { retur...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L12-L30
db1f167fb45de8c41d0679c9d1f1fdcf3211d0c2
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DateUtils.ets
arkts
toUTCDate
解析固定格式UTC日期字符串 @param dateStr UTC格式日期字符串 @returns 解析成功的Date对象,失败返回null
static toUTCDate(dateStr: string): Date | null { return DateUtils.toDate(dateStr, "yyyy-MM-dd'T'HH:mm:ss.000'Z'"); }
AST#method_declaration#Left static toUTCDate AST#parameter_list#Left ( AST#parameter#Left dateStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left D...
static toUTCDate(dateStr: string): Date | null { return DateUtils.toDate(dateStr, "yyyy-MM-dd'T'HH:mm:ss.000'Z'"); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L217-L219
caeee823d182927ff0bff916dfd98d521e437c52
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/request.ets
arkts
暴露
export default AxiosHttpRequest
AST#export_declaration#Left export default AST#expression#Left AxiosHttpRequest AST#expression#Right AST#export_declaration#Right
export default AxiosHttpRequest
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/request.ets#L131-L131
154f8eb589c1613f3a7edef8b495a7b31b868377
github
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets
arkts
City list data.
export const CITY_DATA = [ new CityType('A', uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_A').id)), new CityType('B', uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_B').id)), new CityType('C', uiContext...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CITY_DATA = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CityType AST#expression#Right AST#new_expression#R...
export const CITY_DATA = [ new CityType('A', uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_A').id)), new CityType('B', uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_B').id)), new CityType('C', uiContext...
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets#L41-L86
e6b3ae7767020d48de441c0378d99071da485baf
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/ui/RcpLoadingUtil.ets
arkts
closeLoading
关闭窗口 @returns
static async closeLoading(): Promise<void> { if (RcpLoadingUtil.cacheWindow) { RcpLoadingUtil.showTimes -= 1; if (RcpLoadingUtil.showTimes == 0) { await RcpLoadingUtil.cacheWindow.destroyWindow(); } } }
AST#method_declaration#Left static async closeLoading AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#t...
static async closeLoading(): Promise<void> { if (RcpLoadingUtil.cacheWindow) { RcpLoadingUtil.showTimes -= 1; if (RcpLoadingUtil.showTimes == 0) { await RcpLoadingUtil.cacheWindow.destroyWindow(); } } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/ui/RcpLoadingUtil.ets#L97-L104
fcbb1c5759e8099f8b4d9893c284ad67a5e78775
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/CountDownTimer.ets
arkts
getRemainingTime
获取剩余时间 @returns 剩余时间(毫秒)
getRemainingTime(): number { return this.remainingTime; }
AST#method_declaration#Left getRemainingTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express...
getRemainingTime(): number { return this.remainingTime; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/CountDownTimer.ets#L121-L123
5e48379582c6e6874a5c4c91f1b7ea9b8bb9c7a2
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/Search/search/src/main/ets/components/mainpage/MainPage.ets
arkts
MainPage
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct MainPage { @Link textInfo: string private controller: SearchController = new SearchController() customizeFunction: () => void = () => {} build() { Column() { Search({ value: this.textInfo, placeholder: 'Input to search', controller: this.controller }) .searchButton('S...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right textInfo : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio...
@Component export struct MainPage { @Link textInfo: string private controller: SearchController = new SearchController() customizeFunction: () => void = () => {} build() { Column() { Search({ value: this.textInfo, placeholder: 'Input to search', controller: this.controller }) .searchButton('S...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/Search/search/src/main/ets/components/mainpage/MainPage.ets#L16-L43
8baa26a0640a8ba2fb24ec326efb7d06cd242a2b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/utils/formatTime.ets
arkts
格式化日期时间字符串 @param value 待格式化的日期值,支持数字、字符串和Date类型,默认为当前时间戳 @param fmt 格式化字符串,默认为'YYYY-MM-DD HH:mm:ss' @returns 返回格式化后的日期时间字符串
export function formatTime (value: number | string | Date = Date.now(), fmt: string = 'YYYY-MM-DD HH:mm:ss'): string { try { let data: Date; if(typeof value === 'number' || typeof value === 'string') { data = new Date(value); if(isNaN(data.getTime())) { throw new Error('Invalid date'); ...
AST#export_declaration#Left export AST#function_declaration#Left function formatTime AST#parameter_list#Left ( AST#parameter#Left value : 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 AS...
export function formatTime (value: number | string | Date = Date.now(), fmt: string = 'YYYY-MM-DD HH:mm:ss'): string { try { let data: Date; if(typeof value === 'number' || typeof value === 'string') { data = new Date(value); if(isNaN(data.getTime())) { throw new Error('Invalid date'); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/utils/formatTime.ets#L36-L103
fba5525d8cb2c07f485c143f9b3c06d92979a390
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
updateDb
MARK: - 数据修改接口 执行更新操作(INSERT/UPDATE/DELETE) @param sql - 更新语句 @param params - 参数数组(可选) @returns Promise<boolean> 返回是否执行成功 注意:该方法会自动关闭数据库连接
async updateDb(sql: string, params: ParamType[] = []): Promise<boolean> { if (!await this.initDatabase()) return false; try { await this.rdbStore!.executeSql(sql, params); DebugLog.d(sql +' 参数: ' + params) return true; } catch (err) { console.error(`DBAccessor: 更新失败 [${sql}] - ${e...
AST#method_declaration#Left async updateDb AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamT...
async updateDb(sql: string, params: ParamType[] = []): Promise<boolean> { if (!await this.initDatabase()) return false; try { await this.rdbStore!.executeSql(sql, params); DebugLog.d(sql +' 参数: ' + params) return true; } catch (err) { console.error(`DBAccessor: 更新失败 [${sql}] - ${e...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L343-L357
93a664b851a72db71a0e0958aaec0a606dcf8dae
github