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/sharebutton/src/main/ets/components/ShareButton.ets | arkts | refreshUrl | 如果url发生了变化,需要重新生成 | async refreshUrl() {
console.debug("share url changed")
// 二维码建议最小大小为400,不然可能会扫描不出。
this.imageBarCode = await createBarcode(this.url, 400);
if (this.imageBackground && this.imageBarCode) {
this.generatedImage = mixPixels(this.imageBackground, this.imageBarCode);
await saveImgToFile(this.gene... | AST#method_declaration#Left async refreshUrl 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 console AST#expression#Right . debug AST#member... | async refreshUrl() {
console.debug("share url changed")
this.imageBarCode = await createBarcode(this.url, 400);
if (this.imageBackground && this.imageBarCode) {
this.generatedImage = mixPixels(this.imageBackground, this.imageBarCode);
await saveImgToFile(this.generatedImage, this.imagePath)... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets#L135-L144 | 673b2816238690ba1a1bfdadeca607fa08828197 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/viewmodel/NavigationViewModel.ets | arkts | @file 导航页面 ViewModel
@author Joker.X | @ObservedV2
export default class NavigationViewModel extends BaseViewModel {
/**
* 结果回传标题
*/
@Trace
resultTitle: string = "";
/**
* 结果回传说明
*/
@Trace
resultDescription: string = "";
/**
* 是否存在结果回传
*/
@Trace
hasResult: boolean = false;
/**
* 导航模块卡片数据
*/
@Trace
readonly card... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class NavigationViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 结果回传标题
*/ ... | @ObservedV2
export default class NavigationViewModel extends BaseViewModel {
@Trace
resultTitle: string = "";
@Trace
resultDescription: string = "";
@Trace
hasResult: boolean = false;
@Trace
readonly cards: NavigationCardItem[] = [
{
title: $r("app.string.main_navigation_with_args_... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/NavigationViewModel.ets#L9-L100 | 9e8ede355e6cd1fada5ac24b0cb3c3d61a2742b4 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | clearUpApplicationData | 清理应用本身的数据,同时撤销应用向用户申请的权限。使用Promise异步回调。仅支持主线程调用。 | static async clearUpApplicationData(): Promise<void> {
return AppUtil.getContext().getApplicationContext().clearUpApplicationData();
} | AST#method_declaration#Left static async clearUpApplicationData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Rig... | static async clearUpApplicationData(): Promise<void> {
return AppUtil.getContext().getApplicationContext().clearUpApplicationData();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L210-L212 | 8f5cecee9bfd736c2f6bef107e779d5eb6bb39dd | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BarChartModel.ets | arkts | setDrawBarShadow | If set to true, a grey area is drawn behind each bar that indicates the maximum value. Enabling his will reduce
performance by about 50%.
@param enabled | public setDrawBarShadow(enabled: boolean): void {
this.mDrawBarShadow = enabled;
} | AST#method_declaration#Left public setDrawBarShadow 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#type_annotation#Left AST#primary_type#Left void AST#prim... | public setDrawBarShadow(enabled: boolean): void {
this.mDrawBarShadow = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L222-L224 | 06b573b2d1a6a66791c7e8baeb703187572af9dd | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.MultiNavigation.d.ets | arkts | Splitpolicy indicates the policy of pages pushed to the stack.
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 14 | export declare enum SplitPolicy {
/**
* Indicates that the page will be pushed to the stack as home page.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
HOME_PAGE = 0,
/**
* Indicates that the page will be pushed to the stack as detail page.... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum SplitPolicy AST#enum_body#Left { /**
* Indicates that the page will be pushed to the stack as home page.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
... | export declare enum SplitPolicy {
HOME_PAGE = 0,
DETAIL_PAGE = 1,
FULL_PAGE = 2,
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.MultiNavigation.d.ets#L32-L62 | a135347c85d61c45353feacb3ce39927e7169364 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderConfirmPage.ets | arkts | DiscountPriceValue | 折扣价格值(负数显示)
@param {number} price 价格(单位:分)
@returns {void} 无返回值 | @Builder
private DiscountPriceValue(price: number) {
IBestPrice({
value: -price,
integerFontSize: 14,
decimalFontSize: 12,
symbolFontSize: 12,
color: $r("app.color.danger")
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private DiscountPriceValue AST#parameter_list#Left ( AST#parameter#Left price : 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#builder_f... | @Builder
private DiscountPriceValue(price: number) {
IBestPrice({
value: -price,
integerFontSize: 14,
decimalFontSize: 12,
symbolFontSize: 12,
color: $r("app.color.danger")
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderConfirmPage.ets#L215-L224 | 1e08ba048603022eb6a8ba31d405755cfac4959f | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogBuilder.ets | arkts | ToastIconBuilder | Toast带图标弹窗view | @Builder
export function ToastIconBuilder(options: IToastIconOptions) {
ToastIconView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToastIconBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IToastIconOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param... | @Builder
export function ToastIconBuilder(options: IToastIconOptions) {
ToastIconView({ options: options });
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L293-L296 | 8c166b6e0f3885aecab982095f36134b0f200b73 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/lazyForEach.d.ets | arkts | declare UILazyForEachAttribute
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface UILazyForEachAttribute {} | AST#export_declaration#Left export AST#interface_declaration#Left interface UILazyForEachAttribute AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface UILazyForEachAttribute {} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L632-L632 | 83e402f4637b9086e5640bfc9834c6fe61969ec6 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | strToHex | 16进制字符串转换unit8Array
@param hexStr
@returns | static strToHex(hexStr: string): Uint8Array {
return new Uint8Array(buffer.from(hexStr, 'hex').buffer);
} | AST#method_declaration#Left static strToHex AST#parameter_list#Left ( AST#parameter#Left hexStr : 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 Uint8Array AST#primary_... | static strToHex(hexStr: string): Uint8Array {
return new Uint8Array(buffer.from(hexStr, 'hex').buffer);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L265-L267 | d4791ace2b4b7f0c0b6b92bf971d8eb1792ba866 | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/textInput/TextInputController.ets | arkts | 文本绘制控制器 | export class TextInputController {
private touchDownInfo?: TouchDownInfo;
private color: string = '#DB2904';
private controller: TextEditNodeController;
private currentParentScale: number = 1;
private nodeContainerHeight: number = 1;
private nodeContainerWidth: number = 1;
private onAddTextArea: (data: Te... | AST#export_declaration#Left export AST#class_declaration#Left class TextInputController AST#class_body#Left { AST#property_declaration#Left private touchDownInfo ? : AST#type_annotation#Left AST#primary_type#Left TouchDownInfo AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#propert... | export class TextInputController {
private touchDownInfo?: TouchDownInfo;
private color: string = '#DB2904';
private controller: TextEditNodeController;
private currentParentScale: number = 1;
private nodeContainerHeight: number = 1;
private nodeContainerWidth: number = 1;
private onAddTextArea: (data: Te... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextInputController.ets#L51-L152 | a09aad96d3fb093146c1a34bde783ee330c54a91 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语要求接口 | export interface GreetingRequirements {
length: number;
includeEmoji: boolean;
language: string;
tone: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingRequirements AST#object_type#Left { AST#type_member#Left length : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left includeEmoji : AST#typ... | export interface GreetingRequirements {
length: number;
includeEmoji: boolean;
language: string;
tone: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L21-L26 | 30bee4f91effb17871ce12fdd9e3b1a7872f7419 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/ReadMessageRequest.ets | arkts | @file 已读消息请求模型
@author Joker.X | export class ReadMessageRequest {
/**
* 消息ID数组,用于批量已读
*/
ids: number[];
/**
* @param {ReadMessageRequest} init - 初始化数据
*/
constructor(init: ReadMessageRequest) {
this.ids = init.ids;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ReadMessageRequest AST#class_body#Left { /**
* 消息ID数组,用于批量已读
*/ AST#property_declaration#Left ids : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Righ... | export class ReadMessageRequest {
ids: number[];
constructor(init: ReadMessageRequest) {
this.ids = init.ids;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/ReadMessageRequest.ets#L5-L17 | 70a32bc65a48a6bb4bb452b6df626bd0655aab0c | github | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/path_sensitive/conditional_stmt/conditional_switch_001_T.ets | arkts | Introduction 路径敏感-区分switch
Level 3 | export function conditional_switch_001_T(taint_src : string) {
let data = ""
let n = 2;
switch (n) {
case 2:
data = taint_src
break
}
taint.Sink(data)
} | AST#export_declaration#Left export AST#function_declaration#Left function conditional_switch_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_stat... | export function conditional_switch_001_T(taint_src : string) {
let data = ""
let n = 2;
switch (n) {
case 2:
data = taint_src
break
}
taint.Sink(data)
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/conditional_stmt/conditional_switch_001_T.ets#L7-L16 | e140d83b27cbb96aab59cabfd5ab2dfed2d1851d | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets | arkts | 省市区类型枚举 | export enum AddressType {
Province = 0,
City = 1,
Region = 2
} | AST#export_declaration#Left export AST#enum_declaration#Left enum AddressType AST#enum_body#Left { AST#enum_member#Left Province = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left City = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Region... | export enum AddressType {
Province = 0,
City = 1,
Region = 2
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L75-L79 | ceba90c194644b7d1e9aa5cfe0d1395dc9a76688 | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getContext | 获取上下文,common.UIAbilityContext
@returns | static getContext(): common.UIAbilityContext {
if (!AppUtils.context) {
AppUtils.context = getContext() as common.UIAbilityContext; //兜底
LogUtils.error('AppUtils', "context为空,请在UIAbility的onWindowStageCreate方法中调用AppUtils的init方法初始化!")
}
return AppUtils.context
} | AST#method_declaration#Left static getContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_... | static getContext(): common.UIAbilityContext {
if (!AppUtils.context) {
AppUtils.context = getContext() as common.UIAbilityContext;
LogUtils.error('AppUtils', "context为空,请在UIAbility的onWindowStageCreate方法中调用AppUtils的init方法初始化!")
}
return AppUtils.context
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L29-L35 | dc33959ba02501bda7af51a9482684d786532a9e | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets | arkts | stateEffect | Sets whether or not to display the press status effect.
@param { boolean } stateEffect - press status effect.
@returns { ToolBarModifier } returns the instance of the ToolBarModifier.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 13 | stateEffect(stateEffect: boolean): ToolBarModifier; | AST#method_declaration#Left stateEffect AST#parameter_list#Left ( AST#parameter#Left stateEffect : 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 ToolBarModifier AST#p... | stateEffect(stateEffect: boolean): ToolBarModifier; | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L271-L271 | 0b6a55d4c8b73dcca5dacf98e1153e8426994eda | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取用户梦想统计数据
@param userId 用户ID
@returns 梦想统计数据 | export function getDreamStats(userId: number): Promise<DreamStats> {
try {
// 从后端API获取数据,API返回的是ApiResponse<DreamStats>格式
return request<ApiResponse<DreamStats>>(RequestMethod.GET, `/dreams/user/${userId}/stats`)
.then(response => {
// 处理ApiResponse,提取data字段并返回
if (response && response.d... | AST#export_declaration#Left export AST#function_declaration#Left function getDreamStats AST#parameter_list#Left ( AST#parameter#Left userId : 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 A... | export function getDreamStats(userId: number): Promise<DreamStats> {
try {
return request<ApiResponse<DreamStats>>(RequestMethod.GET, `/dreams/user/${userId}/stats`)
.then(response => {
if (response && response.data) {
console.info(`成功获取梦想统计: ${JSON.stringify(response.data)}`... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L355-L372 | 8cbb643f360f293c4525f2eab589b3707cfcb9bc | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets | arkts | addData | 改变单个数据
@param {number} index - 索引值
@param {PanelDataType} data - 修改后的值 | public addData(index: number, data: PanelDataType): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#method_declaration#Left public addData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left PanelDataType AST#primary_... | public addData(index: number, data: PanelDataType): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L213-L216 | af5c37b66b23cf24041a5b90b64afffcbaced65e | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/WantAgentUtil.ets | arkts | createWantAgentForStartAbility | create wantAgent for start ability
@param bundleName
@param abilityName
@return return the created WantAgent object. | async createWantAgentForStartAbility(bundleName: string, abilityName: string) {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: bundleName,
abilityName: abilityName
}
],
operationType: ohosWantAgent.OperationType.START_ABILITY,
reques... | AST#method_declaration#Left async createWantAgentForStartAbility 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#Left abilityName : AST#type_annotation#Left AST#primary_ty... | async createWantAgentForStartAbility(bundleName: string, abilityName: string) {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: bundleName,
abilityName: abilityName
}
],
operationType: ohosWantAgent.OperationType.START_ABILITY,
reques... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/WantAgentUtil.ets#L28-L40 | a7bb83069c95c90e49b756006ce78cbd9a19771c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/CustomAniamtionTabController.ets | arkts | 自定义动效tab控制器,控制自定义动效Tab组件进行页签切换 | export class CustomAnimationTabController extends SwiperController {
// 状态监听器
private listener: (state: number) => void = (state: number) => {};
public changeTabIndex(index: number, useAnimation?: boolean) {
this.listener(1);
super.changeIndex(index, useAnimation);
}
public setListener(func: (state:... | AST#export_declaration#Left export AST#class_declaration#Left class CustomAnimationTabController extends AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 状态监听器 AST#property_declaration#Left private listener : AST#type_annotation#Le... | export class CustomAnimationTabController extends SwiperController {
private listener: (state: number) => void = (state: number) => {};
public changeTabIndex(index: number, useAnimation?: boolean) {
this.listener(1);
super.changeIndex(index, useAnimation);
}
public setListener(func: (state: number)... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/CustomAniamtionTabController.ets#L20-L32 | 52c31795dbb8a70938179be6e982ec4038a5184a | gitee | |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/beans/Account.ets | arkts | 导出一个名为 Account 的类,该类用于表示记账应用中的一笔记账信息 | export default class Account {
// 记账ID
id: number = -1;
// 记账类型,0 表示支出,1 表示收入
accountType: number = 0;
// 类型文本,用于描述记账类型
typeText: string = '';
// 金额,表示记账的金额
amount: number = 0;
// 日期,表示收入或支出发生的日期,默认为当前日期
date: Date = new Date();
// 描述,用于记录收入或支出的详细信息
desc: string = '';
// 构造函数,用于创建 Accoun... | AST#export_declaration#Left export default AST#class_declaration#Left class Account AST#class_body#Left { // 记账ID AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Lef... | export default class Account {
id: number = -1;
accountType: number = 0;
typeText: string = '';
amount: number = 0;
date: Date = new Date();
desc: string = '';
constructor(
accountType: number = 0,
typeText: string = '',
amount: number = 0,
date: Date = new Da... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/beans/Account.ets#L2-L36 | 39cf806c37ee8c1121dd036e5d786eedad7b03ba | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/utils/PhotoHelperPage.ets | arkts | saveButton | 安全控件保存,图片保存进相册。 | saveButton() {
let uri = FileUtil.getUriFromPath(this.filePath);
PhotoHelper.applyChanges(uri).then((result) => {
this.uriStr = `保存图片成功:${result.uri}`;
}).catch((err: BusinessError) => {
this.uriStr = `保存图片失败:${JSON.stringify(err)}`;
});
} | AST#method_declaration#Left saveButton AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uri = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left F... | saveButton() {
let uri = FileUtil.getUriFromPath(this.filePath);
PhotoHelper.applyChanges(uri).then((result) => {
this.uriStr = `保存图片成功:${result.uri}`;
}).catch((err: BusinessError) => {
this.uriStr = `保存图片失败:${JSON.stringify(err)}`;
});
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/utils/PhotoHelperPage.ets#L189-L196 | 69d9354f0360283a6a43bd583059a29ba772289f | gitee |
robotzzh/AgricultureApp.git | 7b12c588dd1d07cc07a8b25577d785d30bd838f6 | entry/src/main/ets/DB/relationDB.ets | arkts | getDatas | 根据谓词指定的查询条件查找数据 | async getDatas(tableName: string, atomArr: Array<string>, key: string, val: string | number) {
let predicates = new relationalStore.RdbPredicates(tableName);
predicates.equalTo(key, val);
if (store != undefined) {
return new Promise((resolve, reject) => {
(store as relationalStore.RdbStore).qu... | AST#method_declaration#Left async getDatas 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 atomArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le... | async getDatas(tableName: string, atomArr: Array<string>, key: string, val: string | number) {
let predicates = new relationalStore.RdbPredicates(tableName);
predicates.equalTo(key, val);
if (store != undefined) {
return new Promise((resolve, reject) => {
(store as relationalStore.RdbStore).qu... | https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/DB/relationDB.ets#L78-L94 | 77abecfbc0357fdbeec5572e40ef523957cca613 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderDetailPage.ets | arkts | getPaymentMethodText | 获取支付方式文案
@returns {ResourceStr} 支付方式文案 | private getPaymentMethodText(order: Order): ResourceStr {
switch (order.payType) {
case 1:
return $r("app.string.pay_method_wechat");
case 2:
return $r("app.string.pay_method_alipay");
default:
return $r("app.string.unpaid");
}
} | AST#method_declaration#Left private getPaymentMethodText AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr ... | private getPaymentMethodText(order: Order): ResourceStr {
switch (order.payType) {
case 1:
return $r("app.string.pay_method_wechat");
case 2:
return $r("app.string.pay_method_alipay");
default:
return $r("app.string.unpaid");
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L481-L490 | e3889f87ebe674e73b23e446c3d69af059303ca4 | github |
ericple/ohos-weather | f197791bce462c5eb1b22945c25f5bcd5fcc9f7c | libNMC/src/main/ets/Data/City.ets | arkts | This file is part of libNMC, which is the foundation of ohos-weather. Copyright (C) 2023 Tingjin<dev@peercat.cn> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (... | export interface City{
name: string;
id: string;
lat: string,
lon: string,
adm2: string;
adm1: string;
country: string;
tz: string;
utcOffset: string;
isDst: string;
type: string;
rank: string;
fxLink: string;
isCurrentLocation?: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface City AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left id : AST#type_annotation#Left AST#primar... | export interface City{
name: string;
id: string;
lat: string,
lon: string,
adm2: string;
adm1: string;
country: string;
tz: string;
utcOffset: string;
isDst: string;
type: string;
rank: string;
fxLink: string;
isCurrentLocation?: boolean;
} | https://github.com/ericple/ohos-weather/blob/f197791bce462c5eb1b22945c25f5bcd5fcc9f7c/libNMC/src/main/ets/Data/City.ets#L16-L31 | 56390391ad2b39c2f6498cca4b92e64c3ea8d1b5 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/social/CommunityPage.ets | arkts | buildTabBar | 构建标签栏 | @Builder
buildTabBar() {
Row() {
ForEach(this.tabs, (tab, index: number) => {
Column({ space: 4 }) {
Stack() {
Image($r(`app.media.ic_${tab.icon}`))
.width(20)
.height(20)
.fillColor(this.selectedTab === index ? $r('app.color.primary') ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#... | @Builder
buildTabBar() {
Row() {
ForEach(this.tabs, (tab, index: number) => {
Column({ space: 4 }) {
Stack() {
Image($r(`app.media.ic_${tab.icon}`))
.width(20)
.height(20)
.fillColor(this.selectedTab === index ? $r('app.color.primary') ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/CommunityPage.ets#L129-L174 | ce058c3bba1ca7d7d5b1704ed50ff6e9abd680eb | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/Index.ets | arkts | ImageFitType | utils | export { ImageFitType,ConstrainOffsetAndAnimationType,getMaxAllowedOffset,getImgSize,constrainOffsetAndAnimation } from './src/main/ets/utils/Constrain' | AST#export_declaration#Left export { ImageFitType , ConstrainOffsetAndAnimationType , getMaxAllowedOffset , getImgSize , constrainOffsetAndAnimation } from './src/main/ets/utils/Constrain' AST#export_declaration#Right | export { ImageFitType,ConstrainOffsetAndAnimationType,getMaxAllowedOffset,getImgSize,constrainOffsetAndAnimation } from './src/main/ets/utils/Constrain' | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/Index.ets#L22-L22 | 8e633bf45040094dd9b84d44cfbbfe5c435220fa | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/Index.ets | arkts | buildQuickActionItem | 构建快捷操作项 | @Builder
buildQuickActionItem(title: string, icon: Resource, onClick: () => void) {
Column({ space: 8 }) {
Image(icon)
.width(32)
.height(32)
.objectFit(ImageFit.Contain)
Text(title)
.fontSize(12)
.fontColor('#666666')
.textAlign(TextAlign.Center)... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildQuickActionItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : AST#type_annotatio... | @Builder
buildQuickActionItem(title: string, icon: Resource, onClick: () => void) {
Column({ space: 8 }) {
Image(icon)
.width(32)
.height(32)
.objectFit(ImageFit.Contain)
Text(title)
.fontSize(12)
.fontColor('#666666')
.textAlign(TextAlign.Center)... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L384-L402 | e316fa7d327198fa4875bf3cef6e7dc118734eb8 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/SavePhotoUtils.ets | arkts | savePixelMapToAlbum | 将 PixelMap 保存到系统相册
@param context 上下文对象
@param pixel PixelMap 对象
@param format 保存格式 (默认 'jpeg') | static async savePixelMapToAlbum(pixel: image.PixelMap | null | undefined, format: 'jpeg' | 'png' = 'png') {
if (!pixel) return console.error('❌ pixelMap 为空');
try {
const context = getAppContext()
const helper = photoAccessHelper.getPhotoAccessHelper(context);
const uri = await helper.cr... | AST#method_declaration#Left static async savePixelMapToAlbum AST#parameter_list#Left ( AST#parameter#Left pixel : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Righ... | static async savePixelMapToAlbum(pixel: image.PixelMap | null | undefined, format: 'jpeg' | 'png' = 'png') {
if (!pixel) return console.error('❌ pixelMap 为空');
try {
const context = getAppContext()
const helper = photoAccessHelper.getPhotoAccessHelper(context);
const uri = await helper.cr... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/SavePhotoUtils.ets#L22-L46 | c71458b78fee4fc74816878b3d6b0cc67a2af2d8 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/SpecSelectModal.ets | arkts | 构建规格选择弹窗
@returns {void} 无返回值 | build() {
BottomModal({
visible: this.visible,
title: $r("app.string.modal_select_spec"),
onDismiss: this.onDismiss,
content: (): void => this.ModalContentNetWorkLayout()
});
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#ui_custom_component_statement#Left BottomModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . visible AST#member_expression#Right AST#express... | build() {
BottomModal({
visible: this.visible,
title: $r("app.string.modal_select_spec"),
onDismiss: this.onDismiss,
content: (): void => this.ModalContentNetWorkLayout()
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/SpecSelectModal.ets#L103-L110 | a468c0794c282ad78d9666559427304219fc0bac | github | |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/model/KeyboardController.ets | arkts | sendKeyFunction | 发送功能键 | public sendKeyFunction(): void {
this.addLog('sendKeyFunction')
if (this.mTextInputClient && this.mEditorAttribute) {
this.mTextInputClient.sendKeyFunction(this.mEditorAttribute.enterKeyType);
} else {
this.addLog('sendKeyFunction this.mTextInputClient is undefined');
}
} | AST#method_declaration#Left public sendKeyFunction AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#e... | public sendKeyFunction(): void {
this.addLog('sendKeyFunction')
if (this.mTextInputClient && this.mEditorAttribute) {
this.mTextInputClient.sendKeyFunction(this.mEditorAttribute.enterKeyType);
} else {
this.addLog('sendKeyFunction this.mTextInputClient is undefined');
}
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/model/KeyboardController.ets#L117-L124 | ecae78f176a44522d6701bf90da252dac5ae3807 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/NavigationService.ets | arkts | 获取当前导航栈实例
@returns {NavPathStack | undefined} 导航栈实例;未初始化时返回 undefined | export function getNavPathStack(): NavPathStack | undefined {
if (!globalNavStack) {
const msg: string = "[NavigationService] nav stack is not initialized, call setNavPathStack first.";
hilog.error(DOMAIN, "NavSvc", msg);
return undefined;
}
return globalNavStack;
} | AST#export_declaration#Left export AST#function_declaration#Left function getNavPathStack AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left NavPathStack AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#... | export function getNavPathStack(): NavPathStack | undefined {
if (!globalNavStack) {
const msg: string = "[NavigationService] nav stack is not initialized, call setNavPathStack first.";
hilog.error(DOMAIN, "NavSvc", msg);
return undefined;
}
return globalNavStack;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L36-L43 | b3eff11bb7b6ade8aa329e39118be9a513e15e61 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets | arkts | bottomRightComponent | 下部分右侧纵向滚动列表,用于展示车型信息 | @Builder
bottomRightComponent() {
List({ scroller: this.bottomRightListScroller }) {
// TODO:性能知识点:数据量较大,使用了[LazyForEach](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-rendering-control-lazyforeach-V5) 进行数据懒加载优化,以降低内存占用和渲染开销
LazyForEach(this.dataSource, (item: ShowData, index... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bottomRightComponent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_... | @Builder
bottomRightComponent() {
List({ scroller: this.bottomRightListScroller }) {
LazyForEach(this.dataSource, (item: ShowData, index: number) => {
ListItemGroup({ header: this.rightFixedTitle(index) }) {
this.bottomRightListItem(item);
};
}, (item: ShowData, index:... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L256-L294 | de0a01bc524370656fde442b21231c9a989d8540 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/ToDoListArkTS/entry/src/main/ets/viewmodel/DataModel.ets | arkts | getData | Get the data. | getData(): Array<string> {
return this.tasks;
} | AST#method_declaration#Left getData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Righ... | getData(): Array<string> {
return this.tasks;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ToDoListArkTS/entry/src/main/ets/viewmodel/DataModel.ets#L30-L32 | b8330fa539edbc4d25ee3e6ac2a75fca7e78ddf2 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/WindowManager.ets | arkts | immerseFullScreenSync | 沉浸式全屏(全屏屏幕,且显示状态栏、导航栏)
同步方法:适合一次性定性设置沉浸式状态栏,不会动态调整。此方案大多数场景够用了,用户不会频繁显示|隐藏导航栏。
仅在Ability使用(Ability全局,且初始化状态栏和导航栏的高度),建议在 Ability --> onWindowStageCreate 中执行 | static immerseFullScreenSync(windowStage: window.WindowStage) {
// 同步获取一个主窗口实例
let windowClass: window.Window = windowStage.getMainWindowSync()
let area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR);
let navBar = px2vp(area.bottomRect.height)
area = windowClass.get... | AST#method_declaration#Left static immerseFullScreenSync AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li... | static immerseFullScreenSync(windowStage: window.WindowStage) {
let windowClass: window.Window = windowStage.getMainWindowSync()
let area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR);
let navBar = px2vp(area.bottomRect.height)
area = windowClass.getWindowAvoidAre... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/WindowManager.ets#L65-L92 | f96073d5f4786765894a6408cbb4142955ec6085 | gitee |
huaweicloud/huaweicloud-iot-device-sdk-arkts.git | 72954bea19e7e7f93567487b036c0664457bdaf3 | huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets | arkts | onShadow | 影子回调函数,由SDK自动调用
@param requestId 请求id
@param shadow 影子 | public onShadow(requestId: string, shadow: Shadow): void {
} | AST#method_declaration#Left public onShadow AST#parameter_list#Left ( AST#parameter#Left requestId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left shadow : AST#type_annotation#Left AST#primary_type#Left Shadow AST#primary_... | public onShadow(requestId: string, shadow: Shadow): void {
} | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L218-L220 | 064629f1b7a66f80ee0075c0e8a2e546b83409db | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/permission/PermissionUtils.ets | arkts | requestPermissionsEasy | 申请权限,拒绝后并二次向用户申请授权
@param {Array<Permissions>} permissions 目标权限
@returns {Promise<boolean>} 是否已授权 | private async requestPermissionsEasy(permissions: Array<Permissions>): Promise<boolean> {
try {
// 第一次请求权限
let request: PermissionRequestResult = await this.atManager.requestPermissionsFromUser(this.context, permissions);
let isGranted = request.authResults.every(status => status === abilityAccess... | AST#method_declaration#Left private async requestPermissionsEasy AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_anno... | private async requestPermissionsEasy(permissions: Array<Permissions>): Promise<boolean> {
try {
let request: PermissionRequestResult = await this.atManager.requestPermissionsFromUser(this.context, permissions);
let isGranted = request.authResults.every(status => status === abilityAccessCtrl.Grant... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/permission/PermissionUtils.ets#L47-L67 | cae06de4ca89e7108640454a3eb65658a73570dd | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/ContactTypes.ets | arkts | 关系统计接口 | export interface RelationStats {
family: number;
friend: number;
colleague: number;
other: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RelationStats AST#object_type#Left { AST#type_member#Left family : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left friend : AST#type_annotation#... | export interface RelationStats {
family: number;
friend: number;
colleague: number;
other: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L218-L223 | fca68815484b84950b80d62fd0f0028c90b965a5 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | solarToLunar | 公历转农历
@param solarDate 公历日期(YYYY-MM-DD格式)
@returns 农历日期信息 | async solarToLunar(solarDate: string): Promise<LunarDate | null> {
try {
// 优先使用联网数据
if (this.useOnlineData) {
const onlineLunar = await this.onlineLunarService.solarToLunarOnline(solarDate);
if (onlineLunar) {
// 转换为标准LunarDate格式
return {
year: onlineLuna... | AST#method_declaration#Left async solarToLunar AST#parameter_list#Left ( AST#parameter#Left solarDate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#... | async solarToLunar(solarDate: string): Promise<LunarDate | null> {
try {
if (this.useOnlineData) {
const onlineLunar = await this.onlineLunarService.solarToLunarOnline(solarDate);
if (onlineLunar) {
return {
year: onlineLunar.lunarYear,
month... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L146-L174 | 8eea51d16ec92731df4ebd02a032151c24d588dd | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 文本颜色接口 | export interface TextColorConfig {
primary: string;
secondary: string;
disabled: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TextColorConfig AST#object_type#Left { AST#type_member#Left primary : 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 secondary : AST#type_annot... | export interface TextColorConfig {
primary: string;
secondary: string;
disabled: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L215-L219 | 5ef2231843e7be9245636ddbf2e49006291b41a5 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/FloatingButton.ets | arkts | FloatingButton | [Start floating_button] | @Entry
@Component
export struct FloatingButton {
@State private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
// [StartExclude floating_button]
pathStack: NavPathStack = new NavPathStack();
resourceToString(resource: Resource): string {
return getContext(this).resourceManager.getStringSync(resource);
}... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FloatingButton AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private arr : AST#type_annotation#Left AST#primary_t... | @Entry
@Component
export struct FloatingButton {
@State private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
pathStack: NavPathStack = new NavPathStack();
resourceToString(resource: Resource): string {
return getContext(this).resourceManager.getStringSync(resource);
}
build() {
NavDest... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/FloatingButton.ets#L17-L82 | 3311442d52f6fa5da9eaf4da834baf82e24bbc24 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets | arkts | 选择文件保存位置 | export async function getSaveFilePath(context: Context): Promise<string> {
let selectedSaveFilePath: string = ""
let documentSaveOptions = new picker.DocumentSaveOptions();
let documentPicker = new picker.DocumentViewPicker(context);
await documentPicker.save(documentSaveOptions).then((result: Array<string>) =>... | AST#export_declaration#Left export AST#function_declaration#Left async function getSaveFilePath AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat... | export async function getSaveFilePath(context: Context): Promise<string> {
let selectedSaveFilePath: string = ""
let documentSaveOptions = new picker.DocumentSaveOptions();
let documentPicker = new picker.DocumentViewPicker(context);
await documentPicker.save(documentSaveOptions).then((result: Array<string>) =>... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L33-L41 | 3a71bd5b21a887f05470b9b7253556702482f7c6 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets | arkts | totalCount | 获取数据的长度 | public totalCount(): number {
return 0;
} | AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#... | public totalCount(): number {
return 0;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets#L29-L31 | 318fefefc4e50c71cec1d542f0c52ea6c8923b00 | gitee |
huang7855196/ArkTs-iLearn.git | 08590adaca7a58d5284416ba5cfc09117122af84 | HomeModule/src/main/ets/viewmodel/HomeViewModel.ets | arkts | getQuestionList | 获取首页列表数据 | getQuestionList(params: QueryQuestionListParams) {
return HttpUtils.get<{
total: number
pageTotal: number
rows: QuestionItemModel[]
}>('question/list', params)
} | AST#method_declaration#Left getQuestionList AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left QueryQuestionListParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#retur... | getQuestionList(params: QueryQuestionListParams) {
return HttpUtils.get<{
total: number
pageTotal: number
rows: QuestionItemModel[]
}>('question/list', params)
} | https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/HomeModule/src/main/ets/viewmodel/HomeViewModel.ets#L20-L26 | 719a950b7c9ff6e0834383c19de5ab9408e4231e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/AnimationHelper.ets | arkts | transitionInUp | InUp动画
@param duration 动画时间
@returns | static transitionInUp(duration: number = 300): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration * 0.4 })
.combine(TransitionEffect.OPACITY.animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ durat... | AST#method_declaration#Left static transitionInUp AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annota... | static transitionInUp(duration: number = 300): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration * 0.4 })
.combine(TransitionEffect.OPACITY.animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ durat... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/AnimationHelper.ets#L30-L37 | a2eadf27f31fc279dbbceca687242439be4e7d61 | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/url.ets | arkts | _parse | ==================== 核心解析方法 ==================== | private _parse(input: string): void {
// 1. 分离片段
const hashIndex = input.indexOf("#");
if (hashIndex !== -1) {
this._hash = input.substring(hashIndex + 1);
input = input.substring(0, hashIndex);
}
// 2. 分离查询部分
const queryIndex = input.indexOf("?")... | AST#method_declaration#Left private _parse AST#parameter_list#Left ( AST#parameter#Left input : 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 void AST#primary_type#Rig... | private _parse(input: string): void {
const hashIndex = input.indexOf("#");
if (hashIndex !== -1) {
this._hash = input.substring(hashIndex + 1);
input = input.substring(0, hashIndex);
}
const queryIndex = input.indexOf("?");
if (queryInd... | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L324-L364 | 8145c3033f0798de1dc16af2c298d9e1f6645fc0 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/Base64Util.ets | arkts | decode | 解码,通过输入参数解码后输出对应Uint8Array对象。
@param array
@returns | static decode(array: Uint8Array | string, options?: util.Type): Promise<Uint8Array> {
const base64 = new util.Base64Helper();
return base64.decode(array, options);
} | AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , A... | static decode(array: Uint8Array | string, options?: util.Type): Promise<Uint8Array> {
const base64 = new util.Base64Helper();
return base64.decode(array, options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/Base64Util.ets#L75-L78 | d835b2432607b0ed4bbc2762b7f99c0ccf14ef3e | gitee |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | product/phone/src/main/ets/pages/dateAndTime.ets | arkts | onAccept | Successfully built Dialog | onAccept() {
LogUtil.info(MODULE_TAG + 'onAccept');
} | AST#method_declaration#Left onAccept 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 LogUtil AST#expression#Right . info AST#member_expressi... | onAccept() {
LogUtil.info(MODULE_TAG + 'onAccept');
} | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/dateAndTime.ets#L161-L163 | 955d0216acafb452ec7b4c600d54a86b51f63077 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets | arkts | notifyDataSetChanged | Lets the chart know its underlying data has changed and performs all
necessary recalculations. It is crucial that this method is called
everytime data is changed dynamically. Not calling this method can lead
to crashes or unexpected behaviour. | public abstract notifyDataSetChanged(); | AST#method_declaration#Left public abstract notifyDataSetChanged AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right | public abstract notifyDataSetChanged(); | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets#L283-L283 | 21c8e567f6e61340280ec7ba87d3527ce8756859 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/PathUtility.ets | arkts | isDirectory | 检查路径是否为目录
@param path 目标路径
@returns 是否为目录 | static isDirectory(path: string): boolean {
try {
const stat = fs.statSync(path);
return stat.isDirectory();
} catch {
return false;
}
} | AST#method_declaration#Left static isDirectory AST#parameter_list#Left ( AST#parameter#Left path : 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_ty... | static isDirectory(path: string): boolean {
try {
const stat = fs.statSync(path);
return stat.isDirectory();
} catch {
return false;
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L130-L137 | 85bc03c6b00ed78edde567267a29cba9e4b049ee | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/pages/scrollingCharts/data/Square.ets | arkts | Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Square {
public data: number[] = [
0.0, //#0
0.0025000000745058065, //#1
0.010000000298023226, //#2
0.02250000178813938, //#3
0.040000001192092904, //#4
0.0625, //#5
0.09000000715255752, //#6
0.1225000166893011, //#7
0.16000002861023077, //#8
0.202500042915... | AST#export_declaration#Left export default AST#class_declaration#Left class Square AST#class_body#Left { AST#property_declaration#Left public data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left A... | export default class Square {
public data: number[] = [
0.0,
0.0025000000745058065,
0.010000000298023226,
0.02250000178813938,
0.040000001192092904,
0.0625,
0.09000000715255752,
0.1225000166893011,
0.16000002861023077,
0.2025000429153465,
0.25000005960464833, 0
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/data/Square.ets#L16-L119 | 9206f3e8afa0c504098098f009a8d703ab96d868 | gitee | |
common-apps/dsbrigde-harmony-os | bb03e4e95984db32939a1ad609f688537b5a92e8 | library/src/main/ets/core/WebViewControllerProxy.ets | arkts | setGlobalErrorMessageListener | 设置全局错误监听
@param listener | setGlobalErrorMessageListener(listener: OnErrorMessageListener): void {
this.bridge.setGlobalErrorMessageListener(listener)
} | AST#method_declaration#Left setGlobalErrorMessageListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left OnErrorMessageListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t... | setGlobalErrorMessageListener(listener: OnErrorMessageListener): void {
this.bridge.setGlobalErrorMessageListener(listener)
} | https://github.com/common-apps/dsbrigde-harmony-os/blob/bb03e4e95984db32939a1ad609f688537b5a92e8/library/src/main/ets/core/WebViewControllerProxy.ets#L26-L28 | fe3e0f9abf38e3ae21d43305b89709e742f71b26 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragandexchange/src/main/ets/pages/Launcher.ets | arkts | Launcher | 功能描述: 本示例使用position绝对定位实现应用内悬浮窗,并且通过animateTo结合curves动画曲线实现悬浮窗拖拽跟手和松手吸附边缘的弹性动画效果
推荐场景: 悬浮窗显示场景
核心组件:
1. FloatWindowView
实现步骤:
1. 悬浮窗组件使用Stack嵌套video布局,使用属性position绝对定位使组件悬浮,position使用Edges类型控制悬浮窗到父组件四条边的距离
2. 初始化时悬浮窗的position属性设置top和right,让悬浮窗靠右
3. 父组件添加onAreaChange回调,获取父组件的宽高
4. 悬浮窗组件添加onTouchEvent回调,在手指按下时保存触摸点在窗口... | @Component
export struct Launcher {
build() {
Column() {
GridSceneView() // 实现Grid拖拽场景
ListSceneView() // 实现List拖拽场景
}
.width($r("app.string.drag_and_exchange_layout_100_percent"))
.height($r("app.string.drag_and_exchange_layout_100_percent"))
.justifyContent(FlexAlign.Center)
.bac... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Launcher AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { ... | @Component
export struct Launcher {
build() {
Column() {
GridSceneView()
ListSceneView()
}
.width($r("app.string.drag_and_exchange_layout_100_percent"))
.height($r("app.string.drag_and_exchange_layout_100_percent"))
.justifyContent(FlexAlign.Center)
.backgroundImage($r('app.media... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/src/main/ets/pages/Launcher.ets#L35-L48 | ff02d6c8765941e2d64e4d84288a726ad029c92e | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/chat/PrivateChatComponent.ets | arkts | aboutToDisappear | 界面被销毁时被调用。 | aboutToDisappear() {
// this.setKeyboardAvoidModeToRESIZE(this.getUIContext(), false);
// 清除动画循环
clearInterval(this.animationId);
EmitterUtil.unsubscribe(VHRoomEventType.IM_PRIVATE_TEXT);
} | AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // this.setKeyboardAvoidModeToRESIZE(this.getUIContext(), false); // 清除动画循环 AST#ui_custom_component_statement#Left clearInterval ( AST#expression#Left AST#member_expression#Left AST#express... | aboutToDisappear() {
clearInterval(this.animationId);
EmitterUtil.unsubscribe(VHRoomEventType.IM_PRIVATE_TEXT);
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L81-L86 | 3e82cc4065fb3eb3a7dc5f6f648570a69143af41 | gitee |
fourseas1998/hos.RankingDemo.git | 5a98167826252c3c2b5ac58fa9a3db29d5f49d02 | entry/src/main/ets/view/ListItemComponent.ets | arkts | isRenderCircleText | 判断是否为前三个 | isRenderCircleText(): boolean {
return this.index === 1 || this.index === 2 || this.index === 3;
} | AST#method_declaration#Left isRenderCircleText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expr... | isRenderCircleText(): boolean {
return this.index === 1 || this.index === 2 || this.index === 3;
} | https://github.com/fourseas1998/hos.RankingDemo.git/blob/5a98167826252c3c2b5ac58fa9a3db29d5f49d02/entry/src/main/ets/view/ListItemComponent.ets#L54-L56 | 521428cc111ff6c73efc2f2d9745d4cfabaf11ae | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_settings.ets | arkts | init | Initializes the bunch_of_settings. | static async init() {
// Register the default Settings
// Customization
bunch_of_settings.register_setting('title_bar_position', 'string', 'bottom');
bunch_of_settings.register_setting('status_showing_large_my_window_alias', 'boolean', 'false');
bunch_of_settings.register_setting('tabs_style', 'str... | AST#method_declaration#Left static async init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // Register the default Settings // Customization AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#L... | static async init() {
bunch_of_settings.register_setting('title_bar_position', 'string', 'bottom');
bunch_of_settings.register_setting('status_showing_large_my_window_alias', 'boolean', 'false');
bunch_of_settings.register_setting('tabs_style', 'string', 'vertical');
bunch_of_settings.registe... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L16-L137 | 3fabf03e8be398e62cfe9018e5e753ab4ac40777 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets | arkts | stopContinuousTask | 结束后台任务
@returns {void} | stopContinuousTask(): void {
// 避免重新停止后台任务
if (!this.isBackgroundTaskRunning) {
return;
}
// TODO:知识点:停止后台任务
backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => {
logger.info(`Succeeded in operationing stopBackgroundRunning.`);
this.isBackgroundTaskRunning = ... | AST#method_declaration#Left stopContinuousTask 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... | stopContinuousTask(): void {
if (!this.isBackgroundTaskRunning) {
return;
}
backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => {
logger.info(`Succeeded in operationing stopBackgroundRunning.`);
this.isBackgroundTaskRunning = false;
}).catch((err: Busin... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets#L320-L333 | 12b6858a49eadbb343cd063d5cd1429b0f91832b | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | mime_types/src/main/ets/Mime.ets | arkts | getFileExtention | 根据 文件名/文件path/文件uri/文件url,获取文件后缀名
@param src 例如: test.txt test.doc
@returns | static getFileExtention(src: string): string {
if (src.length > 1 && src.includes(".")) {
return src.substring(src.lastIndexOf(".") + 1);
}
return '';
} | AST#method_declaration#Left static getFileExtention AST#parameter_list#Left ( AST#parameter#Left 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#type_annotation#Left AST#primary_type#Left string AST#primary... | static getFileExtention(src: string): string {
if (src.length > 1 && src.includes(".")) {
return src.substring(src.lastIndexOf(".") + 1);
}
return '';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/mime_types/src/main/ets/Mime.ets#L71-L76 | 0b9d27ec3f66c776b39e20be0e55b181ebb14a7b | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the build types of the same baseline code.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get buildType(): string; | AST#method_declaration#Left static get AST#ERROR#Left build Type AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get buildType(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L327-L327 | 31e44c2408ce5845d76b54e3ae34da83c914bc28 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets | arkts | stop | 结束播放 | static async stop() {
await AudioRendererManager.audioRender?.stop()
} | AST#method_declaration#Left static async stop AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left... | static async stop() {
await AudioRendererManager.audioRender?.stop()
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets#L82-L84 | 52d161164e50ffee7dd60837cd6bee06a71de6b5 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreviewUtil.ets | arkts | getIconFileStr | 根据文件后缀名获取对应文件类型的图标
@param fileExtention 文件后缀名,例如:html txt doc ts mp3 | static getIconFileStr(fileExtention: string): string {
const descriptor = PreviewUtil.getTypeDescriptor(fileExtention);
return descriptor.iconFile;
} | AST#method_declaration#Left static getIconFileStr AST#parameter_list#Left ( AST#parameter#Left fileExtention : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST... | static getIconFileStr(fileExtention: string): string {
const descriptor = PreviewUtil.getTypeDescriptor(fileExtention);
return descriptor.iconFile;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L156-L159 | 8570adfbdb9111665fa98b881d0785deb9f1ab62 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets | arkts | fancy | Common text styles. | @Extend(Text)
function fancy() {
.fontColor($r("app.color.dialog_fancy_text_color"))
.fontSize($r("app.float.dialog_fancy_text_size"))
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.layoutWeight(CommonConstants.COMMON_LAYOUT_WEIGHT)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function fancy AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_... | @Extend(Text)
function fancy() {
.fontColor($r("app.color.dialog_fancy_text_color"))
.fontSize($r("app.float.dialog_fancy_text_size"))
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.layoutWeight(CommonConstants.COMMON_LAYOUT_WEIGHT)
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets#L90-L97 | 400025df3a35235db08d9f62f47259b4e97176d9 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | common font weight | export const COMMON_NUM_FONT_WEIGHT: number = 500; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMMON_NUM_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right AST#variable_declarator#Right ; AST#variable_... | export const COMMON_NUM_FONT_WEIGHT: number = 500; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L79-L79 | cf51b5169e7c25213823e6eb7072c7cbd3ccfdbf | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the product model represented by a string.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get productModel(): string; | AST#method_declaration#Left static get AST#ERROR#Left productModel AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get productModel(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L99-L99 | bd2649de0595d224a7ee44fe083c2bd329b1d009 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/Base64Util.ets | arkts | encodeToStr | 将Uint8Array转化为字符串-异步
@param array Uint8Array数组
@returns 转码后的字符串 | static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> {
let base64 = new util.Base64Helper();
return base64.encodeToString(array, options);
} | AST#method_declaration#Left static encodeToStr AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified... | static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> {
let base64 = new util.Base64Helper();
return base64.encodeToString(array, options);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Base64Util.ets#L31-L34 | a6b18f799da4f3e516b206970b7c44f7e62ff74b | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/configs/Colors.ets | arkts | / Colors.ets / / Created by iotjin on 2024/08/01. / description: | export class KColors {
// 主题色(导航条背景、提交按钮背景、弹框确认文字、表单图标录入光标)
// 暗黑模式高亮显示颜色按kThemeColor设置,如tabBar选中文字图标、提交按钮背景色、指示器选中下划线、光标等
static readonly kThemeColor: ResourceColor = '#3BB815'
static readonly kThemeDarkColor: ResourceColor = '#0A0A0A' // (10, 10, 10)
static readonly kThemeBlueColor: ResourceColor = '#4688FA... | AST#export_declaration#Left export AST#class_declaration#Left class KColors AST#class_body#Left { // 主题色(导航条背景、提交按钮背景、弹框确认文字、表单图标录入光标) // 暗黑模式高亮显示颜色按kThemeColor设置,如tabBar选中文字图标、提交按钮背景色、指示器选中下划线、光标等 AST#property_declaration#Left static readonly kThemeColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor A... | export class KColors {
static readonly kThemeColor: ResourceColor = '#3BB815'
static readonly kThemeDarkColor: ResourceColor = '#0A0A0A'
static readonly kThemeBlueColor: ResourceColor = '#4688FA'
static readonly kThemePurpleColor: ResourceColor = '#9C27B0'
static readonly kGradientStartColor: Resour... | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/configs/Colors.ets#L6-L141 | fa469460dd6450efc74bd3f754a9d06f144613d6 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | drawImage | Draw image. | private drawImage(): void {
if (this.ctx !== undefined) {
this.ctx.save();
this.clearCanvas();
let x = this.displayWidth / 2;
let y = this.displayHeight / 2;
this.ctx.translate(this.isFlipHorizontal ? 2 * x : 0, this.isFlipVertically ? 2 * y : 0);
let tX = this.isFlipHorizontal... | AST#method_declaration#Left private drawImage 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#binary_expression#Lef... | private drawImage(): void {
if (this.ctx !== undefined) {
this.ctx.save();
this.clearCanvas();
let x = this.displayWidth / 2;
let y = this.displayHeight / 2;
this.ctx.translate(this.isFlipHorizontal ? 2 * x : 0, this.isFlipVertically ? 2 * y : 0);
let tX = this.isFlipHorizontal... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L463-L487 | 98a6a8caf84ade4466cad9e0d32ff780b1b82152 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | sortPartsAndUnits | 对parts和units进行排序 | private sortPartsAndUnits(): void {
// 对parts按partId升序排序
this.parts.sort((a, b) => {
return (a.partId || 0) - (b.partId || 0);
});
// 对units按unitId升序排序
this.units.sort((a, b) => {
return (a.unitId || 0) - (b.unitId || 0);
});
// 对每个part中的units按unitId排序
for (let i = 0; i < t... | AST#method_declaration#Left private sortPartsAndUnits 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 { // 对parts按partId升序排序 AST#statement#Left AST#expression_statement#Left AST#expressio... | private sortPartsAndUnits(): void {
this.parts.sort((a, b) => {
return (a.partId || 0) - (b.partId || 0);
});
this.units.sort((a, b) => {
return (a.unitId || 0) - (b.unitId || 0);
});
for (let i = 0; i < this.parts.length; i++) {
const part = this.parts[i];
i... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L278-L298 | 40fdba10b29ed1a3bb8c00a396215c620fd0deb0 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.fs.d.ets | arkts | RandomAccessFileOptions type
@interface RandomAccessFileOptions
@syscap SystemCapability.FileManagement.File.FileIO
@since 20 | export interface RandomAccessFileOptions {
/**
* The starting position of file offset.
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/
start?: number;
/**
* The ending position of file offset.
*
* @type { ?number }
* @syscap SystemCapabil... | AST#export_declaration#Left export AST#interface_declaration#Left interface RandomAccessFileOptions AST#object_type#Left { /**
* The starting position of file offset.
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/ AST#type_member#Left start ? : AST#type_ann... | export interface RandomAccessFileOptions {
start?: number;
end?: number;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4460-L4478 | 76d0c9c7e7e2bc8582644afb28778dc9b7a6a6c2 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets | arkts | normalProcess | 非原子操作,进行10000次++ | @Concurrent
function normalProcess(int32Array: Int32Array) {
for (let i = 0; i < 10000; i++) {
int32Array[0]++;
}
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function normalProcess AST#parameter_list#Left ( AST#parameter#Left int32Array : AST#type_annotation#Left AST#primary_type#Left Int32Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list... | @Concurrent
function normalProcess(int32Array: Int32Array) {
for (let i = 0; i < 10000; i++) {
int32Array[0]++;
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets#L97-L102 | 78b4ee76d4ca625bd5e3014418b3e9d1ce50ef08 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/SoundEffect/SEManager.ets | arkts | get | 获取单例实例 | public static get shared(): SEService {
if (!SEService.instance) {
SEService.instance = new SEService();
}
return SEService.instance;
} | AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SEService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_stateme... | public static get shared(): SEService {
if (!SEService.instance) {
SEService.instance = new SEService();
}
return SEService.instance;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L30-L35 | 174716212c0b7cf663f4d3d729cdcf6b7d271e45 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/constants/CommonConstants.ets | arkts | 全局常量定义 | export class CommonConstants {
/**
* 字体大小定义
*/
static readonly FONT_SIZE_SMALL: number = 14;
static readonly FONT_SIZE_NORMAL: number = 16;
static readonly FONT_SIZE_LARGE: number = 20;
static readonly FONT_SIZE_XLARGE: number = 24;
/**
* 边距定义
*/
static readonly MARGIN_SMALL: number = 4;
... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* 字体大小定义
*/ AST#property_declaration#Left static readonly FONT_SIZE_SMALL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 14 ... | export class CommonConstants {
static readonly FONT_SIZE_SMALL: number = 14;
static readonly FONT_SIZE_NORMAL: number = 16;
static readonly FONT_SIZE_LARGE: number = 20;
static readonly FONT_SIZE_XLARGE: number = 24;
static readonly MARGIN_SMALL: number = 4;
static readonly MARGIN_NORMAL: number = ... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/constants/CommonConstants.ets#L4-L62 | c5d836c55e9d2a8b3c7bfbb7ebdbdb176e71e26d | github | |
yongoe1024/RdbPlus.git | 4a3fc04ba5903bc1c1b194efbc557017976909dc | rdbplus/src/main/ets/core/MyWrapper.ets | arkts | getUpdate | 拼接set语句 | getUpdate() {
return this.updateList.join(",")
} | AST#method_declaration#Left getUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#express... | getUpdate() {
return this.updateList.join(",")
} | https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/MyWrapper.ets#L74-L76 | fc6fc0c1e86743b411c4e7d555407907862b5963 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/GattClientManager.ets | arkts | [EndExclude generic_attribute] | export class GattData {
public serviceUuid: string = '00001810-0000-1000-8000-00805F9B34FB';
public characteristicUuid: string = '00001820-0000-1000-8000-00805F9B34FB';
public descriptorUuid: string = '00002902-0000-1000-8000-00805F9B34FB';
public characteristicValue: string = '';
public descriptorValue: stri... | AST#export_declaration#Left export AST#class_declaration#Left class GattData AST#class_body#Left { AST#property_declaration#Left public serviceUuid : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '00001810-0000-1000-8000-00805F9B34FB' AST#ex... | export class GattData {
public serviceUuid: string = '00001810-0000-1000-8000-00805F9B34FB';
public characteristicUuid: string = '00001820-0000-1000-8000-00805F9B34FB';
public descriptorUuid: string = '00002902-0000-1000-8000-00805F9B34FB';
public characteristicValue: string = '';
public descriptorValue: stri... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/GattClientManager.ets#L28-L34 | ed1dbe99e557d3c97104853f89208c1444a296f3 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | AI设置接口 | export interface AISettings {
enabled: boolean;
provider: string;
personalization: boolean;
responseLength: string;
creativity: number;
language: Language;
apiProvider: AIProvider;
apiKey: string;
apiUrl?: string;
model: string;
maxTokens: number;
temperature: number;
customPrompt?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AISettings AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left provider : AST#type_annotation... | export interface AISettings {
enabled: boolean;
provider: string;
personalization: boolean;
responseLength: string;
creativity: number;
language: Language;
apiProvider: AIProvider;
apiKey: string;
apiUrl?: string;
model: string;
maxTokens: number;
temperature: number;
customPrompt?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L199-L213 | 75099387637c522caf4d89006bd0ea02b66af15f | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/view/CartPage.ets | arkts | onPageIndexChange | 监听 main 页面当前选中的页面索引变化 | @Monitor('currentPageIndex')
onPageIndexChange() {
if (this.currentPageIndex === 2) {
this.vm.loadCartData();
}
} | AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'currentPageIndex' AST#expression#Right ) AST#decorator#Right onPageIndexChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left ... | @Monitor('currentPageIndex')
onPageIndexChange() {
if (this.currentPageIndex === 2) {
this.vm.loadCartData();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CartPage.ets#L35-L40 | 55fada402a38d572d20ddc06f38a45b913cd9dee | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/entryability/EntryAbility.ets | arkts | handleNewIntent | 处理新的启动意图
@param want Want信息 | private handleNewIntent(want: Want): void {
// 解析启动参数
if (want.parameters) {
const action = want.parameters['action'] as string;
const data = want.parameters['data'] as string;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
'Handle new intent - action: %{public}s, da... | AST#method_declaration#Left private handleNewIntent AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void... | private handleNewIntent(want: Want): void {
if (want.parameters) {
const action = want.parameters['action'] as string;
const data = want.parameters['data'] as string;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
'Handle new intent - action: %{public}s, data: %{pub... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L204-L221 | bd24886b97f9763acb119c836105330ab49af210 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets | arkts | [EndExclude set_gesture_judge] | build() {
NavDestination() {
Column({ space: 12 }) {
Text($r('app.string.gesture_GestureJudge_text'))
.fontSize(14)
.fontColor('#666')
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) { // 外部滚动容器
Column() {
Text('Scroll... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#co... | build() {
NavDestination() {
Column({ space: 12 }) {
Text($r('app.string.gesture_GestureJudge_text'))
.fontSize(14)
.fontColor('#666')
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Column() {
Text('Scroll Area')
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets#L30-L168 | a9df4633c32d5b8421c319d63e92117e64467584 | gitee | |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkUISymbolGlyphSymbolSpan/entry/src/main/ets/pages/Index.ets | arkts | Row | 通过fontWeight属性设置SymbolSpan组件的粗细。 | Row() {
Column() {
Text("Lighter")
Text() {
SymbolSpan($r('sys.symbol.ohos_trash'))
.fontWeight(FontWeight.Lighter)
.fontSize(96)
} | AST#method_declaration#Left Row AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#ERROR#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_... | Row() {
Column() {
Text("Lighter")
Text() {
SymbolSpan($r('sys.symbol.ohos_trash'))
.fontWeight(FontWeight.Lighter)
.fontSize(96)
} | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUISymbolGlyphSymbolSpan/entry/src/main/ets/pages/Index.ets#L48-L55 | b322f0e2c864fd9fdc17b7c8d27c2fb8e7b00cec | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppFunctions.ets | arkts | /延迟 毫秒 | export async function awaitDelay(milliSeconds: number = 100) {
await new Promise<void>((resolve, reject) => setTimeout(resolve, milliSeconds));
} | AST#export_declaration#Left export AST#function_declaration#Left async function awaitDelay AST#parameter_list#Left ( AST#parameter#Left milliSeconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right AST#parameter#Right... | export async function awaitDelay(milliSeconds: number = 100) {
await new Promise<void>((resolve, reject) => setTimeout(resolve, milliSeconds));
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppFunctions.ets#L25-L27 | cb4524f6fa70b6c4a86783dbd2f8e8543071279e | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets | arkts | 构造函数
@param {common.Context} [context] UIAbility 上下文 | constructor(context?: common.Context) {
const resolvedContext: common.Context = context ?? ContextUtil.getUIAbilityCtx();
this.prefs = new PreferencesUtil(resolvedContext, OrderCacheStoreDataSourceImpl.PREFS_NAME);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block... | constructor(context?: common.Context) {
const resolvedContext: common.Context = context ?? ContextUtil.getUIAbilityCtx();
this.prefs = new PreferencesUtil(resolvedContext, OrderCacheStoreDataSourceImpl.PREFS_NAME);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L87-L90 | 4c9ece1a2a32c9c1e26353243bc6ca4e0606f553 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/model/GoodsModel.ets | arkts | 设置项的数据类 | export class ProductDataModel {
id: number;
uri: ResourceStr;
title: ResourceStr;
price: ResourceStr;
views: ResourceStr;
constructor(id: number, uri: ResourceStr, title: ResourceStr, price: ResourceStr, views: ResourceStr) {
this.id = id;
this.uri = uri;
this.title = title;
this.price = pr... | AST#export_declaration#Left export AST#class_declaration#Left class ProductDataModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left uri : AST#ty... | export class ProductDataModel {
id: number;
uri: ResourceStr;
title: ResourceStr;
price: ResourceStr;
views: ResourceStr;
constructor(id: number, uri: ResourceStr, title: ResourceStr, price: ResourceStr, views: ResourceStr) {
this.id = id;
this.uri = uri;
this.title = title;
this.price = pr... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/model/GoodsModel.ets#L17-L31 | 6de76e0623bf491392acb3cd83b510c0f80231c5 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets | arkts | loadRefundReasons | 加载退款原因字典数据
@returns {void} 无返回值 | loadRefundReasons(): void {
if (this.refundReasonsUiState === BaseNetWorkUiState.SUCCESS && this.refundReasonList.length > 0) {
return;
}
const params: DictDataRequest = new DictDataRequest();
params.types = ["orderRefundReason"];
RequestHelper.repository<DictDataResponse>(this.commonRepositor... | AST#method_declaration#Left loadRefundReasons 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#binary_expression#Lef... | loadRefundReasons(): void {
if (this.refundReasonsUiState === BaseNetWorkUiState.SUCCESS && this.refundReasonList.length > 0) {
return;
}
const params: DictDataRequest = new DictDataRequest();
params.types = ["orderRefundReason"];
RequestHelper.repository<DictDataResponse>(this.commonRepositor... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L114-L134 | f99a8b77f5caaa886a9c65e78924dc8476fdf552 | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets | arkts | putPreference | 将用户输入的数据,保存到缓存的Preference实例中 | async putPreference(key: string, data: string) {
if (this.dataPreferences === null) {
await this.getPreferencesFromStorage();
}
await this.dataPreferences?.put(key, data).then(() => {
console.info(`Succeeded in putting value`);
}).catch((err: BusinessError) => {
console.error(`Failed to get pref... | AST#method_declaration#Left async putPreference AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | async putPreference(key: string, data: string) {
if (this.dataPreferences === null) {
await this.getPreferencesFromStorage();
}
await this.dataPreferences?.put(key, data).then(() => {
console.info(`Succeeded in putting value`);
}).catch((err: BusinessError) => {
console.error(`Failed to get pref... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets#L26-L39 | c552006e2ca745bd1fd68a82f1dc8ee324eaa9db | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/MultiDeviceMusic/features/player/src/main/ets/constants/PlayerConstants.ets | arkts | Constants for player area. | export class PlayerConstants {
/**
* The font size of the singer is smaller.
*/
static readonly FONT_REDUCE: number = 4;
/**
* The layout weight of player info.
*/
static readonly LAYOUT_WEIGHT_PLAYER_INFO: number = 3;
/**
* The layout weight of player control.
*/
static readonly LAYOUT_... | AST#export_declaration#Left export AST#class_declaration#Left class PlayerConstants AST#class_body#Left { /**
* The font size of the singer is smaller.
*/ AST#property_declaration#Left static readonly FONT_REDUCE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Ri... | export class PlayerConstants {
static readonly FONT_REDUCE: number = 4;
static readonly LAYOUT_WEIGHT_PLAYER_INFO: number = 3;
static readonly LAYOUT_WEIGHT_PLAYER_CONTROL: number = 1;
static readonly DISPLAY_PRIORITY_ONE: number = 1;
static readonly DISPLAY_PRIORITY_TWO: number = 2;
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/MultiDeviceMusic/features/player/src/main/ets/constants/PlayerConstants.ets#L19-L49 | b30510addac543f73b5f7e879032b0997e207d92 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinCard/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | 初次启动应用 router 类型事件 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { if (want?.parameters?.params) { // want.parameters.params 对应 postCardAction() 中 params 内容 let params: Record<string, Object> = JSON.parse(want.parameters.params as string); this.selectPage = params.targetPage as string; } } call类型... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.callee.on('changeCount', (data) => {
// 准备一个临时数据结构 存放formId 和数字
interface FromData {
formId: string,
count: number
}
// 从data中获取数据
let params = JSON.parse(data.readStri... | AST#method_declaration#Left onCreate 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 launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.callee.on('changeCount', (data) => {
interface FromData {
formId: string,
count: number
}
let params = JSON.parse(data.readString()) as FromData
const newCoun... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinCard/entry/src/main/ets/entryability/EntryAbility.ets#L19-L41 | 66c7b0c2224058b30025af2af3b2a174d1b2984c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/PreferencesService.ets | arkts | putBoolean | 存储布尔值
@param key 键
@param value 值 | async putBoolean(key: string, value: boolean): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.put(key, value);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `F... | AST#method_declaration#Left async putBoolean 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 value : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#... | async putBoolean(key: string, value: boolean): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.put(key, value);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `F... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L132-L142 | 83ab611012e52f4b72f5be4b7c9cc770492f1c95 | github |
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onForeground | 当切换到前台 | onForeground(): void {
// Ability has brought to foreground
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
} | AST#method_declaration#Left onForeground AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Ability has brought to foreground AST#expression_statement#Left AST#expression#Left AST... | onForeground(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
} | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/entryability/EntryAbility.ets#L50-L53 | 528f71cc9982fc872e3e48602dc3a74cfb2e682a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/enums/VerifyModeEnum.ets | arkts | 识别类型枚举 | export enum VerifyModeEnum {
//语音识别
VOICE = 0,
//转文字
TEXT = 1,
//取消
CANCEL = 2
} | AST#export_declaration#Left export AST#enum_declaration#Left enum VerifyModeEnum AST#enum_body#Left { //语音识别 AST#enum_member#Left VOICE = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , //转文字 AST#enum_member#Left TEXT = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , //取消 AST#enum_... | export enum VerifyModeEnum {
VOICE = 0,
TEXT = 1,
CANCEL = 2
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/enums/VerifyModeEnum.ets#L17-L24 | 308a4894c05cceea191f79587cec9560a352115c | gitee | |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets | arkts | 根据账目类型和日期范围统计收支数据,返回分类统计信息数组 | export function statisticByType(
accounts: Array<Account>,
accountType: number,
beginDate: Date | number,
endDate: Date | number
): Array<ClassifiedStatistic> {
// 将日期对象转换为时间戳
if (beginDate instanceof Date) {
beginDate = beginDate.getTime()
}
if (endDate instanceof Date) {
endDate = endD... | AST#export_declaration#Left export AST#function_declaration#Left function statisticByType AST#parameter_list#Left ( AST#parameter#Left accounts : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#R... | export function statisticByType(
accounts: Array<Account>,
accountType: number,
beginDate: Date | number,
endDate: Date | number
): Array<ClassifiedStatistic> {
if (beginDate instanceof Date) {
beginDate = beginDate.getTime()
}
if (endDate instanceof Date) {
endDate = endDate.getTime()
... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets#L31-L68 | c88a1fdcf8214600ece4ba4b6f79da00b0330ce5 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets | arkts | aboutToAppear | 页面出现前生命周期
@returns {void} 无返回值 | aboutToAppear(): void {
super.aboutToAppear();
this.loadSavedCredentials();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
super.aboutToAppear();
this.loadSavedCredentials();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets#L48-L51 | 52cff459cc846a4d5a44de935bf9cda09de9c184 | github |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/commons/utils/Http.ets | arkts | request | AxiosRequestConfig axios提供的请求对象类型 | request<T, R = Object>(obj: AxiosRequestConfig<R>) {
// !之前第二个泛型很复杂 因为返回的数据没剥离
// !现在数据剥离了 而且剥离干干净净 就是你要的数据 所以类型就是你要的数据的类型
return instance<null, T, R>(obj)
} | AST#method_declaration#Left request AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right , AST#type_parameter#Left R = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#L... | request<T, R = Object>(obj: AxiosRequestConfig<R>) {
return instance<null, T, R>(obj)
} | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/Http.ets#L76-L80 | 3a8a6c0f347baf1eed504e4a33c61bf299f7b8aa | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/action/DialogUtil.ets | arkts | showTimePicker | 时间滑动选择器弹窗 (TimePickerDialog)
@param options
selected 设置选中项的时间。 默认值:当前系统时间。从API version 10开始,该参数支持$$双向绑定变量。
format 指定需要显示的TimePicker的格式。 默认值:TimePickerFormat.HOUR_MINUTE(HOUR_MINUTE-按照小时和分显示、HOUR_MINUTE_SECOND-按照小时、分钟和秒显示。)
useMilitaryTime 展示时间是否为24小时制,默认为12小时制。默认值:false。说明:当展示时间为12小时制时,上下午与小时无联动关系。
onChange:(value: Dat... | static showTimePicker(options: TimePickerDialogOptions) {
DialogUtil.initPickerDialogDefault(options);
TimePickerDialog.show(options);
} | AST#method_declaration#Left static showTimePicker AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TimePickerDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_... | static showTimePicker(options: TimePickerDialogOptions) {
DialogUtil.initPickerDialogDefault(options);
TimePickerDialog.show(options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L172-L175 | 39c204c3154cd8e5a67cbb0729b9d438fb100fdf | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/components/CustomScanCtrlComp.ets | arkts | CustomScanCtrlComp | 扫码控制组件 | @Component
export default struct CustomScanCtrlComp {
@StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM;
@Consume('subPageStack') subPageStack: NavPathStack;
// 自定义扫码vm实例
@Consume('customScanVM') customScanVM: CustomScanViewModel;
@State scanSize: ScanSize = ScanS... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CustomScanCtrlComp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'currentBreakpoint' AST#expression#Right ) AST#decorator#Right currentBreakpoin... | @Component
export default struct CustomScanCtrlComp {
@StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM;
@Consume('subPageStack') subPageStack: NavPathStack;
@Consume('customScanVM') customScanVM: CustomScanViewModel;
@State scanSize: ScanSize = ScanSize.getInsta... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CustomScanCtrlComp.ets#L29-L47 | 0314a6db970bdf0c752d284023e34938cbc93805 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/DataImportExportService.ets | arkts | 数据导入导出服务类 | export class DataImportExportService {
private static instance: DataImportExportService;
private context: common.UIAbilityContext;
private constructor(context: common.UIAbilityContext) {
this.context = context;
}
public static getInstance(context: common.UIAbilityContext): DataImportExportService {
... | AST#export_declaration#Left export AST#class_declaration#Left class DataImportExportService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left DataImportExportService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Rig... | export class DataImportExportService {
private static instance: DataImportExportService;
private context: common.UIAbilityContext;
private constructor(context: common.UIAbilityContext) {
this.context = context;
}
public static getInstance(context: common.UIAbilityContext): DataImportExportService {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L82-L641 | 1bde3999a4743386c8ddebda4b7fbbbbd4391d12 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/GreetingGenerationService.ets | arkts | 联系人信息摘要 | export interface ContactSummary {
name: string;
age?: number;
gender: string;
relation: string;
occupation?: string;
interests?: string[];
personality?: string[];
favoriteFoods?: string[];
notes?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ContactSummary AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left age ? : AST#type_annotation#Le... | export interface ContactSummary {
name: string;
age?: number;
gender: string;
relation: string;
occupation?: string;
interests?: string[];
personality?: string[];
favoriteFoods?: string[];
notes?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L42-L52 | c148a328fb6435eec91c8a464f8cf3d352ef01d4 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Rect.ets | arkts | Create a new rectangle with the specified coordinates. Note: no range
checking is performed, so the caller must ensure that left <= right and
top <= bottom.
@param left The X coordinate of the left side of the rectangle
@param top The Y coordinate of the top of the rectangle
@param right The X coordinate of the ... | constructor(left?: number, top?: number, right?: number, bottom?: number, r?: MyRect) {
this.left = left == undefined ? 0 : left;
this.top = top == undefined ? 0 : top;
this.right = right == undefined ? 0 : right;
this.bottom = bottom == undefined ? 0 : bottom;
if (r != null || r != undefined) {
... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left left ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left top ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ... | constructor(left?: number, top?: number, right?: number, bottom?: number, r?: MyRect) {
this.left = left == undefined ? 0 : left;
this.top = top == undefined ? 0 : top;
this.right = right == undefined ? 0 : right;
this.bottom = bottom == undefined ? 0 : bottom;
if (r != null || r != undefined) {
... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Rect.ets#L41-L52 | f6ecf4097a721a013e8c5bee2737a5154f4f574b | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets | arkts | return | 抛出 | return Promise.reject({ error: efRcpError });
} | AST#method_declaration#Left return AST#ERROR#Left Promise . reject AST#ERROR#Right AST#parameter_list#Left ( AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left error AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : efRcpError } ) ; AST#ERROR#... | return Promise.reject({ error: efRcpError });
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L219-L220 | 69087ff343dbddaa12d17a053c35376954d737cc | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getFirstPartFrom | ================== 字符串处理方法 ==================
从指定的中文翻译中获取第一个分号前的部分(包含词性.意思,如: n.食物)
@param srcText 源文本
@returns 处理后的文本 | private static getFirstPartFrom(srcText: string): string {
const strComma: string = STR_COMMA_HALF;
const strComma2: string = STR_COMMA_FULL;
const strCommaSub: string = STR_COMMA_SUB_HALF;
const strCommaSub2: string = STR_COMMA_SUB_FULL;
let str: string = srcText;
const indexNoFound: number = ... | AST#method_declaration#Left private static getFirstPartFrom AST#parameter_list#Left ( AST#parameter#Left srcText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string... | private static getFirstPartFrom(srcText: string): string {
const strComma: string = STR_COMMA_HALF;
const strComma2: string = STR_COMMA_FULL;
const strCommaSub: string = STR_COMMA_SUB_HALF;
const strCommaSub2: string = STR_COMMA_SUB_FULL;
let str: string = srcText;
const indexNoFound: number = ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L172-L242 | 44c64dd1431a2f70f1f684ba540871475f4f592d | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/common/constant/CommonConstant.ets | arkts | Style constants that can be used by all modules | export class CommonConstants {
/**
* Full width.
*/
static readonly FULL_WIDTH: string = '100%';
/**
* Full height.
*/
static readonly FULL_HEIGHT: string = '100%';
/**
* Normal font weight.
*/
static readonly FONT_WEIGHT: number = 500;
/**
* Larger font weight.
*/
static rea... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Full width.
*/ AST#property_declaration#Left static readonly FULL_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '10... | export class CommonConstants {
static readonly FULL_WIDTH: string = '100%';
static readonly FULL_HEIGHT: string = '100%';
static readonly FONT_WEIGHT: number = 500;
static readonly FONT_WEIGHT_LARGE: number = 700;
static readonly MAIN_BOARD_WIDTH: string = '93.3%';
static readonly OP... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/common/constant/CommonConstant.ets#L19-L250 | cfd72a89b96996946078ba8f563763523e20d79c | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.