nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets | arkts | getTitleScaleOptions | 获取主标题缩放的Scale参数
@returns {ScaleOptions} 主标题缩放系数 | getTitleScaleOptions(): ScaleOptions {
let scaleRatio = 1 + (this.animationAttribute.titleScale - 1) *
Math.min((this.heightValue - this.animationAttribute.normalTitleHeight + Math.max(-this.curOffset, 0)) / this.animationAttribute.continuePullThreshold, 1);
return {
x: scaleRatio,
y: scaleRat... | AST#method_declaration#Left getTitleScaleOptions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ScaleOptions AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Lef... | getTitleScaleOptions(): ScaleOptions {
let scaleRatio = 1 + (this.animationAttribute.titleScale - 1) *
Math.min((this.heightValue - this.animationAttribute.normalTitleHeight + Math.max(-this.curOffset, 0)) / this.animationAttribute.continuePullThreshold, 1);
return {
x: scaleRatio,
y: scaleRat... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets#L211-L220 | 2e5fad3ee62e1d54a6453db448412f28c45098d5 | gitee |
ali5669/ArkTSShopping.git | 7065d61468d80c143788532337c499eb9eaa5ffd | entry/src/main/ets/viewmodel/LocalDataManager.ets | arkts | queryItemListById | 通过ID搜索物品 | queryItemListById(id: string){
const result = ItemData.filter(item => item.id == id)[0];
return result
} | AST#method_declaration#Left queryItemListById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef... | queryItemListById(id: string){
const result = ItemData.filter(item => item.id == id)[0];
return result
} | https://github.com/ali5669/ArkTSShopping.git/blob/7065d61468d80c143788532337c499eb9eaa5ffd/entry/src/main/ets/viewmodel/LocalDataManager.ets#L25-L28 | b52de15ed4716ae0a1b8a07ea962fc05c3bf45f8 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/MD5.ets | arkts | hash | 散列哈希算法
@param value 待处理字符
@param enCoding 编码格式hex/base64
@returns | static hash(value: string, enCoding?: string): OutDTO<string> {
let md = new MD5();
if (enCoding && enCoding == 'base64') {
let md5 = md.b64_md5(value);
if (!md5.endsWith('==')) {
md5 += '==';
}
return OutDTO.OKByDataRow('MD5散列算法Base64成功~', md5);
}
return OutDTO.OKByDataR... | AST#method_declaration#Left static hash AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left enCoding ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static hash(value: string, enCoding?: string): OutDTO<string> {
let md = new MD5();
if (enCoding && enCoding == 'base64') {
let md5 = md.b64_md5(value);
if (!md5.endsWith('==')) {
md5 += '==';
}
return OutDTO.OKByDataRow('MD5散列算法Base64成功~', md5);
}
return OutDTO.OKByDataR... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/MD5.ets#L47-L57 | e8e41bd72918e1a5b2f8793dfb493eda7a168e40 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.collections.d.ets | arkts | getBitsByRange | Returns the bit values in a range of indices in a bit vector.
@param { number } fromIndex - The starting position of the index, containing the value at that index position.
@param { number } toIndex - The end of the index, excluding the value at that index.
@returns { BitVector } The BitVector type, returns the bit va... | getBitsByRange(fromIndex: number, toIndex: number): BitVector; | AST#method_declaration#Left getBitsByRange AST#parameter_list#Left ( AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | getBitsByRange(fromIndex: number, toIndex: number): BitVector; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L12290-L12290 | 5485c7c8c5785085ca2bac6d9aceadaa6bb70840 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/ChatTools.ets | arkts | 聊天工具类。 | export default class ChatTools {
/** 聊天界面全面屏状态栏背景色 */
static readonly chat_page_title_background_color = '#ffffff';//'#fafafa';//#2e3746';//'#2e3746';
/** 聊天界面全面屏状态栏文本颜色 */
static readonly chat_page_title_color = '#000000';//#ffffff';
/**
* 退出系统。
*
* @param context UIAbilityContext上下文对象
*/
sta... | AST#export_declaration#Left export default AST#class_declaration#Left class ChatTools AST#class_body#Left { /** 聊天界面全面屏状态栏背景色 */ AST#property_declaration#Left static readonly chat_page_title_background_color = AST#expression#Left '#ffffff' AST#expression#Right ; AST#property_declaration#Right //'#fafafa';//#2e3746';//'... | export default class ChatTools {
static readonly chat_page_title_background_color = '#ffffff';
static readonly chat_page_title_color = '#000000';
static exitSystem(context: common.UIAbilityContext) {
context.terminateSelf();
}
static setStatusBarColor(context: common.BaseContext, statusBarC... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L12-L379 | b821b0c16049b3d3c86ca80fb2299297fcd0404a | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera/entry/src/main/ets/pages/Index.ets | arkts | requestPermissionsFn | Obtain permissions | async requestPermissionsFn() {
Logger.info(TAG, `requestPermissionsFn entry`);
try {
this.atManager.requestPermissionsFromUser(this.appContext, [
'ohos.permission.CAMERA',
'ohos.permission.MICROPHONE',
'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA'
]).the... | AST#method_declaration#Left async requestPermissionsFn AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Ri... | async requestPermissionsFn() {
Logger.info(TAG, `requestPermissionsFn entry`);
try {
this.atManager.requestPermissionsFromUser(this.appContext, [
'ohos.permission.CAMERA',
'ohos.permission.MICROPHONE',
'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA'
]).the... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/pages/Index.ets#L120-L135 | 5dc1fb353eb26ca0d3e93a99b683b30cc2db58ba | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/ChatListJsonData.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 ChatListJsonData {
public static readonly CHAT_LIST_JSON_DATA: Array<string> = [
'mockChatOneModelData.json',
'mockChatTwoModelData.json'
]
} | AST#export_declaration#Left export default AST#class_declaration#Left class ChatListJsonData AST#class_body#Left { AST#property_declaration#Left public static readonly CHAT_LIST_JSON_DATA : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#... | export default class ChatListJsonData {
public static readonly CHAT_LIST_JSON_DATA: Array<string> = [
'mockChatOneModelData.json',
'mockChatTwoModelData.json'
]
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/ChatListJsonData.ets#L16-L21 | 07e6b02bc7a5e37a80bc1861bbdd84bd0373ac29 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | toAppGalleryDetail | 拉起应用市场对应的应用详情界面
@param bundleName 需要打开应用详情的应用的包名。
@returns | static async toAppGalleryDetail(bundleName: string): Promise<void> {
const want: Want = {
action: 'ohos.want.action.appdetail',
uri: 'store://appgallery.huawei.com/app/detail?id=' + bundleName,
};
return AppUtil.getContext().startAbility(want);
} | AST#method_declaration#Left static async toAppGalleryDetail AST#parameter_list#Left ( AST#parameter#Left bundleName : 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... | static async toAppGalleryDetail(bundleName: string): Promise<void> {
const want: Want = {
action: 'ohos.want.action.appdetail',
uri: 'store://appgallery.huawei.com/app/detail?id=' + bundleName,
};
return AppUtil.getContext().startAbility(want);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L211-L217 | 88b14fceac463459625c8da15ed9098a66fbc2a0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/smartfill/Index.ets | arkts | SmartFill | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { SmartFill } from './src/main/ets/view/SmartFill'; | AST#export_declaration#Left export { SmartFill } from './src/main/ets/view/SmartFill' ; AST#export_declaration#Right | export { SmartFill } from './src/main/ets/view/SmartFill'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/smartfill/Index.ets#L30-L30 | c69ac2b7a01e94db6aff159ed66c1c7fc287b22b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | default opacity | export const DEFAULT_OPACITY: number = Number.parseFloat('0.2'); | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DEFAULT_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#e... | export const DEFAULT_OPACITY: number = Number.parseFloat('0.2'); | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L54-L54 | 0afd8ec5d4dc8d5d8358c5f0a02192980a9393f3 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语模板接口 | export interface GreetingTemplate {
id: string;
name: string;
content: string;
style: GreetingStyle;
occasion: GreetingOccasion;
variables: GreetingVariable[];
isSystem: boolean;
usage: number;
rating: number;
tags: string[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingTemplate AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Lef... | export interface GreetingTemplate {
id: string;
name: string;
content: string;
style: GreetingStyle;
occasion: GreetingOccasion;
variables: GreetingVariable[];
isSystem: boolean;
usage: number;
rating: number;
tags: string[];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/GreetingTypes.ets#L133-L144 | 4fdcdef372d2ef43a07833aa136e3640c346aff5 | github | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/common/UIUtils.ets | arkts | setUIContext | 页面初始化时调用 | static setUIContext(context: UIContext): void {
UIUtils.uiContext = context;
} | AST#method_declaration#Left static setUIContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | static setUIContext(context: UIContext): void {
UIUtils.uiContext = context;
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/common/UIUtils.ets#L60-L62 | 754c60a7bbac30da15f818dbbadcf31c9b944902 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/model/VHHistoryMessageDataSource.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) {
console.info('add listener');
this.listeners.push(listener);
}
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/VHHistoryMessageDataSource.ets#L18-L23 | c11b47fe8f40c26fc53b72b2a4e2f5fc694bf616 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets | arkts | getLocalVideo | Scan the local video.
@return Local video list data | async getLocalVideo() {
this.videoLocalList = [];
await this.assemblingVideoBean();
GlobalContext.getContext().setObject('videoLocalList', this.videoLocalList);
return this.videoLocalList;
} | AST#method_declaration#Left async getLocalVideo 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 . videoLocalList AST#member_expr... | async getLocalVideo() {
this.videoLocalList = [];
await this.assemblingVideoBean();
GlobalContext.getContext().setObject('videoLocalList', this.videoLocalList);
return this.videoLocalList;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets#L31-L36 | b0d19f269de8bd0962e2763484778244f5b38740 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/Photos/entry/src/main/ets/pages/MediaOperationPage.ets | arkts | onActive | Callback when the page is in the foreground | onActive(): void {
if (!this.isActive) {
Log.info(TAG, 'onActive');
this.isActive = true;
}
} | AST#method_declaration#Left onActive 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#member_expressi... | onActive(): void {
if (!this.isActive) {
Log.info(TAG, 'onActive');
this.isActive = true;
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/pages/MediaOperationPage.ets#L150-L155 | 2e6acce71316c409bb456c9ad380bb696abf5204 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderLogisticsViewModel.ets | arkts | loadOrderLogistics | 获取订单物流信息
@returns {void} 无返回值 | loadOrderLogistics(): void {
if (!this.orderId) {
this.logisticsInfo = new Logistics();
return;
}
RequestHelper.repository<Logistics>(this.repository.getOrderLogistics(this.orderId))
.toast(false)
.execute()
.then((data: Logistics): void => {
this.logisticsInfo = data;
... | AST#method_declaration#Left loadOrderLogistics AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Le... | loadOrderLogistics(): void {
if (!this.orderId) {
this.logisticsInfo = new Logistics();
return;
}
RequestHelper.repository<Logistics>(this.repository.getOrderLogistics(this.orderId))
.toast(false)
.execute()
.then((data: Logistics): void => {
this.logisticsInfo = data;
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderLogisticsViewModel.ets#L53-L64 | 08e7baeb13f3fa1bb9dcbe26202877facdf99c7b | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/RadarChartModel.ets | arkts | setDrawWeb | If set to true, drawing the web is enabled, if set to false, drawing the
whole web is disabled. Default: true
@param enabled | public setDrawWeb(enabled: boolean) {
this.mDrawWeb = enabled;
} | AST#method_declaration#Left public setDrawWeb AST#parameter_list#Left ( AST#parameter#Left enabled : 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#builder_function_body#Left { AST#expression_statement#Left AST#e... | public setDrawWeb(enabled: boolean) {
this.mDrawWeb = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L310-L312 | 5ae659cf1e554e4c40e4b20d25f4db8e78d05b21 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | changeFavoriteLevelForWord | 更改单词的收藏等级 | async changeFavoriteLevelForWord(word: WordUser, newLevel: number): Promise<void> {
word.favoriteLevel = newLevel;
await WordUserDbAccess.shared.saveWordUser(word);
} | AST#method_declaration#Left async changeFavoriteLevelForWord AST#parameter_list#Left ( AST#parameter#Left word : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newLevel : AST#type_annotation#Left AST#primary_type#Left num... | async changeFavoriteLevelForWord(word: WordUser, newLevel: number): Promise<void> {
word.favoriteLevel = newLevel;
await WordUserDbAccess.shared.saveWordUser(word);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L837-L840 | 860b1cfbc1de6cbdf2d92d3c69646109d2148340 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | @file 购物车页面 ViewModel
@author Joker.X | @ObservedV2
export default class CartViewModel extends BaseViewModel {
/**
* 购物车仓库
*/
private readonly cartRepository: CartRepository = new CartRepository();
/**
* 订单缓存本地存储仓库
*/
private readonly orderCacheStoreRepository: OrderCacheStoreRepository = new OrderCacheStoreRepository();
/**
* 购物车列表
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class CartViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 购物车仓库
*/ AST#pro... | @ObservedV2
export default class CartViewModel extends BaseViewModel {
private readonly cartRepository: CartRepository = new CartRepository();
private readonly orderCacheStoreRepository: OrderCacheStoreRepository = new OrderCacheStoreRepository();
@Trace
cartList: Cart[] = [];
@Trace
selectedSpe... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L11-L357 | 78ab6c73c8d1862ec7010c3b6f4ed51ec9e9136e | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | getCircleSize | This function is deprecated because of unclarity. Use getCircleRadius instead.
@Deprecated | public getCircleSize(): number {
return this.getCircleRadius();
} | AST#method_declaration#Left public getCircleSize 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#call_expre... | public getCircleSize(): number {
return this.getCircleRadius();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L206-L208 | da120b915d96fb89c98933e0ade9019c1b55708c | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ImageUtil.ets | arkts | packingFromImageSource | 图片压缩或重新打包,使用Promise形式返回结果。
@param source ImageSource-打包的图片源。
@param options 设置打包参数:
format 目标格式。当前只支持"image/jpeg"、"image/webp"、"image/png"和"image/heif"12+(不同硬件设备支持情况不同)。
quality JPEG编码中设定输出图片质量的参数,取值范围为0-100。
bufferSize 接收编码数据的缓冲区大小,单位为Byte。默认为10MB。bufferSize需大于编码后图片大小。
@returns | static packingFromImageSource(source: image.ImageSource, options: image.PackingOption): Promise<ArrayBuffer> {
const imagePacker: image.ImagePacker = image.createImagePacker();
return imagePacker.packing(source, options).finally(() => {
imagePacker.release(); //释放
});
} | AST#method_declaration#Left static packingFromImageSource AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left op... | static packingFromImageSource(source: image.ImageSource, options: image.PackingOption): Promise<ArrayBuffer> {
const imagePacker: image.ImagePacker = image.createImagePacker();
return imagePacker.packing(source, options).finally(() => {
imagePacker.release();
});
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L200-L205 | cf336fac69405981b3fc47c5c2b91d25fe63ccba | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/RefreshLayout.ets | arkts | RefreshLayout | The refresh layout component. | @Component
export default struct RefreshLayout {
@ObjectLink refreshLayoutClass: CustomRefreshLoadLayoutClass;
build() {
Column() {
if (this.refreshLayoutClass.isVisible) {
CustomRefreshLoadLayout({ customRefreshLoadClass: new CustomRefreshLoadLayoutClass
(this.refreshLayoutClass.isVisibl... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct RefreshLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right refreshLayoutClass : AST#type_annotation#Left AST#primary_type#Left CustomRefreshLoadLa... | @Component
export default struct RefreshLayout {
@ObjectLink refreshLayoutClass: CustomRefreshLoadLayoutClass;
build() {
Column() {
if (this.refreshLayoutClass.isVisible) {
CustomRefreshLoadLayout({ customRefreshLoadClass: new CustomRefreshLoadLayoutClass
(this.refreshLayoutClass.isVisibl... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/RefreshLayout.ets#L22-L35 | 08abdfeed59b1ac9ac7c693242dc572982caf791 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/GridSegmentedPicker.ets | arkts | customBuilder | 根据容器宽度计算出的列数 默认UI构建函数 | @LocalBuilder
private customBuilder(option: GridPickerItem) {
Text(option.label)
.fontSize(16)
.textAlign(TextAlign.Center)
} | AST#method_declaration#Left AST#decorator#Left @ LocalBuilder AST#decorator#Right private customBuilder AST#parameter_list#Left ( AST#parameter#Left option : AST#type_annotation#Left AST#primary_type#Left GridPickerItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#... | @LocalBuilder
private customBuilder(option: GridPickerItem) {
Text(option.label)
.fontSize(16)
.textAlign(TextAlign.Center)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/GridSegmentedPicker.ets#L33-L38 | c7e7494585fd109efdb793ab202772fe57fcb6a7 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/ServicesViewModel.ets | arkts | loadGoodsService | Load the data of goods service for the GoodsServiceList view. | public loadGoodsService(): Service[] {
return DataModel.GOOD_SERVICE;
} | AST#method_declaration#Left public loadGoodsService AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Service [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_stateme... | public loadGoodsService(): Service[] {
return DataModel.GOOD_SERVICE;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/ServicesViewModel.ets#L21-L23 | c031326ce4c2fe527069b84d8fe30b89860a3e6d | gitee |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/ChatPage.ets | arkts | beKickout | 被踢的处理逻辑。 | beKickout(kickoutInfo: PKickoutInfo) {
// 首先释放IM所占资源
IMClientManager.getInstance().releaseMobileIMSDK();
// 提示信息
let alertContent: string = '';
if (kickoutInfo.code === PKickoutInfo.KICKOUT_FOR_DUPLICATE_LOGIN) {
alertContent = '账号已在其它地方登陆,当前会话已断开,请退出后重新登陆!';
} else if (kickoutInfo.code =... | AST#method_declaration#Left beKickout AST#parameter_list#Left ( AST#parameter#Left kickoutInfo : AST#type_annotation#Left AST#primary_type#Left PKickoutInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 首先释放IM所占资源 AST#statement#Left AST#exp... | beKickout(kickoutInfo: PKickoutInfo) {
IMClientManager.getInstance().releaseMobileIMSDK();
let alertContent: string = '';
if (kickoutInfo.code === PKickoutInfo.KICKOUT_FOR_DUPLICATE_LOGIN) {
alertContent = '账号已在其它地方登陆,当前会话已断开,请退出后重新登陆!';
} else if (kickoutInfo.code === PKickoutInfo.KICK... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/ChatPage.ets#L186-L215 | c5855692917fa3a22c7cddd3182e63b49df8656a | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/makeObserved/SendableData.ets | arkts | SendableData | 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... | @Sendable
export class SendableData {
public name: string = 'Tom';
public age: number = 20;
public gender: number = 1;
// .... more other properties
public likes: number = 1;
public follow: boolean = false;
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class SendableData AST#class_body#Left { AST#property_declaration#Left public name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Tom' AST#expre... | @Sendable
export class SendableData {
public name: string = 'Tom';
public age: number = 20;
public gender: number = 1;
public likes: number = 1;
public follow: boolean = false;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/makeObserved/SendableData.ets#L15-L23 | db41ee1920fa7a0725bfc0eda3328826ebc2733e | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets | arkts | TabTitleBar | Declaration of the tabbed title bar.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the tabbed title bar.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @Component
export declare struct TabTitleBar {
/**
* Tab items on the left side.
* @type { ?Array<TabTitleBarItem> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Tab items on the left side.
* @type { ?Array<TabTitleBarItem> }.
* @syscap SystemCapabili... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct TabTitleBar AST#component_body#Left { /**
* Tab items on the left side.
* @type { ?Array<TabTitleBarItem> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @si... | @Component
export declare struct TabTitleBar {
tabItems: Array<TabTitleBarTabItem>;
menuItems?: Array<TabTitleBarMenuItem>;
@BuilderParam
swiperContent: () => void;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets#L134-L181 | 8ded6732396d6b7b25071ec439bbc16e25422aaa | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | requestRepository | 请求地址详情
@returns {Promise<NetworkResponse<Address>>} 地址详情响应 | protected requestRepository(): Promise<NetworkResponse<Address>> {
return this.repository.getAddressInfo(this.addressId);
} | AST#method_declaration#Left protected requestRepository 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#generic_type#Left NetworkResponse AST#type_arguments#Le... | protected requestRepository(): Promise<NetworkResponse<Address>> {
return this.repository.getAddressInfo(this.addressId);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L139-L141 | 7830bb7950b49f51c8279711392934b07e854eb5 | github |
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git | 3b5fa45c650dcae2773a19f122161935e0c0e2bc | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onNewWant | Obtain the code value through the onNewWant callback in warm launch scenarios. | onNewWant(want: Want, _: AbilityConstant.LaunchParam): void {
Logger.info(TAG, 'Ability onNewWant');
// Obtain the uri field from the want information.
let uri = want?.uri;
let status: router.RouterState = router.getState();
if (status && status.name !== 'ScanAccess' && uri) {
// Process the s... | AST#method_declaration#Left onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left _ : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AbilityConsta... | onNewWant(want: Want, _: AbilityConstant.LaunchParam): void {
Logger.info(TAG, 'Ability onNewWant');
let uri = want?.uri;
let status: router.RouterState = router.getState();
if (status && status.name !== 'ScanAccess' && uri) {
router.pushUrl({
url: 'pages/access/ScanAccess'
... | https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/entryability/EntryAbility.ets#L122-L133 | 4c9171b9d0ab2b7bffa5f5b6c2be63a2630ac3d7 | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets | arkts | has | / 根据key检查缓存值是否存在 | public static has(key: string): boolean {
return PreferencesUtil.hasSync(key)
} | AST#method_declaration#Left public static has AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | public static has(key: string): boolean {
return PreferencesUtil.hasSync(key)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L140-L142 | 36c9280947622b42e18ec0569027a49adae3a055 | github |
gracienewd/openharmony-App-YunmoAi.git | 181952ab00aab5025a81b7b3a6b88d2a5258c76a | entry/src/main/ets/pages/chat/index.ets | arkts | _chatPlaceHolder | 2.默认 | @Builder
_chatPlaceHolder() {
ChatPlaceHolder()
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right _chatPlaceHolder 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 ChatPlaceHolder ( ) AST#ui_component#Right AST#ui_element... | @Builder
_chatPlaceHolder() {
ChatPlaceHolder()
} | https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/pages/chat/index.ets#L90-L93 | f60965b7a4182466da01261f8905315ac8ac8822 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/highlight/Highlight.ets | arkts | equalTo | Returns true if this highlight object is equal to the other (compares
xIndex and dataSetIndex)
@param h
@return | public equalTo(h: Highlight | null): boolean {
if (h == null)
return false;
else {
if (this.mDataSetIndex == h.mDataSetIndex && this.mX == h.mX
&& this.mStackIndex == h.mStackIndex && this.mDataIndex == h.mDataIndex)
return true;
else
return false;
}
} | AST#method_declaration#Left public equalTo AST#parameter_list#Left ( AST#parameter#Left h : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Highlight 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#par... | public equalTo(h: Highlight | null): boolean {
if (h == null)
return false;
else {
if (this.mDataSetIndex == h.mDataSetIndex && this.mX == h.mX
&& this.mStackIndex == h.mStackIndex && this.mDataIndex == h.mDataIndex)
return true;
else
return false;
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/Highlight.ets#L196-L207 | 8c271d31a2f82deeb5df191d3d5e796e28825b82 | gitee |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/common/helper/DialogHelper.ets | arkts | TODO Dialog帮助工具类(全局自定义弹框,不依赖UI组件)
author: 桃花镇童长老ᥫ᭡
since: 2024/08/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fharmony-dialog
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/harmony-utils
QQ交流群: 1029219059 | export class DialogHelper {
/**
* 显示自定义半模态
* @param wrappedBuilder 自定义半模态中显示的组件内容
* @param options
* @returns
*/
static showBindSheet<T extends BaseSheetOptions>(wrappedBuilder: WrappedBuilder<[T]>, options: T) {
DialogHelper.initBindSheetDefault(options);
if(options.uiContext){
const ... | AST#export_declaration#Left export AST#class_declaration#Left class DialogHelper AST#class_body#Left { /**
* 显示自定义半模态
* @param wrappedBuilder 自定义半模态中显示的组件内容
* @param options
* @returns
*/ AST#method_declaration#Left static showBindSheet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#typ... | export class DialogHelper {
static showBindSheet<T extends BaseSheetOptions>(wrappedBuilder: WrappedBuilder<[T]>, options: T) {
DialogHelper.initBindSheetDefault(options);
if(options.uiContext){
const componentContent = new ComponentContent(options.uiContext, wrappedBuilder, options);
options.... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/helper/DialogHelper.ets#L28-L80 | 223fb4c1a19159cf57bda1447e3f6aa91297fc0a | github | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/array_lib_func_005_T.ets | arkts | Introduction 库函数-array_push | export function array_lib_func_005_T(taint_src : string) {
let arr : string[] = ["a","b"];
arr.push(taint_src);
taint.Sink(arr);
} | AST#export_declaration#Left export AST#function_declaration#Left function array_lib_func_005_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function array_lib_func_005_T(taint_src : string) {
let arr : string[] = ["a","b"];
arr.push(taint_src);
taint.Sink(arr);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/array_lib_func_005_T.ets#L6-L10 | 936ae6187efc5152d790240636bfec85fadc2db8 | github | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.multimedia.avVolumePanel.d.ets | arkts | @file Defines a panel to set the system audio output volume.
@kit AudioKit
Declare custom parameters used for volume panel.
@syscap SystemCapability.Multimedia.Audio.Volume
@atomicservice
@since 12 | export declare class AVVolumePanelParameter {
/**
* Sets the position of volume panel.
*
* @syscap SystemCapability.Multimedia.Audio.Volume
* @atomicservice
* @since 12
*/
position?: Position;
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class AVVolumePanelParameter AST#class_body#Left { /**
* Sets the position of volume panel.
*
* @syscap SystemCapability.Multimedia.Audio.Volume
* @atomicservice
* @since 12
*/ AST#property... | export declare class AVVolumePanelParameter {
position?: Position;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.multimedia.avVolumePanel.d.ets#L26-L35 | 8d1a931f5f6330d67bce362831c2fec4b04a3d18 | github | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/BorderImageSample/entry/src/main/ets/common/util/StringUtil.ets | arkts | numberToPercentage | Numbers turn into percentages.
@param figure , postice number;
@return {string} percentage. | public static numberToPercentage(figure: number): string {
return figure + '%';
} | AST#method_declaration#Left public static numberToPercentage AST#parameter_list#Left ( AST#parameter#Left figure : 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 string... | public static numberToPercentage(figure: number): string {
return figure + '%';
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BorderImageSample/entry/src/main/ets/common/util/StringUtil.ets#L27-L29 | 7c95b6bce62571a7a2bdf624e49555c564d0c0a5 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AvoidTimeComsume/entry/src/main/ets/common/Item.ets | arkts | [Start item] | export class ResponseData{
public data: Item[] = [];
} | AST#export_declaration#Left export AST#class_declaration#Left class ResponseData AST#class_body#Left { AST#property_declaration#Left public data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Item [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#a... | export class ResponseData{
public data: Item[] = [];
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/common/Item.ets#L32-L34 | 82e4b1658cace2a2a0239a0aefa1bb2a6b88b691 | gitee | |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/pages/MoodDetail.ets | arkts | formatDate | 格式化日期:2025年12月26日 星期五 08:30 | formatDate(timestamp: number): string {
const date = new Date(timestamp);
const dateStr = `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`;
const timeStr = `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
return `${dateStr} ${timeStr}`;
... | AST#method_declaration#Left formatDate AST#parameter_list#Left ( AST#parameter#Left timestamp : 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 string AST#primary_type#R... | formatDate(timestamp: number): string {
const date = new Date(timestamp);
const dateStr = `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`;
const timeStr = `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
return `${dateStr} ${timeStr}`;
... | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/pages/MoodDetail.ets#L28-L33 | 9a5fbda91c5defc9951043e03d8929b264488141 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | library/common/src/main/ets/constants/RouterMap.ets | arkts | 分组拼接路径 | export const HAP_A_PAGE_ONE = GROUP + "hapAPageOne"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAP_A_PAGE_ONE = AST#expression#Left AST#binary_expression#Left AST#expression#Left GROUP AST#expression#Right + AST#expression#Left "hapAPageOne" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST... | export const HAP_A_PAGE_ONE = GROUP + "hapAPageOne"; | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/library/common/src/main/ets/constants/RouterMap.ets#L17-L17 | f645e71329f46a6a4e114d9dac797b46dec99e45 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | GreetingStyle | 重新导出GreetingStyle枚举供其他模块使用 | export { GreetingStyle }; | AST#export_declaration#Left export { GreetingStyle } ; AST#export_declaration#Right | export { GreetingStyle }; | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L10-L10 | 794efa5f70c195e650f2a0117e17e6684c5de7f8 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets | arkts | dealUserData | Processes information entered by users. | async dealUserData() {
this.userList = await this.userTableApi.queryUserByUsername(this.username);
if (this.userList.length === 0) {
PromptUtil.promptMessage($r('app.string.message_user_empty'), CommonConstants.PROMPT_TIME);
return;
}
// Decrypt the password using the string decryption API.
... | AST#method_declaration#Left async dealUserData 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 . userList AST#member_expression#... | async dealUserData() {
this.userList = await this.userTableApi.queryUserByUsername(this.username);
if (this.userList.length === 0) {
PromptUtil.promptMessage($r('app.string.message_user_empty'), CommonConstants.PROMPT_TIME);
return;
}
this.aesDecrypt();
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets#L171-L179 | 9d13d09e35672084978e101d2e161ab4bf6ea24e | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderConfirmPage.ets | arkts | RemarkCard | 订单备注卡片
@returns {void} 无返回值 | @Builder
private RemarkCard() {
Card() {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
}) {
// 标题
IBestCell({
hasBorder: true,
titleBuilder: (): void => this.RemarkTitle()
});
// 备注输入框
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RemarkCard 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 Card ( ) AST#container_content_body#Left { AST#arkts_ui... | @Builder
private RemarkCard() {
Card() {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
}) {
IBestCell({
hasBorder: true,
titleBuilder: (): void => this.RemarkTitle()
});
IBestFi... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderConfirmPage.ets#L230-L257 | 8e7966f0900610f5e10f19cb37d6ff2db0d67fdf | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/view/ImageViewComponent.ets | arkts | limitScale | Limit scale to keep the image clear. | limitScale(isReset: boolean): void {
if (this.imgScale < 1) {
this.imgScale = 1;
this.curScale = 1;
if (isReset) {
this.imgOffsetX = 0;
this.imgOffsetY = 0;
}
this.isGesture = false;
} else if (this.imgScale > Const.MAX_SCALE) {
this.imgScale = Const.MAX_SCALE... | AST#method_declaration#Left limitScale AST#parameter_list#Left ( AST#parameter#Left isReset : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | limitScale(isReset: boolean): void {
if (this.imgScale < 1) {
this.imgScale = 1;
this.curScale = 1;
if (isReset) {
this.imgOffsetX = 0;
this.imgOffsetY = 0;
}
this.isGesture = false;
} else if (this.imgScale > Const.MAX_SCALE) {
this.imgScale = Const.MAX_SCALE... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/ImageViewComponent.ets#L96-L111 | e66a39ef84785a8854e1bdc701338459771733c6 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/pages/MainPage.ets | arkts | progressTextStyle | Steps text common style. | @Extend(Text)
function progressTextStyle(styleFontSize: number, styleFontWeight: number) {
.fontColor(Color.White)
.fontSize(styleFontSize)
.fontWeight(styleFontWeight)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function progressTextStyle AST#parameter_list#Left ( AST#parameter#Left styleFontSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotati... | @Extend(Text)
function progressTextStyle(styleFontSize: number, styleFontWeight: number) {
.fontColor(Color.White)
.fontSize(styleFontSize)
.fontWeight(styleFontWeight)
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/pages/MainPage.ets#L105-L110 | aa8dc28cbca1949015b8e678888d9170c166d2eb | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | recoverSync | 对数据进行签名恢复原始数据,同步,目前仅RSA支持
@param signDataBlob 已签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA1024|PKCS1|NoHash|OnlySign、RSA1024|PKCS1|NoHash|Recover、等)。
@returns | static recoverSync(signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'RSA1024|PKCS1|NoHash|Recover') {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
let rawSignData = verifier.recoverSync(signDataBlob);
return rawSignData;
} | AST#method_declaration#Left static recoverSync AST#parameter_list#Left ( AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ... | static recoverSync(signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'RSA1024|PKCS1|NoHash|Recover') {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
let rawSignData = verifier.recoverSync(signDataBlob);
return rawSignData;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L352-L357 | 3d4bb96e88137c9950e1d0f68fc665b63f3b2edd | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/MessageUtil.ets | arkts | txtStyle | 文本样式
@param color | @Extend(Text)
function txtStyle(color: string) {
.margin({
left: UiConst.VP_10
})
.fontColor(color)
.fontSize(UiConst.FONT_14)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function txtStyle AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#para... | @Extend(Text)
function txtStyle(color: string) {
.margin({
left: UiConst.VP_10
})
.fontColor(color)
.fontSize(UiConst.FONT_14)
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L147-L154 | 68c5754c256fae1ce72b05eee5c2cc79bc4cd30a | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/pages/NavPathManager.ets | arkts | clear | 清空所有导航路径 | clear(animated?: boolean) {
this._navPath.clear(animated ?? true)
} | AST#method_declaration#Left clear AST#parameter_list#Left ( AST#parameter#Left animated ? : 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#builder_function_body#Left { AST#expression_statement#Left AST#expression... | clear(animated?: boolean) {
this._navPath.clear(animated ?? true)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L73-L75 | c6dab34a6e07648a9fa803935e4956b2511fa454 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/NetworkUtil.ets | arkts | getSignalInformation | 获取指定SIM卡槽对应的注册网络信号强度信息列表。
@param slotId 卡槽ID,如果不指定slotId,默认主卡。
@returns | static async getSignalInformation(slotId?: number): Promise<Array<radio.SignalInformation>> {
slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号。
let signalInfo: Array<radio.SignalInformation> = await radio.getSignalInformation(slotId);
return signalInfo;
} | AST#method_declaration#Left static async getSignalInformation AST#parameter_list#Left ( AST#parameter#Left slotId ? : 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... | static async getSignalInformation(slotId?: number): Promise<Array<radio.SignalInformation>> {
slotId = slotId ?? await NetworkUtil.getPrimarySlotId();
let signalInfo: Array<radio.SignalInformation> = await radio.getSignalInformation(slotId);
return signalInfo;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/NetworkUtil.ets#L376-L380 | 9a9518f395759d4e773f3de3ee1e4f20486a474b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | getNotifications | 获取通知列表 | async getNotifications(limit: number = 20, offset: number = 0): Promise<Notification[]> {
try {
// TODO: 实现真实的API调用
return this.getMockNotifications(limit);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to get notifications: ${error}`);
ret... | AST#method_declaration#Left async getNotifications AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right AST#parameter#Right , AST#parameter#Left offset : AST#type_annotati... | async getNotifications(limit: number = 20, offset: number = 0): Promise<Notification[]> {
try {
return this.getMockNotifications(limit);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to get notifications: ${error}`);
return [];
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L579-L588 | 82c3a62544bd181478c53a9ac6c7022b5f70855c | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceTabs.d.ets | arkts | AtomicServiceTabs | @file Provides an advanced struct of tabs for atomic services
@kit ArkUI
Defines AtomicServiceTabs.
@struct AtomicServiceTabs
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | @Component
export declare struct AtomicServiceTabs {
/**
* The TabContent array of tabs.
*
* @type { ?[TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabContentBuilder?] }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AtomicServiceTabs AST#component_body#Left { /**
* The TabContent array of tabs.
*
* @type { ?[TabContentBuilder?, TabContentBuilder?, TabContentBuilder?, TabConten... | @Component
export declare struct AtomicServiceTabs {
@BuilderParam
tabContents?: [
TabContentBuilder?,
TabContentBuilder?,
TabContentBuilder?,
TabContentBuilder?,
TabContentBuilder?
];
@Prop
tabBarOptionsArray: [
TabBarOptions,
TabBar... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceTabs.d.ets#L27-L137 | 11ff4df7696ef50cdf778458b0669393ec20ea67 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/Utils.ets | arkts | getDefaultValueFormatter | /// - returns: The default value formatter used for all chart components that needs a default | public static getDefaultValueFormatter(): IValueFormatter {
return Utils.mDefaultValueFormatter;
} | AST#method_declaration#Left public static getDefaultValueFormatter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#exp... | public static getDefaultValueFormatter(): IValueFormatter {
return Utils.mDefaultValueFormatter;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L162-L164 | 699063cf003531e8df055b17903ecf8d356cbb15 | gitee |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/viewmodels/ReviewViewModel.ets | arkts | getAheadCount | 获取超预期完成的任务数量 | static getAheadCount(completedTasks: TaskItem[]): number {
return completedTasks.filter(t => {
if (!t.actualTime) return false;
return t.estimatedTime / t.actualTime > 1.1;
}).length;
} | AST#method_declaration#Left static getAheadCount AST#parameter_list#Left ( AST#parameter#Left completedTasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a... | static getAheadCount(completedTasks: TaskItem[]): number {
return completedTasks.filter(t => {
if (!t.actualTime) return false;
return t.estimatedTime / t.actualTime > 1.1;
}).length;
} | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L111-L116 | 8a69c199ec8a1df35404921cd878d7cb3b2fa992 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | TaskPoolPractice/entry/src/main/ets/pages/sample1/Sample1.ets | arkts | correctConcurrentFunc | [Start sample_fun] Sample1.ets | @Concurrent
function correctConcurrentFunc() {
let foo: Foo = new Foo;
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function correctConcurrentFunc AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left foo : AST#type_annotation#Left AST#... | @Concurrent
function correctConcurrentFunc() {
let foo: Foo = new Foo;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample1/Sample1.ets#L27-L30 | c16fbcdd836eb806a85f057e5754de79e6662ff9 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogBuilder.ets | arkts | CustomContentDialogBuilder | CustomContentDialog | @Builder
export function CustomContentDialogBuilder(options: BaseContentOptions) {
CustomContentDialog(options)
.height(options.height)
.width(options.width)
.constraintSize({ maxWidth: options.maxWidth, maxHeight: options.maxHeight })
.backgroundColor(options.backgroundColor)
.backgroundBlurStyle... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CustomContentDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BaseContentOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ... | @Builder
export function CustomContentDialogBuilder(options: BaseContentOptions) {
CustomContentDialog(options)
.height(options.height)
.width(options.width)
.constraintSize({ maxWidth: options.maxWidth, maxHeight: options.maxHeight })
.backgroundColor(options.backgroundColor)
.backgroundBlurStyle... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L117-L130 | 01de61a337bbc263d1bff024105d845c9de7126b | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/MessageMentions.ets | arkts | get | Getter方法保持TS语法(约束50) | get members(): Collection<Snowflake, GuildMember> | null {
if (this._members) return this._members;
if (!this._guild) return null;
this._members = new Collection();
this.users.forEach(user => {
const member = this._guild!.members.get(user['id']);
if (member) this._members!.set(member['id'], ... | AST#method_declaration#Left get AST#ERROR#Left members AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Collection AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Snowflake AST#primary... | get members(): Collection<Snowflake, GuildMember> | null {
if (this._members) return this._members;
if (!this._guild) return null;
this._members = new Collection();
this.users.forEach(user => {
const member = this._guild!.members.get(user['id']);
if (member) this._members!.set(member['id'], ... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/MessageMentions.ets#L96-L105 | 6c57e92380a025a9e4b6662a1c3c63fb8a479dd0 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | formatDate | 格式化日期为YYYY-MM-DD | formatDate(date: CustomDate): string {
return date.toString();
} | AST#method_declaration#Left formatDate AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left CustomDate AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri... | formatDate(date: CustomDate): string {
return date.toString();
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L450-L452 | 781afbbc6ca0b95e9b5746f0ee94e756f9820973 | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/utils/DateUtils.ets | arkts | 格式化日期时间的函数 | export function formatDateTime(date: Date | number, format: string): string {
// 如果输入的日期是数字,将其转换为日期对象
if (typeof date === 'number') {
date = new Date(date)
}
// 定义日期格式化的参数对象
const o = {
'y+': date.getFullYear(), // 年份
'M+': date.getMonth() + 1, // 月份
'd+': date.getDate(), // 日
'h+': date.... | AST#export_declaration#Left export AST#function_declaration#Left function formatDateTime AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_... | export function formatDateTime(date: Date | number, format: string): string {
if (typeof date === 'number') {
date = new Date(date)
}
const o = {
'y+': date.getFullYear(),
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours() % 12 === 0 ? 12 : date.getHours() % 12,
... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L5-L42 | 061e44f4c930db99511c90e2faa630875eb2829c | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/OrderCount.ets | arkts | readNumber | 读取数值字段
@param {Object} source - 原始对象
@param {string} key - 字段名
@returns {number | null} 数值或空 | private static readNumber(source: Object, key: string): number | null {
const value: string | number | undefined = Reflect.get(source, key) as string | number | undefined;
if (typeof value === "number") {
return value;
}
if (typeof value === "string") {
const parsed: number = Number(value);
... | AST#method_declaration#Left private static readNumber AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left Object 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#prim... | private static readNumber(source: Object, key: string): number | null {
const value: string | number | undefined = Reflect.get(source, key) as string | number | undefined;
if (typeof value === "number") {
return value;
}
if (typeof value === "string") {
const parsed: number = Number(value);
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/OrderCount.ets#L89-L99 | 508ee1a0e0e608afc5ff7577a1216f1286f70568 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/TrendsDetailView.ets | arkts | 后缀图标 | constructor(id: string, des: string | Resource, image: Resource | undefined) {
this.id = id;
this.des = des;
this.image = image;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left des : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string A... | constructor(id: string, des: string | Resource, image: Resource | undefined) {
this.id = id;
this.des = des;
this.image = image;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/TrendsDetailView.ets#L27-L31 | 077195b6e8e0a6a6cd3cbd7028b2e7cf498294b8 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/KvUtil.ets | arkts | get | 获取数据
@param key 获取数据的key
@param defVal 默认值
@returns 获取到的数据 | async get<T>(key: string, defVal: T): Promise<T> {
let isAuth = await this.getAuth();
if (isAuth) {
try {
const value = await this.kvStore?.get(key);
if (value === undefined) {
return defVal;
}
return value as T;
} catch (e) {
return defVal;
}
... | AST#method_declaration#Left async get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , ... | async get<T>(key: string, defVal: T): Promise<T> {
let isAuth = await this.getAuth();
if (isAuth) {
try {
const value = await this.kvStore?.get(key);
if (value === undefined) {
return defVal;
}
return value as T;
} catch (e) {
return defVal;
}
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/KvUtil.ets#L119-L133 | 659bc4b2cd668bc4a1de8a2b1adbfa0799a614a5 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ChartModel.ets | arkts | calcMinMax | Calculates the y-min and y-max value and the y-delta and x-delta value | protected abstract calcMinMax(); | AST#method_declaration#Left protected abstract calcMinMax AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right | protected abstract calcMinMax(); | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L321-L321 | 1732b5d0b034f3e5c67ae2204568b8741a60ebcd | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/PureTabsExt/entry/src/main/ets/view/SwitchTabComponent.ets | arkts | SwitchTabComponent | [Start custom_switch_tab] | @Component
export default struct SwitchTabComponent {
// [StartExclude custom_switch_tab]
@State tabItems: string[] = [];
// [EndExclude custom_switch_tab]
@State currentIndex: number = 0;
private tabController: TabsController = new TabsController();
// [StartExclude custom_switch_tab]
async aboutToAppea... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct SwitchTabComponent AST#component_body#Left { // [StartExclude custom_switch_tab] AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right tabItems : AST#type_annotation#Left AST#primary_typ... | @Component
export default struct SwitchTabComponent {
@State tabItems: string[] = [];
@State currentIndex: number = 0;
private tabController: TabsController = new TabsController();
async aboutToAppear(): Promise<void> {
this.updateTabItems();
this.subscribeSystemLanguageUpdate();
}
privat... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/view/SwitchTabComponent.ets#L20-L116 | 0f4f3571d818e3b4123a8e4bb2d005b395acf770 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationManager.ets | arkts | 通知类型枚举 | export enum NotificationType {
BIRTHDAY_TODAY = 'birthday_today',
BIRTHDAY_TOMORROW = 'birthday_tomorrow',
BIRTHDAY_WEEK = 'birthday_week',
ANNIVERSARY_TODAY = 'anniversary_today',
SYSTEM_REMINDER = 'system_reminder',
SMART_SUGGESTION = 'smart_suggestion'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum NotificationType AST#enum_body#Left { AST#enum_member#Left BIRTHDAY_TODAY = AST#expression#Left 'birthday_today' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left BIRTHDAY_TOMORROW = AST#expression#Left 'birthday_tomorrow' AST#expression#... | export enum NotificationType {
BIRTHDAY_TODAY = 'birthday_today',
BIRTHDAY_TOMORROW = 'birthday_tomorrow',
BIRTHDAY_WEEK = 'birthday_week',
ANNIVERSARY_TODAY = 'anniversary_today',
SYSTEM_REMINDER = 'system_reminder',
SMART_SUGGESTION = 'smart_suggestion'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L19-L26 | f958902d65448185ada0ece900e1a170aa67b8c5 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/DateUtil.ets | arkts | formatDate | 将传入的日期字符串按照传入的format进行格式化输出,不传默认为yyyy-MM-dd,日期格式化年月日时分秒为y-M-d H:m:s
@param value
@param format 格式化字符串
@returns | static formatDate(value: string, format: string = 'yyyy-MM-dd'): string {
const date = new Date(value);
if (value.split(' ').length <= 1 && value.split('T').length <= 1) {
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
}
const year = date.getFullYear();
const month = Dat... | AST#method_declaration#Left static formatDate AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static formatDate(value: string, format: string = 'yyyy-MM-dd'): string {
const date = new Date(value);
if (value.split(' ').length <= 1 && value.split('T').length <= 1) {
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
}
const year = date.getFullYear();
const month = Dat... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/DateUtil.ets#L40-L60 | e22e71cf90d4a178d1f45a1f996a40d4e7d94b85 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Alarm/PermissionManager.ets | arkts | checkPermission | 检查单个权限授权状态(异步方法)
@param permission 要检查的权限名
@returns Promise对象,解析为是否已授权 | static async checkPermission(permission: Permissions): Promise<boolean> {
try {
const tokenId = PermissionManager.getAccessTokenIdSync(); // 获取令牌ID
const atMgr = PermissionManager.getAtManager(); // 获取管理器
// 检查权限状态(类似Swift的AVAuthorizationStatus)
const status = await atMgr.checkAccessToken(to... | AST#method_declaration#Left static async checkPermission AST#parameter_list#Left ( AST#parameter#Left permission : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left A... | static async checkPermission(permission: Permissions): Promise<boolean> {
try {
const tokenId = PermissionManager.getAccessTokenIdSync();
const atMgr = PermissionManager.getAtManager();
const status = await atMgr.checkAccessToken(tokenId, permission);
return status === abilityAccess... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/PermissionManager.ets#L74-L85 | 267f5c0fe5a3ec9a496f8dc0ac987b8200126d19 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.prompt.d.ets | arkts | Defines the option of ShowActionMenu.
@interface ShowActionMenuOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 6
Defines the option of ShowActionMenu.
@interface ShowActionMenuOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export interface ShowActionMenuOptions {
/**
* Title of the text to display.
*
* @type { ?string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
/**
* Title of the text to display.
*
* @type { ?string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @s... | AST#export_declaration#Left export AST#interface_declaration#Left interface ShowActionMenuOptions AST#object_type#Left { /**
* Title of the text to display.
*
* @type { ?string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/ /**
* Title of the text to display.
*
* @type { ?string ... | export interface ShowActionMenuOptions {
title?: string;
buttons: [Button, Button | undefined, Button | undefined, Button | undefined, Button | undefined, Button | undefined];
success?: (tapIndex: number, errMsg: string) => void;
fail?: (errMsg: string) => void;
complete?: ()... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.prompt.d.ets#L287-L376 | 9e9ca4a5a08488ddf7d4c073697db9cb78c1cd99 | gitee | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/array_lib_func_001_T.ets | arkts | Introduction 库函数-array_toString | export function array_lib_func_001_T(taint_src : string) {
let arr : string[] = [taint_src,"a","b"];
let t = arr.toString();
taint.Sink(t);
} | AST#export_declaration#Left export AST#function_declaration#Left function array_lib_func_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function array_lib_func_001_T(taint_src : string) {
let arr : string[] = [taint_src,"a","b"];
let t = arr.toString();
taint.Sink(t);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/array_lib_func_001_T.ets#L6-L10 | 3cc2110ba5aa0bda370b7c4682a2c475fe478b54 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | couldReset | Current image whether can reset.
@returns true means can reset, false means not. | couldReset(): boolean {
let crop = this.cropShow.getCropRect();
MathUtils.roundOutRect(crop);
let image = this.cropShow.getImageRect();
MathUtils.roundOutRect(image);
if (
this.isFlipHorizontal !== false ||
this.isFlipVertically !== false ||
this.rotationAngle !== 0 || this.sli... | AST#method_declaration#Left couldReset 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#variable_declaration#Left let AST#variable_declarator#Left crop = AST#ex... | couldReset(): boolean {
let crop = this.cropShow.getCropRect();
MathUtils.roundOutRect(crop);
let image = this.cropShow.getImageRect();
MathUtils.roundOutRect(image);
if (
this.isFlipHorizontal !== false ||
this.isFlipVertically !== false ||
this.rotationAngle !== 0 || this.sli... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L343-L358 | 49c1eb544e53364b589a32237633689589bb0878 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/HillCipher.ets | arkts | modInverse | 计算模26下的乘法逆元
@param a 要计算逆元的数
@returns 逆元,如果不存在则返回null | private static modInverse(a: number): number | null {
a = ((a % HillCipher.MOD) + HillCipher.MOD) % HillCipher.MOD;
for (let x = 1; x < HillCipher.MOD; x++) {
if ((a * x) % HillCipher.MOD === 1) {
return x;
}
}
return null;
} | AST#method_declaration#Left private static modInverse AST#parameter_list#Left ( AST#parameter#Left a : 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#union_type#Left AST#primary_type#Lef... | private static modInverse(a: number): number | null {
a = ((a % HillCipher.MOD) + HillCipher.MOD) % HillCipher.MOD;
for (let x = 1; x < HillCipher.MOD; x++) {
if ((a * x) % HillCipher.MOD === 1) {
return x;
}
}
return null;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/HillCipher.ets#L23-L31 | 288f243c22968eb79bdbf56a26def2707244f402 | github |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | common/src/main/ets/util/DeviceUtils.ets | arkts | 获取系统语言
@return 系统语言 | export function getSystemLanguage(): string {
let language = i18n.getSystemLanguage();
if (language == 'zh-Hans') {
language = 'zh-cn';
} else {
language = 'en-us';
}
return language;
} | AST#export_declaration#Left export AST#function_declaration#Left function getSystemLanguage 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... | export function getSystemLanguage(): string {
let language = i18n.getSystemLanguage();
if (language == 'zh-Hans') {
language = 'zh-cn';
} else {
language = 'en-us';
}
return language;
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/util/DeviceUtils.ets#L48-L56 | 5c1335d54f06580f5bb5a0b620f6ba803c53c1ea | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index.ets | arkts | search_history_label_link | Searches in the index_map and return eligible history of label-links
@param key the keywords, for example "huawei developers harmony"
@returns string[][] of label-links | static search_history_label_link(key: string, max?: number) {
let history_index_saving = AppStorage.get('history_index_saving') as boolean | undefined;
let history_index_loading = AppStorage.get('history_index_loading') as boolean | undefined;
let reindexing = AppStorage.get('reindexing_history') as boolean... | AST#method_declaration#Left static search_history_label_link AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max ? : AST#type_annotation#Left AST#primary_type#Left number AS... | static search_history_label_link(key: string, max?: number) {
let history_index_saving = AppStorage.get('history_index_saving') as boolean | undefined;
let history_index_loading = AppStorage.get('history_index_loading') as boolean | undefined;
let reindexing = AppStorage.get('reindexing_history') as boolean... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index.ets#L33-L57 | d161a5af6b42a89d2c8596f2e3944e26182d42b0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/constant/Constants.ets | arkts | 常量 | export default class Constants {
// 月份数组
public static readonly MONTHS: string[] =
["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"];
// 星期
public static readonly WEEKS: string[] = ["日", "一", "二", "三", "四", "五", "六"];
// 农历月份的中文表示
public static readonly CHINESE_MONTH: string[] ... | AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // 月份数组 AST#property_declaration#Left public static readonly MONTHS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#... | export default class Constants {
public static readonly MONTHS: string[] =
["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"];
public static readonly WEEKS: string[] = ["日", "一", "二", "三", "四", "五", "六"];
public static readonly CHINESE_MONTH: string[] =
['正', '二', '三', '四... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/constant/Constants.ets#L19-L104 | 27d917b1da48c0ee01a67f7fdc7f696086780549 | gitee | |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | frameworks/text/interface/export/ani/@ohos.graphics.text.ets | arkts | Describes rect style of text.
@typedef RectStyle
@syscap SystemCapability.Graphics.Drawing
@since 12 | export interface RectStyle {
/**
* The color of rect style.
* @type { common2D.Color } The color of rect style
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
color: common2D.Color;
/**
* Radius in left top of rect style.
* @type { number } it is double type da... | AST#export_declaration#Left export AST#interface_declaration#Left interface RectStyle AST#object_type#Left { /**
* The color of rect style.
* @type { common2D.Color } The color of rect style
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/ AST#type_member#Left color : AST#type_annotat... | export interface RectStyle {
color: common2D.Color;
leftTopRadius: number;
rightTopRadius: number;
rightBottomRadius: number;
leftBottomRadius: number;
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/frameworks/text/interface/export/ani/@ohos.graphics.text.ets#L1389-L1429 | ab2daba16eb453a905b171351f7e55a3e3d56e2f | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/properties/componentIDSample/ComponentIDSample.ets | arkts | getComponentRect | 获取组件所占矩形区域坐标 | static getComponentRect(key: string) {
let strJson = getInspectorByKey(key);
let obj: Record<string, Object> = JSON.parse(strJson);
let rectInfo: Array<string> = JSON.parse('[' + obj.$rect + ']');
Utils.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0];
Utils.rect_top = JSON.parse('[' + rectInfo[0]... | AST#method_declaration#Left static getComponentRect AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declarat... | static getComponentRect(key: string) {
let strJson = getInspectorByKey(key);
let obj: Record<string, Object> = JSON.parse(strJson);
let rectInfo: Array<string> = JSON.parse('[' + obj.$rect + ']');
Utils.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0];
Utils.rect_top = JSON.parse('[' + rectInfo[0]... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/properties/componentIDSample/ComponentIDSample.ets#L42-L53 | 4108ec6c51e8a003a8549cc1ac04464693ab635b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocreategif/src/main/ets/components/SelectGifTimeFrameView.ets | arkts | setStateChangeCallback | 设置播放状态机AVPlayerState切换的事件
@returns | async setStateChangeCallback(): Promise<void> {
if (this.avPlayer) {
this.avPlayer?.on('stateChange', async (state, reason) => {
switch (state) {
case 'idle':
logger.info('state idle called');
break;
case 'initialized':
logger.info('state initia... | AST#method_declaration#Left async setStateChangeCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : 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_annota... | async setStateChangeCallback(): Promise<void> {
if (this.avPlayer) {
this.avPlayer?.on('stateChange', async (state, reason) => {
switch (state) {
case 'idle':
logger.info('state idle called');
break;
case 'initialized':
logger.info('state initia... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/SelectGifTimeFrameView.ets#L143-L158 | 9a2bf75ca5bad6e2b8aea7c99270808f760d93c6 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | customConfig2 | 统一配置二 | customConfig2() {
DialogHelper.setDefaultConfig((config) => {
config.autoCancel = false; //点击遮障层时,是否关闭弹窗,true表示关闭弹窗。
config.backCancel = false; //点击返回键或手势返回时,是否关闭弹窗;实现onWillDismiss函数时,该参数不起作用。
config.actionCancel = true; //点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。
config.alignment = DialogAlignment.Botto... | AST#method_declaration#Left customConfig2 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 DialogHelper AST#expression#Right . setDefaultConf... | customConfig2() {
DialogHelper.setDefaultConfig((config) => {
config.autoCancel = false;
config.backCancel = false;
config.actionCancel = true;
config.alignment = DialogAlignment.Bottom;
config.offset = { dx: 0, dy: -35 };
config.maskColor = 0x11000000;
config.backgro... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L105-L142 | 1f4fe2f40593e1fd371d44b953dea24b44f1abd5 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets | arkts | getPreference | Get preference data. | async getPreference() {
let fruit = '';
if (!preference) {
await this.getPreferencesFromStorage();
}
try {
fruit = (await preference.get(CommonConstants.KEY_NAME, '')).toString();
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to get value, Cause: ${err}`);
}
// ... | AST#method_declaration#Left async getPreference AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fruit = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#R... | async getPreference() {
let fruit = '';
if (!preference) {
await this.getPreferencesFromStorage();
}
try {
fruit = (await preference.get(CommonConstants.KEY_NAME, '')).toString();
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to get value, Cause: ${err}`);
}
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L80-L97 | 7b946a3451e3d84b6e63f624a468fec94a30923f | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/StateManager.ets | arkts | 状态--解压中
@since 2022-06-10 | export class Installing extends BaseState {
constructor() {
super();
this.actionSet.push(UpdateAction.SHOW_NEW_VERSION);
this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW);
this.checkAbStreamInstall();
}
async checkAbStreamInstall() {
let isABStreamInstall = await VersionUtils.isABStreamInst... | AST#export_declaration#Left export AST#class_declaration#Left class Installing extends AST#type_annotation#Left AST#primary_type#Left BaseState AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#blo... | export class Installing extends BaseState {
constructor() {
super();
this.actionSet.push(UpdateAction.SHOW_NEW_VERSION);
this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW);
this.checkAbStreamInstall();
}
async checkAbStreamInstall() {
let isABStreamInstall = await VersionUtils.isABStreamInst... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L493-L525 | df9949145874601b503690c135a22a86eb33e252 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DataPreferencesUtils.ets | arkts | initPreferences | 初始化preferences实例 | initPreferences() {
this.preferences = dataPreferences.getPreferencesSync(context, { name: this.preferencesName });
} | AST#method_declaration#Left initPreferences 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 . preferences AST#member_expression#... | initPreferences() {
this.preferences = dataPreferences.getPreferencesSync(context, { name: this.preferencesName });
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DataPreferencesUtils.ets#L13-L15 | f120e9830dffc6355089690603d8aa0fd2c62a18 | github |
seasonZhu/HarmonyStudy.git | b55e58c962e9b39d5211337590bdd45f2c2349b3 | entry/src/main/ets/router/PagesConstant.ets | arkts | / 需要再当前工程下resources/base/profile/main_pages.json中进行注册才能正常路由,目前已经支持自动注册 | export abstract class PagesConstant {
public static Splash = "pages/Splash"
public static Index = "pages/Index"
public static Login = "pages/Login"
public static Register = "pages/Register"
public static MyCoin = "pages/MyCoin"
public static Rank = "pages/Rank"
public static SearchResult = "pages/SearchRe... | AST#export_declaration#Left export AST#class_declaration#Left abstract class PagesConstant AST#class_body#Left { AST#property_declaration#Left public static Splash = AST#expression#Left "pages/Splash" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left public static Index = AST#expression... | export abstract class PagesConstant {
public static Splash = "pages/Splash"
public static Index = "pages/Index"
public static Login = "pages/Login"
public static Register = "pages/Register"
public static MyCoin = "pages/MyCoin"
public static Rank = "pages/Rank"
public static SearchResult = "pages/SearchRe... | https://github.com/seasonZhu/HarmonyStudy.git/blob/b55e58c962e9b39d5211337590bdd45f2c2349b3/entry/src/main/ets/router/PagesConstant.ets#L3-L19 | 6eb538677314a8d2cb259199d59ee59eb2553d24 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSA.ets | arkts | decodePKCS1Segment | 解密-分段
@param decodeStr 待解密的字符串
@param priKey RSA私钥 | static async decodePKCS1Segment(str: string, priKey: string): Promise<string> {
return CryptoUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | AST#method_declaration#Left static async decodePKCS1Segment 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 priKey : AST#type_annotation#Left AST#primary_type#Left string AS... | static async decodePKCS1Segment(str: string, priKey: string): Promise<string> {
return CryptoUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L96-L98 | 6bcda3555a9913edd802a3dad9933e5db19be4cd | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isUint32Array | 检查是否为Uint32Array数组类型。
@param value
@returns | static isUint32Array(value: Object): boolean {
return new util.types().isUint32Array(value);
} | AST#method_declaration#Left static isUint32Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | static isUint32Array(value: Object): boolean {
return new util.types().isUint32Array(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L191-L193 | 733a2817752f2f6efc69f36fecf201d26669eb23 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/AudioPlayer/entry/src/main/ets/common/utils/CommonUtil.ets | arkts | formatDuration | Convert milliseconds to component second format.
@param ms Milliseconds.
@returns | public static formatDuration(ms: number): string {
if (ms < 0) {
ms = 0;
}
const secondPrecision = CommonConstants.SECOND_PRECISION;
const secondDuration = ms / CommonConstants.SECOND_TO_MS;
let min = Math.floor(secondDuration / CommonConstants.MIN_TO_SEC);
let sec = Math.round(secondDurat... | AST#method_declaration#Left public static formatDuration AST#parameter_list#Left ( AST#parameter#Left ms : 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 string AST#pri... | public static formatDuration(ms: number): string {
if (ms < 0) {
ms = 0;
}
const secondPrecision = CommonConstants.SECOND_PRECISION;
const secondDuration = ms / CommonConstants.SECOND_TO_MS;
let min = Math.floor(secondDuration / CommonConstants.MIN_TO_SEC);
let sec = Math.round(secondDurat... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/CommonUtil.ets#L28-L41 | 3bf85109c8bc1c6d1cb0103e135c7e58828a9cac | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | fetchDreamDetail | 获取梦想详情信息 | private async fetchDreamDetail(dreamId: number) {
try {
this.isLoading = true;
console.info(`获取梦想详情,ID: ${dreamId}`);
const dreamDetail: Dream = await ApiService.getDreamById(dreamId);
console.info(`获取到梦想详情: ${JSON.stringify(dreamDetail)}`);
// 将后端返回的数据填充到表单
this.dream = d... | AST#method_declaration#Left private async fetchDreamDetail AST#parameter_list#Left ( AST#parameter#Left dreamId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_st... | private async fetchDreamDetail(dreamId: number) {
try {
this.isLoading = true;
console.info(`获取梦想详情,ID: ${dreamId}`);
const dreamDetail: Dream = await ApiService.getDreamById(dreamId);
console.info(`获取到梦想详情: ${JSON.stringify(dreamDetail)}`);
this.dream = dreamDetail;
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L399-L442 | eda607c9e8e180a1035eaef46d7c42167d1439b7 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets | arkts | addTableColumn | 上层接口 向表格中添加一行属性 调用 addTableColumnSql 生成 sql 语句, executeSql 执行 | addTableColumn(tableName: string, column: ColumnInfo): Promise<void> {
let addTableColumnSql = tableHelper.addTableColumnSql(tableName, column);
return this.executeSql(addTableColumnSql);
} | AST#method_declaration#Left addTableColumn AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left column : AST#type_annotation#Left AST#primary_type#Left ColumnInfo AST#prima... | addTableColumn(tableName: string, column: ColumnInfo): Promise<void> {
let addTableColumnSql = tableHelper.addTableColumnSql(tableName, column);
return this.executeSql(addTableColumnSql);
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets#L57-L60 | 27807275dd6ea655c6664c350861e1d6d81f7d2e | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/cache/CacheUtil.ets | arkts | 存值
@param key 存入key
@param value 存入数据 | export function save<T>(key: string, value: T): void {
cache[key] = value as Object;
} | AST#export_declaration#Left export AST#function_declaration#Left function save AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#typ... | export function save<T>(key: string, value: T): void {
cache[key] = value as Object;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/cache/CacheUtil.ets#L36-L38 | 2c3267abc806cf6e94e791cbfe7cc8b73b6baa4e | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | maskColor | 弹窗背景遮罩颜色
@param maskColor 不设置获取config默认
@returns | maskColor(maskColor: ResourceColor) {
this.builderOptions.maskColor = maskColor;
return this;
} | AST#method_declaration#Left maskColor AST#parameter_list#Left ( AST#parameter#Left maskColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_stateme... | maskColor(maskColor: ResourceColor) {
this.builderOptions.maskColor = maskColor;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L131-L134 | f73d19056b5862ffa8ba134bf24f4ea7429a6ae3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PermissionUtil.ets | arkts | requestGlobalSwitch | 用于UIAbility/UIExtensionAbility拉起全局开关设置弹框。部分情况下,录音、拍照等功能禁用,应用可拉起此弹框请求用户同意开启对应功能。如果当前全局开关的状态为开启,则不拉起弹框
@param type 全局开关类型。
@returns | static async requestGlobalSwitch(type: abilityAccessCtrl.SwitchType): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = AppUtil.getContext();
return await atManager.requestGlobalSwitch(context, type);
} | AST#method_declaration#Left static async requestGlobalSwitch AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left abilityAccessCtrl . SwitchType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param... | static async requestGlobalSwitch(type: abilityAccessCtrl.SwitchType): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = AppUtil.getContext();
return await atManager.requestGlobalSwitch(context, type);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L136-L140 | cc86fbecdd5effff1762d1f9aeeee146852e3386 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/FileUtils.ets | arkts | getDownloadUri | 获取当前应用的Download目录下当前应用包名对应的Uri
@param relativePath 文件路径;相对路径(wps/doc);传空字符串表示根目录
@param fileName 不传或传空 返回当前应用的Download文件夹uri | static getDownloadUri(relativePath: string | undefined = undefined, fileName?: string): string {
const downloadPath = FileUtils.getDownloadPath(relativePath, fileName);
//'file://docs/storage/Users/currentUser/Download/' + bundleName
let downloadUri = FileUtils.getUriFromPath(downloadPath);
return downl... | AST#method_declaration#Left static getDownloadUri AST#parameter_list#Left ( AST#parameter#Left relativePath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#exp... | static getDownloadUri(relativePath: string | undefined = undefined, fileName?: string): string {
const downloadPath = FileUtils.getDownloadPath(relativePath, fileName);
let downloadUri = FileUtils.getUriFromPath(downloadPath);
return downloadUri;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L121-L126 | 174b2848fd7f14f2fe66f83e2231b16ebb53f48c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/components/MusicPlayerInfoComp.ets | arkts | MusicPlayerInfoComp | 播放器歌曲信息组件,包括歌名、歌手、歌曲封面、歌词
实现步骤:
1.组件创建时,根据当前折叠屏状态和横竖屏状态初始化组件树上各组件属性
2.通过父组件监听屏幕折叠态变更事件,同时通过单项绑定通知到此组件的状态变量,修改组件树上各组件属性
3.通过媒体查询监听横竖屏变更,修改组件树上各组件属性
4.通过配置属性动画,动态变更各组件样式 | @Component
export struct MusicPlayerInfoComp {
// 父组件单向绑定的屏幕状态
@Prop @Watch('updateWithFoldStatus') curFoldStatus: display.FoldStatus;
// 通知Navigation组件隐藏导航栏
@Consume('isFullScreen') isFullScreen: boolean;
// 当前页面的vm实例
@Consume('musicPlayerViewModel') @Watch('onViewModelChanged') viewModel: MusicPlayerViewM... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MusicPlayerInfoComp AST#ERROR#Left { // 父组件单向绑定的屏幕状态 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateWithFoldStatus' AST#expression#R... | @Component
export struct MusicPlayerInfoComp {
@Prop @Watch('updateWithFoldStatus') curFoldStatus: display.FoldStatus;
@Consume('isFullScreen') isFullScreen: boolean;
@Consume('musicPlayerViewModel') @Watch('onViewModelChanged') viewModel: MusicPlayerViewModel;
private lyricsScrollerCtrl: Scroller =... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/components/MusicPlayerInfoComp.ets#L31-L87 | ab58617d4366c7d4c1b59481c6a5e20abe2c7597 | gitee |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | ‘56%’ | export const THOUSANDTH_800: string = '80%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_800 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '80%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const THOUSANDTH_800: string = '80%'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L58-L58 | c78904866cc1a7c5201d0fd55c7153b7881cf460 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets | arkts | pushData | 存储数据到懒加载数据源中 | pushData(data: MemoInfo): void {
this.memoData.push(data);
// 在数组头部添加数据
this.notifyDataAdd(this.memoData.length - 1);
} | AST#method_declaration#Left pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left MemoInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AS... | pushData(data: MemoInfo): void {
this.memoData.push(data);
this.notifyDataAdd(this.memoData.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets#L99-L103 | b27b4eb01e17d1172ad4b7e95077827182c36fd7 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/select/selectLevel5.ets | arkts | SelectLevel5Builder | 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 SelectLevel5Builder(name: string, param: Object) {
SelectLevel5Example()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SelectLevel5Builder 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 SelectLevel5Builder(name: string, param: Object) {
SelectLevel5Example()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/select/selectLevel5.ets#L16-L19 | 9abad7b5cefd6565d24d4c02c9a3210a3b382836 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Piece.ets | arkts | get | MARK: - Getter 方法
获取piece编号 | get pieceNo(): number {
return this._pieceNo;
} | AST#method_declaration#Left get AST#ERROR#Left pieceNo AST#ERROR#Right 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#expressi... | get pieceNo(): number {
return this._pieceNo;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Piece.ets#L25-L27 | b5430332b7f7ae4c2c64ebaf7712f2269117c44d | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | isThisWeek | 判断是否为本周 | private isThisWeek(date: Date): boolean {
const now = new Date();
const startOfWeek = new Date(now);
startOfWeek.setDate(now.getDate() - now.getDay());
startOfWeek.setHours(0, 0, 0, 0);
return date >= startOfWeek;
} | AST#method_declaration#Left private isThisWeek AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | private isThisWeek(date: Date): boolean {
const now = new Date();
const startOfWeek = new Date(now);
startOfWeek.setDate(now.getDate() - now.getDay());
startOfWeek.setHours(0, 0, 0, 0);
return date >= startOfWeek;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L629-L636 | 14fa1a882a40d1e2ca5c1e9d84a4215557ab1d15 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/src/main/ets/components/ItemGroup.ets | arkts | ItemGroup | Copyright (c) 2021-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,... | @Component
export struct ItemGroup {
@BuilderParam noParam: () => void
build() {
Column() {
this.noParam()
}
.width('100%')
.borderRadius(24)
.backgroundColor($r('sys.color.ohos_id_color_foreground_contrary'))
.padding(4)
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ItemGroup AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right noParam : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#paramet... | @Component
export struct ItemGroup {
@BuilderParam noParam: () => void
build() {
Column() {
this.noParam()
}
.width('100%')
.borderRadius(24)
.backgroundColor($r('sys.color.ohos_id_color_foreground_contrary'))
.padding(4)
}
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/src/main/ets/components/ItemGroup.ets#L16-L29 | d1ffc3fa81c3b2412a7cb316d70cdd3dc6508049 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/AVPlayer/AVPlayerArkTSStreamingMedia/entry/src/main/ets/pages/Index.ets | arkts | changeBitrate | HLS切换码率 | changeBitrate(bitrate: number) {
if (this.avPlayer == null) {
return;
}
// 设置播放码率
try {
this.avPlayer.setBitrate(bitrate);
} catch (error) {
console.error(`${this.tag}: setBitrate failed, error message is = ${JSON.stringify(error.message)}`);
}
} | AST#method_declaration#Left changeBitrate AST#parameter_list#Left ( AST#parameter#Left bitrate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( ... | changeBitrate(bitrate: number) {
if (this.avPlayer == null) {
return;
}
try {
this.avPlayer.setBitrate(bitrate);
} catch (error) {
console.error(`${this.tag}: setBitrate failed, error message is = ${JSON.stringify(error.message)}`);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVPlayer/AVPlayerArkTSStreamingMedia/entry/src/main/ets/pages/Index.ets#L173-L183 | 57b27dfc487f43a3862fae2fbd8238d4063403a6 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | JSCrash/entry/src/main/ets/pages/utils.ets | arkts | [End TestJSErrorUtils] | export class Log {
/**
* Outputs info-level logs.
*
* @param tag Identifies the log tag.
* @param format Indicates the log format string.
* @param args Indicates the log parameters.
* @since 7
*/
static showInfo(tag: string): void {
if (Log.isLoggable(tag, hilog.LogLevel.INFO)) {
hilo... | AST#export_declaration#Left export AST#class_declaration#Left class Log AST#class_body#Left { /**
* Outputs info-level logs.
*
* @param tag Identifies the log tag.
* @param format Indicates the log format string.
* @param args Indicates the log parameters.
* @since 7
*/ AST#method_declaration#Left ... | export class Log {
static showInfo(tag: string): void {
if (Log.isLoggable(tag, hilog.LogLevel.INFO)) {
hilog.info(DOMAIN, TAG, tag + SYMBOL);
}
}
static showDebug(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.DEBUG)) {
hilog.debug(DO... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L13-L94 | ddeb300cf9394bff1f215c575ba00b42a04b322d | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderLogisticsPage.ets | arkts | LogisticsNumberValue | 物流编号展示区域
@param {Logistics} logistics - 物流信息
@returns {void} 无返回值 | @Builder
private LogisticsNumberValue(logistics: Logistics): void {
RowStartCenter() {
Text(logistics.number ?? $r("app.string.none"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_secondary"));
SpaceHorizontalSmall();
Text($r("app.string.copy"))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private LogisticsNumberValue AST#parameter_list#Left ( AST#parameter#Left logistics : AST#type_annotation#Left AST#primary_type#Left Logistics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AS... | @Builder
private LogisticsNumberValue(logistics: Logistics): void {
RowStartCenter() {
Text(logistics.number ?? $r("app.string.none"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_secondary"));
SpaceHorizontalSmall();
Text($r("app.string.copy"))
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L186-L201 | d52625878d813094a9e08bd2532dd7e6eb30c48a | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIAssistantService.ets | arkts | sendMessage | 发送消息并获取AI响应 | async sendMessage(message: string, sessionId?: string): Promise<AIResponse> {
try {
const currentSessionId = sessionId || this.currentSessionId;
const context = this.conversations.get(currentSessionId);
if (!context) {
throw new Error('会话不存在');
}
// 创建用户消息
const u... | AST#method_declaration#Left async sendMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sessionId ? : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | async sendMessage(message: string, sessionId?: string): Promise<AIResponse> {
try {
const currentSessionId = sessionId || this.currentSessionId;
const context = this.conversations.get(currentSessionId);
if (!context) {
throw new Error('会话不存在');
}
const userMessag... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L352-L425 | 817e0542d9bc1fa97cf7a2ece9a1f582e613a140 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.