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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/PermissionUtil.ets | arkts | TODO 申请授权工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class PermissionUtil {
/**
* 校验当前是否已经授权
* @param permissions 待判断的权限
* @returns 已授权true,未授权false
*/
static async checkPermissions(permissions: Permissions): Promise<boolean> {
let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtil.checkAccessToken(permissions);
if (grantS... | AST#export_declaration#Left export AST#class_declaration#Left class PermissionUtil AST#class_body#Left { /**
* 校验当前是否已经授权
* @param permissions 待判断的权限
* @returns 已授权true,未授权false
*/ AST#method_declaration#Left static async checkPermissions AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_... | export class PermissionUtil {
static async checkPermissions(permissions: Permissions): Promise<boolean> {
let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtil.checkAccessToken(permissions);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
return true;
}... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/PermissionUtil.ets#L27-L152 | e34d5565ba4524f509db7ada830dd0e163e2f219 | gitee | |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/iconfont/ImageEditIconFont.ets | arkts | 部分场景中,有一些地方需要判断数据是 ResourceStr 还是 iconfont,因此单独定义一个 wrapper class,用来做类型判断 | export class ImageEditIconFontAttributeWrapper {
attr: ImageEditIconFontAttribute
constructor | AST#export_declaration#Left export AST#ERROR#Left class ImageEditIconFontAttributeWrapper { attr : ImageEditIconFontAttribute AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right | export class ImageEditIconFontAttributeWrapper {
attr: ImageEditIconFontAttribute
constructor | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/iconfont/ImageEditIconFont.ets#L30-L32 | db4bce2cfa4773a1d8f0655cfb5e48cad9865be1 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets | arkts | isExistBookDb | 判断 BookDb 是否存在 | public isExistBookDb(baseName: string): boolean {
const sqlitePath = new CBookDbPath(baseName).sqlite;
return sqlitePath ? FileUtility.isFileExistAt(sqlitePath) : false;
} | AST#method_declaration#Left public isExistBookDb AST#parameter_list#Left ( AST#parameter#Left baseName : 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#prim... | public isExistBookDb(baseName: string): boolean {
const sqlitePath = new CBookDbPath(baseName).sqlite;
return sqlitePath ? FileUtility.isFileExistAt(sqlitePath) : false;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets#L218-L221 | fcfe30ea2c7c65465525f9ca0abcfc365e5b695e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/Index.ets | arkts | buildHomeContent | 构建首页内容 | @Builder
buildHomeContent() {
Column({ space: 16 }) {
// 欢迎横幅
this.buildWelcomeBanner()
// 今日生日
this.buildTodayBirthdays()
// 即将到来的生日
this.buildUpcomingBirthdays()
// 快捷操作
this.buildQuickActions()
}
.width('100%')
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHomeContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_pa... | @Builder
buildHomeContent() {
Column({ space: 16 }) {
this.buildWelcomeBanner()
this.buildTodayBirthdays()
this.buildUpcomingBirthdays()
this.buildQuickActions()
}
.width('100%')
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L136-L152 | 5c5eff1d268dac9d95f49ef135aac0336ea7ccd2 | github |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/common/utils/HttpUtil.ets | arkts | get | GET 请求 | static async get<T>(url: string): Promise<T> {
return HttpUtil.request<T>(url, http.RequestMethod.GET);
} | AST#method_declaration#Left static async get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#R... | static async get<T>(url: string): Promise<T> {
return HttpUtil.request<T>(url, http.RequestMethod.GET);
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/common/utils/HttpUtil.ets#L7-L9 | baaf86940ba43d1fdf77c07db87dfb299d0eeb17 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoLoadFramesListener.ets | arkts | 视频帧加载回调接口 | export interface VideoLoadFramesListener {
// 开始加载视频帧
onStartLoad: () => void;
// 视频帧加载完成
onFinishLoad: () => void;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface VideoLoadFramesListener AST#object_type#Left { // 开始加载视频帧 AST#type_member#Left onStartLoad : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left ... | export interface VideoLoadFramesListener {
onStartLoad: () => void;
onFinishLoad: () => void;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoLoadFramesListener.ets#L19-L24 | 12b01d3d168af66d9ed8da856f4caa19b875bf71 | gitee | |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/http/Api.ets | arkts | 点赞 | export function like(postId: number) {
return instance.get('/word/like/create', { params: { postId: postId } })
} | AST#export_declaration#Left export AST#function_declaration#Left function like AST#parameter_list#Left ( AST#parameter#Left postId : 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#statem... | export function like(postId: number) {
return instance.get('/word/like/create', { params: { postId: postId } })
} | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/http/Api.ets#L37-L39 | 6a3fd451e448619b550b455df9ade163a1513968 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/SubscribeManager.ets | arkts | getPrefs | 内部同步获取 Preferences | getPrefs(): preferences.Preferences | null {
return preferences.getPreferencesSync(getAppContext(), { name: SubscribeManagerPref.Name });
} | AST#method_declaration#Left getPrefs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_t... | getPrefs(): preferences.Preferences | null {
return preferences.getPreferencesSync(getAppContext(), { name: SubscribeManagerPref.Name });
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/SubscribeManager.ets#L68-L70 | 5b3a0c474e1cf6bd2c13737bdcec335bcdd1d6d2 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listitemoverflow/src/main/ets/pages/AboutMe.ets | arkts | userInfoItem | 用户信息组件。
@param portrait 头像图片
@param username 用户名
@param prompt 点击后的提示语 | @Builder userInfoItem(portrait: ResourceStr, username: ResourceStr, prompt: ResourceStr) {
Row() {
// TODO 知识点:通过设置负的margin值,移动头像框位置,使其超出父组件范围
Image(portrait)
.width($r("app.integer.listitem_overflow_avatar_size"))
.height($r("app.integer.listitem_overflow_avatar_size"))
.margin(... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right userInfoItem AST#parameter_list#Left ( AST#parameter#Left portrait : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left username : AST#type_annot... | @Builder userInfoItem(portrait: ResourceStr, username: ResourceStr, prompt: ResourceStr) {
Row() {
Image(portrait)
.width($r("app.integer.listitem_overflow_avatar_size"))
.height($r("app.integer.listitem_overflow_avatar_size"))
.margin({
top: $r("app.integer.listitem_o... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listitemoverflow/src/main/ets/pages/AboutMe.ets#L208-L227 | 5c79296cd39606e86b52f9a974d6480e707e387f | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets | arkts | AlertDialog | Declare CustomDialog AlertDialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare CustomDialog AlertDialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @CustomDialog
export declare struct AlertDialog {
/**
* Sets the AlertDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the AlertDialog Controller.
* @type { CustomDialogController }.
* @syscap Sys... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AlertDialog AST#component_body#Left { /**
* Sets the AlertDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | @CustomDialog
export declare struct AlertDialog {
controller: CustomDialogController;
primaryTitle?: ResourceStr;
secondaryTitle?: ResourceStr;
content: ResourceStr;
primaryButton?: ButtonOptions;
secondaryButton?: ButtonOptions;
theme?:... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets#L577-L673 | afbf5e16c1ed160bf932b6ed9c1cfe39e38a525f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/media/MediaManager.ets | arkts | 图片处理选项接口 | export interface ImageProcessOptions {
width?: number;
height?: number;
quality?: number; // 0-100
format?: string; // 'jpeg', 'png', 'webp'
crop?: {
x: number;
y: number;
width: number;
height: number;
}; | AST#export_declaration#Left export AST#interface_declaration#Left interface ImageProcessOptions AST#ERROR#Left { AST#type_member#Left width ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left height ? : AST#type_annotati... | export interface ImageProcessOptions {
width?: number;
height?: number;
quality?: number;
format?: string;
crop?: {
x: number;
y: number;
width: number;
height: number;
}; | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L27-L37 | 06035c970d28fadd4dc40226ec2dcd8074a76f67 | github | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/models/ThemeModel.ets | arkts | 主题变化监听器接口 | export interface ThemeChangeListener {
onThemeChanged(newTheme: ThemeModel, oldTheme: ThemeModel): void;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ThemeChangeListener AST#object_type#Left { AST#type_member#Left onThemeChanged AST#parameter_list#Left ( AST#parameter#Left newTheme : AST#type_annotation#Left AST#primary_type#Left ThemeModel AST#primary_type#Right AST#type_annotation#Right AS... | export interface ThemeChangeListener {
onThemeChanged(newTheme: ThemeModel, oldTheme: ThemeModel): void;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L126-L128 | 5d15412b7abda2a2071577ed6227f37633c1abbc | github | |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/recents/src/main/ets/default/common/uicomponents/RecentMissionAppName.ets | arkts | RecentMissionAppName | App name component for recent missions. | @Component
export default struct RecentMissionAppName {
@Prop @Watch('updateName') appName: string;
@State nameSize: number = RecentsStyleConstants.DEFAULT_FONT_SIZE;
@State nameMargin: number = RecentsStyleConstants.APP_NAME_MARGIN;
@State name: string = '';
@Prop bundleName: string;
@Prop moduleName: stri... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct RecentMissionAppName AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateName' AST#expression#Right ) A... | @Component
export default struct RecentMissionAppName {
@Prop @Watch('updateName') appName: string;
@State nameSize: number = RecentsStyleConstants.DEFAULT_FONT_SIZE;
@State nameMargin: number = RecentsStyleConstants.APP_NAME_MARGIN;
@State name: string = '';
@Prop bundleName: string;
@Prop moduleName: stri... | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/recents/src/main/ets/default/common/uicomponents/RecentMissionAppName.ets#L23-L55 | d33eff0ba46a868d702d1a13d5b889a9bfab3511 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderDetailPage.ets | arkts | shouldShowRefundInfo | 是否显示退款信息卡片
@returns {boolean} 是否显示 | private shouldShowRefundInfo(order: Order): boolean {
return order.refund !== null || order.refundStatus !== null;
} | AST#method_declaration#Left private shouldShowRefundInfo AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#... | private shouldShowRefundInfo(order: Order): boolean {
return order.refund !== null || order.refundStatus !== null;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L440-L442 | a151c08b490d4776885bb0acf2515b04be842507 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | setGridDashedLine | Enables the grid line to be drawn in dashed mode, e.g. like this
"- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF.
Keep in mind that hardware acceleration boosts performance.
@param effect the DashPathEffect | public setGridDashedLine(effect: DashPathEffect
): void {
this.mGridDashPathEffect = effect;
} | AST#method_declaration#Left public setGridDashedLine AST#parameter_list#Left ( AST#parameter#Left effect : AST#type_annotation#Left AST#primary_type#Left DashPathEffect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void A... | public setGridDashedLine(effect: DashPathEffect
): void {
this.mGridDashPathEffect = effect;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L596-L599 | d8d6f49aaad9a8ab25a948da376a97c73a5fce5b | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/userdata/CosDownloaderUserData.ets | arkts | downloadUserData | MARK: - 文件下载方法
从腾讯云COS下载用户数据
@param objectName COS上的文件路径(例如:app_upload/userData_whitecard/101.zip)
@param toPath 本地保存路径
@param proccessing 下载进度回调(0-100)
@param finished 完成回调(是否成功、文件路径、错误信息) | public downloadUserData(
objectName: string,
toPath: string,
proccessing: (progress: number) => void,
finished: (success: boolean, filePath?: string, error?: string) => void
) {
// 删除缓存中的旧文件
FileUtility.deleteFileAt(toPath)
// 存储桶名称,由 bucketname-appid 组成,appid 必须填入,可以在 COS 控制台查看存储桶名称。 ht... | AST#method_declaration#Left public downloadUserData AST#parameter_list#Left ( AST#parameter#Left objectName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toPath : AST#type_annotation#Left AST#primary_type#Left string AST... | public downloadUserData(
objectName: string,
toPath: string,
proccessing: (progress: number) => void,
finished: (success: boolean, filePath?: string, error?: string) => void
) {
FileUtility.deleteFileAt(toPath)
let bucket = CurrentBucket
let cosPath = objectName
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/userdata/CosDownloaderUserData.ets#L98-L149 | 8fa6ec256127ef0c032e3bcd3c791073e30a4569 | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/controller/MapController.ets | arkts | panEnd | End of panning gesture. | panEnd(): void {
this.panX = 0;
this.panY = 0;
} | AST#method_declaration#Left panEnd 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#assignment_expression#Left AST#member_expr... | panEnd(): void {
this.panX = 0;
this.panY = 0;
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/controller/MapController.ets#L113-L116 | 16d2bff7e318c5587fb150ce2d4c4d77c98045eb | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWebHelper.ets | arkts | configCookieSync | 为指定url设置单个cookie的值。
@param url 要设置的cookie所属的url,建议使用完整的url。
@param value 要设置的cookie的值。
@param incognito true表示设置隐私模式下对应url的cookies,false表示设置正常非隐私模式下对应url的cookies。 | static configCookieSync(url: string, value: string, incognito?: boolean) {
webview.WebCookieManager.configCookieSync(url, value, incognito);
} | AST#method_declaration#Left static configCookieSync AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static configCookieSync(url: string, value: string, incognito?: boolean) {
webview.WebCookieManager.configCookieSync(url, value, incognito);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L136-L138 | 92003f9847445c59412ff77faeee0417292fc4df | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/suggestion.ets | arkts | Top | *********************************顶部********************************************// | @Builder
Top(){
Row() {
Image('/image/home/return.png')
.width(24)
.height(24)
.onClick(() => {
router.back()
})
Text('意见反馈')
.fontSize(18)
.fontWeight(500)
Text().width(24)
}
.width('100%')
.height(56)
.justifyContent(Flex... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right Top 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_element#Left AS... | @Builder
Top(){
Row() {
Image('/image/home/return.png')
.width(24)
.height(24)
.onClick(() => {
router.back()
})
Text('意见反馈')
.fontSize(18)
.fontWeight(500)
Text().width(24)
}
.width('100%')
.height(56)
.justifyContent(Flex... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/suggestion.ets#L18-L38 | d412eb4e6975789fee21b4966487ad60cbebeb9a | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/view/DailyTipComponent.ets | arkts | hide | 隐藏小贴士 | private hide(): void {
this.getUIContext().animateTo({
duration: 300,
curve: Curve.EaseIn
}, () => {
this.tipOpacity = 0;
this.slideOffset = -30;
});
setTimeout(() => {
this.show = false;
}, 300);
} | AST#method_declaration#Left private hide 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#... | private hide(): void {
this.getUIContext().animateTo({
duration: 300,
curve: Curve.EaseIn
}, () => {
this.tipOpacity = 0;
this.slideOffset = -30;
});
setTimeout(() => {
this.show = false;
}, 300);
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/DailyTipComponent.ets#L214-L226 | 04de31c71064c96052b61d39080005b8d112770f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | addCommemoration | 添加纪念日
@param commemoration 纪念日实体 | async addCommemoration(commemoration: CommemorationEntity): Promise<number> {
this.checkInitialization();
return await this.commemorationDAO.insertCommemoration(commemoration);
} | AST#method_declaration#Left async addCommemoration AST#parameter_list#Left ( AST#parameter#Left commemoration : AST#type_annotation#Left AST#primary_type#Left CommemorationEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | async addCommemoration(commemoration: CommemorationEntity): Promise<number> {
this.checkInitialization();
return await this.commemorationDAO.insertCommemoration(commemoration);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L167-L170 | 2ea7f6ae7d8dc8e154180c6358eb862e575a7a0b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildTodayBirthdays | 构建今日生日模块 | @Builder
buildTodayBirthdays() {
Column({ space: 12 }) {
Row() {
Text('今日生日')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
Text('查看全部')
.fontSize(14)
.fontColor('#007AFF')
}
.width... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTodayBirthdays AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component... | @Builder
buildTodayBirthdays() {
Column({ space: 12 }) {
Row() {
Text('今日生日')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
Text('查看全部')
.fontSize(14)
.fontColor('#007AFF')
}
.width... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L537-L581 | 9d12f28c8daf377416fbfc4afa1e27df7df8f6de | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/PagesRouter/entry/src/main/ets/common/utils/Logger.ets | arkts | Common log for all features. | export class Logger {
private domain: number;
private prefix: string;
private format: string = `%{public}s, %{public}s`;
constructor(prefix: string) {
this.prefix = prefix;
this.domain = 0xFF00;
}
debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
}
... | AST#export_declaration#Left export AST#class_declaration#Left class Logger AST#class_body#Left { AST#property_declaration#Left private domain : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private pr... | export class Logger {
private domain: number;
private prefix: string;
private format: string = `%{public}s, %{public}s`;
constructor(prefix: string) {
this.prefix = prefix;
this.domain = 0xFF00;
}
debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
}
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/PagesRouter/entry/src/main/ets/common/utils/Logger.ets#L21-L54 | fec5a2c3d8880bba2ba41be38ba2b381697c79f5 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/view/AddressDetailPage.ets | arkts | 构建地址详情页面
@returns {void} 无返回值 | build(): void {
AppNavDestination({
title: this.vm.isEditMode
? $r("app.string.edit_address")
: $r("app.string.add_address"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.wi... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left... | build(): void {
AppNavDestination({
title: this.vm.isEditMode
? $r("app.string.edit_address")
: $r("app.string.add_address"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.wi... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressDetailPage.ets#L44-L72 | 67c2974be0e3d1df25a9e37498032a2ded5fed46 | github | |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Settings.ets | arkts | ClearCacheDialog | 清除缓存确认对话框 | @Builder
ClearCacheDialog() {
Stack() {
// 半透明背景遮罩
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 0.5)')
.onClick(() => {
this.showClearDialog = false;
})
// 对话框内容
Column() {
Text('清除缓存')
.f... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ClearCacheDialog 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 Stack ( ) AST#container_content_body#Left { // 半透明背景遮罩 AS... | @Builder
ClearCacheDialog() {
Stack() {
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 0.5)')
.onClick(() => {
this.showClearDialog = false;
})
Column() {
Text('清除缓存')
.fontSize(18)
... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Settings.ets#L278-L343 | 14b355bc73ef478307c83a63f1ba58e7cdbc1a7a | github |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/common/conts.ets | arkts | 90s | export const OFFICIAL_WEBSITE = 'https://github.com/iamhyc/Aigis'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left OFFICIAL_WEBSITE = AST#expression#Left 'https://github.com/iamhyc/Aigis' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const OFFICIAL_WEBSITE = 'https://github.com/iamhyc/Aigis'; | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/common/conts.ets#L25-L25 | 6448bd8f1eeef7ccbd04a61dbf7cb2c6acdbd913 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets | arkts | buildGreetingHistoryCard | 构建祝福语历史卡片 | @Builder
buildGreetingHistoryCard() {
Column({ space: 12 }) {
Row() {
Text('祝福记录')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
if (this.greetingHistory.length > 0) {
Text('查看更多')
.f... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingHistoryCard AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#comp... | @Builder
buildGreetingHistoryCard() {
Column({ space: 12 }) {
Row() {
Text('祝福记录')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
if (this.greetingHistory.length > 0) {
Text('查看更多')
.f... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L392-L437 | 4d29faafed10e217e74c3e708f09df2447c69958 | github |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | cameraInputOpenFn | 打开相机 | async cameraInputOpenFn(cameraInput: camera.CameraInput): Promise<boolean> {
let isOpenSuccess = false;
try {
await cameraInput.open();
isOpenSuccess = true;
Logger.info(TAG, 'cameraInput open success');
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `cre... | AST#method_declaration#Left async cameraInputOpenFn AST#parameter_list#Left ( AST#parameter#Left cameraInput : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraInput AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | async cameraInputOpenFn(cameraInput: camera.CameraInput): Promise<boolean> {
let isOpenSuccess = false;
try {
await cameraInput.open();
isOpenSuccess = true;
Logger.info(TAG, 'cameraInput open success');
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `cre... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L484-L495 | 6f4f2814530dc5373a94c6ba5cf9a37ac83f017e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets | arkts | applyCustomColors | 应用自定义颜色 | async applyCustomColors() {
try {
await this.themeManager.setCustomColorTheme({
primary: this.customPrimaryColor,
secondary: this.customSecondaryColor,
background: this.customBackgroundColor
});
this.currentTheme = this.themeManager.getCurrentTheme();
this.showCustomD... | AST#method_declaration#Left async applyCustomColors AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A... | async applyCustomColors() {
try {
await this.themeManager.setCustomColorTheme({
primary: this.customPrimaryColor,
secondary: this.customSecondaryColor,
background: this.customBackgroundColor
});
this.currentTheme = this.themeManager.getCurrentTheme();
this.showCustomD... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L114-L126 | 3a8a6f4a9b0b14c43b623dcf3c3a23f3a2150f12 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets | arkts | The newsList state enum. | export const enum PageState {
Loading = 0,
Success = 1,
Fail = 2
} | AST#export_declaration#Left export AST#enum_declaration#Left const enum PageState AST#enum_body#Left { AST#enum_member#Left Loading = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Success = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ... | export const enum PageState {
Loading = 0,
Success = 1,
Fail = 2
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets#L218-L222 | bace8460b28757a8f0c769a219583d6187bea152 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | entry/src/main/ets/pages/Home.ets | arkts | PageMap | 构建页面 | @Builder
PageMap() {
if (this.pageName === "RcpPage") {
RcpPage()
}
if (this.pageName === "KvPage") {
KvPage()
}
if (this.pageName === "CryptoPage") {
Crypto()
}
if (this.pageName === "WelcomePage") {
Welcome()
}
if (this.pageName === "IndexPage") {
In... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right PageMap 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 ... | @Builder
PageMap() {
if (this.pageName === "RcpPage") {
RcpPage()
}
if (this.pageName === "KvPage") {
KvPage()
}
if (this.pageName === "CryptoPage") {
Crypto()
}
if (this.pageName === "WelcomePage") {
Welcome()
}
if (this.pageName === "IndexPage") {
In... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/entry/src/main/ets/pages/Home.ets#L65-L82 | 11b935dac726b3d6068ad2f9e3b55a45598afa23 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/TextAreaBuilderProxy.ets | arkts | inputType | 文本框类型
@default TextAreaType.Normal | inputType(inputType: TextAreaType) {
this.builderOptions.inputType = inputType;
return this
} | AST#method_declaration#Left inputType AST#parameter_list#Left ( AST#parameter#Left inputType : AST#type_annotation#Left AST#primary_type#Left TextAreaType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statemen... | inputType(inputType: TextAreaType) {
this.builderOptions.inputType = inputType;
return this
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextAreaBuilderProxy.ets#L19-L22 | c07038d8599ab82f3dab9d53e6583b68413bd829 | github |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/UserService.ets | arkts | isLoggedIn | 检查是否已登录 | isLoggedIn(): boolean {
return this.loggedIn;
} | AST#method_declaration#Left isLoggedIn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#L... | isLoggedIn(): boolean {
return this.loggedIn;
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L76-L78 | 13f3b3832413cd52004cff7f27d47ce4606712ef | github |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/views/CommonDialog.ets | arkts | CommonDialog | 通用Dialog弹窗组件 | @CustomDialog
export struct CommonDialog {
//自定义加载的内容
@BuilderParam contentBuilder?: () => void
//标题
@Link title: Resource
//描述
@Link description: Resource
//确认按钮文案
private positiveText = "确认"
//取消按钮文案
private negativeText = "取消"
//确认按钮回调
private positiveCallback: () => void
//取消按钮回调
private... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommonDialog AST#ERROR#Left { //自定义加载的内容 AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right contentBuilder ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Lef... | @CustomDialog
export struct CommonDialog {
@BuilderParam contentBuilder?: () => void
@Link title: Resource
@Link description: Resource
private positiveText = "确认"
private negativeText = "取消"
private positiveCallback: () => void
private negativeCallback: () => void
private showPos... | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/views/CommonDialog.ets#L4-L87 | 88190ca2b0250a3dcc27d4ca49d8a1155569acbb | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets | arkts | setWindowSize | 返回当前窗口大小
@returns | public setWindowSize(): window.Size | null {
logger.info('Start to set window size');
let displayClass: display.Display | null = this.getDisplay();
let windowSize: window.Size;
if (displayClass !== null) {
windowSize = {
width: px2vp(displayClass.width),
height: px2vp(displayClass.... | AST#method_declaration#Left public setWindowSize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . Size AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_t... | public setWindowSize(): window.Size | null {
logger.info('Start to set window size');
let displayClass: display.Display | null = this.getDisplay();
let windowSize: window.Size;
if (displayClass !== null) {
windowSize = {
width: px2vp(displayClass.width),
height: px2vp(displayClass.... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets#L106-L118 | 7645d425b0077b8d0c4079266b3b4ac91f265650 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/pages/onAreaChange/OnAreaChangePage.ets | arkts | commonStyle | Set common style. | @Styles
commonStyle(){
.width(this._width)
.height(this._height)
.offset(this._offset)
.key(this.componentKey)
.onAreaChange((oldValue: Area, newValue: Area) => {
this.sizeOldValue = JSON.stringify(oldValue)
this.sizeNewValue = JSON.stringify(newValue)
})
} | AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right commonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _width ... | @Styles
commonStyle(){
.width(this._width)
.height(this._height)
.offset(this._offset)
.key(this.componentKey)
.onAreaChange((oldValue: Area, newValue: Area) => {
this.sizeOldValue = JSON.stringify(oldValue)
this.sizeNewValue = JSON.stringify(newValue)
})
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/pages/onAreaChange/OnAreaChangePage.ets#L70-L80 | 2e0681f25c3d62a8812c46d79e92133f99342575 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AbilityUtils.ets | arkts | toAppSetting | NFC设置页面
跳转应用设置页面(调用此方法到设置,手动开启权限) | static async toAppSetting(uri: string = AbilityUtils.uri_info): Promise<void> {
let context = AppUtils.getContext();
let want: Want = {
bundleName: 'com.huawei.hmos.settings', //设置应用bundleName
abilityName: 'com.huawei.hmos.settings.MainAbility', //设置应用abilityName
uri: uri, //目标页面
paramet... | AST#method_declaration#Left static async toAppSetting 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#expression#Left AST#member_expression#Left AST#expression#Left AbilityUtils AST#expression#Right . uri_inf... | static async toAppSetting(uri: string = AbilityUtils.uri_info): Promise<void> {
let context = AppUtils.getContext();
let want: Want = {
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.MainAbility',
uri: uri,
parameters: {
bundleName: context.abil... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AbilityUtils.ets#L21-L33 | 6281824ac8a6eb0c10f2f91a833eb70fe7695c5d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DateUtil.ets | arkts | compareDays | 比较日历和指定日期相差的天数(按毫秒级的精度,不足一天将按一天进行计算,正数代表日历时间更早,负数代表日历时间更晚)。
@param date1
@param date2
@param abs 是否绝对值
@param digit 位数,默认保留两位小数。
@returns | static compareDays(date1: number | string | Date, date2: number | string | Date,
abs: boolean = false, digit: number = 2): number {
let diff = DateUtil.compareDate(date1, date2, abs) / (24 * 3600 * 1000);
if (digit >= 0) {
diff = NumberUtil.keepDecimals(diff, digit);
}
return diff;
} | AST#method_declaration#Left static compareDays AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri... | static compareDays(date1: number | string | Date, date2: number | string | Date,
abs: boolean = false, digit: number = 2): number {
let diff = DateUtil.compareDate(date1, date2, abs) / (24 * 3600 * 1000);
if (digit >= 0) {
diff = NumberUtil.keepDecimals(diff, digit);
}
return diff;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L243-L250 | c78c3cd15c330e173e1211c7c01eaeeabd8a577e | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | requestLogout | 触发退出登录弹窗
@returns {void} 无返回值 | requestLogout(): void {
this.showLogoutDialog = true;
} | AST#method_declaration#Left requestLogout 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#assignment_expression#Left AST#memb... | requestLogout(): void {
this.showLogoutDialog = true;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L34-L36 | 424d7b86f553eb2f57c019a03bb16e4606fd6e2c | github |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/home/message/CardService.ets | arkts | popupBuilder | popup构造器定义弹框内容 | @Builder popupBuilder() {
Column(){
Row() {
Text('退订').fontSize(10)
}.width(90).height(50).padding(4).justifyContent(FlexAlign.Center)
Row() {
Text('删除').fontSize(10).fontColor('#D69291')
}.width(90).height(50).padding(4).border({
width: { top: 0.5,bottom:0.5},
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right popupBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_ele... | @Builder popupBuilder() {
Column(){
Row() {
Text('退订').fontSize(10)
}.width(90).height(50).padding(4).justifyContent(FlexAlign.Center)
Row() {
Text('删除').fontSize(10).fontColor('#D69291')
}.width(90).height(50).padding(4).border({
width: { top: 0.5,bottom:0.5},
... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/home/message/CardService.ets#L48-L74 | 0cc8e2919fd0b75034325b53762b041d6fc783da | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagemosaic/src/main/ets/view/ImageMosaicView.ets | arkts | doMosaicTask | 执行马赛克任务 | async doMosaicTask(offMinX: number, offMinY: number, offMaxX: number, offMaxY: number): Promise<void> {
// TODO 知识点:将手势移动的起始坐标转换为原始图片中的坐标
offMinX = Math.round(offMinX * this.imageWidth / this.displayWidth);
offMinY = Math.round(offMinY * this.imageHeight / this.displayHeight);
offMaxX = Math.round(offMa... | AST#method_declaration#Left async doMosaicTask AST#parameter_list#Left ( AST#parameter#Left offMinX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offMinY : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | async doMosaicTask(offMinX: number, offMinY: number, offMaxX: number, offMaxY: number): Promise<void> {
offMinX = Math.round(offMinX * this.imageWidth / this.displayWidth);
offMinY = Math.round(offMinY * this.imageHeight / this.displayHeight);
offMaxX = Math.round(offMaxX * this.imageWidth / this.displ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagemosaic/src/main/ets/view/ImageMosaicView.ets#L155-L189 | 1998cd4fcf9b28153883d444bca3266e1b0cc4db | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets | arkts | checkCurrentDay | check is current day | public checkCurrentDay(): boolean {
return dateToStr(new Date()) === this.selectedDayInfo?.dateStr;
} | AST#method_declaration#Left public checkCurrentDay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_... | public checkCurrentDay(): boolean {
return dateToStr(new Date()) === this.selectedDayInfo?.dateStr;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets#L94-L96 | 2f413c562428f7d14806d3e407184aff576fba68 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/UserUpdate.ets | arkts | 应用约束61:使用export default代替module.exports | export default UserUpdateHandler; | AST#export_declaration#Left export default AST#expression#Left UserUpdateHandler AST#expression#Right ; AST#export_declaration#Right | export default UserUpdateHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/UserUpdate.ets#L15-L15 | de1ee0de9d49fbbdf960fa64b7aa9176b68b9d22 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 发表评论
@param postId 动态ID
@param comment 评论内容
@returns 创建的评论 | export function createComment(postId: number, comment: Comment): Promise<Comment> {
// 获取当前用户会话
const userSession = UserSession.getInstance();
// 确保用户已登录
if (!userSession.isLoggedIn()) {
console.error('用户未登录,无法发表评论');
return Promise.reject(new Error('用户未登录,请先登录'));
}
// 确保包含用户ID
const userId =... | AST#export_declaration#Left export AST#function_declaration#Left function createComment AST#parameter_list#Left ( AST#parameter#Left postId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left comment : AST#type_annotation#Left... | export function createComment(postId: number, comment: Comment): Promise<Comment> {
const userSession = UserSession.getInstance();
if (!userSession.isLoggedIn()) {
console.error('用户未登录,无法发表评论');
return Promise.reject(new Error('用户未登录,请先登录'));
}
const userId = userSession.getUserId();
if (... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L943-L1014 | 18e153d82c7019e864729c149089809eba363780 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets | arkts | openBindSheet | 创建并弹出以bindSheetContent作为内容的半模态。
@param wrappedBuilder 自定义半模态中显示的组件内容。
@param options 半模态样式。 | openBindSheet<T extends BaseSheetOptions>(wrappedBuilder: WrappedBuilder<[T]>, options: T): string {
if (!this.exist(options.dialogId ?? "")) { //判断dialogId是否存在
if (!options.dialogId) {
options.dialogId = this.generateDialogId();
}
const onDisappear = options.onDisappear; //弹窗消失时的事件回调。
... | AST#method_declaration#Left openBindSheet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left BaseSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left wrappe... | openBindSheet<T extends BaseSheetOptions>(wrappedBuilder: WrappedBuilder<[T]>, options: T): string {
if (!this.exist(options.dialogId ?? "")) {
if (!options.dialogId) {
options.dialogId = this.generateDialogId();
}
const onDisappear = options.onDisappear;
options.onDisappear = () =... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L74-L113 | a2c7b2aaed955b9d020479b82002e12c5c416fcc | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | verify | 对数据进行验签,异步
@param dataBlob 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、等)。
@returns | static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'RSA1024|PKCS1|SHA256'): Promise<boolean> {
return CryptoUtil.verify(dataBlob, signDataBlob, pubKey, algName);
} | AST#method_declaration#Left static async verify AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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 sig... | static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'RSA1024|PKCS1|SHA256'): Promise<boolean> {
return CryptoUtil.verify(dataBlob, signDataBlob, pubKey, algName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L262-L264 | 5c94d07a1a5f36d7ece71b66c167ea262c9e02c8 | gitee |
tobias910903/komue-harmonyapp.git | cd4dd4e7859ec5b33a5140bdd1d050377f13175b | entry/src/main/ets/utils/Router.ets | arkts | 跳转到指定页面 | export function goRoutePage(url: string, params: RouteParams | null = null): void {
AppUtil.getUIContext().getRouter().pushUrl({
url,
params
}).then(() => {
console.info('succeeded');
}).catch((error: BusinessError) => {
console.error(`pushUrl failed, code is ${error.code}, message is ${error... | AST#export_declaration#Left export AST#function_declaration#Left function goRoutePage AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#u... | export function goRoutePage(url: string, params: RouteParams | null = null): void {
AppUtil.getUIContext().getRouter().pushUrl({
url,
params
}).then(() => {
console.info('succeeded');
}).catch((error: BusinessError) => {
console.error(`pushUrl failed, code is ${error.code}, message is ${error... | https://github.com/tobias910903/komue-harmonyapp.git/blob/cd4dd4e7859ec5b33a5140bdd1d050377f13175b/entry/src/main/ets/utils/Router.ets#L18-L28 | c219f440f8570ef823f3edfde7c292bee5561ff1 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_defaults.ets | arkts | The default name of a window.
@returns 'Foxy Meowy Dodgy! Welcome to a new window!' | export function default_new_window_name(): string {
return resource_to_string($r('app.string.Settings_appearance_windows_default_name'));
} | AST#export_declaration#Left export AST#function_declaration#Left function default_new_window_name AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_stateme... | export function default_new_window_name(): string {
return resource_to_string($r('app.string.Settings_appearance_windows_default_name'));
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L139-L141 | 7c217970f4f1ea216505296af515cee3189c94e2 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets | arkts | updateOrder | 更新订单信息
@param {Unknown} params - 订单更新参数
@returns {Promise<NetworkResponse<Unknown>>} 更新结果 | async updateOrder(params: Unknown): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("order/info/update", params);
return resp.data;
} | AST#method_declaration#Left async updateOrder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Unknown 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#Lef... | async updateOrder(params: Unknown): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("order/info/update", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L38-L42 | f24cffeec5f1cdaefcbd4200274cf52069fec341 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | 成就类型枚举 | export enum AchievementType {
MILESTONE = 'milestone', // 里程碑成就
STREAK = 'streak', // 连续性成就
COLLECTION = 'collection', // 收集类成就
SOCIAL = 'social', // 社交类成就
SPECIAL = 'special', // 特殊成就
SEASONAL = 'seasonal' // 季节性成就
} | AST#export_declaration#Left export AST#enum_declaration#Left enum AchievementType AST#enum_body#Left { AST#enum_member#Left MILESTONE = AST#expression#Left 'milestone' AST#expression#Right AST#enum_member#Right , // 里程碑成就 AST#enum_member#Left STREAK = AST#expression#Left 'streak' AST#expression#Right AST#enum_member#Ri... | export enum AchievementType {
MILESTONE = 'milestone',
STREAK = 'streak',
COLLECTION = 'collection',
SOCIAL = 'social',
SPECIAL = 'special',
SEASONAL = 'seasonal'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L35-L42 | 0c54ab3e969664399dfc59e8118b0c9d7ad6bd9b | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/main/Mine.ets | arkts | Mine | 我的页面 | @Component
export struct Mine {
build() {
Column({ space: '15vp' }) {
TopComponent({ title: '我的' })
Image($r('app.media.person'))
.width('80vp')
.height('80vp')
.margin({ top: '30vp' })
Text('test')
.height('20vp')
.fontSize('14vp')
.fontColor(0x... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Mine AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#comp... | @Component
export struct Mine {
build() {
Column({ space: '15vp' }) {
TopComponent({ title: '我的' })
Image($r('app.media.person'))
.width('80vp')
.height('80vp')
.margin({ top: '30vp' })
Text('test')
.height('20vp')
.fontSize('14vp')
.fontColor(0x... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/main/Mine.ets#L23-L125 | 5ec4565731f259f8077a0191be3a49eea2fa94f0 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SM3.ets | arkts | hmac | 消息认证码计算
@param str 计算字符串
@returns | static async hmac(str: string): Promise<OutDTO<string>> {
return DynamicUtil.hmac(str, 'SM3');
} | AST#method_declaration#Left static async hmac 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 AST#generic_type#Left Pr... | static async hmac(str: string): Promise<OutDTO<string>> {
return DynamicUtil.hmac(str, 'SM3');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM3.ets#L41-L43 | 48ca2bf05674c63850ce1171813db4a384cd1fea | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/constant/AlarmSettingTypes.ets | arkts | 闹钟设置类型枚举描述。 | export enum AlarmSettingTypes {
/**
* 闹钟设置类型:重复。
*/
REPEAT,
/**
* 闹钟设置类型:名称。
*/
ALARM_NAME,
/**
* 闹钟设置类型:响铃时长。
*/
RING_DURATION,
/**
* 闹钟设置类型:间隔。
*/
INTERVAL
} | AST#export_declaration#Left export AST#enum_declaration#Left enum AlarmSettingTypes AST#enum_body#Left { /**
* 闹钟设置类型:重复。
*/ AST#enum_member#Left REPEAT AST#enum_member#Right , /**
* 闹钟设置类型:名称。
*/ AST#enum_member#Left ALARM_NAME AST#enum_member#Right , /**
* 闹钟设置类型:响铃时长。
*/ AST#enum_member#Left RING_D... | export enum AlarmSettingTypes {
REPEAT,
ALARM_NAME,
RING_DURATION,
INTERVAL
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/constant/AlarmSettingTypes.ets#L4-L24 | 2a756c16e0d7d2aa3785af48a0c6d8b189c59d9e | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | toBluetoothSetting | 跳转蓝牙设置页面 | static toBluetoothSetting(): Promise<void> {
return WantUtil.toSetting(WantUtil.URI_BLUETOOTH);
} | AST#method_declaration#Left static toBluetoothSetting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#t... | static toBluetoothSetting(): Promise<void> {
return WantUtil.toSetting(WantUtil.URI_BLUETOOTH);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L147-L149 | 19e720a85f091c716e4a0e179809cf8e42aceacd | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets | arkts | cancelingUserAuthentication | cancel-authentication.md
发起认证可信等级≥ATL3的人脸+锁屏密码认证后,取消认证请求 | cancelingUserAuthentication() {
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
const randData: Uint8Array = rand?.generateRandomSync(len)?.data;
// 设置认证参数
const authParam: userAuth.AuthParam = {
challenge: randData,
authType: [userAuth.UserAu... | AST#method_declaration#Left cancelingUserAuthentication 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 const AST#variable_declarator#Left rand = AST#expression#Left ... | cancelingUserAuthentication() {
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
const randData: Uint8Array = rand?.generateRandomSync(len)?.data;
const authParam: userAuth.AuthParam = {
challenge: randData,
authType: [userAuth.UserAuthType.PI... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L366-L390 | da91b5fa5f8198bf351f234bc4ddac5e761653a5 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/HillCipher.ets | arkts | inverseMatrix | 计算2x2矩阵的逆矩阵
@param matrix 2x2矩阵
@returns 逆矩阵,如果不存在则返回null | private static inverseMatrix(matrix: number[][]): number[][] | null {
const det = HillCipher.determinant(matrix);
const detInverse = HillCipher.modInverse(det);
if (detInverse === null) {
return null;
}
return [
[
((matrix[1][1] * detInverse) % HillCipher.MOD + HillCipher.MOD) %... | AST#method_declaration#Left private static inverseMatrix AST#parameter_list#Left ( AST#parameter#Left matrix : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type... | private static inverseMatrix(matrix: number[][]): number[][] | null {
const det = HillCipher.determinant(matrix);
const detInverse = HillCipher.modInverse(det);
if (detInverse === null) {
return null;
}
return [
[
((matrix[1][1] * detInverse) % HillCipher.MOD + HillCipher.MOD) %... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/HillCipher.ets#L38-L55 | c5fad32264e377ea3cb79e63aceb03f061efbd05 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets | arkts | NavDestinationTitle | [End handover_change_listen] | @Builder
NavDestinationTitle() {
Column() {
Text($r('app.string.network_status_listening'))
.fontSize(20)
.lineHeight(40)
.fontWeight(700)
.width('100%')
.padding({ left: 12 })
}
.width('100%')
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NavDestinationTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts... | @Builder
NavDestinationTitle() {
Column() {
Text($r('app.string.network_status_listening'))
.fontSize(20)
.lineHeight(40)
.fontWeight(700)
.width('100%')
.padding({ left: 12 })
}
.width('100%')
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L251-L262 | fb0a3ecce52a8ed7411ba477dc00c425d8f72c5a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/model/FsManager.ets | arkts | innerPasteFromDistributedDir | 粘贴,弹进度条 | innerPasteFromDistributedDir(from: string, to: string) {
Logger.info(TAG, `innerPasteFromDistributedDir--from: ${from}`);
Logger.info(TAG, `innerPasteFromDistributedDir--to: ${to}`);
try {
// 定义拷贝回调
let totalProgress: number = 0;
let totalCopySize: number = 0;
let copiedSize: number ... | AST#method_declaration#Left innerPasteFromDistributedDir AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | innerPasteFromDistributedDir(from: string, to: string) {
Logger.info(TAG, `innerPasteFromDistributedDir--from: ${from}`);
Logger.info(TAG, `innerPasteFromDistributedDir--to: ${to}`);
try {
let totalProgress: number = 0;
let totalCopySize: number = 0;
let copiedSize: number = 0;
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/model/FsManager.ets#L255-L313 | 686449bdc3fc60fd68bbe4f6ee24167a18494809 | gitee |
hushenghao/ArkTS-RelativeContainerExtend.git | 8df722220a15be576736c7a58a8ed30820c3a1ea | entry/src/main/ets/utils/RelativeContainerExtend.ets | arkts | 构建相对布局规则
@param rules
@returns | export function buildRules(rules: AlignRules): AlignRuleOption {
let _left: HorizontalRule | undefined = undefined
if (rules.leftToLeftOf != null && rules.leftToRightOf != null) {
throw Error("leftToLeftOf 和 leftToRightOf 不能同时约束")
} else if (rules.leftToLeftOf != null) {
_left = toLeftOf(rules.leftToLeftO... | AST#export_declaration#Left export AST#function_declaration#Left function buildRules AST#parameter_list#Left ( AST#parameter#Left rules : AST#type_annotation#Left AST#primary_type#Left AlignRules AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A... | export function buildRules(rules: AlignRules): AlignRuleOption {
let _left: HorizontalRule | undefined = undefined
if (rules.leftToLeftOf != null && rules.leftToRightOf != null) {
throw Error("leftToLeftOf 和 leftToRightOf 不能同时约束")
} else if (rules.leftToLeftOf != null) {
_left = toLeftOf(rules.leftToLeftO... | https://github.com/hushenghao/ArkTS-RelativeContainerExtend.git/blob/8df722220a15be576736c7a58a8ed30820c3a1ea/entry/src/main/ets/utils/RelativeContainerExtend.ets#L24-L104 | dbcc6b6f0e0fae02cb2fc4f89a3a0706dea943f4 | github | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | openPlayerPage | 打开播放页面 | openPlayerPage() {
const currentEpisode = this.playerService.getCurrentEpisode();
if (currentEpisode) {
const params = new RouteParams();
params.episodeId = currentEpisode.id;
UIUtils.pushUrl('pages/PlayerPage', params);
}
} | AST#method_declaration#Left openPlayerPage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentEpisode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#... | openPlayerPage() {
const currentEpisode = this.playerService.getCurrentEpisode();
if (currentEpisode) {
const params = new RouteParams();
params.episodeId = currentEpisode.id;
UIUtils.pushUrl('pages/PlayerPage', params);
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L373-L380 | 7e51d8d063af63c05dd31fe792447cd50c2a8007 | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/view/UserProfileComponent.ets | arkts | loadUserProfile | 加载用户资料 | async loadUserProfile() {
if (!this.token) {
Logger.warn('未登录,使用默认资料');
return;
}
this.isLoading = true;
try {
let response = await HttpUtils.get<UserInfo>(ApiConstants.USER_INFO_URL);
if (response.code === 200 && response.data) {
this.userInfo = response.data;
... | AST#method_declaration#Left async loadUserProfile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST... | async loadUserProfile() {
if (!this.token) {
Logger.warn('未登录,使用默认资料');
return;
}
this.isLoading = true;
try {
let response = await HttpUtils.get<UserInfo>(ApiConstants.USER_INFO_URL);
if (response.code === 200 && response.data) {
this.userInfo = response.data;
... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L125-L147 | ae14e3541889efd4d8f5db7449b51364cb1d1ae2 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/dbUtils/DBAccessor.ets | arkts | isExist | 检查表中是否存在某列
@param column - 需要检查的列名
@param table - 表名
@returns Promise<boolean> 返回列是否存在 | async isExist(column: string, table: string): Promise<boolean> {
// 使用PRAGMA查询表结构
const names = await this.getDatas<string>(
`PRAGMA table_info(${table})`,
[],
rs => rs.getString(1) // 获取列名字段
);
return names?.includes(column) ?? false;
} | AST#method_declaration#Left async isExist AST#parameter_list#Left ( AST#parameter#Left column : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left table : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | async isExist(column: string, table: string): Promise<boolean> {
const names = await this.getDatas<string>(
`PRAGMA table_info(${table})`,
[],
rs => rs.getString(1)
);
return names?.includes(column) ?? false;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L299-L307 | acac8091c5b32c88e8819a63813c6d853808d337 | github |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/MessageRegistry.ets | arkts | create | 根据类型名动态创建消息
⚠️ 注意:需要预先调用 register() 注册类型
@param typeName 消息类型名称
@param init 初始化数据(可选)
@returns 创建的消息对象,如果类型未注册则返回 null
使用示例:
```typescript
MessageRegistry.register(Person)
const person = MessageRegistry.create('test.Person', { name: 'Alice' })
if (person !== null) {
console.log(person.toJson())
}
``` | static create(typeName: string, init?: Object): Message | null {
const ctor = MessageRegistry.get(typeName)
if (ctor === undefined) {
console.warn(`Message type "${typeName}" not registered. Call MessageRegistry.register() first.`)
return null
}
return ctor.create(init as Partial<Message>)
... | AST#method_declaration#Left static create AST#parameter_list#Left ( AST#parameter#Left typeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_typ... | static create(typeName: string, init?: Object): Message | null {
const ctor = MessageRegistry.get(typeName)
if (ctor === undefined) {
console.warn(`Message type "${typeName}" not registered. Call MessageRegistry.register() first.`)
return null
}
return ctor.create(init as Partial<Message>)
... | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageRegistry.ets#L158-L165 | 7be9ab0f209c1be4516827fc2db4349915f927ca | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/ClockArea.ets | arkts | drawPan | 绘制表盘。 | private drawPan(): void {
this.renderContext.beginPath();
let secondImg = new ImageBitmap(MainConstant.CLOCK_PAN_IMAGE_URL);
let imgWidth = this.clockRadius * 2;
this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth);
this.renderContext.restore();
} | AST#method_declaration#Left private drawPan 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#expression_statement#Left AST#expression#Left AST#call_expression#Left... | private drawPan(): void {
this.renderContext.beginPath();
let secondImg = new ImageBitmap(MainConstant.CLOCK_PAN_IMAGE_URL);
let imgWidth = this.clockRadius * 2;
this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth);
this.renderContext.restore();
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/ClockArea.ets#L119-L125 | ad4b7ddfd65d263e2c6b87faa017d4e7601925d8 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderLogisticsPage.ets | arkts | OrderLogisticsContent | 订单物流页面内容视图
@returns {void} 无返回值 | @Builder
private OrderLogisticsContent(): void {
ColumnStart({ fillMaxSize: true }) {
Scroll() {
Column() {
AddressCard({
address: this.getOrderData().address ?? null
});
SpaceVerticalMedium();
this.LogisticsInfoCard(this.getLogisticsData());
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderLogisticsContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Lef... | @Builder
private OrderLogisticsContent(): void {
ColumnStart({ fillMaxSize: true }) {
Scroll() {
Column() {
AddressCard({
address: this.getOrderData().address ?? null
});
SpaceVerticalMedium();
this.LogisticsInfoCard(this.getLogisticsData());
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L74-L103 | 527295529ddd8aa642555a477495b99ff609c94e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getRawFd | 用户获取resources/rawfile目录下对应rawfile文件所在hap的descriptor信息
@param path rawfile文件路径
@returns | static async getRawFd(path: string): Promise<resourceManager.RawFileDescriptor> {
return ResUtil.getResourceManager().getRawFd(path);
} | AST#method_declaration#Left static async getRawFd 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 AST#generic_type#Le... | static async getRawFd(path: string): Promise<resourceManager.RawFileDescriptor> {
return ResUtil.getResourceManager().getRawFd(path);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L486-L488 | 968e3d5d7c8c44536b0195c9a3bd4c13d056dd20 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | clearAllData | ==================== 数据管理相关操作 ====================
清空所有数据 | async clearAllData(): Promise<void> {
this.checkInitialization();
await this.dbManager.clearAllData();
console.info('[DatabaseService] All data cleared');
} | AST#method_declaration#Left async clearAllData 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_arg... | async clearAllData(): Promise<void> {
this.checkInitialization();
await this.dbManager.clearAllData();
console.info('[DatabaseService] All data cleared');
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L294-L298 | 043b5c3e2c65bf63a3f855be7a3bb0e4a2613c32 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets | arkts | getCorrectCountByManger | 统计试卷正确题数量
@param examList
@returns | public getCorrectCountByManger(examList: ExamDetail[]): number {
return examList.filter((item: ExamDetail) => item.isCorrect === true).length;
} | AST#method_declaration#Left public getCorrectCountByManger AST#parameter_list#Left ( AST#parameter#Left examList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ExamDetail [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#... | public getCorrectCountByManger(examList: ExamDetail[]): number {
return examList.filter((item: ExamDetail) => item.isCorrect === true).length;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L146-L148 | d2f3c008b4bf7975caba81646ee861b7812f191b | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/BasicDataSource.ets | arkts | getData | Retrieve data at the specified index. | public getData(index: number): void {
hilog.info(0x0000, 'testTag', 'getData, index:' + index);
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig... | public getData(index: number): void {
hilog.info(0x0000, 'testTag', 'getData, index:' + index);
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/BasicDataSource.ets#L28-L30 | 8aa8799ce1505d3fb57f82184f1419bfd72e8302 | gitee |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bundle/Model/DMPBundleLoadInfo.ets | arkts | isAppUpdate | 应用升级 | isAppUpdate(): Boolean {
if (this.cacheVersionCode == null || this.cacheVersionCode == 0) {
return true;
}
return this.appVersionCode! > this.cacheVersionCode;
} | AST#method_declaration#Left isAppUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left A... | isAppUpdate(): Boolean {
if (this.cacheVersionCode == null || this.cacheVersionCode == 0) {
return true;
}
return this.appVersionCode! > this.cacheVersionCode;
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Model/DMPBundleLoadInfo.ets#L30-L35 | 12b14c35068078d5191109cbfecdb1a66c861c76 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/viewmodel/NavigationViewModel.ets | arkts | hasResultDesc | 是否存在结果说明
@returns {boolean} 是否存在 | hasResultDesc(): boolean {
return this.resultDescription.length > 0;
} | AST#method_declaration#Left hasResultDesc AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expressio... | hasResultDesc(): boolean {
return this.resultDescription.length > 0;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/NavigationViewModel.ets#L97-L99 | 7c8b25ec01803d3e11e7593a4f6bf96ead7cbbef | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/MenuData.ets | arkts | MenuData is used to initialize MenusComponent. | export default class MenuData {
menuName: Resource = $r('app.string.home_menu_all');
menuContent: Resource = $r('app.string.home_menu_all_content');
fontWeight: string = '';
fontColor: string = '';
} | AST#export_declaration#Left export default AST#class_declaration#Left class MenuData AST#class_body#Left { AST#property_declaration#Left menuName : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#express... | export default class MenuData {
menuName: Resource = $r('app.string.home_menu_all');
menuContent: Resource = $r('app.string.home_menu_all_content');
fontWeight: string = '';
fontColor: string = '';
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/MenuData.ets#L19-L24 | a460a6d687f7d12694d956186c26837763725ab3 | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/chat/PrivateChatComponent.ets | arkts | PrivateChatComponent | 问答界面 | @Component
export struct PrivateChatComponent {
@Prop functionConfig: VHConfigList | null = null; //功能配置
@State chatDisable: boolean = false;
@Prop room_tool: VHRoomToolsStatusData | null = null;
@Prop webinars: VHWebinarData | null = null;
@Prop imBase: VHIMServer;
@State avatar: string | undefined = "";
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PrivateChatComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right functionConfig : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left VHConfigLi... | @Component
export struct PrivateChatComponent {
@Prop functionConfig: VHConfigList | null = null;
@State chatDisable: boolean = false;
@Prop room_tool: VHRoomToolsStatusData | null = null;
@Prop webinars: VHWebinarData | null = null;
@Prop imBase: VHIMServer;
@State avatar: string | undefined = "";
@Stat... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L29-L529 | 06cf8a94952ac00d44818b13f8100166124dc488 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatMessage.ets | arkts | 构造函数
@param data | constructor(data:IChatMessage) {
this.name=data.name;
this.roleType=data.roleType;
this.picurl=data.picurl;
this.content=data.content;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IChatMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statem... | constructor(data:IChatMessage) {
this.name=data.name;
this.roleType=data.roleType;
this.picurl=data.picurl;
this.content=data.content;
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatMessage.ets#L35-L40 | 3458fa1a37d8bd5e112ba32e12c318b00eb44e5b | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/DateHelper.ets | arkts | getDaysByMonth | 获取指定月份的天数 | static getDaysByMonth(year: number, month: number): number {
if (month == 2) {
if (DateHelper.isLeapYear(year)) {
return 29;
} else {
return 28;
}
} else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
return 31;
... | AST#method_declaration#Left static getDaysByMonth 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_... | static getDaysByMonth(year: number, month: number): number {
if (month == 2) {
if (DateHelper.isLeapYear(year)) {
return 29;
} else {
return 28;
}
} else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
return 31;
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L39-L51 | 528da17a1bcc913b5ced386f1e355d268689d9bb | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/StringUtils.ets | arkts | unit8ArrayToStr | Uint8Array转字符串
@param src Uint8Array
@returns 字符串 | static unit8ArrayToStr(src: Uint8Array, encoding: buffer.BufferEncoding = 'utf-8'): string {
let textDecoder = util.TextDecoder.create(encoding, { ignoreBOM: true })
let result = textDecoder.decodeWithStream(src, { stream: true });
return result;
} | AST#method_declaration#Left static unit8ArrayToStr AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left encoding : AST#type_annotation#Left AST#primary_type#Left AST#qualifie... | static unit8ArrayToStr(src: Uint8Array, encoding: buffer.BufferEncoding = 'utf-8'): string {
let textDecoder = util.TextDecoder.create(encoding, { ignoreBOM: true })
let result = textDecoder.decodeWithStream(src, { stream: true });
return result;
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L215-L219 | 2c2dd3626099bb0e4f97638e988c654e21539bdb | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarUtils.ets | arkts | getLunarBirthdaySolarDate | 计算农历生日对应的公历日期(用于提醒计算)
@param birthYear 出生年份(农历)
@param birthMonth 出生月份(农历)
@param birthDay 出生日期(农历)
@param isLeapMonth 是否闰月
@param targetYear 目标年份(公历)
@returns 目标年份的公历生日日期 | static getLunarBirthdaySolarDate(
birthYear: number,
birthMonth: number,
birthDay: number,
isLeapMonth: boolean,
targetYear: number
): string | null {
// 将目标公历年份转换为农历年份
const targetYearStart = new Date(targetYear, 0, 1);
const lunarInfo = LunarUtils.solarToLunar(targetYearStart);
... | AST#method_declaration#Left static getLunarBirthdaySolarDate AST#parameter_list#Left ( AST#parameter#Left birthYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left birthMonth : AST#type_annotation#Left AST#primary_type#Lef... | static getLunarBirthdaySolarDate(
birthYear: number,
birthMonth: number,
birthDay: number,
isLeapMonth: boolean,
targetYear: number
): string | null {
const targetYearStart = new Date(targetYear, 0, 1);
const lunarInfo = LunarUtils.solarToLunar(targetYearStart);
if (!lunarInf... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L492-L520 | ad7b3784cd411648fa260227d39fe17639046069 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | entry/src/main/ets/entryability/EntryAbility.ets | arkts | 入口Ability
负责初始化应用、设置路由、处理生命周期事件
@author Joker.X | export default class EntryAbility extends UIAbility {
/**
* 应用创建时调用
* 初始化应用上下文、设置颜色模式、注册路由
* @param {Want} want - 启动意图
* @param {AbilityConstant.LaunchParam} launchParam - 启动参数
* @returns {void} 无返回值
*/
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.con... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 应用创建时调用
* 初始化应用上下文、设置颜色模式、注册路由
* @param {Want} want - 启动意图
* @param {AbilityC... | export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
this.registerRouter();
ContextUtil.init(this.context)
}... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/entry/src/main/ets/entryability/EntryAbility.ets#L25-L112 | a3bde43fa494660748ed79a73e0d19917bb0cd4c | github | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/constant/WorldClockConstants.ets | arkts | 世界时钟常量类。 | export default class WorldClockConstants {
/**
* 计时器格式。
*/
static readonly TIMER_FORMAT: string = 'HH:mm';
/**
* 世界时钟字符串。
*/
static readonly WORLD_CLOCK: string = '世界时钟';
} | AST#export_declaration#Left export default AST#class_declaration#Left class WorldClockConstants AST#class_body#Left { /**
* 计时器格式。
*/ AST#property_declaration#Left static readonly TIMER_FORMAT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression... | export default class WorldClockConstants {
static readonly TIMER_FORMAT: string = 'HH:mm';
static readonly WORLD_CLOCK: string = '世界时钟';
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/constant/WorldClockConstants.ets#L4-L13 | 090d3597d999cb5c81890316816082b9325885f0 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onDestroy | 删除 | onDestroy(): void {
} | AST#method_declaration#Left onDestroy 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 | onDestroy(): void {
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets#L13-L14 | baa944588471c13c7d3fec5dd1fdc2df890dfd32 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets | arkts | 生命周期函数 | export default class EntryAbility extends UIAbility {
// 被拉起
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
}
// 删除
onDestroy(): void {
}
// 窗口呈现
onWindowStageCreate(windowStage: window.WindowStage): void {
windowStage.loadContent( "pages/Index", (err) => {
if (err... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 被拉起 AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want ... | export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
}
onDestroy(): void {
}
onWindowStageCreate(windowStage: window.WindowStage): void {
windowStage.loadContent( "pages/Index", (err) => {
if (err.code) {
re... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets#L6-L37 | 295ba2077df6a14c3d8053cbdf606d0d64394048 | gitee | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/SearchSchedule.ets | arkts | getEndTimeText | 结束时间字符串。 | private getEndTimeText(schedule: Schedule): string {
if (schedule.endYear === 0) {
console.error('[hxk] MyDay getEndTimeText err');
}
else {
return schedule.endMonth + '月' + schedule.endDate + '日';
}
} | AST#method_declaration#Left private getEndTimeText AST#parameter_list#Left ( AST#parameter#Left schedule : AST#type_annotation#Left AST#primary_type#Left Schedule 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#p... | private getEndTimeText(schedule: Schedule): string {
if (schedule.endYear === 0) {
console.error('[hxk] MyDay getEndTimeText err');
}
else {
return schedule.endMonth + '月' + schedule.endDate + '日';
}
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/SearchSchedule.ets#L449-L456 | 28ed25a441605ed20c0f658b11a79ea15447469c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWebHelper.ets | arkts | configCookie | 以异步Promise方式为指定url设置单个cookie的值。
@param url 要设置的cookie所属的url,建议使用完整的url。
@param value 要设置的cookie的值。 | static async configCookie(url: string, value: string): Promise<void> {
return await webview.WebCookieManager.configCookie(url, value);
} | AST#method_declaration#Left static async configCookie AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | static async configCookie(url: string, value: string): Promise<void> {
return await webview.WebCookieManager.configCookie(url, value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L126-L128 | bb29f61be25067f305b1aa1a70ea022450510357 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/PathUtility.ets | arkts | join | 路径拼接工具函数(兼容多平台分隔符)
@param segments 要拼接的路径片段数组
@returns 标准化后的路径字符串(统一使用'/'分隔符)
@since 13
@example
// 返回 "foo/bar/baz"
PathUtils.join('foo', 'bar', 'baz');
// 处理多余分隔符(返回 "a/b/c")
PathUtils.join('a/', '/b/', '/c'); | static join(...segments: string[]): string {
// 1. 使用数组join方法拼接路径(初始处理)
let combinedPath = segments.join('/');
// 2. 正则替换处理:
// - 将连续多个'/'替换为单个'/'
// - 兼容Windows风格的路径输入(如'a\\b'会被自动转为'a/b')
return combinedPath.replace(/\/+/g, '/');
} | AST#method_declaration#Left static join AST#parameter_list#Left ( AST#parameter#Left ... segments : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef... | static join(...segments: string[]): string {
let combinedPath = segments.join('/');
return combinedPath.replace(/\/+/g, '/');
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L23-L31 | 6d753c9952be556e3606dfd3f60d0101d24666c0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/HistoryItem.ets | arkts | HistoryItem | 获取当前页面的上下文 | @Component
export default struct HistoryItem {
// 下载历史的数据
@ObjectLink FileInfo: downloadFilesData;
// 文件名称
@State fileName: string = '';
// 待下载任务数量
@Link downloadCount: number;
// 下载历史列表
@Link historyArray: downloadFilesData[];
// 下载列表
@Link downloadFileArray: downloadFilesData[];
// 文件下载状态
@Sta... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct HistoryItem AST#component_body#Left { // 下载历史的数据 AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right FileInfo : AST#type_annotation#Left AST#primary_type#Left downloadFilesData AS... | @Component
export default struct HistoryItem {
@ObjectLink FileInfo: downloadFilesData;
@State fileName: string = '';
@Link downloadCount: number;
@Link historyArray: downloadFilesData[];
@Link downloadFileArray: downloadFilesData[];
@State fileStatus: number = -1;
aboutToAppear(): void... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/HistoryItem.ets#L28-L195 | b63e0c1a35b747068910a382b70e60e1ed470ea4 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Notification/CustomCommonEvent/entry/src/main/ets/module/GlobalContext.ets | arkts | Copyright (C) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class GlobalContext {
private constructor() {
}
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.insta... | AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat... | export class GlobalContext {
private constructor() {
}
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.insta... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomCommonEvent/entry/src/main/ets/module/GlobalContext.ets#L16-L37 | 86173dcf134381291e118135863cf71398f87d99 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildDelete.ets | arkts | 应用约束60: 使用export代替module.exports | export default GuildDeleteAction; | AST#export_declaration#Left export default AST#expression#Left GuildDeleteAction AST#expression#Right ; AST#export_declaration#Right | export default GuildDeleteAction; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildDelete.ets#L69-L69 | cda8c00ab3780b74270bfc8fd41b2b3783c372db | github | |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/pages/Index.ets | arkts | initASF | 初始化 ASF 服务 设置服务器地址和 ASF 密码 | private initASF() {
this.asf.setAddress(this.currentAddress);
this.asf.setASFPassword(this.currentASFPassword)
} | AST#method_declaration#Left private initASF AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left t... | private initASF() {
this.asf.setAddress(this.currentAddress);
this.asf.setASFPassword(this.currentASFPassword)
} | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L184-L187 | 8419428e9df2eb0017074b9db7b189119e0021d3 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets | arkts | onPageShow | 路由返回后刷新页面 | onPageShow() {
AppStorage.setOrCreate('flashPage', !AppStorage.get<number>('flashPage'));
this.subTitle = updateContextArea(this.directoryPath, myContext);
} | AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#mem... | onPageShow() {
AppStorage.setOrCreate('flashPage', !AppStorage.get<number>('flashPage'));
this.subTitle = updateContextArea(this.directoryPath, myContext);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets#L134-L137 | 9bc11b7c2514d8fd373ab6fb36f94954ffa6ba0b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets | arkts | monitoringData | 监听数据变化函数 | monitoringData(): void {
this.isChange = true;
this.GridItemDeletion = new GridItemDeletionCtrl<AppInfo>(this.appInfoList);
} | AST#method_declaration#Left monitoringData 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#assignment_expression#Left AST#mem... | monitoringData(): void {
this.isChange = true;
this.GridItemDeletion = new GridItemDeletionCtrl<AppInfo>(this.appInfoList);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L222-L225 | 7d3fbd5d593123eeac877a29dc5c9ba66530a5c8 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets | arkts | 私有构造函数 | private constructor() {
// 创建目录(假设dMyDataFolderPath已定义)
createFolderIfNeeds(dAppCloudSoundFolderPath);
// 初始化数据库访问器
const sqlitePath = new CDbPath(CDBName.sounds).sqlite
this.db = new DBAccessor(sqlitePath, null, false);
this.createDbsIfNeeds();
} | AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 创建目录(假设dMyDataFolderPath已定义) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left createFolderIfNeeds AST#expression#Right ... | private constructor() {
createFolderIfNeeds(dAppCloudSoundFolderPath);
const sqlitePath = new CDbPath(CDBName.sounds).sqlite
this.db = new DBAccessor(sqlitePath, null, false);
this.createDbsIfNeeds();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L34-L42 | 8076e9ef5ef3be6845ac86933cfbc004e5ccdab8 | github | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/function_override/polymorphism_002_F.ets | arkts | Introduction 函数重载-多态
Level 2 | export function polymorphism_002_F(taint_src : string) {
let sub = new Sub2()
taint.Sink(sub.call(taint_src));
} | AST#export_declaration#Left export AST#function_declaration#Left function polymorphism_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function polymorphism_002_F(taint_src : string) {
let sub = new Sub2()
taint.Sink(sub.call(taint_src));
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/function_override/polymorphism_002_F.ets#L7-L10 | 18cf77b3d74d8c0b4a66f20c47ad09a0a12ecd30 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/navigation/SmsLoginNav.ets | arkts | SmsLoginNav | @file 短信登录页面导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function SmsLoginNav(): void {
SmsLoginPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SmsLoginNav 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_co... | @Builder
export function SmsLoginNav(): void {
SmsLoginPage();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/navigation/SmsLoginNav.ets#L8-L11 | 5a5649b1fdb6f87ca8a38c543e47c36e050de5d6 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | TODO 文件操作相关工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class FileUtil {
static readonly separator: string = '/';
static readonly KB: number = 1024;
/**
* 获取文件目录下的文件夹路径或文件路径。
* @param relativePath 文件路径;相对路径(download/wps/doc);传空表示根目录
* @param fileName 文件名(test.text);传空表示文件夹路径
* @param blHap true:HAP级别文件路径、 false:App级别文件路径
* @returns
*/
stat... | AST#export_declaration#Left export AST#class_declaration#Left class FileUtil AST#class_body#Left { AST#property_declaration#Left static readonly separator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/' AST#expression#Right ; AST#propert... | export class FileUtil {
static readonly separator: string = '/';
static readonly KB: number = 1024;
static getFilesDirPath(relativePath: string | undefined = undefined,
fileName: string | undefined = undefined, blHap: boolean = true): string {
let filePath = blHap ? AppUtil.getContext().filesDir : Ap... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L28-L1003 | 4ca946d8365b001649b22447b563ad89b7a040bb | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/GreetingsPage.ets | arkts | loadGreetings | 加载祝福语数据 | private async loadGreetings(): Promise<void> {
try {
this.loading = true;
this.greetings = await this.greetingService.searchGreetings({
pageSize: 1000 // 加载所有祝福语
});
this.applyFilters();
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to... | AST#method_declaration#Left private async loadGreetings 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... | private async loadGreetings(): Promise<void> {
try {
this.loading = true;
this.greetings = await this.greetingService.searchGreetings({
pageSize: 1000
});
this.applyFilters();
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to load gree... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L43-L55 | 5355d4cc75364e7c1e9e3a8fc08b7554792eb144 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | NetworkManagement/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets | arkts | getNewsTypeList | Get news type list from server.
@return NewsTypeBean[] newsTypeList | getNewsTypeList(): Promise<NewsTypeBean[]> {
return new Promise((resolve: Function) => {
let url = `${Const.SERVER}/${Const.GET_NEWS_TYPE}`;
httpRequestGet(url).then((data: ResponseResult) => {
if (data.code === Const.SERVER_CODE_SUCCESS) {
resolve(data.data);
} else {
... | AST#method_declaration#Left getNewsTypeList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NewsTypeBean [ ] AST#array_type#Right AST#primary_t... | getNewsTypeList(): Promise<NewsTypeBean[]> {
return new Promise((resolve: Function) => {
let url = `${Const.SERVER}/${Const.GET_NEWS_TYPE}`;
httpRequestGet(url).then((data: ResponseResult) => {
if (data.code === Const.SERVER_CODE_SUCCESS) {
resolve(data.data);
} else {
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets#L26-L39 | 4aa9e0e4299b2db9f1959bb21889b6287635db0d | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/viewmodel/ChartValues.ets | arkts | Chart value entity class. | export default class ChartValues {
/**
* Chart fill color.
*/
fillColor: string = '';
/**
* Chart line color.
*/
strokeColor: string = '';
/**
* Sets whether to display the fill gradient color.
*/
gradient: boolean = false;
/**
* Draw a set of points in a line type chart.
*/
data... | AST#export_declaration#Left export default AST#class_declaration#Left class ChartValues AST#class_body#Left { /**
* Chart fill color.
*/ AST#property_declaration#Left fillColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#exp... | export default class ChartValues {
fillColor: string = '';
strokeColor: string = '';
gradient: boolean = false;
data: Array<ChartPoint> = [];
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/viewmodel/ChartValues.ets#L21-L38 | 8b4d023abae505a3683dd92f84c29e28548756af | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets | arkts | Protect | 保护隧道的方法 | Protect() {
console.info('xdw step2');
Logger.info('developTag', '%{public}s', 'vpn Protect');
this.vpnConnection.protect(gTunnelFd).then(() => {
Logger.info('developTag', '%{public}s', 'vpn Protect Success');
this.SetupVpn();
}).catch((err: Error) => {
Logger.error('developTag', 'vpn ... | AST#method_declaration#Left Protect AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expressio... | Protect() {
console.info('xdw step2');
Logger.info('developTag', '%{public}s', 'vpn Protect');
this.vpnConnection.protect(gTunnelFd).then(() => {
Logger.info('developTag', '%{public}s', 'vpn Protect Success');
this.SetupVpn();
}).catch((err: Error) => {
Logger.error('developTag', 'vpn ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets#L97-L106 | f73a83ea5a0ab7b4d8a9102f4dea3171b5d133c9 | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/Logger.ets | arkts | info | 记录信息级别的日志。
@param args 要记录的日志信息 | info(...args: string[]): void {
hilog.info(this.domain, this.prefix, this.format, args);
} | AST#method_declaration#Left info AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prima... | info(...args: string[]): void {
hilog.info(this.domain, this.prefix, this.format, args);
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/Logger.ets#L33-L35 | 8fc09fffef8c4cb21273bb6372b1e281b1c82bf8 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/ContactsPage.ets | arkts | buildContactItem | 构建联系人项 | @Builder
buildContactItem(contact: Contact) {
Row({ space: 16 }) {
// 选择框(选择模式下)
if (this.isSelectionMode) {
Checkbox()
.select(this.selectedContacts.has(contact.id))
.onChange((value: boolean) => {
this.toggleContactSelection(contact.id);
})
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactItem AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function... | @Builder
buildContactItem(contact: Contact) {
Row({ space: 16 }) {
if (this.isSelectionMode) {
Checkbox()
.select(this.selectedContacts.has(contact.id))
.onChange((value: boolean) => {
this.toggleContactSelection(contact.id);
})
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L348-L448 | 350c2d27a2b7917a95eaf10b6b733f15d3e6ed6d | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.