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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets | arkts | 获取问题类型
@param questionType
@returns | export function getQuestionType(questionType: QuestionTypeEnum): string {
if (questionType === QuestionTypeEnum.RADIO) {
return '单选';
}
if (questionType === QuestionTypeEnum.CHECK_BOX) {
return '多选';
}
if (questionType === QuestionTypeEnum.JUDGE) {
return '判断';
}
return '';
} | AST#export_declaration#Left export AST#function_declaration#Left function getQuestionType AST#parameter_list#Left ( AST#parameter#Left questionType : AST#type_annotation#Left AST#primary_type#Left QuestionTypeEnum AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type... | export function getQuestionType(questionType: QuestionTypeEnum): string {
if (questionType === QuestionTypeEnum.RADIO) {
return '单选';
}
if (questionType === QuestionTypeEnum.CHECK_BOX) {
return '多选';
}
if (questionType === QuestionTypeEnum.JUDGE) {
return '判断';
}
return '';
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets#L410-L421 | 31d23fa415b9842242ced0a950b5e09e80d7f4dd | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | decrypt | 解密,异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
@returns | static async decrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, symKey, params, transformation);
} | AST#method_declaration#Left static async decrypt AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey... | static async decrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, symKey, params, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L241-L244 | 4a6507788988ac5b82bc1c2476fcd65a1291cc82 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets | arkts | setCircleColor | Sets the one and ONLY color that should be used for this DataSet.
Internally, this recreates the colors array and adds the specified color.
@param color | public setCircleColor(color: number): void {
this.resetCircleColors();
this.mCircleColor = color;
this.mCircleColors.add(color);
} | AST#method_declaration#Left public setCircleColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | public setCircleColor(color: number): void {
this.resetCircleColors();
this.mCircleColor = color;
this.mCircleColors.add(color);
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets#L294-L298 | 19197aca2ac1a7247b04abf0c3fecd758a4780b8 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/model/ScaleModel.ets | arkts | ScaleModel | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Observed
export class ScaleModel {
/**
* scaleValue: 本次缩放因子,用于控制图片的大小显示
* lastValue:记录上次缩放完后的缩放因子
* defaultMaxScaleValue:默认的最大放大值
* defaultScaleValue:默认缩放值,1
*/
// 本次缩放因子,用于控制图片的大小显示
public scaleValue: number;
// 记录上次缩放完后的缩放因子
public lastValue: number;
// 最大放大值
public maxScaleValue: number... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ScaleModel AST#class_body#Left { /**
* scaleValue: 本次缩放因子,用于控制图片的大小显示
* lastValue:记录上次缩放完后的缩放因子
* defaultMaxScaleValue:默认的最大放大值
* defaultScaleValue:默认缩放值,1
*/ // 本次缩放因子,用于控制图片的大小显示 AST#property_declaratio... | @Observed
export class ScaleModel {
public scaleValue: number;
public lastValue: number;
public maxScaleValue: number;
public extraScaleValue: number;
public readonly defaultScaleValue: number = 1;
constructor(scaleValue: number = 1.0, lastValue: number = 1.0,
maxScaleValue:... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/model/ScaleModel.ets#L16-L55 | 67378a4a9fa06c462914a9aaf923f263e2736518 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取用户特定状态的梦想列表
@param userId 用户ID
@param status 状态
@returns 梦想列表 | export function getDreamsByStatus(userId: number, status: number): Promise<ApiResponse<Dream[]>> {
return request<ApiResponse<Dream[]>>(RequestMethod.GET, `/dreams/user/${userId}/status/${status}`);
} | AST#export_declaration#Left export AST#function_declaration#Left function getDreamsByStatus 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#Left status : AST#type_annotation#L... | export function getDreamsByStatus(userId: number, status: number): Promise<ApiResponse<Dream[]>> {
return request<ApiResponse<Dream[]>>(RequestMethod.GET, `/dreams/user/${userId}/status/${status}`);
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L436-L438 | 90342a930a0599329c298a77341801ba236491a6 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | generateKeyPair | 生成非对称密钥KeyPair,异步
@param algName 待生成对称密钥生成器的算法名称(RSA1024、RSA2048、等)。
@returns | static async generateKeyPair(algName: crypto.RSA_AlG = 'RSA1024|PRIMES_2'): Promise<cryptoFramework.KeyPair> {
return CryptoUtil.generateKeyPair(algName);
} | AST#method_declaration#Left static async generateKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . RSA_AlG AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'RSA1024|PRIMES_2' AST#e... | static async generateKeyPair(algName: crypto.RSA_AlG = 'RSA1024|PRIMES_2'): Promise<cryptoFramework.KeyPair> {
return CryptoUtil.generateKeyPair(algName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L188-L190 | 4c8542ff4e30c01721cd03ac176a75bf98b629ac | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets | arkts | drawValues | Loops over all Entrys and draws their values.
@param c | public abstract drawValues(): Paint[]; | AST#method_declaration#Left public abstract drawValues AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Paint [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | public abstract drawValues(): Paint[]; | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets#L148-L148 | 8e0bd404ebf44fff58da847fd0e142d61d4b2265 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Image/entry/src/main/ets/pages/example/ImageExample023.ets | arkts | getDrawableDescriptor | 辅助方法:获取DrawableDescriptor | private async getDrawableDescriptor(resource: Resource): Promise<DrawableDescriptor | undefined> {
const resManager = this.getUIContext().getHostContext()?.resourceManager;
if (!resManager) {
return undefined;
}
return (resManager.getDrawableDescriptor(resource.id)) as DrawableDescriptor;
} | AST#method_declaration#Left private async getDrawableDescriptor AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left... | private async getDrawableDescriptor(resource: Resource): Promise<DrawableDescriptor | undefined> {
const resManager = this.getUIContext().getHostContext()?.resourceManager;
if (!resManager) {
return undefined;
}
return (resManager.getDrawableDescriptor(resource.id)) as DrawableDescriptor;
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Image/entry/src/main/ets/pages/example/ImageExample023.ets#L87-L93 | d53d2991e2124b84106f4bf3dd717d6c7d8db26d | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/interceptions/InterceptorMgr.ets | arkts | runAsync | @deprecated
@param stackName
@param context
@param isPush
@param callback
@returns | public async runAsync(stackName: string, context: InterceptorInfo, isPush: boolean = false,
callback?: (it: IGlobalNavigateInterceptor) => void) {
return Promise.resolve(this.run(stackName, context, isPush, callback))
} | AST#method_declaration#Left public async runAsync AST#parameter_list#Left ( AST#parameter#Left stackName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left InterceptorI... | public async runAsync(stackName: string, context: InterceptorInfo, isPush: boolean = false,
callback?: (it: IGlobalNavigateInterceptor) => void) {
return Promise.resolve(this.run(stackName, context, isPush, callback))
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/interceptions/InterceptorMgr.ets#L106-L109 | 6e1185c767216eb8e9e108c429494fb43eb0dcd3 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets | arkts | checkSrcNull | Check whether the playback path is empty. | checkSrcNull(): boolean {
if (this.isLoading) {
return false;
}
if (this.homeTabModel.src.trim() === '') {
prompt.showToast({
duration: HomeConstants.DURATION,
message: $r('app.string.place_holder_src')
});
return false;
}
return true;
} | AST#method_declaration#Left checkSrcNull 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left ... | checkSrcNull(): boolean {
if (this.isLoading) {
return false;
}
if (this.homeTabModel.src.trim() === '') {
prompt.showToast({
duration: HomeConstants.DURATION,
message: $r('app.string.place_holder_src')
});
return false;
}
return true;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets#L150-L162 | 11d6f40180bd17688e12b0f3b8cc6f5602713a68 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationService.ets | arkts | getInstance | 获取单例实例 | public static getInstance(): NotificationService {
if (!NotificationService.instance) {
NotificationService.instance = new NotificationService();
}
return NotificationService.instance;
} | AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NotificationService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#exp... | public static getInstance(): NotificationService {
if (!NotificationService.instance) {
NotificationService.instance = new NotificationService();
}
return NotificationService.instance;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L58-L63 | a7ceecf28bba088ba5bb8161a743a92eec0ed06b | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/NavigationService.ets | arkts | 跳转并监听返回结果(使用 ArkUI promise 版本 pushDestinationByName)
@param {string} name - 路由名称
@param {Any} [params] - 跳转参数
@param {(info: PopInfo) => void} [onPop] - 返回结果回调(在目标页调用 pop(result) 时触发)
@returns {Promise<void>} 跳转完成 Promise | export function navigateToWithResult(name: string, params?: Any,
onPop?: (info: PopInfo) => void): Promise<void> {
if (requiresLogin(name)) {
const userState = getUserState();
if (!userState.isLoggedIn()) {
hilog.info(DOMAIN, "NavSvc", `[NavigationService] Intercepting route to ${name}, redirecting to... | AST#export_declaration#Left export AST#function_declaration#Left function navigateToWithResult AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params ? : AST#type_annotatio... | export function navigateToWithResult(name: string, params?: Any,
onPop?: (info: PopInfo) => void): Promise<void> {
if (requiresLogin(name)) {
const userState = getUserState();
if (!userState.isLoggedIn()) {
hilog.info(DOMAIN, "NavSvc", `[NavigationService] Intercepting route to ${name}, redirecting to... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L139-L169 | 76421691e730d242aa8ce5c8eca6be3dfccda505 | github | |
linhanlove/hormany-os-notion | a65f47bfc1a2bbce531b9af97831eb1ba934c2f8 | entry/src/main/ets/pages/auth/Login.ets | arkts | inputStyle | 输入框样式 | @Extend(TextInput) function inputStyle() {
.fontColor(StyleConstants.BASE_STYLE.fontColor)
.caretColor(StyleConstants.BASE_STYLE.fontColor)
.placeholderColor(StyleConstants.BASE_STYLE.fontColor)
.width(StyleConstants.FULL_WIDTH)
.height(StyleConstants.INPUT_HEIGHT)
.fontSize($r('app.float.font_size_18fp'))
... | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left TextInput AST#expression#Right ) AST#decorator#Right function inputStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST... | @Extend(TextInput) function inputStyle() {
.fontColor(StyleConstants.BASE_STYLE.fontColor)
.caretColor(StyleConstants.BASE_STYLE.fontColor)
.placeholderColor(StyleConstants.BASE_STYLE.fontColor)
.width(StyleConstants.FULL_WIDTH)
.height(StyleConstants.INPUT_HEIGHT)
.fontSize($r('app.float.font_size_18fp'))
... | https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/pages/auth/Login.ets#L152-L161 | 284e73821d8278051911fd94d6312c5c938ff7ee | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/ContactsPage.ets | arkts | deleteSelectedContacts | 删除选中的联系人 | private async deleteSelectedContacts(): Promise<void> {
try {
const selectedIds = Array.from(this.selectedContacts);
if (selectedIds.length === 0) return;
const deletedCount = await this.contactService.batchDeleteContacts(selectedIds);
if (deletedCount > 0) {
// 刷新列表
... | AST#method_declaration#Left private async deleteSelectedContacts 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#Ri... | private async deleteSelectedContacts(): Promise<void> {
try {
const selectedIds = Array.from(this.selectedContacts);
if (selectedIds.length === 0) return;
const deletedCount = await this.contactService.batchDeleteContacts(selectedIds);
if (deletedCount > 0) {
await t... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L131-L146 | 051f5bdde4e48907c6f59efb12ca28211a702ce1 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/toolbox/src/main/ets/model/Offset.ets | arkts | 偏移类型 | export interface Offset {
x: number;
y: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Offset AST#object_type#Left { AST#type_member#Left x : 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 y : AST#type_annotation#Left AST#primary_... | export interface Offset {
x: number;
y: number;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/Offset.ets#L19-L22 | ca50d5219d92d6216a2d20062a6cbaab6907b982 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringMapUtility.ets | arkts | / 与 Java interface MapTransform 等价 | export interface MapTransform {
transform(partStr: string | null): string | null;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MapTransform AST#object_type#Left { AST#type_member#Left transform AST#parameter_list#Left ( AST#parameter#Left partStr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left n... | export interface MapTransform {
transform(partStr: string | null): string | null;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringMapUtility.ets#L81-L83 | 969dedc018ab7fb008cc8c5e93a589740d9f531d | github | |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | common/search/src/main/ets/default/page/searchHeader.ets | arkts | SearchHeader | Search header component | @Component
export default struct SearchHeader {
@Link inputKeyword: string
@State placeholderSize: string = ''
@State placeholder: string = ''
@State icBackIsTouch: boolean = false;
@State cancelIsTouch: boolean = false;
build() {
Row() {
Image($r("app.media.ic_back"))
.width($r('app.floa... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct SearchHeader AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputKeyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AS... | @Component
export default struct SearchHeader {
@Link inputKeyword: string
@State placeholderSize: string = ''
@State placeholder: string = ''
@State icBackIsTouch: boolean = false;
@State cancelIsTouch: boolean = false;
build() {
Row() {
Image($r("app.media.ic_back"))
.width($r('app.floa... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/search/src/main/ets/default/page/searchHeader.ets#L28-L125 | 0d76207cd254c1c21c3e99035566f6fdb6b1bda5 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 联系人列表视图类型枚举 | export enum ContactListViewType {
LIST = 'list',
GRID = 'grid',
CARD = 'card'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ContactListViewType AST#enum_body#Left { AST#enum_member#Left LIST = AST#expression#Left 'list' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left GRID = AST#expression#Left 'grid' AST#expression#Right AST#enum_member#Right , AST#enum_memb... | export enum ContactListViewType {
LIST = 'list',
GRID = 'grid',
CARD = 'card'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L376-L380 | 778b79f6d71974a1cfc9b5033ff024967281cc3f | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets | arkts | 中文释义1 | export const titleCn2 = "item5"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left titleCn2 = AST#expression#Left "item5" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const titleCn2 = "item5"; | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L26-L26 | f41e34b1567ddec5244729c7787ffc062dc12dcc | github | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/viewmodel/AgreementViewModel.ets | arkts | getUrlByAgreementId | 根据协议 ID 获取 URL | private getUrlByAgreementId(): string {
return this.agreementId === 0 ? this.privacyUrl : this.userUrl;
} | AST#method_declaration#Left private getUrlByAgreementId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#mem... | private getUrlByAgreementId(): string {
return this.agreementId === 0 ? this.privacyUrl : this.userUrl;
} | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/viewmodel/AgreementViewModel.ets#L18-L20 | 85d17f1b9ae484e4cf522d9dcea3227dae27bb0d | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/products/entry/src/main/ets/common/WidgetUtil.ets | arkts | publishFormId | 发布公共事件跨进程传递卡片id | public static publishFormId(formId: string, isDelete: boolean) {
commonEventManager.publish(
WidgetUtil._formIdEventName,
{ data: formId, parameters: { isDelete } },
(err: BusinessError) => {
if (err) {
Logger.error(
TAG,
`Failed to publish common event. C... | AST#method_declaration#Left public static publishFormId AST#parameter_list#Left ( AST#parameter#Left formId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isDelete : AST#type_annotation#Left AST#primary_type#Left boolean ... | public static publishFormId(formId: string, isDelete: boolean) {
commonEventManager.publish(
WidgetUtil._formIdEventName,
{ data: formId, parameters: { isDelete } },
(err: BusinessError) => {
if (err) {
Logger.error(
TAG,
`Failed to publish common event. C... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/products/entry/src/main/ets/common/WidgetUtil.ets#L43-L58 | 3c647621ca4b73b5eb6f760a2b5499105a929731 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/pages/Index.ets | arkts | startAbilityQQApplication | 拉起方应用使用 startAbility 实现应用跳转 启动 QQApplication | startAbilityQQApplication(){
let context:common.UIAbilityContext =this.getUIContext().getHostContext() as common.UIAbilityContext;
let want:Want = {
// QQApplication 中配置的 uris 数据
uri:"http://www.dxin.com/qq"
}
context.startAbility(want)
.then(() => {
console.log(`dxin =>使用 sta... | AST#method_declaration#Left startAbilityQQApplication AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityConte... | startAbilityQQApplication(){
let context:common.UIAbilityContext =this.getUIContext().getHostContext() as common.UIAbilityContext;
let want:Want = {
uri:"http://www.dxin.com/qq"
}
context.startAbility(want)
.then(() => {
console.log(`dxin =>使用 startAbility 拉起QQ成功 `)
})... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/pages/Index.ets#L102-L115 | 0715839c59d245f6cac7f5abe709fce2510edb3b | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/LoginPage.ets | arkts | buildLoginButtons | 构建登录按钮区域
@returns {void} 无返回值 | @Builder
private buildLoginButtons(): void {
IBestButton({
text: $r("app.string.sms_login"),
type: "primary",
round: true,
btnWidth: P100,
onBtnClick: (): void => {
AuthNavigator.toSmsLogin();
}
});
SpaceVerticalXLarge();
IBestButton({
text: $r("app.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildLoginButtons AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_stat... | @Builder
private buildLoginButtons(): void {
IBestButton({
text: $r("app.string.sms_login"),
type: "primary",
round: true,
btnWidth: P100,
onBtnClick: (): void => {
AuthNavigator.toSmsLogin();
}
});
SpaceVerticalXLarge();
IBestButton({
text: $r("app.... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/LoginPage.ets#L86-L114 | 3f72212824c3f64f348543e54eddf7caa29b2720 | github |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets | arkts | buildOrderItem | 构建单个订单项 | @Builder
buildOrderItem(item: OrderItem) {
Column({ space: 6 }) {
this.renderOrderItem(item);
}
.backgroundColor('#ECFDFA')
.width('100%')
.height(230)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildOrderItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left OrderItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bo... | @Builder
buildOrderItem(item: OrderItem) {
Column({ space: 6 }) {
this.renderOrderItem(item);
}
.backgroundColor('#ECFDFA')
.width('100%')
.height(230)
} | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets#L190-L198 | 6b4d9085ef5a808317c18d36652ddfbc5ed6c83b | github |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/ApiService.ets | arkts | verifyUser | 验证用户是否存在,并获取用户基本信息(如密保问题)
@param username 用户名
@returns Promise with API response | static async verifyUser(username: string): Promise<ApiResponse> {
let httpRequest = http.createHttp()
try {
// 构建请求数据
let requestData: VerifyUserRequest = {
username: username
}
// 创建请求参数
const requestParams = new HttpRequestParams();
requestParams.method = http.Req... | AST#method_declaration#Left static async verifyUser AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | static async verifyUser(username: string): Promise<ApiResponse> {
let httpRequest = http.createHttp()
try {
let requestData: VerifyUserRequest = {
username: username
}
const requestParams = new HttpRequestParams();
requestParams.method = http.RequestMethod.POST;
... | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/ApiService.ets#L266-L302 | f93040ca6709f2c052905e601477ac1ffa36fc1a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets | arkts | pushData | 向列表追加数据 | public pushData(data: FlowItemContent | FlowItemContent[]): void {
if (Array.isArray(data)) {
this.momentList.push(...data);
} else {
this.momentList.push(data);
};
this.notifyDataAdd(this.momentList.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left FlowItemContent AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left FlowItemContent [ ] AST#array_type#Right AST#primary_type#Right AST#union_... | public pushData(data: FlowItemContent | FlowItemContent[]): void {
if (Array.isArray(data)) {
this.momentList.push(...data);
} else {
this.momentList.push(data);
};
this.notifyDataAdd(this.momentList.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets#L91-L98 | dcbdfcf3fe92622bc0d20ba859999f40b9d5cf80 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/utils/Helper.ets | arkts | TODO 工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export class Helper {
/**
* 检查API版本是否安全
* @param apiVersion API方法支持的最低版本
*/
static isApiSupported(apiVersion: number): boolean {
return deviceInfo.sdkApiVersion >= apiVersion;
}
/**
* 判断字符串是否为空(undefined、null)
* @param str 被检测的字符串
* @returns 是否为空
*/
static isNull(str: string | numb... | AST#export_declaration#Left export AST#class_declaration#Left class Helper AST#class_body#Left { /**
* 检查API版本是否安全
* @param apiVersion API方法支持的最低版本
*/ AST#method_declaration#Left static isApiSupported AST#parameter_list#Left ( AST#parameter#Left apiVersion : AST#type_annotation#Left AST#primary_type#Left numbe... | export class Helper {
static isApiSupported(apiVersion: number): boolean {
return deviceInfo.sdkApiVersion >= apiVersion;
}
static isNull(str: string | number | undefined | null): boolean {
return str === undefined || str === null;
}
static isNotNull(str: string | number | undefined | nul... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/utils/Helper.ets#L30-L294 | b70607de492133b13ed167528232328cde735b12 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/OffscreenCanvas.ets | arkts | 离屏画布类 | export class OffscreenCanvas {
settings: RenderingContextSettings = new RenderingContextSettings(true);
context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
// OffscreenCanvasRenderingContext2D入参分别是离屏画布的宽度,离屏画布的高度,用来配置OffscreenCanvasRenderingContext2D对象的参数
offContext: OffscreenCanvas... | AST#export_declaration#Left export AST#class_declaration#Left class OffscreenCanvas AST#class_body#Left { AST#property_declaration#Left settings : AST#type_annotation#Left AST#primary_type#Left RenderingContextSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#e... | export class OffscreenCanvas {
settings: RenderingContextSettings = new RenderingContextSettings(true);
context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(200, 200, this.settings);
year: number... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/OffscreenCanvas.ets#L19-L31 | 84915943ccc27ba0d41dc889884049a05ed1cfc9 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | isDrawHoleEnabled | returns true if the hole in the center of the pie-chart is set to be
visible, false if not
@return | public isDrawHoleEnabled(): boolean {
return this.mDrawHole;
} | AST#method_declaration#Left public isDrawHoleEnabled 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#membe... | public isDrawHoleEnabled(): boolean {
return this.mDrawHole;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L469-L471 | c8f2e57b197b9bc3de46e86dbd8e0f7afad4c030 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/CombinedChartModel.ets | arkts | setDrawValueAboveBar | If set to true, all values are drawn above their bars, instead of below
their top.
@param enabled | public setDrawValueAboveBar(enabled: boolean): void {
this.mDrawValueAboveBar = enabled;
} | AST#method_declaration#Left public setDrawValueAboveBar 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#... | public setDrawValueAboveBar(enabled: boolean): void {
this.mDrawValueAboveBar = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L189-L191 | 3864ba2e5e78ae0215bc0f52663f624aa8df3c19 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | cancel | 取消通知,通过通知ID和通知标签取消已发布的通知,若label为空表示取消与指定通知ID相匹配的已发布通知。
@param id 通知id
@param label 通知标签,默认为空。
@returns | static async cancel(id: number, label?: string): Promise<void> {
return notificationManager.cancel(id, label);
} | AST#method_declaration#Left static async cancel AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left label ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static async cancel(id: number, label?: string): Promise<void> {
return notificationManager.cancel(id, label);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L296-L298 | 416e72d75178334d686ecb51649877926c26e7a3 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/action/ToastUtil.ets | arkts | showToast | 弹出土司,默认时长为2s,距离底部默认为80vp
@param message 提示消息
@param options (显示时长、距离屏幕底部的位置、是否显示在应用之上) | static showToast(message: string | Resource, options?: ToastOptions) {
if (message || (typeof message === 'string' && message.length > 0)) {
options = ToastUtil.initToastDefault(options, 0);
let toastOptions = options as promptAction.ShowToastOptions;
toastOptions.message = message;
if (opti... | AST#method_declaration#Left static showToast AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ... | static showToast(message: string | Resource, options?: ToastOptions) {
if (message || (typeof message === 'string' && message.length > 0)) {
options = ToastUtil.initToastDefault(options, 0);
let toastOptions = options as promptAction.ShowToastOptions;
toastOptions.message = message;
if (opti... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/ToastUtil.ets#L46-L57 | bc119e9df2e95fdc8f4c2008fa3348de5d89663f | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/ToastUtil.ets | arkts | @Author csx
@DateTime 2024/1/24 19:31
@TODO ToastUtil 文本提示框工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui | export class ToastUtil {
/**
* 弹出文本消息提示框,默认时长为2s,距离底部默认为20vp
* @param msg 提示消息
* @param options: {duration:'',bottom:'',showMode:0} 提示参数duration为显示时长,bottom为距离底部位置,showMode设置弹窗是否显示在应用之上0内,1上
*/
static showToast(msg: ResourceStr, options?: toastOptions): void {
if (!options) {
options = new to... | AST#export_declaration#Left export AST#class_declaration#Left class ToastUtil AST#class_body#Left { /**
* 弹出文本消息提示框,默认时长为2s,距离底部默认为20vp
* @param msg 提示消息
* @param options: {duration:'',bottom:'',showMode:0} 提示参数duration为显示时长,bottom为距离底部位置,showMode设置弹窗是否显示在应用之上0内,1上
*/ AST#method_declaration#Left static sho... | export class ToastUtil {
static showToast(msg: ResourceStr, options?: toastOptions): void {
if (!options) {
options = new toastOptions();
}
promptAction.showToast({
message: msg,
duration: options.duration ? options.duration : Const.ANIMATION_DURATION,
bottom: options.bottom ? o... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/ToastUtil.ets#L26-L44 | 41a2e6a8ae546e30a410fa9ffeda44340eeb3391 | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/system/IBaseContentOptions.ets | arkts | 自定义内容区弹窗参数接口(该参数用于系统组件:CustomContentDialog)
@extends DialogOptions | export interface IBaseContentOptions extends IModalDialogOptions {
/**
* 自定义内容弹窗按钮【系统自定义弹窗CustomContentDialog的按钮样式】
* 最多支持4个按钮。
* @description1 ⚠️注意:只有输入框类型buttons为空时,会默认提供“取消+确认”按钮(系统样式)
*/
buttons?: Array<ResourceStr | ButtonOptions> //ButtonOptions[]; | ResourceStr
/**
* Sets the CustomContent... | AST#export_declaration#Left export AST#interface_declaration#Left interface IBaseContentOptions AST#extends_clause#Left extends IModalDialogOptions AST#extends_clause#Right AST#object_type#Left { /**
* 自定义内容弹窗按钮【系统自定义弹窗CustomContentDialog的按钮样式】
* 最多支持4个按钮。
* @description1 ⚠️注意:只有输入框类型buttons为空时,会默认提供“取消+确认”按钮(... | export interface IBaseContentOptions extends IModalDialogOptions {
buttons?: Array<ResourceStr | ButtonOptions>
controller?: CustomDialogController
primaryTitle?: ResourceStr;
secondaryTitle?: ResourceStr;
localizedContentAreaPadding?: LocalizedPadding;
contentAreaPadding?: Padding;
... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/system/IBaseContentOptions.ets#L8-L83 | df4e40943ac1ebbc2e58d5b30efde710ef2239ff | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets | arkts | rectValueToPixel | Transform a rectangle with all matrices.
@param r | public rectValueToPixel(r: MyRect) {
this.mMatrixValueToPx.mapRect(r);
this.mViewPortHandler.getMatrixTouch().mapRect(r);
this.mMatrixOffset.mapRect(r);
} | AST#method_declaration#Left public rectValueToPixel AST#parameter_list#Left ( AST#parameter#Left r : AST#type_annotation#Left AST#primary_type#Left MyRect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#ex... | public rectValueToPixel(r: MyRect) {
this.mMatrixValueToPx.mapRect(r);
this.mViewPortHandler.getMatrixTouch().mapRect(r);
this.mMatrixOffset.mapRect(r);
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L278-L282 | 9730b71c28a8df2d37a29859b91cc4108126cd84 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | create | 创建弹窗
@param options
@returns | abstract create(options: IBaseDialogOptions): D
/**
* 构建弹窗 可设置全部弹窗样式
* @param allOptions
* @returns
*/
build(allOptions?: T): D {
let options = this.builderOptions as T
if (allOptions) {
options = ObjectUtil.assignIgnoreTargetExist(allOptions, this.builderOptions) as T
if (!options.... | AST#method_declaration#Left abstract create AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IBaseDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Left D /**
* 构建弹窗 可设置全部弹窗样式
... | abstract create(options: IBaseDialogOptions): D
build(allOptions?: T): D {
let options = this.builderOptions as T
if (allOptions) {
options = ObjectUtil.assignIgnoreTargetExist(allOptions, this.builderOptions) as T
if (!options.uiContext && this.uiContext) {
options.uiContext = this.ui... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L28-L45 | ba660b51ca8325fed22ec01beff9e60306753158 | github |
CMoments/HarmonOS-arkTS-YunShangChuanDa.git | 895985b9b6013c906bf88eaea6e32e03ddf2a9db | project code/entry/src/main/ets/pages/DaibanPage9.ets | arkts | tabBar | 当前选中的tab为第几个 | @Builder
tabBar(item:TabModel){
Column(){
Text(item.name).fontColor((this.tabsModels[this.currentSelect].name==item.name?"#32303B":"#A2A2A2"))
.fontSize(20)
}
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBar AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left {... | @Builder
tabBar(item:TabModel){
Column(){
Text(item.name).fontColor((this.tabsModels[this.currentSelect].name==item.name?"#32303B":"#A2A2A2"))
.fontSize(20)
}
} | https://github.com/CMoments/HarmonOS-arkTS-YunShangChuanDa.git/blob/895985b9b6013c906bf88eaea6e32e03ddf2a9db/project code/entry/src/main/ets/pages/DaibanPage9.ets#L25-L31 | b25ab09b55c2c4a624678364acd8419fcf8e2b6a | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/path_sensitive/conditional_stmt/conditional_switch_002_F.ets | arkts | Introduction 路径敏感-区分switch
Level 3 | export function conditional_switch_002_F(taint_src : string) {
let data = ""
let n = 2;
switch (n) {
case 1:
data = taint_src
break
}
taint.Sink(data)
} | AST#export_declaration#Left export AST#function_declaration#Left function conditional_switch_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stat... | export function conditional_switch_002_F(taint_src : string) {
let data = ""
let n = 2;
switch (n) {
case 1:
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_002_F.ets#L7-L16 | a8a957fdd15922aca3162e380e7fdabb80e87e4f | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customstepper/src/main/ets/view/CategoryView.ets | arkts | Radio每个选项的间隔 | build() {
Column() {
Scroll() {
Column({ space: this.ITEM_SPACE }) {
ForEach(this.categoryArray, (item: string, index: number) => {
Row() {
Radio({ value: index.toString(), group: this.group })
.checked(this.checkedIndex === index)
.o... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_... | build() {
Column() {
Scroll() {
Column({ space: this.ITEM_SPACE }) {
ForEach(this.categoryArray, (item: string, index: number) => {
Row() {
Radio({ value: index.toString(), group: this.group })
.checked(this.checkedIndex === index)
.o... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customstepper/src/main/ets/view/CategoryView.ets#L32-L81 | 0b99ecd046aaa3345eaf0f1fd11746ef469c5112 | gitee | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/map_lib_func_002_F.ets | arkts | Introduction 库函数-map_set | export function map_lib_func_002_F(taint_src : string) {
let map = new Map<string,string>();
map.set("t","_");
taint.Sink(map);
} | AST#export_declaration#Left export AST#function_declaration#Left function map_lib_func_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function map_lib_func_002_F(taint_src : string) {
let map = new Map<string,string>();
map.set("t","_");
taint.Sink(map);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/map_lib_func_002_F.ets#L7-L11 | 1e3e6b2bebbfe3171848bca1804eb7c9358002ef | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/Log.ets | arkts | showError | Outputs error-level logs.
@param tag Identifies the log tag.
@param format Indicates the log format string.
@param args Indicates the log parameters.
@since 7 | static showError(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.ERROR)) {
hilog.error(DOMAIN, tag, format, args);
}
} | AST#method_declaration#Left static showError AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static showError(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.ERROR)) {
hilog.error(DOMAIN, tag, format, args);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/Log.ets#L73-L77 | ba7fbe12a08bea9ec069ab03dd63ee1f1c4790d6 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | spinkit/src/main/ets/components/SpinR.ets | arkts | SpinR | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01 | @ComponentV2
export struct SpinR {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.2
@Local scale1: number = 0;
@Local scale2: number = 0;
@Local scale3: number = 0;
@Local scale4: number = 0;
@Local scale5: number = 0;
@Local ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinR AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinR {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.2
@Local scale1: number = 0;
@Local scale2: number = 0;
@Local scale3: number = 0;
@Local scale4: number = 0;
@Local scale5: number = 0;
@Local ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinR.ets#L22-L312 | e64f2740dd4efb81810be64c3fc70cab9d7e4636 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/FileUtil.ets | arkts | Select a picture from the gallery.
@returns uri The uri for the selected file. | export async function fileSelect(): Promise<Array<string>> {
let imgUri: Array<string> = [];
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 5;
let photoPicker = new photoAc... | AST#export_declaration#Left export AST#function_declaration#Left async function fileSelect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Ar... | export async function fileSelect(): Promise<Array<string>> {
let imgUri: Array<string> = [];
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 5;
let photoPicker = new photoAc... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/FileUtil.ets#L24-L42 | 11565247170d7159ee135ad1b58f02e99ebae669 | gitee | |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/viewmodel/Message/MessageDataSource.ets | arkts | get | to make names consistent | public get(index: number): Message {
return this.sortedMessages.getValueAt(index) || nullMessage;
} | AST#method_declaration#Left public get AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Righ... | public get(index: number): Message {
return this.sortedMessages.getValueAt(index) || nullMessage;
} | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Message/MessageDataSource.ets#L41-L43 | 772ceba63f0d7a91c7bf2c3068a614502a1d37c1 | github |
Huarrrr/MiShop_HarmonyOS.git | a94d941f50550522c8324416afe4551ed4a2df93 | entry/src/main/ets/widgets/PageLoading.ets | arkts | PageLoading | 带状态的页面容器 | @Component
export struct PageLoading {
@Link loadState: LoadState;
onReload?: () => void;
@Link showLoading: boolean;
@BuilderParam content: () => void;
build() {
Stack() {
if (this.loadState === LoadState.LOADING) {
MaterialProgressBar({ style: MaterialProgressStyle.MaterialCircular,
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageLoading AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right loadState : AST#type_annotation#Left AST#primary_type#Left LoadState AST#primary_type#Right AST#type_an... | @Component
export struct PageLoading {
@Link loadState: LoadState;
onReload?: () => void;
@Link showLoading: boolean;
@BuilderParam content: () => void;
build() {
Stack() {
if (this.loadState === LoadState.LOADING) {
MaterialProgressBar({ style: MaterialProgressStyle.MaterialCircular,
... | https://github.com/Huarrrr/MiShop_HarmonyOS.git/blob/a94d941f50550522c8324416afe4551ed4a2df93/entry/src/main/ets/widgets/PageLoading.ets#L11-L85 | 7cc37da51b46b997d44b8ac54ab6a355949fd99b | github |
sRect/Harmony-Arkts-todolist.git | d854c95e96ec2ab8aef0f829a8b7e0a57dd3ab34 | entry/src/main/ets/pages/Index.ets | arkts | onDidBuild | 自定义组件的build()函数之后执行。 不建议在onDidBuild函数中更改状态变量、使用animateTo等功能,这可能会导致不稳定的UI表现 | onDidBuild(): void {
console.info('onDidBuild');
} | AST#method_declaration#Left onDidBuild AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Le... | onDidBuild(): void {
console.info('onDidBuild');
} | https://github.com/sRect/Harmony-Arkts-todolist.git/blob/d854c95e96ec2ab8aef0f829a8b7e0a57dd3ab34/entry/src/main/ets/pages/Index.ets#L84-L86 | 246458cd2aece24e9fde97639d403eb396d3a07c | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/user/User.ets | arkts | SNS登录类型 | export enum SnsOneType {
WECHAT = "wechat"
} | AST#export_declaration#Left export AST#enum_declaration#Left enum SnsOneType AST#enum_body#Left { AST#enum_member#Left WECHAT = AST#expression#Left "wechat" AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right | export enum SnsOneType {
WECHAT = "wechat"
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/user/User.ets#L106-L108 | 11896c149c3ea7978af325d259df64207151d2c5 | github | |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/http/apiService.ets | arkts | 请求首页数据-axios客户端请求
@param date
@returns | export function getHomeListAxios(date: string = "") {
return axiosClient.get<HomeModel>({
url: baseUrl + "api/v2/feed",
params: { "date": date },
showLoading: true
// headers: { "Accept": "application/json" } as AxiosRequestHeaders
})
} | AST#export_declaration#Left export AST#function_declaration#Left function getHomeListAxios AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right ) AST#pa... | export function getHomeListAxios(date: string = "") {
return axiosClient.get<HomeModel>({
url: baseUrl + "api/v2/feed",
params: { "date": date },
showLoading: true
})
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/http/apiService.ets#L31-L38 | b56355d43f58e8defa809d4aa001bff2ea8f5e3b | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | getFileExtention | 根据文件名获取文件后缀
@param fileName 例如: test.txt test.doc
@returns | static getFileExtention(fileName: string) {
if (Helper.isNotEmpty(fileName) && fileName.includes(".")) {
return fileName.substring(fileName.lastIndexOf(".") + 1);
}
return '';
} | AST#method_declaration#Left static getFileExtention AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement... | static getFileExtention(fileName: string) {
if (Helper.isNotEmpty(fileName) && fileName.includes(".")) {
return fileName.substring(fileName.lastIndexOf(".") + 1);
}
return '';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L303-L308 | 34058d642c4981da18107c52cfb8424e052c8b9d | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Sandbox Operations
Checks if a file exists in sandbox.
@param file_name The file name.
@returns True if exist, false otherwise. | export function sandbox_access(file_name: string, context_filesDir?: string) {
let filesDir: string = context_filesDir || meowContext().filesDir;
let full_file_directory = filesDir + '/' + file_name;
try {
return fs.accessSync(full_file_directory);
} catch (error) {
return false;
}
} | AST#export_declaration#Left export AST#function_declaration#Left function sandbox_access AST#parameter_list#Left ( AST#parameter#Left file_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDir ? : AST#type_... | export function sandbox_access(file_name: string, context_filesDir?: string) {
let filesDir: string = context_filesDir || meowContext().filesDir;
let full_file_directory = filesDir + '/' + file_name;
try {
return fs.accessSync(full_file_directory);
} catch (error) {
return false;
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L309-L317 | db5d7cbaed28bdafe6cc986742fb70e4d2744dbe | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ClickResponseOptimization/entry/src/main/ets/pages/CameraOptPage.ets | arkts | onPageHide | [Start release_camera] Trigger once every time the camera page is hidden. | onPageHide() {
setTimeout(this.releaseCamera, 200);
} | AST#method_declaration#Left onPageHide AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left setTimeout ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . releaseCamera AST#member_expression#Right AST#ex... | onPageHide() {
setTimeout(this.releaseCamera, 200);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/pages/CameraOptPage.ets#L37-L39 | 34856c6e8539900450789d318b7987403627ae8d | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/CombinedChartRenderer.ets | arkts | drawData | @Override | public drawData(c: CanvasRenderingContext2D): void {
for (let index = 0; index < this.mRenderers.length(); index++) {
this.mRenderers.get(index).drawData(c);
}
} | AST#method_declaration#Left public drawData AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D 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#p... | public drawData(c: CanvasRenderingContext2D): void {
for (let index = 0; index < this.mRenderers.length(); index++) {
this.mRenderers.get(index).drawData(c);
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/CombinedChartRenderer.ets#L100-L104 | 4a514b33fc426b2c6a49114456853f78ce7e93f1 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | pushData | 插入数据函数 | public pushData(data: ChatMessage): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ChatMessage 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_typ... | public pushData(data: ChatMessage): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L21-L24 | 1b7594c0dec4d3eaad947eb73b36e956e140a4d2 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSASync.ets | arkts | verifyPKCS1 | 验签-PKCS1
@param signStr 已签名的字符串
@param verifyStr 需要验签的字符串
@param pubKey RSA公钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@param isPem 秘钥是否为pem格式 - 默认为false
@returns 验签结果OutDTO对象,其中Msg为验签结果 | static verifyPKCS1(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string {
return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024, keyCoding,
dataCoding, ... | AST#method_declaration#Left static verifyPKCS1 AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | static verifyPKCS1(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string {
return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024, keyCoding,
dataCoding, ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L210-L214 | e6004697304cf8933c58f28cfd85874a868d11b6 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets | arkts | registerDataChangeListener | 为LazyForEach组件向其数据源处添加listener监听。
@param {DataChangeListener} listener - 监听对象。 | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
console.info('add listener');
this.listeners.push(listener);
}
} | AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef... | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
console.info('add listener');
this.listeners.push(listener);
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L53-L58 | ba7e85146f64094e8a4074ce323ae65ba7638ad2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets | arkts | getCurrentTime | 获取当前时间 | static getCurrentTime(): string {
const now = new Date();
const currentYear: number = now.getFullYear();
let currentMonth: number = now.getMonth() + 1;
let currentDay: number = now.getDate();
return `${currentYear}-${currentMonth}-${currentDay}`;
} | AST#method_declaration#Left static getCurrentTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left n... | static getCurrentTime(): string {
const now = new Date();
const currentYear: number = now.getFullYear();
let currentMonth: number = now.getMonth() + 1;
let currentDay: number = now.getDate();
return `${currentYear}-${currentMonth}-${currentDay}`;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets#L96-L102 | 23323ba78ac7f9d68de7659a45dcaaac6165760e | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets | arkts | WaterFlowView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct WaterFlowView {
@Link _position: Position;
private componentKey: string;
@State minSize: number = 50
@State maxSize: number = 100
@State fontSize: number = 24
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
scroller: Scroller = new Scroller()... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WaterFlowView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_a... | @Component
export struct WaterFlowView {
@Link _position: Position;
private componentKey: string;
@State minSize: number = 50
@State maxSize: number = 100
@State fontSize: number = 24
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
scroller: Scroller = new Scroller()... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets#L16-L38 | e935f64c462f252cde8bd2d5d1e41997fad1f9bc | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | handleTabChanged | 切换 Tab 时更新索引
@param {number} index - 选中的索引
@returns {void} 无返回值 | handleTabChanged(index: number): void {
this.updateCurrentPage(index);
} | AST#method_declaration#Left handleTabChanged AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | handleTabChanged(index: number): void {
this.updateCurrentPage(index);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L39-L41 | 4ea011029b28102d9cceb463e6d77673cdffdea3 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index_lite.ets | arkts | add_index_string_full | Pushes a timestamp to the correct position of values of str (keys).
@param str the keys.
@param timestamp the timestamp. | static add_index_string_full(str: string, timestamp: number) {
const target_year: number = new Date(timestamp).getUTCFullYear();
const target_month: number = new Date(timestamp).getUTCMonth() + 1;
if (index_file_name_of_month(target_year, target_month) != bunch_of_history_index_lite.this_file_name()) {
... | AST#method_declaration#Left static add_index_string_full AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AS... | static add_index_string_full(str: string, timestamp: number) {
const target_year: number = new Date(timestamp).getUTCFullYear();
const target_month: number = new Date(timestamp).getUTCMonth() + 1;
if (index_file_name_of_month(target_year, target_month) != bunch_of_history_index_lite.this_file_name()) {
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L139-L162 | 21b3f11728d66788b884bfab44c6f2952692beb1 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.atomicservice.InterstitialDialogAction.d.ets | arkts | Defines the properties required by the dialog.
@interface DialogOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare interface DialogOptions {
/**
* The UIContext required by the dialog.
*
* @type { UIContext }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
uiContext: UIContext;
/**
* The type of the bottom offset.
*
* @type { ?B... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface DialogOptions AST#object_type#Left { /**
* The UIContext required by the dialog.
*
* @type { UIContext }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since ... | export declare interface DialogOptions {
uiContext: UIContext;
bottomOffsetType?: BottomOffset;
title?: ResourceStr;
subtitle?: ResourceStr;
titleColor?: ResourceStr | Color;
subtitleColor?: ResourceStr | Color;
backgroundImage?: Resource;
foregrou... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.InterstitialDialogAction.d.ets#L106-L215 | ffa8b261b703f7d01e3553d092c4cfa784a5d367 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/SimpleAIService.ets | arkts | buildGreetingPrompt | 构建祝福语生成提示词 | private buildGreetingPrompt(params: GenerationParams): string {
const greetingDesc = params.greetingDescription || '';
const targetWordCount = params.targetWordCount || 0;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] buildGreetingPrompt - Received params: greetingDescr... | AST#method_declaration#Left private buildGreetingPrompt AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GenerationParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left s... | private buildGreetingPrompt(params: GenerationParams): string {
const greetingDesc = params.greetingDescription || '';
const targetWordCount = params.targetWordCount || 0;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[SimpleAIService] buildGreetingPrompt - Received params: greetingDescr... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L418-L571 | 285559b6e45678f7d530298dbaa1d0fa681437f9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index_backup.ets | arkts | saveNotificationSettings | 保存通知设置 | private async saveNotificationSettings(): Promise<void> {
try {
// 暂时使用简化的保存方法,避免类型不匹配
console.log('[Settings] Notification settings saved successfully', this.notificationSettings);
promptAction.showToast({
message: '设置已保存',
duration: 1000
});
} catch (error) {
cons... | AST#method_declaration#Left private async saveNotificationSettings 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#... | private async saveNotificationSettings(): Promise<void> {
try {
console.log('[Settings] Notification settings saved successfully', this.notificationSettings);
promptAction.showToast({
message: '设置已保存',
duration: 1000
});
} catch (error) {
console.error('[Settings] ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1100-L1115 | d9aaffc64883439694dae490e430b58eb31f181f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileItemModel.ets | arkts | FileItem type.
@param fileName
@param filePath | export class FileItem {
fileName: string;
filePath: string;
constructor(fileName: string, filePath: string) {
this.fileName = fileName;
this.filePath = filePath;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class FileItem AST#class_body#Left { AST#property_declaration#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left filePath : AST... | export class FileItem {
fileName: string;
filePath: string;
constructor(fileName: string, filePath: string) {
this.fileName = fileName;
this.filePath = filePath;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileItemModel.ets#L22-L30 | eb390e55396482b501cb60c690b4821bde3e302a | gitee | |
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/pages/学习/40.生命周期.ets | arkts | onBackPress | 对返回键进行监听 | onBackPress(): boolean | void {
router.back()
return true
} | AST#method_declaration#Left onBackPress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left void AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { A... | onBackPress(): boolean | void {
router.back()
return true
} | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/40.生命周期.ets#L35-L38 | 318124ffc62d2f2d0e16d3c69df3ba3372adc717 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/form.ets | arkts | submitForm | 提交表单 | private submitForm() {
if (!this.validateForm()) {
return
}
this.isSubmitting = true
// 模拟API调用
setTimeout(() => {
this.isSubmitting = false
this.submitSuccess = true
// 实际应用中这里可以调用API提交数据
console.log('表单提交成功:', JSON.stringify(this.formData))
}, 1500)
} | AST#method_declaration#Left private submitForm AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression... | private submitForm() {
if (!this.validateForm()) {
return
}
this.isSubmitting = true
setTimeout(() => {
this.isSubmitting = false
this.submitSuccess = true
console.log('表单提交成功:', JSON.stringify(this.formData))
}, 1500)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/form.ets#L204-L218 | a5806f65067406a8a4c3198cae2976bdc6658375 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets | arkts | getLunarDayColor | 获取日期农历字体颜色(仅用于月视图和周视图)
@param day 日期信息
@param month 月
@param currentSelectDay 当前选择的日期
@param calendarViewType 日历视图类型
@param CalendarStyle 自定义日历样式
@returns 返回颜色 | static getLunarDayColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType,
CalendarStyle: CalendarStyle): Color | number | string | Resource {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month &&
... | AST#method_declaration#Left static getLunarDayColor AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left Day AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | static getLunarDayColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType,
CalendarStyle: CalendarStyle): Color | number | string | Resource {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month &&
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets#L62-L80 | a8b1f260d34e69d9072ca0372700bcaa874e6314 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/digitalscrollanimation/src/main/ets/pages/DigitalScrollExample.ets | arkts | DigitalScrollExampleComponent | 功能描述: 本示例主要介绍了数字滚动动效的实现方案。 该方案多用于数字刷新,例如页面刷新抢票数量等场景。
推荐场景: 用于数字刷新,例如页面刷新抢票数量等场景
核心组件:
1. DigitalScrollDetail
实现步骤:
1. 通过双重ForEach循环分别横向、纵向渲染数字。
2. 通过Math.random()生成随机数,并更新到currentData数组中。
3. 使用显示动画animateTo,对currentData数组中的每个数字执行不同的滚动动效。
4. 设置数字所在容器属性.clip(true),将多余的数字裁剪。 | @Component
export struct DigitalScrollExampleComponent {
private scroller: Scroller = new Scroller(); // Scroller对象
@State data: number[] = [1, 2, 3, 4, 5, 6]; // 数据项
@State isRefresh: boolean = false;
build() {
Column({ space: STYLE_CONFIG.ITEM_GUTTER }) {
// 下拉刷新组件
Refresh({ refreshing: $$thi... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DigitalScrollExampleComponent AST#component_body#Left { AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#e... | @Component
export struct DigitalScrollExampleComponent {
private scroller: Scroller = new Scroller();
@State data: number[] = [1, 2, 3, 4, 5, 6];
@State isRefresh: boolean = false;
build() {
Column({ space: STYLE_CONFIG.ITEM_GUTTER }) {
Refresh({ refreshing: $$this.isRefresh }) {
thi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/digitalscrollanimation/src/main/ets/pages/DigitalScrollExample.ets#L34-L92 | 67851237ed41c1aaed582d1aba2815d4edea73af | gitee |
mhtcgr/ToDoList_For_Harmony.git | 356d4c9a507205f02870e970203022a380c8a2a1 | entry/src/main/ets/model/userModel.ets | arkts | deletePreferences | 删除用户首选项 | async deletePreferences() {
try {
await preferences.deletePreferences(context, CommonConstants.PREFERENCES_NAME);
Logger.info(CommonConstants.TAG, 'Preferences have been deleted successfully.');
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to delete preferences, Cause: ${err}`);
... | AST#method_declaration#Left async deletePreferences AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A... | async deletePreferences() {
try {
await preferences.deletePreferences(context, CommonConstants.PREFERENCES_NAME);
Logger.info(CommonConstants.TAG, 'Preferences have been deleted successfully.');
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to delete preferences, Cause: ${err}`);
... | https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L70-L77 | 20032f76d9f7743000eed883d03cc3941a944bca | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/media/MediaManager.ets | arkts | getPlayerState | 获取播放状态 | getPlayerState(): MediaPlayerState {
return { ...this.playerState };
} | AST#method_declaration#Left getPlayerState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MediaPlayerState AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object... | getPlayerState(): MediaPlayerState {
return { ...this.playerState };
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/media/MediaManager.ets#L69-L71 | 691134280706097b6455f1f911e601e1d45187a4 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets | arkts | aboutToDisappear | 当controller对应的NodeContainer在Disappear的时候进行回调 | aboutToDisappear() {
console.info('aboutToDisappear');
} | AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_... | aboutToDisappear() {
console.info('aboutToDisappear');
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets#L71-L73 | 3e8f1fe478b67acf8860c8f0c8854a34ab995d41 | gitee |
yongoe1024/RdbPlus.git | 4a3fc04ba5903bc1c1b194efbc557017976909dc | entry/src/main/ets/rdb/MapperMultiple.ets | arkts | 多数据源示例 | export class MapperMultiple {
private static mapper1: BaseMapper<Employee>
private static mapper2: BaseMapper<Employee>
// 单例模式 db1
static getInstance1DB() {
if (!MapperMultiple.mapper1) {
MapperMultiple.mapper1 = BaseMapper.build<Employee>({
class: Employee,
config: {
name:... | AST#export_declaration#Left export AST#class_declaration#Left class MapperMultiple AST#class_body#Left { AST#property_declaration#Left private static mapper1 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseMapper AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Employe... | export class MapperMultiple {
private static mapper1: BaseMapper<Employee>
private static mapper2: BaseMapper<Employee>
static getInstance1DB() {
if (!MapperMultiple.mapper1) {
MapperMultiple.mapper1 = BaseMapper.build<Employee>({
class: Employee,
config: {
name: 'RdbTest1.... | https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/entry/src/main/ets/rdb/MapperMultiple.ets#L8-L39 | ea369f93def8490c915947207cb206021c0c8417 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoHelper.ets | arkts | toHexWithPaddingZero | 补零操作 | static toHexWithPaddingZero(val: bigint) {
let length = 64;
let c1x = val.toString(16);
if (c1x.length > length) {
return c1x;
}
let padLength = length - c1x.length;
let returnVal = '';
for (let i = 0; i < padLength; i++) {
returnVal += '0'
}
return returnVal += c1x;
} | AST#method_declaration#Left static toHexWithPaddingZero AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left bigint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_decl... | static toHexWithPaddingZero(val: bigint) {
let length = 64;
let c1x = val.toString(16);
if (c1x.length > length) {
return c1x;
}
let padLength = length - c1x.length;
let returnVal = '';
for (let i = 0; i < padLength; i++) {
returnVal += '0'
}
return returnVal += c1x;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoHelper.ets#L167-L179 | a9a396608e6a6f69a0249a6d58098bab20ac34ff | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/imperativedynamiclayouts/src/main/ets/view/ImperativeView.ets | arkts | ImperativeViewComponent | 功能描述: 本实例主要讲解如何使用ArkUI的FrameNode扩展实现动态布局类框架。
推荐场景: 需要使用动态布局的场景
核心组件:
1. FrameNode
2. NodeContainer组件
实现步骤:
1. 定义DSL,DSL一般会使用JSON、XML等数据交换格式来描述UI。
2. 定义相应数据结构用于接收UI描述数据。
3. 自定义DSL解析逻辑,且使用carouselNodes保存轮播图节点,方便后续操作节点更新
4. 使用NodeContainer组件占位,将创建的组件加载到页面中。 | @Component
export struct ImperativeViewComponent {
controller: ImperativeController = new ImperativeController();
build() {
Column() {
NodeContainer(this.controller)
}
.height('100%')
.width('100%')
.backgroundColor(Color.Black)
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImperativeViewComponent AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left ImperativeController AST#primary_type#Right AST#type_annotation#Right = AST#e... | @Component
export struct ImperativeViewComponent {
controller: ImperativeController = new ImperativeController();
build() {
Column() {
NodeContainer(this.controller)
}
.height('100%')
.width('100%')
.backgroundColor(Color.Black)
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/imperativedynamiclayouts/src/main/ets/view/ImperativeView.ets#L158-L170 | f2e7432065765071b27e64939fc08390ae2fcf93 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets | arkts | loadFile | 加载文件内容并设置状态 | loadFile(fileUri: string, callback: (content: string) => void) {
workerPort.postMessage({ type: 'loadFile', fileUri: fileUri });
workerPort.onmessage = (e: MessageEvents) => {
const response: TlsTwoWayMessage = e.data;
// 根据返回的字段判断:若有 caContent、certContent 或 privateKeyContent,则调用回调
if (respons... | AST#method_declaration#Left loadFile AST#parameter_list#Left ( AST#parameter#Left fileUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left (... | loadFile(fileUri: string, callback: (content: string) => void) {
workerPort.postMessage({ type: 'loadFile', fileUri: fileUri });
workerPort.onmessage = (e: MessageEvents) => {
const response: TlsTwoWayMessage = e.data;
if (response.type === 'fileLoaded') {
if (response.caContent) {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets#L308-L329 | 3cf3760ac374e8d8c16e7c070e1ebffd253fe9dd | gitee |
shubai-xixi/DistributeNewsArkts.git | 7a527c5f4121612c8070d809824b0f2615d1b238 | entry/src/main/ets/model/NewsData.ets | arkts | 先定义接口(统一数据结构) | export interface NewData {
newsId: string;
title: string;
newsType: string;
imgUrl: Resource;
reads: string;
likes: string;
content: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NewData AST#object_type#Left { AST#type_member#Left newsId : 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 title : AST#type_annotation#Left AS... | export interface NewData {
newsId: string;
title: string;
newsType: string;
imgUrl: Resource;
reads: string;
likes: string;
content: string;
} | https://github.com/shubai-xixi/DistributeNewsArkts.git/blob/7a527c5f4121612c8070d809824b0f2615d1b238/entry/src/main/ets/model/NewsData.ets#L2-L10 | 83136335f7e995f006c86a5ff3160f5a58364cf6 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/base/OutDTO.ets | arkts | ErrorByDataRow | 失败-包含单行数据
@param msg 提示消息
@param dataRow 单行数据
@returns | static ErrorByDataRow<T>(msg: string, dataRow: T): OutDTO<T> {
let dto = new OutDTO<T>(false, msg, dataRow, [], 400);
return dto;
} | AST#method_declaration#Left static ErrorByDataRow AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parame... | static ErrorByDataRow<T>(msg: string, dataRow: T): OutDTO<T> {
let dto = new OutDTO<T>(false, msg, dataRow, [], 400);
return dto;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/base/OutDTO.ets#L112-L115 | 81ee5e801aa1b2e5fdf3f596360aeef77588c7f3 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/init_process.ets | arkts | clear_profile | Delete Profile package | function clear_profile(context: common.UIAbilityContext) {
try {
sandbox_unlink('profile.zip', context.filesDir);
} catch (e) {
console.error('[Index] unlink profile.zip! ' + e);
}
} | AST#function_declaration#Left function clear_profile AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#... | function clear_profile(context: common.UIAbilityContext) {
try {
sandbox_unlink('profile.zip', context.filesDir);
} catch (e) {
console.error('[Index] unlink profile.zip! ' + e);
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L199-L205 | c1e76df95bf26cb06930e7c4948c4bf75913e4b4 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LRUCacheUtil.ets | arkts | getCapacity | 获取当前缓冲区的容量。
@returns | public getCapacity(): number {
return this.lruCache.getCapacity();
} | AST#method_declaration#Left public getCapacity AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_express... | public getCapacity(): number {
return this.lruCache.getCapacity();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LRUCacheUtil.ets#L90-L92 | f01e9b21d044011cc18cad2c24539403db6ce1a0 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getStringValue | 获取指定资源对应的字符串
@param resId 资源ID值/资源信息 | static async getStringValue(resId: number | Resource): Promise<string> {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getStringValue(resId);
} else {
return ResUtil.getResourceManager().getStringValue(resId);
}
} | AST#method_declaration#Left static async getStringValue AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#paramet... | static async getStringValue(resId: number | Resource): Promise<string> {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getStringValue(resId);
} else {
return ResUtil.getResourceManager().getStringValue(resId);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L113-L119 | e89434cd12f6c80f611ad832957c02b73ddf93f7 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/control_flow/loop_stmt/dowhile_body_002_F.ets | arkts | Introduction 循环结构-dowhile | export function dowhile_body_002_F(taint_src : string) {
let clean = ""
let _t = taint_src;
let i = 2;
do {
clean = clean + "_"
i--;
} | AST#export_declaration#Left export AST#function_declaration#Left function dowhile_body_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function dowhile_body_002_F(taint_src : string) {
let clean = ""
let _t = taint_src;
let i = 2;
do {
clean = clean + "_"
i--;
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/dowhile_body_002_F.ets#L6-L13 | a6731dcb92d86cc5addff70760b9b617950fdabb | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/SettingPage.ets | arkts | 功能菜单文本 | build() {
Row() {
Row() {
Image(this.image)
.width($r('app.integer.setting_menu_width'))
.height($r('app.integer.setting_menu_width'))
.objectFit(ImageFit.Contain)
Text(this.text)
.fontSize($r('app.integer.setting_menu_font_size'))
.fontColor($... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_ele... | build() {
Row() {
Row() {
Image(this.image)
.width($r('app.integer.setting_menu_width'))
.height($r('app.integer.setting_menu_width'))
.objectFit(ImageFit.Contain)
Text(this.text)
.fontSize($r('app.integer.setting_menu_font_size'))
.fontColor($... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/SettingPage.ets#L170-L201 | 8d6ab40c55b971d5a60c3ef5e8a6501a9e854b80 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | getStatusBarHeight | 获取状态栏的高度,单位为px。
@returns | static getStatusBarHeight(uiContext?: common.UIAbilityContext): number {
try {
if (!uiContext) {
uiContext = DialogHelper.getUIAbilityContext();
}
let height = uiContext.windowStage.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
.topRect.height;
... | AST#method_declaration#Left static getStatusBarHeight AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_... | static getStatusBarHeight(uiContext?: common.UIAbilityContext): number {
try {
if (!uiContext) {
uiContext = DialogHelper.getUIAbilityContext();
}
let height = uiContext.windowStage.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
.topRect.height;
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L150-L165 | 82a93bdcfd5a8db2fc1de66350d5380bd713950a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets | arkts | getRandomFileName | 根据时间生成随机文件名
@param filePrefix 文件名前缀
@param fileSuffix 文件名后缀 | getRandomFileName(filePrefix: string, fileSuffix: string) {
let dateTimeUtil = new DateTimeUtil()
return filePrefix + `${dateTimeUtil.getDate()}_${dateTimeUtil.getTime()}` + fileSuffix
} | AST#method_declaration#Left getRandomFileName AST#parameter_list#Left ( AST#parameter#Left filePrefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileSuffix : AST#type_annotation#Left AST#primary_type#Left string AST#p... | getRandomFileName(filePrefix: string, fileSuffix: string) {
let dateTimeUtil = new DateTimeUtil()
return filePrefix + `${dateTimeUtil.getDate()}_${dateTimeUtil.getTime()}` + fileSuffix
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets#L249-L252 | aa283aada6717fb59e87202ce3db5ae3e56ba089 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/expression/special_expression/nullish_coalescing_002_F.ets | arkts | Introduction 空合并运算符 | export function nullish_coalescing_002_F(taint_src : string) {
let _t = taint_src;
let clean = null ?? "_";
taint.Sink(clean);
} | AST#export_declaration#Left export AST#function_declaration#Left function nullish_coalescing_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stat... | export function nullish_coalescing_002_F(taint_src : string) {
let _t = taint_src;
let clean = null ?? "_";
taint.Sink(clean);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/nullish_coalescing_002_F.ets#L6-L10 | a6c49d23de732e0bde7012435606e5bc34cca260 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/keyAgree/ECDHSync.ets | arkts | ecdh | ecdh动态协商密钥,要求密钥长度为256位的非对称密钥
@param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
@param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns ECC256共享密钥 | static ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'ECC256', 256, keyCoding, resultCoding);
} | AST#method_declaration#Left static ecdh AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AS... | static ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'ECC256', 256, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/keyAgree/ECDHSync.ets#L35-L38 | dd0a3d13fbc57726926bd4b861cf90002d5b3ece | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets | arkts | The DataSet class represents one group or type of entries (Entry) in the
Chart that belong together. It is designed to logically separate different
groups of values inside the Chart (e.g. the values for a specific line in the
LineChart, or the values of a specific group of bars in the BarChart). | export abstract class DataSet<T extends EntryOhos> extends BaseDataSet<T> {
/**
* the entries that this DataSet represents / holds together
*/
protected mEntries: JArrayList<T>;
/**
* maximum y-value in the value array
*/
protected mYMax: number = -Number.MAX_VALUE;
/**
* minimum y-value in t... | AST#export_declaration#Left export AST#class_declaration#Left abstract class DataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right extends AST#typ... | export abstract class DataSet<T extends EntryOhos> extends BaseDataSet<T> {
protected mEntries: JArrayList<T>;
protected mYMax: number = -Number.MAX_VALUE;
protected mYMin: number = Number.MAX_VALUE;
protected mXMax: number = -Number.MAX_VALUE;
protected mXMin: number = Number.MAX_VALUE;
... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets#L27-L425 | a5bb23fba1e806f4a874800e739a1b07d8b17d3c | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/TodoTypes.ets | arkts | 代办事项状态枚举 | export enum TodoStatus {
PENDING = 'pending', // 待办
IN_PROGRESS = 'in_progress', // 进行中
COMPLETED = 'completed', // 已完成
CANCELLED = 'cancelled' // 已取消
} | AST#export_declaration#Left export AST#enum_declaration#Left enum TodoStatus AST#enum_body#Left { AST#enum_member#Left PENDING = AST#expression#Left 'pending' AST#expression#Right AST#enum_member#Right , // 待办 AST#enum_member#Left IN_PROGRESS = AST#expression#Left 'in_progress' AST#expression#Right AST#enum_member#Righ... | export enum TodoStatus {
PENDING = 'pending',
IN_PROGRESS = 'in_progress',
COMPLETED = 'completed',
CANCELLED = 'cancelled'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L14-L19 | 265d7bc87117969eb227f8753085e7089f84eb2f | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/FileSample/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets | arkts | 日志标签 | export default class EntryBackupAbility extends BackupExtensionAbility {
async onBackup() {
hilog.info(DOMAIN, 'testTag', 'onBackup ok');
}
async onRestore(bundleVersion: BundleVersion) {
hilog.info(DOMAIN, 'testTag', `onRestore ok %{public}s`, JSON.stringify(bundleVersion));
}
} | AST#export_declaration#Left export default AST#class_declaration#Left class EntryBackupAbility extends AST#type_annotation#Left AST#primary_type#Left BackupExtensionAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left async onBackup AST#parameter_list#Left ( ) AST#p... | export default class EntryBackupAbility extends BackupExtensionAbility {
async onBackup() {
hilog.info(DOMAIN, 'testTag', 'onBackup ok');
}
async onRestore(bundleVersion: BundleVersion) {
hilog.info(DOMAIN, 'testTag', `onRestore ok %{public}s`, JSON.stringify(bundleVersion));
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileSample/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets#L21-L29 | 5c678841c873856f00dc8c345da39a2d0f7e03d7 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | getDatabaseStatistics | ==================== 数据统计相关操作 ====================
获取数据库统计信息 | async getDatabaseStatistics(): Promise<DatabaseStatisticsResult> {
this.checkInitialization();
try {
const stats = await this.dbManager.getDatabaseStats();
const result: DatabaseStatisticsResult = {
contactCount: stats.contactCount,
commemorationCount: stats.commemorationCount,
... | AST#method_declaration#Left async getDatabaseStatistics 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 DatabaseStatisticsResult AST#primary_type#Right AST#type_an... | async getDatabaseStatistics(): Promise<DatabaseStatisticsResult> {
this.checkInitialization();
try {
const stats = await this.dbManager.getDatabaseStats();
const result: DatabaseStatisticsResult = {
contactCount: stats.contactCount,
commemorationCount: stats.commemorationCount,
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L261-L279 | fa084751c35c0d00e2e35dcfed67f2a34babbb54 | github |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets | arkts | collect | 收藏文章
@param id article id | async collect(id: number) {
try {
const response = await wanHttpClient.collect(id)
if (response.data.errorCode === 0) { //errorCode === 0说明收藏成功
EventBus.getInstance().post(WanEventId.EVENT_COLLECT, new CollectEvent(true, id))
} else {
EventBus.getInstance()
.post(WanEvent... | AST#method_declaration#Left async collect AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#b... | async collect(id: number) {
try {
const response = await wanHttpClient.collect(id)
if (response.data.errorCode === 0) {
EventBus.getInstance().post(WanEventId.EVENT_COLLECT, new CollectEvent(true, id))
} else {
EventBus.getInstance()
.post(WanEventId.EVENT_COLLECT, new C... | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets#L72-L85 | 0b2d54ddd34e8f4380bac602358f89b0360fad1c | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/launch/Index.ets | arkts | LaunchGraph | @file launch 模块统一导出
@author Joker.X | export { LaunchGraph } from "./src/main/ets/navigation/LaunchGraph"; | AST#export_declaration#Left export { LaunchGraph } from "./src/main/ets/navigation/LaunchGraph" ; AST#export_declaration#Right | export { LaunchGraph } from "./src/main/ets/navigation/LaunchGraph"; | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/Index.ets#L6-L6 | 2ed7f973e2b63835c9e31c054878c47e17968829 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | unregister | 取消订阅默认网络状态变化的通知。 | static unregister() {
if (NetworkUtil.netConnection) {
NetworkUtil.netConnection.unregister((error: BusinessError) => {
if (error) {
LogUtil.error(error);
}
});
}
} | AST#method_declaration#Left static unregister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left NetworkUtil AST#expression#Right . netConnection AST#member_expres... | static unregister() {
if (NetworkUtil.netConnection) {
NetworkUtil.netConnection.unregister((error: BusinessError) => {
if (error) {
LogUtil.error(error);
}
});
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L293-L301 | 395f1b0ea32bcc39ee23fde77491b52e2d9f18f5 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets | arkts | clearTestResults | ====== 清空测试结果 ====== | async clearTestResults(): Promise<void> {
if (!this.db) return;
const sql = `UPDATE ${Tables.Learn.NAME}
SET ${Tables.Learn.Col.CORRECTED_TIMES} = 0,
${Tables.Learn.Col.WRANG_TIMES} = 0,
${Tables.Learn.Col.LAST_RESULT} = ?`;
await this.db.updateDb(sql, [SearchConstants.TEST_RESULT_NONE... | AST#method_declaration#Left async clearTestResults AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type... | async clearTestResults(): Promise<void> {
if (!this.db) return;
const sql = `UPDATE ${Tables.Learn.NAME}
SET ${Tables.Learn.Col.CORRECTED_TIMES} = 0,
${Tables.Learn.Col.WRANG_TIMES} = 0,
${Tables.Learn.Col.LAST_RESULT} = ?`;
await this.db.updateDb(sql, [SearchConstants.TEST_RESULT_NONE... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L489-L498 | 81bf5017da919905d736ea64a438254940bba86f | github |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/pages/MerchantDetailPage.ets | arkts | NavigationMenus | 构建导航栏菜单(收藏按钮) | @Builder
NavigationMenus() {
Row() {
Text(this.isFavorited() ? '♥' : '♡')
.fontSize(24)
.fontColor(this.isFavorited() ? $r('app.color.primary_color') : $r('app.color.text_primary'))
.onClick(() => {
this.toggleFavorite();
})
}
.padding({ left: 12, right: 12 ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NavigationMenus AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_ele... | @Builder
NavigationMenus() {
Row() {
Text(this.isFavorited() ? '♥' : '♡')
.fontSize(24)
.fontColor(this.isFavorited() ? $r('app.color.primary_color') : $r('app.color.text_primary'))
.onClick(() => {
this.toggleFavorite();
})
}
.padding({ left: 12, right: 12 ... | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/MerchantDetailPage.ets#L143-L154 | 5cd40be4f94eddbb942072ea9c184aee3d4c6890 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/personal/src/main/ets/pages/OtherLogin.ets | arkts | getVerifyCode | 获取验证码计数 | getVerifyCode(): void {
let timer = setInterval(() => {
this.verifyCodeTime--;
if (!this.verifyCodeTime) {
clearInterval(timer)
}
}, 1000)
} | AST#method_declaration#Left getVerifyCode 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#variable_declaration#Left let AST#variable_declarator#Left timer = AST#e... | getVerifyCode(): void {
let timer = setInterval(() => {
this.verifyCodeTime--;
if (!this.verifyCodeTime) {
clearInterval(timer)
}
}, 1000)
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/personal/src/main/ets/pages/OtherLogin.ets#L261-L268 | efe4bd1f758d060c4a65d2912ec7e1280109babb | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | 农历公历映射服务 | export class LunarSolarMappingService {
private static instance: LunarSolarMappingService;
private mappingCache: Map<number, YearMappingData> = new Map();
private initialized: boolean = false;
private constructor() {}
static getInstance(): LunarSolarMappingService {
if (!LunarSolarMappingService.instanc... | AST#export_declaration#Left export AST#class_declaration#Left class LunarSolarMappingService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left LunarSolarMappingService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#R... | export class LunarSolarMappingService {
private static instance: LunarSolarMappingService;
private mappingCache: Map<number, YearMappingData> = new Map();
private initialized: boolean = false;
private constructor() {}
static getInstance(): LunarSolarMappingService {
if (!LunarSolarMappingService.instanc... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L48-L343 | 1b7a419e8c8e63157e30e8993866e7ee7c38d1e2 | github | |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/viewmodel/Chat/ChatViewModel.ets | arkts | load locally cached chats from database and sync to the rust side we should separate loading chats and messages, because loading messages is a heavy task | export async function loadCachedChats(chatDataSource: ChatDataSource,
messagesOfChats: HashMap<string, MessageDataSource>, seenChatsMap: HashMap<string, SeenChat>): Promise<void> {
Logger.debug('loadCachedChats: loading cached chats');
let start = 0;
let end = 0;
let elapsed = 0;
start = Date.now();
// l... | AST#export_declaration#Left export AST#function_declaration#Left async function loadCachedChats AST#parameter_list#Left ( AST#parameter#Left chatDataSource : AST#type_annotation#Left AST#primary_type#Left ChatDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left messagesOf... | export async function loadCachedChats(chatDataSource: ChatDataSource,
messagesOfChats: HashMap<string, MessageDataSource>, seenChatsMap: HashMap<string, SeenChat>): Promise<void> {
Logger.debug('loadCachedChats: loading cached chats');
let start = 0;
let end = 0;
let elapsed = 0;
start = Date.now();
... | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatViewModel.ets#L51-L113 | b2011792f39be8f65f20fa5bffd05decab50ae60 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/pages/CustomScanPage.ets | arkts | CustomScanPage | 二维码扫描页面
实现步骤:
1.用户授权相机后初始化页面内子组件
2.进二维码扫描路由时监控折叠屏状态变化,实时重新初始化扫码服务和相机流尺寸 | @Component
export struct CustomScanPage {
// 应用前后台标记
@StorageProp('isBackground') @Watch('onBackgroundUpdate') isBackground: boolean = false;
// 自页面栈
@Provide('subPageStack') subPageStack: NavPathStack = new NavPathStack();
// 自定义扫码vm实例
@Provide('customScanVM') customScanVM: CustomScanViewModel = CustomScan... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomScanPage AST#component_body#Left { // 应用前后台标记 AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'isBackground' AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ W... | @Component
export struct CustomScanPage {
@StorageProp('isBackground') @Watch('onBackgroundUpdate') isBackground: boolean = false;
@Provide('subPageStack') subPageStack: NavPathStack = new NavPathStack();
@Provide('customScanVM') customScanVM: CustomScanViewModel = CustomScanViewModel.getInstance();
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/pages/CustomScanPage.ets#L30-L145 | b92d596779e62d61ba06c04408e7d3667888fd29 | gitee |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | opacity | export const OPACITY_4: number = 0.4; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left OPACITY_4 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.4 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#R... | export const OPACITY_4: number = 0.4; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L90-L90 | d58a48b54b8cd07fd72985a89bafc09d4f90e5ce | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DisplayUtils.ets | arkts | getScreenWidthVp | vp单位方法(新增) | public static getScreenWidthVp(): number {
return DisplayUtils.px2vp(DisplayUtils._defaultDisplay.width);
} | AST#method_declaration#Left public static getScreenWidthVp AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#... | public static getScreenWidthVp(): number {
return DisplayUtils.px2vp(DisplayUtils._defaultDisplay.width);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DisplayUtils.ets#L27-L29 | 1a443924ab17e1f93b278c498f844544b4f6d858 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.