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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
shubai-xixi/DistributeNewsArkts.git | 7a527c5f4121612c8070d809824b0f2615d1b238 | entry/src/main/ets/pages/NewsDetail.ets | arkts | startPolling | 健壮版轮询逻辑 | private async startPolling() {
// 双重确认 isPolling 为 true
if (!this.isPolling) {
this.isPolling = true;
}
// 用递归替代 while 循环,更稳定(避免鸿蒙异步循环兼容问题)
const pollFunc = async () => {
if (!this.isPolling) {
return; // 终止递归
}
try {
// 拉取远程ID
const remoteNewsId: st... | AST#method_declaration#Left private async startPolling AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 双重确认 isPolling 为 true AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#... | private async startPolling() {
if (!this.isPolling) {
this.isPolling = true;
}
const pollFunc = async () => {
if (!this.isPolling) {
return;
}
try {
const remoteNewsId: string = await fetchRemoteNewsId();
console.log(`[轮询日志] 拉取到远程ID:${rem... | https://github.com/shubai-xixi/DistributeNewsArkts.git/blob/7a527c5f4121612c8070d809824b0f2615d1b238/entry/src/main/ets/pages/NewsDetail.ets#L24-L63 | 6534a47e60811203e7f5490dbc25c78f8f7ee217 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.fs.d.ets | arkts | ListFileOptions type
@interface ListFileOptions
@syscap SystemCapability.FileManagement.File.FileIO
@since 20 | export interface ListFileOptions {
/**
* Whether to recursively list files.
*
* @type { ?boolean }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/
recursion?: boolean;
/**
* The number of files listed.
*
* @type { ?number }
* @syscap SystemCapability.FileManag... | AST#export_declaration#Left export AST#interface_declaration#Left interface ListFileOptions AST#object_type#Left { /**
* Whether to recursively list files.
*
* @type { ?boolean }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/ AST#type_member#Left recursion ? : AST#type_annotatio... | export interface ListFileOptions {
recursion?: boolean;
listNum?: number;
filter?: Filter;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4424-L4451 | 22ca4fae1ad176fed928ef341edbbabcbf1f7d25 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderRefundPage.ets | arkts | RefundInfoTitle | 退款信息标题
@returns {void} 无返回值 | @Builder
private RefundInfoTitle(): void {
TitleWithLine({
text: $r("app.string.refund_info")
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RefundInfoTitle 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_statem... | @Builder
private RefundInfoTitle(): void {
TitleWithLine({
text: $r("app.string.refund_info")
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderRefundPage.ets#L160-L165 | 581e87c90807e50c8f25d33b4e5f18cc5f1a7d84 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets | arkts | loadTaskProgress | 加载任务进度记录 | async loadTaskProgress() {
try {
this.isLoadingProgress = true;
// 获取任务进度记录
this.progress = await getTaskProgress(this.taskId);
} catch (error) {
console.error(`加载进度记录失败: ${error instanceof Error ? error.message : String(error)}`);
prompt.showToast({
message: '加载进度记录失败',
... | AST#method_declaration#Left async loadTaskProgress 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#assignment_expression#Left AST#member_expre... | async loadTaskProgress() {
try {
this.isLoadingProgress = true;
this.progress = await getTaskProgress(this.taskId);
} catch (error) {
console.error(`加载进度记录失败: ${error instanceof Error ? error.message : String(error)}`);
prompt.showToast({
message: '加载进度记录失败',
durat... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets#L72-L86 | 75f6d5ab1fcb908bbf3a28f3eb614d628a27cddb | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customstepper/src/main/ets/view/CustomStepperView.ets | arkts | getCustomStepperView | 创建WrappedBuilder对象,动态路由跳转时构建页面 | @Builder
export function getCustomStepperView(): void {
CustomStepperViewComponent();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function getCustomStepperView 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_... | @Builder
export function getCustomStepperView(): void {
CustomStepperViewComponent();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customstepper/src/main/ets/view/CustomStepperView.ets#L93-L96 | dc043aff0a0b4eb5e5201d78c9278f713cae469b | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets | arkts | convertSM2PriKey | 将服务器端生成的16进制的长度为64位的C1C3C2格式的SM2私钥转换为前端所需的ASN.1格式SM2私钥字符串
@param priKey 16进制的64位的私钥字符串
@returns 转换后的私钥字符串 | static convertSM2PriKey(priKey: string): OutDTO<string> {
if (priKey.length != 64) {
return OutDTO.Error('服务器端SM2私钥长度不正确~');
}
//构建SM2私钥参数对象
let keyPair: cryptoFramework.ECCPriKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
algName: 'SM2',
sk: Bi... | AST#method_declaration#Left static convertSM2PriKey AST#parameter_list#Left ( AST#parameter#Left priKey : 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_typ... | static convertSM2PriKey(priKey: string): OutDTO<string> {
if (priKey.length != 64) {
return OutDTO.Error('服务器端SM2私钥长度不正确~');
}
let keyPair: cryptoFramework.ECCPriKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
algName: 'SM2',
sk: BigInt('0x' + p... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L130-L148 | 0fb580ccfb653b976f212e43b4b881e074e9d95e | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/form.ets | arkts | validatePassword | 验证密码 | private validatePassword() {
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,16}$/
if (!passwordRegex.test(this.formData.password)) {
this.validation.password = {
valid: false,
message: '密码需8-16位,包含大小写字母和数字'
}
} else {
this.validation.password = { valid: true, m... | AST#method_declaration#Left private validatePassword AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ERROR#Left const AST#variable_declarator#Left passwordRegex = AST#ERROR#Left / ^ AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expr... | private validatePassword() {
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,16}$/
if (!passwordRegex.test(this.formData.password)) {
this.validation.password = {
valid: false,
message: '密码需8-16位,包含大小写字母和数字'
}
} else {
this.validation.password = { valid: true, m... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/form.ets#L139-L149 | 727be437dfbd0fcd3ac52cadf5b98bcb6b768d6b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildOccasionChip | 构建场合标签 | @Builder
buildOccasionChip(label: string, occasion: GreetingOccasion) {
Button(label)
.type(ButtonType.Capsule)
.fontSize(14)
.fontColor(this.selectedOccasion === occasion ? '#ffffff' : '#666666')
.backgroundColor(this.selectedOccasion === occasion ? '#007AFF' : '#f0f0f0')
.height('3... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildOccasionChip AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left occasion : AST#type_annotati... | @Builder
buildOccasionChip(label: string, occasion: GreetingOccasion) {
Button(label)
.type(ButtonType.Capsule)
.fontSize(14)
.fontColor(this.selectedOccasion === occasion ? '#ffffff' : '#666666')
.backgroundColor(this.selectedOccasion === occasion ? '#007AFF' : '#f0f0f0')
.height('3... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L570-L582 | 57d3e0f81aa9d39abbd01cf85f8a7cebd5948815 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/pages/VideoUpload.ets | arkts | getVideoFirstImage | 获取视频第一张图片 | async getVideoFirstImage(): Promise<void> {
let callBack: ICallBack = {
// 回调函数
callBackResult: (code: number) => {
if (code === 0) {
let frameCallBack: IFrameCallBack = {
callBackResult: async (data: ArrayBuffer, timeUs: number) => {
const imageSource: image... | AST#method_declaration#Left async getVideoFirstImage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#ty... | async getVideoFirstImage(): Promise<void> {
let callBack: ICallBack = {
callBackResult: (code: number) => {
if (code === 0) {
let frameCallBack: IFrameCallBack = {
callBackResult: async (data: ArrayBuffer, timeUs: number) => {
const imageSource: image.ImageSo... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/pages/VideoUpload.ets#L71-L101 | e424b0109178a725acc7c6eed7db166f4822f5fd | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | PreHttpRequestUseFiles/entry/src/main/ets/pages/PageOne.ets | arkts | PageOneBuilder | [Start segment1] | @Builder
export function PageOneBuilder() {
PageOne();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function PageOneBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left PageOne ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_... | @Builder
export function PageOneBuilder() {
PageOne();
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PreHttpRequestUseFiles/entry/src/main/ets/pages/PageOne.ets#L16-L19 | 7987f16153647f6079b5c2850a4a1a6134f3e790 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets | arkts | LoadingDialog | Declare CustomDialog LoadingDialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare CustomDialog LoadingDialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @CustomDialog
export declare struct LoadingDialog {
/**
* Sets the LoadingDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the LoadingDialog Controller.
* @type { CustomDialogController }.
* @sysc... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct LoadingDialog AST#component_body#Left { /**
* Sets the LoadingDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full... | @CustomDialog
export declare struct LoadingDialog {
Controller: CustomDialogController;
content?: ResourceStr;
theme?: Theme | CustomTheme;
themeColorMode?: ThemeColorMode;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets#L685-L735 | a8c6939ba3bfca4251d1c4418194b7f8c40d7c39 | github |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/card/components/ShowCardArea.ets | arkts | cardItemInfo | 银行卡展示内容 | @Builder cardItemInfo () {
Row() {
Text('余额总计 ')
Text(this.dealMoneyShow(this.allMoney))
Image(this.eyeState ? $r('app.media.i_eye') : $r('app.media.i_close_eye'))
.width(20)
.margin({left: 10})
.onClick(()=>{
this.eyeState = !this.eyeState
})
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right cardItemInfo 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_elemen... | @Builder cardItemInfo () {
Row() {
Text('余额总计 ')
Text(this.dealMoneyShow(this.allMoney))
Image(this.eyeState ? $r('app.media.i_eye') : $r('app.media.i_close_eye'))
.width(20)
.margin({left: 10})
.onClick(()=>{
this.eyeState = !this.eyeState
})
}
... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/card/components/ShowCardArea.ets#L54-L123 | 91b8aaa980a32b27196368f2f7f5893d544cda58 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets | arkts | strToBytes | 字符串转Bytes
@param str
@returns | public static strToBytes(str: string): Uint8Array {
let byteArray: Array<number> = [];
for (let i = 0; i < str.length; i++) {
byteArray.push(str.charCodeAt(i));
}
return new Uint8Array(byteArray);
} | AST#method_declaration#Left public static strToBytes 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_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#pr... | public static strToBytes(str: string): Uint8Array {
let byteArray: Array<number> = [];
for (let i = 0; i < str.length; i++) {
byteArray.push(str.charCodeAt(i));
}
return new Uint8Array(byteArray);
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets#L229-L235 | 6db02b90bb237d28f05da1991a08999763294157 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/common/database/Form.ets | arkts | toValuesBucket | Get inserted form data.
@return Return form data. | toValuesBucket(): relationalStore.ValuesBucket {
return {
'formId': this.formId,
'formName': this.formName,
'dimension': this.dimension
};
} | AST#method_declaration#Left toValuesBucket AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left ... | toValuesBucket(): relationalStore.ValuesBucket {
return {
'formId': this.formId,
'formName': this.formName,
'dimension': this.dimension
};
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/database/Form.ets#L39-L45 | 30d89ef37dbf2ed4c089a75bd36716c64495e4f4 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | bottomSheetDialog | 动作面板 | bottomSheetDialog(index: number) {
if (index == 0) {
//简单使用
DialogHelper.showBottomSheetDialog({
sheets: this.menuArray,
onAction: (index) => {
ToastUtil.showToast(`您点击了,${this.menuArray[index]}`);
}
})
} else if (index == 1) {
//带标题
DialogHelper.s... | AST#method_declaration#Left bottomSheetDialog 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_sta... | bottomSheetDialog(index: number) {
if (index == 0) {
DialogHelper.showBottomSheetDialog({
sheets: this.menuArray,
onAction: (index) => {
ToastUtil.showToast(`您点击了,${this.menuArray[index]}`);
}
})
} else if (index == 1) {
DialogHelper.showBottomSh... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L665-L709 | cd205875971e1d747a90d13b9f555dfdbddc2532 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationManagementUtil.ets | arkts | cancelNotificationType | 取消属于该类型的通知 | cancelNotificationType(typeId: number) {
this.typeNotifications[typeId].forEach(item => {
notification.cancel(item.id);
})
} | AST#method_declaration#Left cancelNotificationType AST#parameter_list#Left ( AST#parameter#Left typeId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AS... | cancelNotificationType(typeId: number) {
this.typeNotifications[typeId].forEach(item => {
notification.cancel(item.id);
})
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationManagementUtil.ets#L53-L57 | e086b8a1e38fa20bd142404f5f6c75e4fde6d37e | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/ZFunction.ets | arkts | findAllMatches | 在文本中查找模式串的所有出现位置
@param text 文本字符串
@param pattern 模式串
@returns 所有匹配位置的数组 | static findAllMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const combined = pattern + '$' + text;
const z = ZFunction.computeZArray(combined);
const result: number[] = [];
for (let i = pattern.length + 1; i < combined.le... | AST#method_declaration#Left static findAllMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static findAllMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const combined = pattern + '$' + text;
const z = ZFunction.computeZArray(combined);
const result: number[] = [];
for (let i = pattern.length + 1; i < combined.le... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/ZFunction.ets#L70-L86 | cb3d17e30661ffc791288ee156cfa79f61f226d5 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsInfoCard.ets | arkts | CouponList | 优惠券标签列表
@returns {void} 无返回值 | @Builder
private CouponList(): void {
if (this.coupons.length > 0) {
SpaceVerticalSmall();
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(this.coupons, (coupon: Coupon, index: number): void => {
this.CouponTag(coupon);
}, (coupon: Coupon, index: number): string => `${coupon.id}-${in... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CouponList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_... | @Builder
private CouponList(): void {
if (this.coupons.length > 0) {
SpaceVerticalSmall();
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(this.coupons, (coupon: Coupon, index: number): void => {
this.CouponTag(coupon);
}, (coupon: Coupon, index: number): string => `${coupon.id}-${in... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsInfoCard.ets#L114-L125 | 265151ea440708a115fa1efbcba38cd1b712800f | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets | arkts | getAddressList | 获取地址列表
@returns {Promise<NetworkResponse<Address[]>>} 地址列表 | async getAddressList(): Promise<NetworkResponse<Address[]>> {
const resp: AxiosResponse<NetworkResponse<Address[]>> =
await NetworkClient.http.post("user/address/list");
return resp.data;
} | AST#method_declaration#Left async getAddressList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AS... | async getAddressList(): Promise<NetworkResponse<Address[]>> {
const resp: AxiosResponse<NetworkResponse<Address[]>> =
await NetworkClient.http.post("user/address/list");
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets#L37-L41 | b1d9f8abbd90d4f107d29bea577068576a1e84cf | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/customView/MpSlider.ets | arkts | MpSlider | Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @ComponentV2
export default struct MpSlider {
@Require @Param name: string | Resource
private step?: number
@Require @Param value: number
@Event $value: (value: number) => void = (value: number) => {};
@Require @Param min: number
@Require @Param max: number
build() {
Row() {
Text(this.name)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export default struct MpSlider AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right name : AST#type_annotation#Left AST#union_type... | @ComponentV2
export default struct MpSlider {
@Require @Param name: string | Resource
private step?: number
@Require @Param value: number
@Event $value: (value: number) => void = (value: number) => {};
@Require @Param min: number
@Require @Param max: number
build() {
Row() {
Text(this.name)
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/customView/MpSlider.ets#L16-L39 | fb23e6feb3afc2df1d415b186f1d597346d5ebd1 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/BasicDataSource.ets | arkts | IDataSource处理数据监听的基本实现 | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = []
public abstract totalCount(): number
public getData(index: number): T | void {
console.info('getDataindex:'+index);
}
registerDataChangeListener(listener: DataChangeListener): void {
if (t... | AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declarat... | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = []
public abstract totalCount(): number
public getData(index: number): T | void {
console.info('getDataindex:'+index);
}
registerDataChangeListener(listener: DataChangeListener): void {
if (t... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/BasicDataSource.ets#L20-L71 | 86e63be87ea040a2bcb41a26891e9c624e12a398 | gitee | |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/PhotoPickerUtils.ets | arkts | copyFileToCache | file开头路径文件外部APP不能直接进行访问,需拷贝到APP目录下的沙箱文件中目录才能访问读取 | static async copyFileToCache(uri: string): Promise<string> {
try {
const index = uri.lastIndexOf('.')
let fileType = index < 0 ? '.jpg' : uri.substring(index)
if (fileType.length < 1) {
fileType = '.jpg'
}
let dir = getContext().cacheDir + '/pictures'
if (!fs.accessSync(d... | AST#method_declaration#Left static async copyFileToCache AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | static async copyFileToCache(uri: string): Promise<string> {
try {
const index = uri.lastIndexOf('.')
let fileType = index < 0 ? '.jpg' : uri.substring(index)
if (fileType.length < 1) {
fileType = '.jpg'
}
let dir = getContext().cacheDir + '/pictures'
if (!fs.accessSync(d... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/PhotoPickerUtils.ets#L124-L144 | 0ad3948c60c969783fae5a108b40a0c82fbde19d | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets | arkts | 更新任务状态
@param taskId 任务ID
@param status 新状态:0-待开始,1-进行中,2-已完成,3-已延期
@returns 更新后的任务 | export function updateTaskStatus(taskId: number, status: number): Promise<Task> {
try {
return request<Task>(
RequestMethod.PUT,
`/tasks/${taskId}/status/${status}`
);
} catch (error) {
console.error(`更新任务状态失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(... | AST#export_declaration#Left export AST#function_declaration#Left function updateTaskStatus AST#parameter_list#Left ( AST#parameter#Left taskId : 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#Le... | export function updateTaskStatus(taskId: number, status: number): Promise<Task> {
try {
return request<Task>(
RequestMethod.PUT,
`/tasks/${taskId}/status/${status}`
);
} catch (error) {
console.error(`更新任务状态失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L271-L281 | f25bf6be19feb80419ea0caeef4c69ee25a008d6 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/media/MediaManager.ets | arkts | startAudioRecording | 开始录音 | async startAudioRecording(config?: Partial<AudioRecordConfig>): Promise<void> {
try {
const recordConfig = { ...this.defaultAudioConfig, ...config };
// 创建录音器
this.audioRecorder = await media.createAVRecorder();
// 配置录音参数
const audioRecorderConfig: media.AVRecorderConfig = {
... | AST#method_declaration#Left async startAudioRecording AST#parameter_list#Left ( AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AudioRecordConfig AST#primary_type#Right AST#type_annotation... | async startAudioRecording(config?: Partial<AudioRecordConfig>): Promise<void> {
try {
const recordConfig = { ...this.defaultAudioConfig, ...config };
this.audioRecorder = await media.createAVRecorder();
const audioRecorderConfig: media.AVRecorderConfig = {
audioSourceType: ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L391-L430 | d7efc7378ed2920fc958f72ebcfd2c7120f53317 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clockin/src/main/ets/model/ClockInModel.ets | arkts | 定义了打卡信息的数据结构。
包含打卡的时间和地址。 | export interface ClockInInfo {
time: string
address: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ClockInInfo AST#object_type#Left { AST#type_member#Left time : 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 address : AST#type_annotation#Left ... | export interface ClockInInfo {
time: string
address: string
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clockin/src/main/ets/model/ClockInModel.ets#L32-L35 | 4da5f7a87149b057dee4048e7365ae244016ebef | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/Logger.ets | arkts | printLog | 统一的日志打印
@param logCallBack 日志级别
@param args 入参 | static printLog(logCallBack: (prefix: string, args: string[] | string) => void, ...args: string[]) {
let content: string = args.join();
if (content.length <= Logger.maxSize) {
// 长度小于等于限制直接打印
logCallBack(Logger.prefix, args);
} else {
// 循环分段打印
let newPrefix = Logger.prefix + "[" + I... | AST#method_declaration#Left static printLog AST#parameter_list#Left ( AST#parameter#Left logCallBack : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#paramete... | static printLog(logCallBack: (prefix: string, args: string[] | string) => void, ...args: string[]) {
let content: string = args.join();
if (content.length <= Logger.maxSize) {
logCallBack(Logger.prefix, args);
} else {
let newPrefix = Logger.prefix + "[" + IdUtil.randomUUID() + "]"... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Logger.ets#L92-L108 | 25011c190d8b1c514aae4d58a9c8a69b2d2d837f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets | arkts | onForeground | [EndExclude save_the_uiContext_to_localstorage_in_entry_ability] [StartExclude save_the_uiContext_to_localstorage_in_entry_ability] | onForeground(): void {
// Ability has brought to foreground
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
} | AST#method_declaration#Left onForeground AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Ability has brought to foreground AST#expression_statement#Left AST#expression#Left AST... | onForeground(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L54-L57 | c5b96788f909c310968931855ab7f976d4cc5f44 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | clearApiConfig | 清除API配置 | async clearApiConfig(): Promise<void> {
await this.configService.clearApiConfig();
} | AST#method_declaration#Left async clearApiConfig 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_a... | async clearApiConfig(): Promise<void> {
await this.configService.clearApiConfig();
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L707-L709 | ed931337566ce1fcf748de76e85e29526e19a4a5 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/chat/QaComponent.ets | arkts | clearInterval | 清除动画循环 | clearInterval(this.animationId); | AST#method_declaration#Left clearInterval AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . animationId AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right | clearInterval(this.animationId); | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/QaComponent.ets#L126-L126 | 20c7f015479964cd052914edd6e0a7b974b92cd0 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AbilityUtils.ets | arkts | toNotificationSetting | 跳转通知设置页面 | static toNotificationSetting(): Promise<void> {
return AbilityUtils.toAppSetting(AbilityUtils.uri_notification)
} | AST#method_declaration#Left static toNotificationSetting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | static toNotificationSetting(): Promise<void> {
return AbilityUtils.toAppSetting(AbilityUtils.uri_notification)
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AbilityUtils.ets#L45-L47 | 34772dceb2026f3ad0b00e71f53891c193c95ef6 | gitee |
shubai-xixi/DistributeNewsArkts.git | 7a527c5f4121612c8070d809824b0f2615d1b238 | entry/src/main/ets/model/NewsData.ets | arkts | NewsData | 类实现接口,构造函数接收接口对象 | @Observed
export class NewsData implements NewData {
newsId: string;
title: string;
newsType: string;
imgUrl: Resource;
reads: string;
likes: string;
content: string;
// 接收接口对象,既减少参数,又保留平铺字段
constructor(data: NewData) {
// 加默认值(类的核心价值)
this.newsId = data.newsId || '0';
this.title = data.t... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class NewsData AST#implements_clause#Left implements NewData AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left newsId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | @Observed
export class NewsData implements NewData {
newsId: string;
title: string;
newsType: string;
imgUrl: Resource;
reads: string;
likes: string;
content: string;
constructor(data: NewData) {
this.newsId = data.newsId || '0';
this.title = data.title || '默认标题';
this.newsType = da... | https://github.com/shubai-xixi/DistributeNewsArkts.git/blob/7a527c5f4121612c8070d809824b0f2615d1b238/entry/src/main/ets/model/NewsData.ets#L14-L35 | 14902231f2d6c70500e2245a52bf885ccbfa8865 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/ExpandPage.ets | arkts | ExpandContent | 扩展页面内容视图
@returns {void} 无返回值 | @Builder
private ExpandContent() {
MediumPaddingVerticalScroll() {
IBestCellGroup({ inset: true, outerMargin: 0 }) {
ForEach(this.vm.cards, (item: ExpandCardItem, index: number) => {
IBestCell({
title: item.title,
label: item.description,
isLink: true,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ExpandContent 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 MediumPaddingVerticalScroll ( ) AST#container_conten... | @Builder
private ExpandContent() {
MediumPaddingVerticalScroll() {
IBestCellGroup({ inset: true, outerMargin: 0 }) {
ForEach(this.vm.cards, (item: ExpandCardItem, index: number) => {
IBestCell({
title: item.title,
label: item.description,
isLink: true,
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/ExpandPage.ets#L47-L63 | efdca553d056a92a558741c63df1f5d83f5ddf43 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Load.ets | arkts | initCpuLoad0to3Data | 初始化数据 cpu0Load、cpu1Load、cpu2Load、cpu3Load
@param count 曲线图点的个数
@param range y轴范围 | private initCpuLoad0to3Data(): LineData {
let dataSet = new JArrayList<ILineDataSet>();
let values = new JArrayList<EntryOhos>();
for (let index: number = 0; index < this.gpData.length; index++) {
const gpDataCur = this.gpData[index];
if (gpDataCur.cpu0Load == '') {
continue
}
... | AST#method_declaration#Left private initCpuLoad0to3Data AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LineData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#... | private initCpuLoad0to3Data(): LineData {
let dataSet = new JArrayList<ILineDataSet>();
let values = new JArrayList<EntryOhos>();
for (let index: number = 0; index < this.gpData.length; index++) {
const gpDataCur = this.gpData[index];
if (gpDataCur.cpu0Load == '') {
continue
}
... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Load.ets#L578-L691 | 907a21ad9c3e11c1cd3280dabe70aee077ea3734 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets | arkts | setAVPlaybackState | 设置AVSession实例状态
@returns {void} | setAVPlaybackState(): void {
logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState));
// TODO:知识点:设置AVSession当前状态
this.session?.setAVPlaybackState(this.curState, (err) => {
if (err) {
logger.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`);
... | AST#method_declaration#Left setAVPlaybackState 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#expre... | setAVPlaybackState(): void {
logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState));
this.session?.setAVPlaybackState(this.curState, (err) => {
if (err) {
logger.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`);
} else {
logg... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets#L263-L273 | 66ec4783799fdf92fa57c5325feec1df8277fdd0 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SimpleChatList/entry/src/main/ets/pages/EdgeBlur.ets | arkts | EdgeBlur | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct EdgeBlur {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@StorageProp('topRectHeight') topRectHeight: number = 0;
// [Start linearGradient]
@Builder
overlayBuilder() {
Stack().height('100%').height('100%')
.linearGradient({
direction: GradientDirection.Bot... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EdgeBlur AST#component_body#Left { AST#property_declaration#Left private arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotat... | @Component
export struct EdgeBlur {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@StorageProp('topRectHeight') topRectHeight: number = 0;
@Builder
overlayBuilder() {
Stack().height('100%').height('100%')
.linearGradient({
direction: GradientDirection.Bottom,
colors: [[0... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/EdgeBlur.ets#L17-L67 | dbfa23551364c7ee64c6ca0c060a06deb3f3a9d9 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets | arkts | login | 执行登录操作
@returns {void} 无返回值 | login(): void {
if (!ValidationUtil.isValidPhone(this.account)) {
ToastUtils.showError($r("app.string.invalid_phone_number"));
return;
}
if (!ValidationUtil.isValidPassword(this.password)) {
ToastUtils.showError($r("app.string.invalid_password"));
return;
}
const params: Pass... | AST#method_declaration#Left login AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expressi... | login(): void {
if (!ValidationUtil.isValidPhone(this.account)) {
ToastUtils.showError($r("app.string.invalid_phone_number"));
return;
}
if (!ValidationUtil.isValidPassword(this.password)) {
ToastUtils.showError($r("app.string.invalid_password"));
return;
}
const params: Pass... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets#L57-L78 | b96e08235d0545fdcba622d57d931e1cd6b9616c | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/viewmodels/ReviewViewModel.ets | arkts | calculateEfficiencyRate | 计算效率指数(百分比) | static calculateEfficiencyRate(): string {
if (AppState.completedTasks.length === 0) return '0';
let totalEfficiency = 0;
AppState.completedTasks.forEach(task => {
if (task.actualTime && task.actualTime > 0) {
totalEfficiency += (task.estimatedTime / task.actualTime) * 100;
}
});
... | AST#method_declaration#Left static calculateEfficiencyRate 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#if_statement#Left if ( AST#expression#Left AST#binary... | static calculateEfficiencyRate(): string {
if (AppState.completedTasks.length === 0) return '0';
let totalEfficiency = 0;
AppState.completedTasks.forEach(task => {
if (task.actualTime && task.actualTime > 0) {
totalEfficiency += (task.estimatedTime / task.actualTime) * 100;
}
});
... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L42-L51 | 0257276727c81d89a35e99e3bdf3907005f8e282 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/GreetingsPage.ets | arkts | applyFilters | 应用筛选条件 | private applyFilters(): void {
let filtered = [...this.greetings];
// 应用搜索关键词
if (this.searchKeyword.trim()) {
const keyword = this.searchKeyword.trim().toLowerCase();
filtered = filtered.filter(greeting =>
greeting.content.toLowerCase().includes(keyword) ||
greeting.tags.some(... | AST#method_declaration#Left private applyFilters 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 filter... | private applyFilters(): void {
let filtered = [...this.greetings];
if (this.searchKeyword.trim()) {
const keyword = this.searchKeyword.trim().toLowerCase();
filtered = filtered.filter(greeting =>
greeting.content.toLowerCase().includes(keyword) ||
greeting.tags.some(tag => tag... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L60-L83 | a4cc02d6aca842564b7ac0af05f668c00f8eb087 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/model/Task.ets | arkts | toRow | Convert to database row format | toRow(): TaskData {
return {
title: this.title,
due_time: this.dueTime,
is_done: this.isDone ? 1 : 0,
created_at: this.createdAt
};
} | AST#method_declaration#Left toRow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TaskData 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_literal#Left { A... | toRow(): TaskData {
return {
title: this.title,
due_time: this.dueTime,
is_done: this.isDone ? 1 : 0,
created_at: this.createdAt
};
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/Task.ets#L58-L65 | 26c9eedb7857b27ed8993d91ac0000dffd92f472 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/I18nManager.ets | arkts | switchLanguage | 切换语言 | async switchLanguage(language: SupportedLanguage): Promise<void> {
try {
if (!this.supportedLanguages.has(language)) {
throw new Error(`Unsupported language: ${language}`);
}
this.currentLanguage = language;
this.config.language = language;
// 保存配置
await thi... | AST#method_declaration#Left async switchLanguage AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g... | async switchLanguage(language: SupportedLanguage): Promise<void> {
try {
if (!this.supportedLanguages.has(language)) {
throw new Error(`Unsupported language: ${language}`);
}
this.currentLanguage = language;
this.config.language = language;
await this.saveC... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L332-L354 | 580088170f6f70e619a6de85724cffb80027d5f6 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/NotificationUtils.ets | arkts | requestEnableNotification | 应用需要获取用户授权才能发送通知。在通知发布前调用该接口,可以拉起通知授权弹窗,让用户选择是否允许发送通知。使用Promise异步回调。
@param context
@returns | static async requestEnableNotification(context: common.UIAbilityContext = ArkWebHelper.getContext()):Promise<void> {
return await notificationManager.requestEnableNotification(context)
} | AST#method_declaration#Left static async requestEnableNotification 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#expression#Left AST#c... | static async requestEnableNotification(context: common.UIAbilityContext = ArkWebHelper.getContext()):Promise<void> {
return await notificationManager.requestEnableNotification(context)
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L72-L74 | e3c111530e4b46be21b15dc9b7f569182bcc21fb | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/SimpleLunarCalendar.ets | arkts | solarToLunar | 公历转农历(2025年专用) | static solarToLunar(year: number, month: number, day: number): SimpleLunarDate | null {
// 目前只支持2025年
if (year !== 2025) {
return null;
}
const targetDate = new Date(year, month - 1, day);
const springFestival = SimpleLunarCalendar.config2025.springFestivalDate;
// 计算从春节开始的天数
con... | AST#method_declaration#Left static solarToLunar AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | static solarToLunar(year: number, month: number, day: number): SimpleLunarDate | null {
if (year !== 2025) {
return null;
}
const targetDate = new Date(year, month - 1, day);
const springFestival = SimpleLunarCalendar.config2025.springFestivalDate;
const daysDiff = Math.floor((... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/SimpleLunarCalendar.ets#L68-L134 | 1aaf3e12a1b9a8947a7d3f7dc1c77081ad131d66 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/SwipeableListItem.ets | arkts | [End build_the_tail_slide_out_component] | build() {
NavDestination() {
Column({ space: 12 }) {
ComponentCard({ title: $r('app.string.SwipeListItem_titleExample') }) {
List({ space: 12 }) {
ForEach(this.arr, (item: number) => {
// [Start bind_the_swipeAction_property_to_left_swipe_list_item]
Li... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#co... | build() {
NavDestination() {
Column({ space: 12 }) {
ComponentCard({ title: $r('app.string.SwipeListItem_titleExample') }) {
List({ space: 12 }) {
ForEach(this.arr, (item: number) => {
ListItem() {
Text('Message ' + it... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/SwipeableListItem.ets#L43-L80 | 847d5dfe8478e433aa6519dd771864c79eb7dda5 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/ResourceAllocation/ApplicationThemeSwitch/entry/src/main/ets/models/ThemeConst.ets | arkts | 系统主题 包括 深浅模式 通过dark目录实现 | export class DefaultTheme {
static DEFAULT_COLOR = $r('app.color.default_color')
static BACKGROUND_COLOR = $r('app.color.default_bg_color')
static TITLE_BACKGROUND = $r('app.color.title_bg_color')
static STATUS_COLOR = $r('app.color.status_color')
static CATEGORIES_BACKGROUND_COLOR = $r('app.color.top_nav_bg_... | AST#export_declaration#Left export AST#class_declaration#Left class DefaultTheme AST#class_body#Left { AST#property_declaration#Left static DEFAULT_COLOR = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.default_color' AST#expression#Right ) AST#resource_expression#Right AST#express... | export class DefaultTheme {
static DEFAULT_COLOR = $r('app.color.default_color')
static BACKGROUND_COLOR = $r('app.color.default_bg_color')
static TITLE_BACKGROUND = $r('app.color.title_bg_color')
static STATUS_COLOR = $r('app.color.status_color')
static CATEGORIES_BACKGROUND_COLOR = $r('app.color.top_nav_bg_... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ResourceAllocation/ApplicationThemeSwitch/entry/src/main/ets/models/ThemeConst.ets#L40-L52 | 292088e9df6cc32d378310cc83ec62260fc2c70d | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/OrderRepository.ets | arkts | getOrderInfo | 获取订单详情
@param id 订单 ID
@returns 订单详情 | async getOrderInfo(id: number): Promise<NetworkResponse<Order>> {
return this.networkDataSource.getOrderInfo(id);
} | AST#method_declaration#Left async getOrderInfo AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr... | async getOrderInfo(id: number): Promise<NetworkResponse<Order>> {
return this.networkDataSource.getOrderInfo(id);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L109-L111 | 2afe39c002681c2619ff0d7f19e343b3d5b28637 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM2.ets | arkts | signSegmentSync | 对数据进行分段签名,同步
@param data 待签名数据
@param priKey 私钥
@param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
@param len 自定义的数据拆分长度,此处取64
@returns | static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'SM2_256|SM3',
len: number = 128): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, algName, len);
} | AST#method_declaration#Left static signSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified... | static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'SM2_256|SM3',
len: number = 128): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, algName, len);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L276-L279 | dd44faf6893ba25461ac5c2e3a0063d83d2c3dff | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | Weather/common/src/main/ets/model/FormDate.ets | arkts | fill | 格式化 当前分钟 | fill(num: number) {
return num > 9 ? '' : '0' + num;
} | AST#method_declaration#Left fill AST#parameter_list#Left ( AST#parameter#Left num : 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#return_statement#Left return AST#exp... | fill(num: number) {
return num > 9 ? '' : '0' + num;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/model/FormDate.ets#L51-L53 | 84aefee080bd5741024aa540eabce933f4539d48 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/CreateOrderRequest.ets | arkts | 创建订单所需参数 | export class CreateOrder {
/**
* 备注信息
*/
remark?: string;
/**
* 地址ID
*/
addressId: number;
/**
* 选中的商品列表
*/
goodsList: SelectedGoods[];
/**
* 优惠券ID(可选)
*/
couponId?: number | null;
/**
* 标题
*/
title?: string;
/**
* @param {CreateOrderInit} init - 初始化数据
*/
con... | AST#export_declaration#Left export AST#class_declaration#Left class CreateOrder AST#class_body#Left { /**
* 备注信息
*/ AST#property_declaration#Left remark ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 地址ID
*/ A... | export class CreateOrder {
remark?: string;
addressId: number;
goodsList: SelectedGoods[];
couponId?: number | null;
title?: string;
constructor(init: CreateOrderInit) {
this.addressId = init.addressId;
this.goodsList = init.goodsList.map((g) => new SelectedGoods(g));
if (init... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/CreateOrderRequest.ets#L61-L99 | 1ec7646935e102c2605d0ef81517f3de6c04357f | github | |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/components/VideoView.ets | arkts | onVideoInfoUpdate | React to video metadata updates: recompute prefix sums and total timeline. | onVideoInfoUpdate() {
if (this.videosInfo && this.videosInfo.length > 0) {
this.oldTime = this.initialTime;
this.totalTimelineMs = computeTimelineEndOffset(this.videosInfo, this.timelineOffsets ?? []);
}
} | AST#method_declaration#Left onVideoInfoUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expressi... | onVideoInfoUpdate() {
if (this.videosInfo && this.videosInfo.length > 0) {
this.oldTime = this.initialTime;
this.totalTimelineMs = computeTimelineEndOffset(this.videosInfo, this.timelineOffsets ?? []);
}
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/components/VideoView.ets#L78-L83 | 1eb912440361435dc5cb4f73081d2305aac6f9bb | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Native/NdkTsDrawing/entry/src/main/ets/pages/Index.ets | arkts | draw | 在RenderNode的draw中使用drawing自定义绘制 | async draw(context: DrawContext) {
const canvas = context.canvas;
let height_ = 600;
let width_ = 600;
let len = height_ / 4;
let aX = width_ / 3;
let aY = height_ / 6;
let dX = aX - len * Math.sin(18.0);
let dY = aY + len * Math.cos(18.0);
let cX = aX + len * Math.sin(18.0);
let... | AST#method_declaration#Left async draw AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left DrawContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#... | async draw(context: DrawContext) {
const canvas = context.canvas;
let height_ = 600;
let width_ = 600;
let len = height_ / 4;
let aX = width_ / 3;
let aY = height_ / 6;
let dX = aX - len * Math.sin(18.0);
let dY = aY + len * Math.cos(18.0);
let cX = aX + len * Math.sin(18.0);
let... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Native/NdkTsDrawing/entry/src/main/ets/pages/Index.ets#L33-L88 | 6847ec78ac45bca9f8066363b1f642353b08b32e | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets | arkts | MARK: - Piece | export namespace Piece {
export const name = "P_Piece"; | AST#export_declaration#Left export AST#ERROR#Left namespace Piece { export AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left name = AST#expression#Left "P_Piece" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export namespace Piece {
export const name = "P_Piece"; | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L28-L29 | 36d4a860a44952f2bcf0510fd89b6cf859bd62dd | github | |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/MessageRegistry.ets | arkts | registerAll | 批量注册消息类型
用于生成的索引文件中的 registerAllMessages() 函数
@param ctors 消息构造器数组
使用示例:
```typescript
MessageRegistry.registerAll([Person, Address, Employee])
``` | static registerAll(ctors: MessageConstructor<Message>[]): void {
ctors.forEach(ctor => MessageRegistry.register(ctor))
} | AST#method_declaration#Left static registerAll AST#parameter_list#Left ( AST#parameter#Left ctors : AST#ERROR#Left AST#primary_type#Left AST#generic_type#Left MessageConstructor AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | static registerAll(ctors: MessageConstructor<Message>[]): void {
ctors.forEach(ctor => MessageRegistry.register(ctor))
} | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageRegistry.ets#L101-L103 | 6bf9f6bff7d5d4f252c32c4dc437dd321ac223d2 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | bookmark item, consists of a label, a link and an add timestamp.
@param label A string, the name of this bookmark.
@param link A string, the link of this bookmark.
@param add_date A number, the add date of this folder (timestamp in seconds). | constructor(label: string, link: string, add_date?: number, last_modified?: number, is_folder: boolean = false) {
let date = new Date();
this.label = label.replaceAll("/", "/");
this.link = link;
this.add_date = add_date || Math.round(date.getTime() / 1000);
this.last_modified = last_modified || Mat... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left link : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | constructor(label: string, link: string, add_date?: number, last_modified?: number, is_folder: boolean = false) {
let date = new Date();
this.label = label.replaceAll("/", "/");
this.link = link;
this.add_date = add_date || Math.round(date.getTime() / 1000);
this.last_modified = last_modified || Mat... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L698-L705 | 2a60e82b3ba8ab24d56601dadc6cb7db3f68e393 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/accessibility/AccessibilityService.ets | arkts | 语音提示配置 | export interface VoiceOverConfig {
enabled: boolean;
language: string;
rate: number;
pitch: number;
volume: number;
pauseOnTouch: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface VoiceOverConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left language : AST#type_annot... | export interface VoiceOverConfig {
enabled: boolean;
language: string;
rate: number;
pitch: number;
volume: number;
pauseOnTouch: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L110-L117 | 15ddda97535bca4ff557116198c0be8acc140f5e | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM4.ets | arkts | encryptSync | 加密,同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|GCM|PKCS7、SM4_128|CBC|PKCS7、SM4_128|ECB|PKCS7、等)。
@returns | static encryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, symKey, params, transformation);
} | AST#method_declaration#Left static encryptSync 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 encryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, symKey, params, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L227-L230 | d6f92c14343c38effb0482cf420b66cfc3ae3ec4 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets | arkts | FlashSaleItem | 限时精选商品项 | @Builder
FlashSaleItem(goods: Goods) {
Column({ space: AppDimensions.spaceSmall }) {
Image(goods.mainPic)
.width(120)
.height(120)
.borderRadius(AppDimensions.radiusSmall)
.objectFit(ImageFit.Cover)
Text(goods.name)
.fontSize(AppTypography.fontSizeMedium)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right FlashSaleItem AST#parameter_list#Left ( AST#parameter#Left goods : AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L... | @Builder
FlashSaleItem(goods: Goods) {
Column({ space: AppDimensions.spaceSmall }) {
Image(goods.mainPic)
.width(120)
.height(120)
.borderRadius(AppDimensions.radiusSmall)
.objectFit(ImageFit.Cover)
Text(goods.name)
.fontSize(AppTypography.fontSizeMedium)
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L236-L257 | bd20ff22deb406eabde0563096d262d01864b82e | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Scroll.ets | arkts | LargePaddingVerticalScroll | 带大内边距的垂直滚动布局 | @ComponentV2
export struct LargePaddingVerticalScroll {
/**
* 滚动控制器
*/
@Param
scroller: Scroller = new Scroller();
/**
* 是否填充最大尺寸
*/
@Param
fillMaxSize: boolean = false;
/**
* 是否填充最大宽度
*/
@Param
fillMaxWidth: boolean = true;
/**
* 宽度
*/
@Param
widthValue: Length | undefin... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct LargePaddingVerticalScroll AST#component_body#Left { /**
* 滚动控制器
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right scroller : AST#type_annotation#Left AST#primary_type#Left Scroll... | @ComponentV2
export struct LargePaddingVerticalScroll {
@Param
scroller: Scroller = new Scroller();
@Param
fillMaxSize: boolean = false;
@Param
fillMaxWidth: boolean = true;
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Pa... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Scroll.ets#L233-L287 | e5013dafc58ae34b6446c8e2c9f7a0a269815836 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets | arkts | batchInsert | 批量插入数据
@param tableName 表名
@param data 数据
@returns 插入条数 | async batchInsert(tableName: string, data: ValuesBucket[]): Promise<void> {
if (store === undefined) {
return;
}
await store.batchInsert(tableName, data);
} | AST#method_declaration#Left async batchInsert AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left... | async batchInsert(tableName: string, data: ValuesBucket[]): Promise<void> {
if (store === undefined) {
return;
}
await store.batchInsert(tableName, data);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L133-L138 | 57b419039f9914c960b49b192f11c603ca06e282 | gitee |
openharmony/base_location | 724370a03f6f23ddc07c8eb9f49dfc61ab716bdb | services/location_ui/entry/src/main/ets/pages/BluetoothReceive.ets | arkts | dealFileReceiveUri | 处理接收的文件URI生成、发布流程 | private async dealFileReceiveUri() {
try {
await this.generateFileUri();
this.publishFileUriEvent();
} catch (error) {
let err: BusinessError = error as BusinessError;
console.error(TAG, `dealFileReceiveUri failed, code is ${err.code}, message is ${err.message}`);
... | AST#method_declaration#Left private async dealFileReceiveUri 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#expressi... | private async dealFileReceiveUri() {
try {
await this.generateFileUri();
this.publishFileUriEvent();
} catch (error) {
let err: BusinessError = error as BusinessError;
console.error(TAG, `dealFileReceiveUri failed, code is ${err.code}, message is ${err.message}`);
... | https://github.com/openharmony/base_location/blob/724370a03f6f23ddc07c8eb9f49dfc61ab716bdb/services/location_ui/entry/src/main/ets/pages/BluetoothReceive.ets#L53-L62 | 3ca7d200bcf0fea6acafa76b71355ca17f9b5f6f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/component/DatePickerDialogView.ets | arkts | DatePickerDialogView | TODO DatePickerDialog组件
author: 桃花镇童长老ᥫ᭡
since: 2024/08/01 | @Preview
@Component
export struct DatePickerDialogView {
@Prop options: DateTimePickerOptions;
@State dateType: DateType = DateType.YmdHm; //选择的日期类型
@State startDate: Date = new Date("1900-01-01 00:00:00"); //开始日期(1900-01-01 00:00:00)
@State endDate: Date = new Date("2199-12-31 23:59:59"); //结束日期(2199-12-31 23:... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct DatePickerDialogView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right options : AST#type_annotation#Left AST#primar... | @Preview
@Component
export struct DatePickerDialogView {
@Prop options: DateTimePickerOptions;
@State dateType: DateType = DateType.YmdHm;
@State startDate: Date = new Date("1900-01-01 00:00:00");
@State endDate: Date = new Date("2199-12-31 23:59:59");
@State selectDate: Date = new Date();
@State contai... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/component/DatePickerDialogView.ets#L29-L68 | 94c8aa5b61dd6bc7e49964c3ac5758d664f68b81 | gitee |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/FlowLocale.ets | arkts | from | Constructs a new FlorisLocale with given language and country.
@param language A two-letter language code.
@param country A two-letter country code.
@return A new FlorisLocale. | public static from(language: string, country: string): FlorisLocale {
return FlorisLocale.from(new Locale(language, country));
} | AST#method_declaration#Left public static from AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left country : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | public static from(language: string, country: string): FlorisLocale {
return FlorisLocale.from(new Locale(language, country));
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L54-L56 | cf669cbbe3e6bab952bc63419f0e60b9b40e1779 | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/utils/DateUtils.ets | arkts | 获取一周的第一天(周一)的日期 | export function getMondayOfWeek(inputDate: Date | number): Date {
// 如果输入的日期是数字,将其转换为日期对象
if (typeof inputDate === 'number') {
inputDate = new Date(inputDate)
}
// 获取当前日期对象
const date = new Date(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate());
// 获取当前日期是一周的第几天
const dayOfWeek = dat... | AST#export_declaration#Left export AST#function_declaration#Left function getMondayOfWeek AST#parameter_list#Left ( AST#parameter#Left inputDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST... | export function getMondayOfWeek(inputDate: Date | number): Date {
if (typeof inputDate === 'number') {
inputDate = new Date(inputDate)
}
const date = new Date(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate());
const dayOfWeek = date.getDay();
const difference = dayOfWeek;
c... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L77-L93 | 1a10a2a88ba45dd8d161265c6cca5cf0b18dbf13 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | getOAID | 获取开放匿名设备标识符,OAID。
需要权限:ohos.permission.APP_TRACKING_CONSENT | static async getOAID(): Promise<string> {
return identifier.getOAID();
} | AST#method_declaration#Left static async getOAID 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type... | static async getOAID(): Promise<string> {
return identifier.getOAID();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L108-L110 | 78a7ad9876193d5ca8520065181bcb47f0b72b56 | gitee |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/view/PersonalInformation.ets | arkts | dialogButtonStyle | 使用 @Extend 装饰器扩展 Button 组件,定义按钮样式。 | @Extend(Button)
function dialogButtonStyle() {
.fontSize(16)
.fontColor('#0A59F7')
.layoutWeight(1)
.backgroundColor(Color.White)
.width('100%')
.height(40)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Button AST#expression#Right ) AST#decorator#Right function dialogButtonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left ... | @Extend(Button)
function dialogButtonStyle() {
.fontSize(16)
.fontColor('#0A59F7')
.layoutWeight(1)
.backgroundColor(Color.White)
.width('100%')
.height(40)
} | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/PersonalInformation.ets#L31-L39 | 0b2ac63e4dd9f3697a9cd1af1bd56739df17f17b | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.utils.d.ets | arkts | lockAsync | Perform an operation with the acquired lock.
The method acquires the lock first, then calls the callback, and then releases the lock.
The callback is called asynchronously in the same thread where lockAsync was called.
An optional timeout value can be provided in {@link AsyncLockOptions}. In this case, lockAsync will r... | lockAsync<T, U>(callback: AsyncLockCallback<T>, mode: AsyncLockMode,
options: AsyncLockOptions<U>): Promise<T | U>; | AST#method_declaration#Left lockAsync AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right , AST#type_parameter#Left U AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | lockAsync<T, U>(callback: AsyncLockCallback<T>, mode: AsyncLockMode,
options: AsyncLockOptions<U>): Promise<T | U>; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L279-L280 | a072464f710dd7bf10e3ac2d661d037334ecbd6a | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | decodeAsymSegment | 非对称分段解密
@param str 待解密的字符串
@param priKey 给定秘钥规格私钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
@param keyName 密钥长度
@param keyCoding 密钥编码方式(utf8/hex/base64)
@param dataCoding 入参字符串编码方式(hex/base64)
@param isPem 是否为pem格式的key | static decodeAsymSegment(str: string, priKey: string, symAlgName: string, symEncryptName: string,
keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding,
isPem: boolean): string {
//将私钥转换
let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) :
... | AST#method_declaration#Left static decodeAsymSegment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | static decodeAsymSegment(str: string, priKey: string, symAlgName: string, symEncryptName: string,
keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding,
isPem: boolean): string {
let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) :
Crypto... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L341-L370 | 908fcdcbda018475c077db7fe5058ecd7a1a71d1 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/FileUtility.ets | arkts | normalizePath | 规范化路径字符串(去除末尾的/)
@param path 待处理的路径字符串
@returns 规范化后的路径 | static normalizePath(path: string): string {
// 检查路径非空且以/结尾
if (path && path.endsWith('/')) {
return path.substring(0, path.length - 1); // 去除最后一个字符
}
return path;
} | AST#method_declaration#Left static normalizePath AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | static normalizePath(path: string): string {
if (path && path.endsWith('/')) {
return path.substring(0, path.length - 1);
}
return path;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L219-L225 | 6dea9a75a4fad7991e1dcb523968f035b038bb01 | github |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/views/RefreshFooter.ets | arkts | RefreshFooter | 通用上拉加载底部布局 | @Component
export struct RefreshFooter {
@Prop showFooter: boolean
build() {
Row() {
Text("数据加载中,请稍后...").fontColor($r('app.color.color_333')).fontSize($r('app.float.size_text_15'))
}
.width("100%")
.height($r('app.float.size_50'))
.backgroundColor($r('app.color.color_f8f8f8'))
.visib... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RefreshFooter AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right showFooter : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_a... | @Component
export struct RefreshFooter {
@Prop showFooter: boolean
build() {
Row() {
Text("数据加载中,请稍后...").fontColor($r('app.color.color_333')).fontSize($r('app.float.size_text_15'))
}
.width("100%")
.height($r('app.float.size_50'))
.backgroundColor($r('app.color.color_f8f8f8'))
.visib... | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/views/RefreshFooter.ets#L4-L18 | 97a96aab09a0a5830c5db4b59fd4f799af577c71 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/src/main/ets/repository/UserInfoRepository.ets | arkts | 构造函数
@param {UserInfoNetworkDataSource} networkDataSource - 可选的用户信息数据源实例 | constructor(networkDataSource?: UserInfoNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new UserInfoNetworkDataSourceImpl();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left UserInfoNetworkDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statemen... | constructor(networkDataSource?: UserInfoNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new UserInfoNetworkDataSourceImpl();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/UserInfoRepository.ets#L18-L20 | 3f8e66f3753bbd913fef81bc790d67c96c23a911 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/buffer/AbstractBuffer.ets | arkts | limitTo | limits the drawing on the x-axis | public limitTo(to: number): void {
if (to < 0)
to = 0;
this.mTo = to;
} | AST#method_declaration#Left public limitTo AST#parameter_list#Left ( AST#parameter#Left to : 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#Right ... | public limitTo(to: number): void {
if (to < 0)
to = 0;
this.mTo = to;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/buffer/AbstractBuffer.ets#L50-L54 | 69e20fb27ad4bdc54223fa68d0c4e9be096eb8ed | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets | arkts | resume | 恢复播放
@returns {void} | resume(): void {
this.avplayerModel.resume();
} | AST#method_declaration#Left resume AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A... | resume(): void {
this.avplayerModel.resume();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L229-L231 | 3a40a06793657b77ba2de1ad9955e55cbaf4c86e | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/network/BaseNetWorkView.ets | arkts | BaseNetWorkView | @file 网络请求通用视图组件
@author Joker.X | @ComponentV2
export struct BaseNetWorkView {
/**
* 当前网络请求 UI 状态
*/
@Param
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
/**
* 错误状态下的重试回调
*/
@Param
onRetry: () => void = () => {
};
/**
* 自定义加载内容
*/
@BuilderParam
loadingBuilder: CustomBuilder;
/**
* 自定义错误内容
*/
@... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct BaseNetWorkView AST#component_body#Left { /**
* 当前网络请求 UI 状态
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right uiState : AST#type_annotation#Left AST#primary_type#Left BaseNetWork... | @ComponentV2
export struct BaseNetWorkView {
@Param
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
@Param
onRetry: () => void = () => {
};
@BuilderParam
loadingBuilder: CustomBuilder;
@BuilderParam
errorBuilder: CustomBuilder;
@BuilderParam
content: CustomBuilder;
@... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/network/BaseNetWorkView.ets#L9-L93 | 18f25b74ff001be912ef75c8e4816db5db13dd8b | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | get_all_restore_on_creations | Gets a list of all tabs' current restoring state.
@returns A boolean[] array, the states. | get_all_restore_on_creations() {
let r: boolean[] = [];
for (let index = 0; index < this.Tabs.length; index++) {
r.push(this.Tabs[index].pre_restoration_stage);
}
return r;
} | AST#method_declaration#Left get_all_restore_on_creations AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left r : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left boolean [ ] AST#array_type#Rig... | get_all_restore_on_creations() {
let r: boolean[] = [];
for (let index = 0; index < this.Tabs.length; index++) {
r.push(this.Tabs[index].pre_restoration_stage);
}
return r;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L532-L539 | fcd71174905610a0e2462cca41fef2b28e2fd057 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/LoginViewModel.ets | arkts | onWechatLoginClick | 微信登录点击
@returns {void} 无返回值 | onWechatLoginClick(): void {
// 第三方登录暂未接入,等待后续实现
} | AST#method_declaration#Left onWechatLoginClick 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#builder_function_body#Right AST#method_declaration#Right | onWechatLoginClick(): void {
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/LoginViewModel.ets#L12-L14 | 884accf1ecaf879d5bbf75b7eeb436d2ab2c260b | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/FileUtil.ets | arkts | getFilePath | 通过URI或路径获取文件路径
@param uriOrPath URI或路径
@returns | static getFilePath(uriOrPath: string): string {
return new fileUri.FileUri(uriOrPath).path;
} | AST#method_declaration#Left static getFilePath AST#parameter_list#Left ( AST#parameter#Left uriOrPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static getFilePath(uriOrPath: string): string {
return new fileUri.FileUri(uriOrPath).path;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L132-L134 | f82577743bd67088d126d5fef613a070536cf820 | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | Build timeline start offsets (ms) for each segment with optional gaps.
@param infos Video list.
@param gapsAfterIndex Gap configuration.
@returns Start offsets for each segment.
@example
durations: [d0, d1, d2, d3, d4]
gapsAfterIndex: { 1: G }
timelineStarts: [0, d0, d0+d1+G, d0+d1+G+d2, d0+d1+G+d2+d3] | export function buildTimelineOffsets(infos: VideoInfo[], gapsAfterIndex?: GapMap): number[] {
const n = infos?.length ?? 0;
const starts: number[] = [];
if (n === 0) {
return starts;
}
let acc = 0;
for (let i = 0; i < n; i++) {
starts.push(acc);
const dur = Number(infos[i]?.duration) || 0;
... | AST#export_declaration#Left export AST#function_declaration#Left function buildTimelineOffsets AST#parameter_list#Left ( AST#parameter#Left infos : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VideoInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ,... | export function buildTimelineOffsets(infos: VideoInfo[], gapsAfterIndex?: GapMap): number[] {
const n = infos?.length ?? 0;
const starts: number[] = [];
if (n === 0) {
return starts;
}
let acc = 0;
for (let i = 0; i < n; i++) {
starts.push(acc);
const dur = Number(infos[i]?.duration) || 0;
... | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L232-L247 | 0bce53e649084af7c7f278bb6e4655903f324d1b | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets | arkts | 轮播图数据类 | export class DataType {
id: string;
source: Resource;
type: string = 'image';
constructor(id: string, source: Resource) {
this.id = id;
this.source = source;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class DataType AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left source : AST#type_an... | export class DataType {
id: string;
source: Resource;
type: string = 'image';
constructor(id: string, source: Resource) {
this.id = id;
this.source = source;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets#L19-L28 | acbe8caa0512d75b008be21fdb24ae97f14cbe0a | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets | arkts | colorTransform | Color transform.
@param rgbValue 0 - 255.
@return 0 - 1. | function colorTransform(rgbValue: number) : number{
return Number((rgbValue / CommonConstants.COLOR_LEVEL_MAX).toFixed(CommonConstants.DECIMAL_TWO));
} | AST#function_declaration#Left function colorTransform AST#parameter_list#Left ( AST#parameter#Left rgbValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#... | function colorTransform(rgbValue: number) : number{
return Number((rgbValue / CommonConstants.COLOR_LEVEL_MAX).toFixed(CommonConstants.DECIMAL_TWO));
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets#L182-L184 | 3bb09815f97e200a4b2b86447553c3f475e9e764 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/ApiService.ets | arkts | resetPassword | 重置密码
@param username 用户名
@param oldPassword 原密码
@param newPassword 新密码
@returns Promise with API response | static async resetPassword(username: string, oldPassword: string, newPassword: string): Promise<ApiResponse> {
// 创建HTTP请求客户端
let httpRequest = http.createHttp()
try {
// 构建请求数据
let requestData: ResetPasswordRequest = {
username: username,
oldPassword: oldPassword,
newPa... | AST#method_declaration#Left static async resetPassword AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left oldPassword : AST#type_annotation#Left AST#primary_type#Left stri... | static async resetPassword(username: string, oldPassword: string, newPassword: string): Promise<ApiResponse> {
let httpRequest = http.createHttp()
try {
let requestData: ResetPasswordRequest = {
username: username,
oldPassword: oldPassword,
newPassword: newPassword
... | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/ApiService.ets#L205-L259 | c5a9b4d5ad9a3aece8e22abca2af06fbcbde48ed | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets | arkts | BottomBar | 底部结算栏 | @Builder
BottomBar() {
Row() {
// 全选
Row({ space: AppDimensions.spaceSmall }) {
Checkbox()
.select(this.isAllSelected)
.onChange((value: boolean) => {
this.toggleSelectAll();
})
Text('全选')
.fontSize(AppTypography.fontSizeMedium)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right BottomBar 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
BottomBar() {
Row() {
Row({ space: AppDimensions.spaceSmall }) {
Checkbox()
.select(this.isAllSelected)
.onChange((value: boolean) => {
this.toggleSelectAll();
})
Text('全选')
.fontSize(AppTypography.fontSizeMedium)
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets#L198-L267 | 676d25daa15c27349cd3c118eeb73b8458d40c29 | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | entry/src/main/ets/pages/model/UserModel.ets | arkts | class UserModel { name: String image: ResourceStr price: number discount: number // constructor(name: String, imagee: ResourceStr, price: number, discount: number = 0) { // this.name = name // this.image = imagee // this.price = price // this.discount = discount // } } | export class UserModel {
userID?: string = "";
userName?: string = "";
phone?: string = "";
pwd?: string = "";
token?: string = "";
avatarUrl?: string = "";
} | AST#export_declaration#Left export AST#class_declaration#Left class UserModel AST#class_body#Left { AST#property_declaration#Left userID ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Rig... | export class UserModel {
userID?: string = "";
userName?: string = "";
phone?: string = "";
pwd?: string = "";
token?: string = "";
avatarUrl?: string = "";
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/entry/src/main/ets/pages/model/UserModel.ets#L14-L21 | 75f7cdf40b0c9042f119be71d75f965c098a8fd2 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsBanner.ets | arkts | getAspectRatioModifier | 获取轮播图比例修饰器
@returns {AttributeModifier<SwiperAttribute>} 属性修饰器 | private getAspectRatioModifier(): AttributeModifier<SwiperAttribute> {
const ratio = bp({ xs: 1, sm: 1, md: 1.2, lg: 1 });
return {
applyNormalAttribute: (instance: SwiperAttribute): void => {
if (this.useSquareRatio) {
instance.aspectRatio(ratio);
}
}
};
} | AST#method_declaration#Left private getAspectRatioModifier AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SwiperAttribute AST#primary_type#Right AST#typ... | private getAspectRatioModifier(): AttributeModifier<SwiperAttribute> {
const ratio = bp({ xs: 1, sm: 1, md: 1.2, lg: 1 });
return {
applyNormalAttribute: (instance: SwiperAttribute): void => {
if (this.useSquareRatio) {
instance.aspectRatio(ratio);
}
}
};
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsBanner.ets#L67-L76 | ce31349cca1aae0379cbb87ae2cce807a6b77bed | github |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | extractAudio | 提取音频(AAC) | public static extractAudio(input: string, output: string): string[] {
return ['ffmpeg', '-i', input, '-vn', '-c:a', 'aac', '-b:a', '128k', '-y', output];
} | AST#method_declaration#Left public static extractAudio AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#p... | public static extractAudio(input: string, output: string): string[] {
return ['ffmpeg', '-i', input, '-vn', '-c:a', 'aac', '-b:a', '128k', '-y', output];
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L52-L54 | acfdd98ec895d149b51d3e1227bfb751aa7f0310 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | JSCrash/entry/src/main/ets/pages/CannotReadPropertyXXXOfUndefinedFix.ets | arkts | [End updateGestureValue2] | build() {
RelativeContainer() {
Text(this.message)
.id('HelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expres... | build() {
RelativeContainer() {
Text(this.message)
.id('HelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/CannotReadPropertyXXXOfUndefinedFix.ets#L41-L57 | 3220b08e8e5bccd6812c3b147a6fa27856263a64 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/AESSync.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey AES密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns | static decodeCBC(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256, keyCoding, dataCoding);
} | AST#method_declaration#Left static decodeCBC 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static decodeCBC(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256, keyCoding, dataCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L230-L233 | 870495b246c6bd18df637647e557a61370229f38 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets | arkts | 自定义class实现button的AttributeModifier接口,用于初始化 | export class ButtonModifier implements AttributeModifier<ButtonAttribute> {
applyNormalAttribute(instance: ButtonAttribute): void {
instance.width($r('app.float.dynamicattributes_float_30'));
instance.height($r('app.float.dynamicattributes_float_15'));
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ButtonModifier AST#implements_clause#Left implements AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ButtonAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#... | export class ButtonModifier implements AttributeModifier<ButtonAttribute> {
applyNormalAttribute(instance: ButtonAttribute): void {
instance.width($r('app.float.dynamicattributes_float_30'));
instance.height($r('app.float.dynamicattributes_float_15'));
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets#L128-L133 | a206e8ebdc701df0ce86d62a9a4a304f88fd0ed2 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets | arkts | updateCurTime | 更新播放歌曲当前进度时间
@param curTime 当前进度时间
@returns {void} | updateCurTime(curTime: number): void {
if (!this.curMusicModelRaw) {
return;
}
this.curTimeRaw = curTime;
this.curTimeStrRaw = this.genTimeStr(curTime);
this.curProgressRaw = curTime / this.curMusicModelRaw.totalTime * CommonConstants.MUSIC_SLIDER_MAX;
this.curMusiclyricsLineRaw = this.cu... | AST#method_declaration#Left updateCurTime AST#parameter_list#Left ( AST#parameter#Left curTime : 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#Ri... | updateCurTime(curTime: number): void {
if (!this.curMusicModelRaw) {
return;
}
this.curTimeRaw = curTime;
this.curTimeStrRaw = this.genTimeStr(curTime);
this.curProgressRaw = curTime / this.curMusicModelRaw.totalTime * CommonConstants.MUSIC_SLIDER_MAX;
this.curMusiclyricsLineRaw = this.cu... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L329-L338 | b0f5306c1e9fc0eaa84786aa833ddcdb28110251 | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | buildAnimParam | 注册路由转场动画,相关参数构建
@param modifier
@param ctx | buildAnimParam(component: object, ctx: NavDestinationContext): NavAnimParamBuilder {
const callback = this.registerAnimParam(component, ctx)
return NavAnimParamBuilder.builder(callback)
} | AST#method_declaration#Left buildAnimParam AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left NavDestinationContext A... | buildAnimParam(component: object, ctx: NavDestinationContext): NavAnimParamBuilder {
const callback = this.registerAnimParam(component, ctx)
return NavAnimParamBuilder.builder(callback)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L326-L329 | 18108b1df09e31d918db17ec17ad613e76b1450d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | dup | 将文件描述符转化为File。
@param fd 文件描述符。
@returns | static dup(fd: number): fs.File {
return fs.dup(fd);
} | AST#method_declaration#Left static dup AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fs . Fil... | static dup(fd: number): fs.File {
return fs.dup(fd);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L856-L858 | 083ec737e1cdb515d16bed671b50b4a29cc41e32 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinM.ets | arkts | SpinM | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinM {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.14
@Local opacity1: number = 0;
@Local opacity2: number = 0;
@Local opacity3: number = 0;
@Local opacity4: number = 0;
@Local opacity5: number = 0... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinM 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 SpinM {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.14
@Local opacity1: number = 0;
@Local opacity2: number = 0;
@Local opacity3: number = 0;
@Local opacity4: number = 0;
@Local opacity5: number = 0... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinM.ets#L25-L358 | 0eb7c516687489f5919c5594876f07fd9485b225 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/backgroundTask/Index.ets | arkts | BackgroundTaskHomeView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { BackgroundTaskHomeView } from './src/main/ets/view/BackgroundTaskHomeView' | AST#export_declaration#Left export { BackgroundTaskHomeView } from './src/main/ets/view/BackgroundTaskHomeView' AST#export_declaration#Right | export { BackgroundTaskHomeView } from './src/main/ets/view/BackgroundTaskHomeView' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/backgroundTask/Index.ets#L15-L15 | a1b5cf2e4be813e1a262f795428430997cdef3e7 | gitee |
LiuAnclouds/Harmony-ArkTS-App.git | 2119ce333927599b81a31081bc913e1416837308 | WeatherMind/entry/src/main/ets/pages/ChooseCity.ets | arkts | loadCurrentCity | 加载当前城市 | private async loadCurrentCity() {
try {
let httpRequest = http.createHttp();
let response = await httpRequest.request(Config.API.CURRENT_CITY, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json'
}
});
console.log('当前城市API响应:', res... | AST#method_declaration#Left private async loadCurrentCity 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#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expressio... | private async loadCurrentCity() {
try {
let httpRequest = http.createHttp();
let response = await httpRequest.request(Config.API.CURRENT_CITY, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json'
}
});
console.log('当前城市API响应:', res... | https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L182-L211 | c11b02ce5bfa77f7c8e11979be6c917309689c9a | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuild/entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | [EndExclude create_component] | aboutToAppear(): void {
// [StartExclude create_component]
let intervalId = setInterval(() => {
if (this.timer === 1) {
let uiContext = this.getUIContext();
let router = uiContext.getRouter();
router.pushUrl({ url: 'pages/OnIdlePage' });
router.clear();
clearInterva... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // [StartExclude create_component] AST#statement#Left AST#variable_declaration#Left let AST#var... | aboutToAppear(): void {
let intervalId = setInterval(() => {
if (this.timer === 1) {
let uiContext = this.getUIContext();
let router = uiContext.getRouter();
router.pushUrl({ url: 'pages/OnIdlePage' });
router.clear();
clearInterval(intervalId)
} else {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/entry/src/main/ets/pages/Index.ets#L29-L52 | 35ec7781b5e1d1882274494e1a29557533ba2259 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/ValidationUtils.ets | arkts | validateEmail | 验证邮箱地址
@param email 邮箱地址
@returns 是否有效 | static validateEmail(email: string): boolean {
if (!email || email.trim() === '') {
return false;
}
const regex = new RegExp(RegexConstants.EMAIL_REGEX);
return regex.test(email.trim());
} | AST#method_declaration#Left static validateEmail AST#parameter_list#Left ( AST#parameter#Left email : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | static validateEmail(email: string): boolean {
if (!email || email.trim() === '') {
return false;
}
const regex = new RegExp(RegexConstants.EMAIL_REGEX);
return regex.test(email.trim());
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/ValidationUtils.ets#L30-L37 | e73f895221d01e33ebd8f72c4ea19def1efdb230 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogHelper.ets | arkts | showLoadingDialog | 显示进度加载类弹出框 | static showLoadingDialog(options?: LoadingOptions) {
options = options ?? {};
ActionParameter.initLoadingDefault(options);
let dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(LoadingBuilder), options);
CacheHelper.put(`${CacheHelper.CACHE_LABEL}${dialogId}`, options); //缓存加载框options... | AST#method_declaration#Left static showLoadingDialog AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left LoadingOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stat... | static showLoadingDialog(options?: LoadingOptions) {
options = options ?? {};
ActionParameter.initLoadingDefault(options);
let dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(LoadingBuilder), options);
CacheHelper.put(`${CacheHelper.CACHE_LABEL}${dialogId}`, options);
return di... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L320-L326 | c0c2a7eafcd8bd12c66da1871a590846a4a22d36 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ar/ARCardService.ets | arkts | handleGestureInteraction | 处理手势交互 | async handleGestureInteraction(gesture: HandGesturePattern, position: Vector3D): Promise<void> {
try {
// 查找当前场景中的手势识别器
for (const [cardId, cardData] of this.activeCards.entries()) {
const recognizer = cardData.interactions.gestureRecognizers.find(
r => r.pattern === gesture
); | AST#method_declaration#Left async handleGestureInteraction AST#parameter_list#Left ( AST#parameter#Left gesture : AST#type_annotation#Left AST#primary_type#Left HandGesturePattern AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left position : AST#type_annotation#Left AST#primary_ty... | async handleGestureInteraction(gesture: HandGesturePattern, position: Vector3D): Promise<void> {
try {
for (const [cardId, cardData] of this.activeCards.entries()) {
const recognizer = cardData.interactions.gestureRecognizers.find(
r => r.pattern === gesture
); | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L582-L588 | 4d43c864644a56a58bfe88ca0f643b3805bc70ea | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/searchswiper/src/main/ets/components/mainpage/SearchSwiper.ets | arkts | NewsItemView | 新闻list布局样式 | @Builder
NewsItemView(listData: ListConstruction) {
RelativeContainer() {
Image($r('app.media.strawberry'))
.objectFit(ImageFit.Contain)
.width($r('app.string.search_swiper_image_width'))
.height($r('app.integer.search_swiper_image_height'))
.backgroundColor($r('app.color.sea... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NewsItemView AST#parameter_list#Left ( AST#parameter#Left listData : AST#type_annotation#Left AST#primary_type#Left ListConstruction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu... | @Builder
NewsItemView(listData: ListConstruction) {
RelativeContainer() {
Image($r('app.media.strawberry'))
.objectFit(ImageFit.Contain)
.width($r('app.string.search_swiper_image_width'))
.height($r('app.integer.search_swiper_image_height'))
.backgroundColor($r('app.color.sea... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchswiper/src/main/ets/components/mainpage/SearchSwiper.ets#L183-L223 | 493e5b48df2b11507d1bf1da4ea683b48cf1e0be | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/SoundEffect/SEManager.ets | arkts | preloadAllSounds | 预加载所有音效 | private async preloadAllSounds(): Promise<boolean> {
const types = Object.values(SEType);
let allLoaded = true;
for (let type of types) {
const loaded = await this.loadSound(type);
if (!loaded) {
allLoaded = false;
console.error(`Failed to load sound: ${type}`);
}
}
... | AST#method_declaration#Left private async preloadAllSounds 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 boolean AST#primary_type#Right AST#type_annotation#Right... | private async preloadAllSounds(): Promise<boolean> {
const types = Object.values(SEType);
let allLoaded = true;
for (let type of types) {
const loaded = await this.loadSound(type);
if (!loaded) {
allLoaded = false;
console.error(`Failed to load sound: ${type}`);
}
}
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L104-L117 | 0d0f8aa2ae84fbf6d72c0650312761040142232e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | LunarCalendar_Fixed.ets | arkts | getZodiac | 获取生肖 | private static getZodiac(lunarYear: number): string {
return ZODIAC_ANIMALS[(lunarYear - 1900) % 12];
} | AST#method_declaration#Left private static getZodiac AST#parameter_list#Left ( AST#parameter#Left lunarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#... | private static getZodiac(lunarYear: number): string {
return ZODIAC_ANIMALS[(lunarYear - 1900) % 12];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L458-L460 | c5f41585e6a78ce03952f42cd7824a7a51f11c8f | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/Coupon.ets | arkts | @file 优惠券信息
@author Joker.X | export class Coupon {
/**
* ID
*/
id: number = 0;
/**
* 标题
*/
title: string = "";
/**
* 描述
*/
description: string = "";
/**
* 类型 0-满减
*/
type: number = 0;
/**
* 金额
*/
amount: number = 0.0;
/**
* 数量
*/
num: number = 0;
/**
* 已领取
*/
receivedNum: number... | AST#export_declaration#Left export AST#class_declaration#Left class Coupon AST#class_body#Left { /**
* ID
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declara... | export class Coupon {
id: number = 0;
title: string = "";
description: string = "";
type: number = 0;
amount: number = 0.0;
num: number = 0;
receivedNum: number = 0;
startTime?: string | null = null;
endTime?: string | null = null;
status: number = 0;
condition?: C... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Coupon.ets#L7-L84 | 893b5336c25c109d12cea8efedb09388177498a4 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.