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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | product/phone/src/main/ets/pages/passwordCheck.ets | arkts | getButtonVisibility | Get button visibility
@return : button visibility | getButtonVisibility(): Visibility {
return this.passwordType == PinSubType.PIN_SIX ? Visibility.Hidden : Visibility.Visible;
} | AST#method_declaration#Left getButtonVisibility AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Visibility 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_... | getButtonVisibility(): Visibility {
return this.passwordType == PinSubType.PIN_SIX ? Visibility.Hidden : Visibility.Visible;
} | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/passwordCheck.ets#L282-L284 | 64ee41e9638b524057329cdcfb443b96c99fb3e6 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/radio/radioSelected.ets | arkts | RadioSelectedBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function RadioSelectedBuilder(name: string, param: Object) {
RadioSelectedExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function RadioSelectedBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ... | @Builder
export function RadioSelectedBuilder(name: string, param: Object) {
RadioSelectedExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/radio/radioSelected.ets#L16-L19 | 65263c5982969ff20f7ec6ff54b2858964543b57 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/ResetPasswordPage.ets | arkts | 构建重置密码页面
@returns {void} 无返回值 | build(): void {
AppNavDestination({
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") },
viewModel: this.vm
}) {
this.ResetPasswordContent();
}
} | 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({
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") },
viewModel: this.vm
}) {
this.ResetPasswordContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/ResetPasswordPage.ets#L46-L54 | 292105bdfc20166ce2e7878b4921e204bb67be18 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getQuizTopIconResIds | Used for Quiz Top icon
@returns 测验顶部图标资源ID数组 | static getQuizTopIconResIds(): number[] {
const ids: number[] = [
// $r('app.media.quiz_top_icon_0'),
// $r('app.media.quiz_top_icon_1'),
// $r('app.media.quiz_top_icon_2'),
// $r('app.media.quiz_top_icon_3'),
// $r('app.media.quiz_top_icon_4')
];
return ids;
} | AST#method_declaration#Left static getQuizTopIconResIds AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_de... | static getQuizTopIconResIds(): number[] {
const ids: number[] = [
];
return ids;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L70-L79 | e5eda2ce909fa83f906f64fc49ba3347da9dd850 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeBanner.ets | arkts | HomeBanner | @file 首页轮播图组件
@author Joker.X | @ComponentV2
export struct HomeBanner {
/**
* 轮播图数据
*/
@Param
bannerList: Banner[] = [];
/**
* 轮播图点击回调
*/
@Param
onBannerClick: (item: Banner) => void = () => {
};
/**
* 屏幕断点状态
*/
@Local
private breakpointState: BreakpointState = getBreakpointState();
/**
* 构建轮播图视图
* @retu... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HomeBanner AST#component_body#Left { /**
* 轮播图数据
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right bannerList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ... | @ComponentV2
export struct HomeBanner {
@Param
bannerList: Banner[] = [];
@Param
onBannerClick: (item: Banner) => void = () => {
};
@Local
private breakpointState: BreakpointState = getBreakpointState();
build(): void {
Column() {
if (this.bannerList && this.bannerList.length > 0)... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeBanner.ets#L9-L74 | 3d6c0b08cf569e6cc49ca5c5b25498540fd2df15 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/StatsManager.ets | arkts | getTodayStats | 获取今日统计 | getTodayStats(): DailyStats | null {
const today = DateUtils.getTodayKey();
return this.stats.dailyStats[today] || null;
} | AST#method_declaration#Left getTodayStats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DailyStats AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Lef... | getTodayStats(): DailyStats | null {
const today = DateUtils.getTodayKey();
return this.stats.dailyStats[today] || null;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L295-L298 | 05f459d952d146008e7fa6324098d925c6a53ec1 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets | arkts | bindPhone | 绑定手机号
@param {Record<string, string>} params - 绑定参数
@returns {Promise<NetworkResponse<Unknown>>} 绑定结果 | async bindPhone(params: Record<string, string>): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("user/info/bindPhone", params);
return resp.data;
} | AST#method_declaration#Left async bindPhone AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annota... | async bindPhone(params: Record<string, string>): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("user/info/bindPhone", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets#L49-L53 | c96244449fa16f27bdb88a0f181f249a8d5c6097 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | getConvertKeyPairSync | 获取转换的非对称密钥KeyPair,同步
@param pubKey 公钥字符串
@param priKey 私钥字符串
@param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
@param algName 待生成对称密钥生成器的算法名称
@returns | static getConvertKeyPairSync(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: crypto.RSA_AlG = 'RSA1024|PRIMES_2'): cryptoFramework.KeyPair {
return CryptoUtil.getConvertKeyPairSync(algName, pu... | AST#method_declaration#Left static getConvertKeyPairSync AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left crypto... | static getConvertKeyPairSync(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: crypto.RSA_AlG = 'RSA1024|PRIMES_2'): cryptoFramework.KeyPair {
return CryptoUtil.getConvertKeyPairSync(algName, pu... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L223-L227 | fcc85d055caabfb33fd953b008f72f3c357d833f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/component/VerificationCodeField.ets | arkts | 构建验证码输入组件
@returns {void} 无返回值 | build(): void {
ColumnStart({ widthValue: P100 }) {
IBestField({
value: this.verificationCode,
type: "number",
showLabel: false,
labelWidth: 0,
inputAlign: "left",
inputFontSize: 16,
inputFontColor: $r("app.color.text_primary"),
placeholder: this... | 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 ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width... | build(): void {
ColumnStart({ widthValue: P100 }) {
IBestField({
value: this.verificationCode,
type: "number",
showLabel: false,
labelWidth: 0,
inputAlign: "left",
inputFontSize: 16,
inputFontColor: $r("app.color.text_primary"),
placeholder: this... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/VerificationCodeField.ets#L48-L83 | bb62415f70fa3df4e9c53169d138ed4dfb41f9b3 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/PermissionUtil.ets | arkts | requestPermissions | 申请授权(支持权限组合)
@param permissions 需要授权的权限
@returns true表示授权成功继续业务操作,false表示用户拒绝授权 | static async requestPermissions(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = getContext() as common.UIAbilityContext;
//requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
let req... | AST#method_declaration#Left static async requestPermissions AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Permissions AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#L... | static async requestPermissions(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = getContext() as common.UIAbilityContext;
let request = await atManager.requestPermissionsFromUs... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/PermissionUtil.ets#L65-L73 | 9088d7fbd0e696ac3b4abfd41aaf561919a81145 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackComponent.ets | arkts | StackComponent | Show child component in Stack | @Component
export struct StackComponent {
@Consume currentStackAlignContent: Alignment;
@Consume message: string;
@State textAl: TextAlign = TextAlign.Center;
build() {
Column() {
Stack({ alignContent: this.currentStackAlignContent }) {
Text('')
.width(ALL_PERCENT)
.height... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct StackComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right currentStackAlignContent : AST#type_annotation#Left AST#primary_type#Left Alignment AST#primary_t... | @Component
export struct StackComponent {
@Consume currentStackAlignContent: Alignment;
@Consume message: string;
@State textAl: TextAlign = TextAlign.Center;
build() {
Column() {
Stack({ alignContent: this.currentStackAlignContent }) {
Text('')
.width(ALL_PERCENT)
.height... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackComponent.ets#L22-L55 | b9022724a85b271c8cf49fce9457abc529e2c4cd | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/TextReaderHelper.ets | arkts | offListener | 注销监听事件
@param listener | static offListener(listener: TextReaderListener) {
if (listener?.onStateChange) {
TextReaderHelper.off('stateChange', listener.onStateChange);
}
if (listener?.onStop) {
TextReaderHelper.off('stop', listener.onStop);
}
if (listener?.onRelease) {
TextReaderHelper.off('release', liste... | AST#method_declaration#Left static offListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left TextReaderListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Le... | static offListener(listener: TextReaderListener) {
if (listener?.onStateChange) {
TextReaderHelper.off('stateChange', listener.onStateChange);
}
if (listener?.onStop) {
TextReaderHelper.off('stop', listener.onStop);
}
if (listener?.onRelease) {
TextReaderHelper.off('release', liste... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L289-L329 | 6893dafa8946b2348f5e6dfbccd67fee39ce4340 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语发送请求接口 | export interface GreetingSendRequest {
contactId: string;
greetingId?: string;
content: string;
occasion: GreetingOccasion;
style: GreetingStyle;
method: NotificationMethod;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingSendRequest AST#object_type#Left { AST#type_member#Left contactId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left greetingId ? : AST#t... | export interface GreetingSendRequest {
contactId: string;
greetingId?: string;
content: string;
occasion: GreetingOccasion;
style: GreetingStyle;
method: NotificationMethod;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L186-L193 | 143b087210cf81e85cbbc536bc2668ed5bd3acf0 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationService.ets | arkts | cancelAllReminders | 取消所有提醒 | public async cancelAllReminders(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[NotificationService] Cancelling all reminders');
// 取消所有系统级定时提醒
const cancelledCount = await this.timedReminderService.cancelAllReminders();
promptAction.showToast({
... | AST#method_declaration#Left public async cancelAllReminders 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 >... | public async cancelAllReminders(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[NotificationService] Cancelling all reminders');
const cancelledCount = await this.timedReminderService.cancelAllReminders();
promptAction.showToast({
message: `已取消... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L245-L266 | c0d2a96d0a74a6241b862c7b6c486874a3506b19 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/device/DeviceManager.ets | arkts | getNetworkInfo | 获取网络状态 | async getNetworkInfo(): Promise<NetworkInfo> {
try {
const netHandle = network.getDefaultNetSync();
if (!netHandle) {
return {
isConnected: false,
type: network.NetBearType.BEARER_CELLULAR,
typeName: 'None'
};
}
const netCapabilities = netHandle... | AST#method_declaration#Left async getNetworkInfo 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 NetworkInfo AST#primary_type#Right AST#type_annotation#Right > AST... | async getNetworkInfo(): Promise<NetworkInfo> {
try {
const netHandle = network.getDefaultNetSync();
if (!netHandle) {
return {
isConnected: false,
type: network.NetBearType.BEARER_CELLULAR,
typeName: 'None'
};
}
const netCapabilities = netHandle... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/device/DeviceManager.ets#L139-L180 | 962f18b6833228ba650d05766c3802e01e9e4121 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NumberUtil.ets | arkts | subDecimal | 减法Decimal
@param x
@param y
@returns | static subDecimal(x: Value, y: Value): Decimal {
return Decimal.sub(x, y);
} | AST#method_declaration#Left static subDecimal AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AS... | static subDecimal(x: Value, y: Value): Decimal {
return Decimal.sub(x, y);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L229-L231 | 7ca075550ef9fe0158933c4feae91fb7415fa705 | gitee |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | src/main/ets/component/TaskTimeRangeItem.ets | arkts | getCardBackgroundColor | 获取卡片背景色 | private getCardBackgroundColor(): string {
if (this.taskItem.isCompleted) {
return '#F0F0F0';
}
const priorityColors = {
1: '#F8F9FA', // 低优先级
2: '#FFF3CD', // 中优先级
3: '#F8D7DA' // 高优先级
};
return priorityColors[this.taskItem.priority] || '#F8F9FA';
} | AST#method_declaration#Left private getCardBackgroundColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member... | private getCardBackgroundColor(): string {
if (this.taskItem.isCompleted) {
return '#F0F0F0';
}
const priorityColors = {
1: '#F8F9FA',
2: '#FFF3CD',
3: '#F8D7DA'
};
return priorityColors[this.taskItem.priority] || '#F8F9FA';
} | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/component/TaskTimeRangeItem.ets#L78-L89 | ddf55e165f093d9b8d530445d291166221610ee7 | github |
patient-fyd/HarmonyOS4.git | 5ee3421130cb66278a1eac52fbd43dde7843f845 | basic/code/关灯开灯案例/basic01/pages/Index.ets | arkts | 书写UI的地方 | build() {
Column({space:20}){
Row(){
Image(this.isOn?$rawfile('code-wallpaper-2.jpeg'):$rawfile('maxresdefault.jpg'))
.width("100%")
.height(200)
}
.width('100%')
Row(){
Button("开灯")
.margin({right:20})
.onClick(()=>{
this... | 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#component_parameter#Left space : AST#expression#Left 20 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Righ... | build() {
Column({space:20}){
Row(){
Image(this.isOn?$rawfile('code-wallpaper-2.jpeg'):$rawfile('maxresdefault.jpg'))
.width("100%")
.height(200)
}
.width('100%')
Row(){
Button("开灯")
.margin({right:20})
.onClick(()=>{
this... | https://github.com/patient-fyd/HarmonyOS4.git/blob/5ee3421130cb66278a1eac52fbd43dde7843f845/basic/code/关灯开灯案例/basic01/pages/Index.ets#L7-L35 | c1d9ea9a34b22a5c640fd31601972aebed20c3c9 | github | |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets | arkts | loadIcon | Load icon of AccessibilityService | async loadIcon(bundleInfo: bundleManager.BundleInfo): Promise<string> {
let appInfo = bundleInfo.appInfo;
let imageValue = '';
let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context;
LogUtil.info(`${MODULE_TAG} getResourceManager appInfo.iconResource... | AST#method_declaration#Left async loadIcon AST#parameter_list#Left ( AST#parameter#Left bundleInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | async loadIcon(bundleInfo: bundleManager.BundleInfo): Promise<string> {
let appInfo = bundleInfo.appInfo;
let imageValue = '';
let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context;
LogUtil.info(`${MODULE_TAG} getResourceManager appInfo.iconResource... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L207-L223 | 42f5ca6b1e3fa821321e68ef82f338344f8b75f1 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsDetailBottomBar.ets | arkts | GoodsDetailBottomBar | @file 商品详情底部操作栏组件
@author Joker.X | @ComponentV2
export struct GoodsDetailBottomBar {
/**
* 加入购物车按钮点击回调
*/
@Param
onAddToCartClick: () => void = (): void => {
};
/**
* 立即购买按钮点击回调
*/
@Param
onBuyNowClick: () => void = (): void => {
};
/**
* 客服入口点击回调
*/
@Param
onCsClick: () => void = (): void => {
};
/**
* 购物车... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsDetailBottomBar AST#component_body#Left { /**
* 加入购物车按钮点击回调
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onAddToCartClick : AST#type_annotation#Left AST#function_type#Le... | @ComponentV2
export struct GoodsDetailBottomBar {
@Param
onAddToCartClick: () => void = (): void => {
};
@Param
onBuyNowClick: () => void = (): void => {
};
@Param
onCsClick: () => void = (): void => {
};
@Param
onCartClick: () => void = (): void => {
};
@Param
safeAreaEnabled... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailBottomBar.ets#L17-L150 | ab34fe9d3ee2fa0a9a3d811500093fa4b7c11b55 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets | arkts | appendData | 追加数据 | public appendData(data: T): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | AST#method_declaration#Left public appendData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ... | public appendData(data: T): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L47-L50 | acc215ac077fa155365a6b9147b6e0d7f701cb33 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | createDefaultTheme | 创建默认主题 | private createDefaultTheme(): ThemeConfig {
return {
mode: ThemeMode.LIGHT,
type: ThemeType.DEFAULT,
colorTheme: this.colorThemes[0], // 默认浅色主题
fontConfig: this.fontConfigs[0], // 默认字体
animationConfig: {
enabled: true,
duration: 300,
curve: 'ease',
scale... | AST#method_declaration#Left private createDefaultTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ThemeConfig AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST... | private createDefaultTheme(): ThemeConfig {
return {
mode: ThemeMode.LIGHT,
type: ThemeType.DEFAULT,
colorTheme: this.colorThemes[0],
fontConfig: this.fontConfigs[0],
animationConfig: {
enabled: true,
duration: 300,
curve: 'ease',
scale: 1.0
},
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L726-L747 | 6e963ba097fe9e26638570997be06a9bbb491064 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets | arkts | buildContactInfoCard | 构建联系方式卡片 | @Builder
buildContactInfoCard() {
Column({ space: 12 }) {
Text('联系方式')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Column({ space: 8 }) {
if (this.contact!.phone) {
this.buildContactItem('电话', t... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactInfoCard 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#componen... | @Builder
buildContactInfoCard() {
Column({ space: 12 }) {
Text('联系方式')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Column({ space: 8 }) {
if (this.contact!.phone) {
this.buildContactItem('电话', t... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L324-L357 | 9942d175afc6b9712e39db16acd852462e70ed4d | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/AboutPage.ets | arkts | 构建关于页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.about"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.AboutContent();
}
... | AST#build_method#Left build ( ) 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 title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.about" A... | build() {
AppNavDestination({
title: $r("app.string.about"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.AboutContent();
}
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/AboutPage.ets#L38-L50 | 801b178d61e6e476d34bc28b2f716023d8eacd8d | github | |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/EventTrack/DMPTraceUtils.ets | arkts | 简单耗时统计工具 | export class TraceUtils {
private static timers: Map<string, number> = new Map()
static start(label: string) {
TraceUtils.timers.set(label, systemDateTime.getTime())
}
static end(label: string,tag:string) {
const startTime = TraceUtils.timers.get(label)
if (startTime !== undefined) {
let cur... | AST#export_declaration#Left export AST#class_declaration#Left class TraceUtils AST#class_body#Left { AST#property_declaration#Left private static timers : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | export class TraceUtils {
private static timers: Map<string, number> = new Map()
static start(label: string) {
TraceUtils.timers.set(label, systemDateTime.getTime())
}
static end(label: string,tag:string) {
const startTime = TraceUtils.timers.get(label)
if (startTime !== undefined) {
let cur... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/EventTrack/DMPTraceUtils.ets#L7-L25 | 6cb241ae265176f67e0b67171a0aaad871f6b800 | github | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider18.ets | arkts | buildSlider18 | Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 l... | @Builder function buildSlider18(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildSlider18 AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left SliderConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li... | @Builder function buildSlider18(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider18.ets#L16-L67 | bef02cb24c9d51bd8eaf1597d8cdf582892e3173 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/src/main/ets/components/SearchBox.ets | arkts | SearchBox | Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct SearchBox {
build() {
Row() {
Image($r('app.media.ic_search'))
.width(18)
.height(18)
.objectFit(ImageFit.Contain)
.margin({left: 11})
Text($r('app.string.searchHint'))
.fontSize(16)
.lineHeight(21)
.fontWeight(FontWeight.Regular)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SearchBox 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 Row ( ) AST#container_content_body#Left { AS... | @Component
export struct SearchBox {
build() {
Row() {
Image($r('app.media.ic_search'))
.width(18)
.height(18)
.objectFit(ImageFit.Contain)
.margin({left: 11})
Text($r('app.string.searchHint'))
.fontSize(16)
.lineHeight(21)
.fontWeight(FontWeight.Regular)
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/src/main/ets/components/SearchBox.ets#L16-L40 | a0f40c87e43cf863eb877587226e7cab56f19b06 | gitee |
zqf-dev/WAndroidHOS.git | e2e560a7c96110c43d13eb232826707601172b6d | entry/src/main/ets/request/SquareReq.ets | arkts | 导航数据
@returns | export function getNav(): Promise<INav[]> {
return new Promise((resolve: Function, reject: Function) => {
get(API.nav).then((data: Response) => {
if (data.errorCode === API.SERVER_CODE_SUCCESS) {
resolve(data.data);
} else {
console.log('getTree failed', JSON.stringify(data));
... | AST#export_declaration#Left export AST#function_declaration#Left function getNav 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 INav [ ] AST#a... | export function getNav(): Promise<INav[]> {
return new Promise((resolve: Function, reject: Function) => {
get(API.nav).then((data: Response) => {
if (data.errorCode === API.SERVER_CODE_SUCCESS) {
resolve(data.data);
} else {
console.log('getTree failed', JSON.stringify(data));
... | https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/request/SquareReq.ets#L28-L42 | a4d0c73616950bf40b36ebd99cb8394266d4f573 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets | arkts | Basic implementation of IDataSource to handle data listener
@implements {IDataSource} | export class SwiperDataSource implements IDataSource {
private listeners: DataChangeListener[] = [];
private originDataArray: ESObject[] = [];
/**
* 获取数组长度
*/
public totalCount(): number {
return this.originDataArray.length;
}
/**
* 获取索引对应的数据
* @param index 数组索引
*/
public getData(inde... | AST#export_declaration#Left export AST#class_declaration#Left class SwiperDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener... | export class SwiperDataSource implements IDataSource {
private listeners: DataChangeListener[] = [];
private originDataArray: ESObject[] = [];
public totalCount(): number {
return this.originDataArray.length;
}
public getData(index: number): ESObject {
return this.originDataArray[index];
}
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets#L20-L154 | d4b9aa3095ca078d45b566ccfb9de04a2e60a75d | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.DialogV2.d.ets | arkts | ConfirmDialogV2 | Declare CustomDialog ConfirmDialogV2
@struct { ConfirmDialogV2 }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @ComponentV2
export declare struct ConfirmDialogV2 {
/**
* Sets the ConfirmDialogV2 title.
*
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Require
@Param
title: ResourceStr;
/**
* Sets the ConfirmDialogV2 conte... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ConfirmDialogV2 AST#component_body#Left { /**
* Sets the ConfirmDialogV2 title.
*
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crosspl... | @ComponentV2
export declare struct ConfirmDialogV2 {
@Require
@Param
title: ResourceStr;
@Param
content?: ResourceStr;
@Param
checkTips?: ResourceStr;
@Param
checked?: boolean;
@Param
primaryButton?: AdvancedDialogV2Button;
@Param
secondaryButton?: AdvancedDialogV2Button;
... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L467-L547 | 9cfb2559badc222b5e6d46135f4d0312bfcbf439 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | TODO Preferences工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class PreferencesUtil {
private static defaultPreferenceName: string = DEFAULT_PREFERENCE_NAME;
private static preferences: preferences.Preferences;
/**
* 初始化,非必要不要初始化该方法
* @param name Preferences实例的名称。
*/
static init(preferenceName: string) {
if (!PreferencesUtil.preferences || preferenc... | AST#export_declaration#Left export AST#class_declaration#Left class PreferencesUtil AST#class_body#Left { AST#property_declaration#Left private static defaultPreferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left DEFAULT_PREFERENCE_N... | export class PreferencesUtil {
private static defaultPreferenceName: string = DEFAULT_PREFERENCE_NAME;
private static preferences: preferences.Preferences;
static init(preferenceName: string) {
if (!PreferencesUtil.preferences || preferenceName !== PreferencesUtil.defaultPreferenceName) {
Preferen... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L27-L328 | 0ffabab3605bb56fba03de95677e0337991a3524 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/DefaultFocus.ets | arkts | DefaultFocus | [Start focus_visualization_manage] | @Entry
@Component
export struct DefaultFocus {
@State oneButtonColor: Color = Color.Gray;
@State twoButtonColor: Color = Color.Gray;
@State threeButtonColor: Color = Color.Gray;
build() {
NavDestination() {
Column({ space: 12 }) {
Column({ space: 20 }) {
// 通过外接键盘的上下键可以让焦点在三个按钮间移动,... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct DefaultFocus AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right oneButtonColor : AST#type_annotation#Left AST#primary_... | @Entry
@Component
export struct DefaultFocus {
@State oneButtonColor: Color = Color.Gray;
@State twoButtonColor: Color = Color.Gray;
@State threeButtonColor: Color = Color.Gray;
build() {
NavDestination() {
Column({ space: 12 }) {
Column({ space: 20 }) {
Button('First Bu... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/DefaultFocus.ets#L19-L85 | 117059f5789edb8c2130ddcade7b926557e4c208 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets | arkts | dealDeviceId | Indicates the ID of the processing device.
@param deviceId Device ID.
@returns Indicates the ID of the device after processing. | dealDeviceId(deviceId: string) {
return (deviceId.substring(0, CommonConstants.DEVICE_ID_LENGTH) + CommonConstants.DEVICE_ID_ELLIPSIS);
} | AST#method_declaration#Left dealDeviceId AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left r... | dealDeviceId(deviceId: string) {
return (deviceId.substring(0, CommonConstants.DEVICE_ID_LENGTH) + CommonConstants.DEVICE_ID_ELLIPSIS);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets#L109-L111 | 55d0bd02ebe637b48e4d98caabc8214327af5b81 | gitee |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/utils/GestureUtils.ets | arkts | isValidDrag | 判断是否为有效拖拽
@param state - 手势状态
@returns 是否为有效拖拽 | static isValidDrag(state: GestureState): boolean {
const distance: number = Math.sqrt(state.deltaX * state.deltaX + state.deltaY * state.deltaY);
return distance >= GestureConstants.MIN_DRAG_DISTANCE;
} | AST#method_declaration#Left static isValidDrag AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left GestureState 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#pri... | static isValidDrag(state: GestureState): boolean {
const distance: number = Math.sqrt(state.deltaX * state.deltaX + state.deltaY * state.deltaY);
return distance >= GestureConstants.MIN_DRAG_DISTANCE;
} | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L114-L117 | 733584d77a0814f7a1557334d8a9988a9b618183 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ExpandTitle/entry/src/main/ets/utils/TitleExpansion.ets | arkts | animateToThrottle | 节流器:如果短时间内多次触发了同一事件,那么在函数执行一次后,在一个限期内不再执行
@param {Callback<void>} fn: 动画函数
@param {number} delay: 同一事件触发间隔
@returns | animateToThrottle(fn: Callback<void>, delay: number): void {
if (this.throttleStatus) {
// TODO: 性能知识点:播放动画时,系统需要在一个刷新周期内完成动画变化曲线的计算,完成组件布局绘制等操作。建议使用系统提供的动画接口,
// 只需设置曲线类型、终点位置、时长等信息,就能够满足常用的动画功能,减少UI主线程的负载。参考资料:
// https://gitee.com/openharmony/docs/blob/OpenHarmony-5.0.0-Release/zh-cn/applicatio... | AST#method_declaration#Left animateToThrottle AST#parameter_list#Left ( AST#parameter#Left fn : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | animateToThrottle(fn: Callback<void>, delay: number): void {
if (this.throttleStatus) {
animateTo({
duration: this.animationDuration, curve: Curve.FastOutLinearIn
}, fn)
this.throttleStatus = false;
setTimeout(() => {
this.throttleStatus = true;
}, ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ExpandTitle/entry/src/main/ets/utils/TitleExpansion.ets#L241-L253 | 5c130dedd56e8b5dc684f4e3cea55e658fd1bd3c | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceNavigation.d.ets | arkts | Side bar options.
@typedef SideBarOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 18 | export interface SideBarOptions {
/**
* Side bar Background.
*
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
sideBarBackground?: ResourceColor;
/**
* Side bar status change callback.
*
* @type { ?Callback<boolean> }.
* @sy... | AST#export_declaration#Left export AST#interface_declaration#Left interface SideBarOptions AST#object_type#Left { /**
* Side bar Background.
*
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left sideBarBackground ? : AST#type_... | export interface SideBarOptions {
sideBarBackground?: ResourceColor;
onChange?: Callback<boolean>;
sideBarIcon?: Resource | SymbolGlyphModifier;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets#L442-L473 | 56ebba07679b04c40d31637ee6c9c07272da2482 | gitee | |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/components/SwipeCardStack.ets | arkts | swipeRight | 程序化向右滑动 | public swipeRight(): void {
if (this.cardState !== CardState.IDLE || this.currentIndex >= this.cardDataList.length) {
return;
}
const data: object = this.cardDataList[this.currentIndex];
const deltaX: number = this.finalConfig.swipeThreshold + 1;
const deltaY: number = 0;
this.performSwi... | AST#method_declaration#Left public swipeRight AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Lef... | public swipeRight(): void {
if (this.cardState !== CardState.IDLE || this.currentIndex >= this.cardDataList.length) {
return;
}
const data: object = this.cardDataList[this.currentIndex];
const deltaX: number = this.finalConfig.swipeThreshold + 1;
const deltaY: number = 0;
this.performSwi... | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L483-L493 | 14ce745bed5881ed1baf2539e1f034206d305dba | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderPayPage.ets | arkts | OrderPayContent | 订单支付页面内容视图
@returns {void} 无返回值 | @Builder
private OrderPayContent() {
ColumnStart({ fillMaxSize: true }) {
Scroll() {
ColumnStart({
fillMaxSize: true,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
top: $r("app.fl... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderPayContent 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 ColumnStart ( AST#component_parameters#Left { AST#... | @Builder
private OrderPayContent() {
ColumnStart({ fillMaxSize: true }) {
Scroll() {
ColumnStart({
fillMaxSize: true,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
top: $r("app.fl... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderPayPage.ets#L53-L85 | e8856d48f1a037142bfde56c3dd9d7dcd6f02487 | github |
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git | 3b5fa45c650dcae2773a19f122161935e0c0e2bc | entry/src/main/ets/pages/customScan/constants/BreakpointConstants.ets | arkts | Breakpoint constants | export class BreakpointConstants {
/**
* Small device
*/
public static readonly BREAKPOINT_SM: string = 'sm';
/**
* Medium device
*/
public static readonly BREAKPOINT_MD: string = 'md';
/**
* Large device
*/
public static readonly BREAKPOINT_LG: string = 'lg';
/**
* Medium device min.... | AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /**
* Small device
*/ AST#property_declaration#Left public static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expr... | export class BreakpointConstants {
public static readonly BREAKPOINT_SM: string = 'sm';
public static readonly BREAKPOINT_MD: string = 'md';
public static readonly BREAKPOINT_LG: string = 'lg';
public static readonly MIDDLE_DEVICE_WIDTH: number = 600;
public static readonly LARGE_DEVICE_WIDTH: ... | https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/pages/customScan/constants/BreakpointConstants.ets#L4-L37 | 445621c488821bdfadce2e15ff3c24b2b536dc2d | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagegridlayout/Index.ets | arkts | ImageGridLayoutComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { ImageGridLayoutComponent } from './src/main/ets/components/mainpage/ImageGridLayout'; | AST#export_declaration#Left export { ImageGridLayoutComponent } from './src/main/ets/components/mainpage/ImageGridLayout' ; AST#export_declaration#Right | export { ImageGridLayoutComponent } from './src/main/ets/components/mainpage/ImageGridLayout'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagegridlayout/Index.ets#L18-L18 | 1f3a75648ad0aa91dc13a175ce8dde16ac8509a5 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets | arkts | Based on lightweight databases preferences handler. | export default class PreferencesHandler {
static instance: PreferencesHandler = new PreferencesHandler();
private preferences: data_preferences.Preferences | null = null;
private defaultValue = '';
private listeners: PreferencesListener[];
private constructor() {
this.listeners = new Array();
}
/**
... | AST#export_declaration#Left export default AST#class_declaration#Left class PreferencesHandler AST#class_body#Left { AST#property_declaration#Left static instance : AST#type_annotation#Left AST#primary_type#Left PreferencesHandler AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expressio... | export default class PreferencesHandler {
static instance: PreferencesHandler = new PreferencesHandler();
private preferences: data_preferences.Preferences | null = null;
private defaultValue = '';
private listeners: PreferencesListener[];
private constructor() {
this.listeners = new Array();
}
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets#L23-L117 | ae428ab440c3be112718a24315a418798cf53d8b | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | handleRebuy | 处理再次购买逻辑
@returns {void} 无返回值 | handleRebuy(): void {
if (this.cartList.length > 1) {
this.showRebuyModal();
return;
}
const goodsId: number = this.getFirstCartGoodsId();
if (!goodsId) {
return;
}
this.toGoodsDetail(goodsId);
} | AST#method_declaration#Left handleRebuy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#... | handleRebuy(): void {
if (this.cartList.length > 1) {
this.showRebuyModal();
return;
}
const goodsId: number = this.getFirstCartGoodsId();
if (!goodsId) {
return;
}
this.toGoodsDetail(goodsId);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L145-L155 | b54773b8d8095efde1f3ff8f1f9d47a5717a916d | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets | arkts | Class that holds all relevant data that represents the chart. That involves
at least one (or more) DataSets, and an array of x-values. | export default class ChartData<T extends IDataSet</*T extends*/ EntryOhos>> {
/**
* maximum y-value in the value array across all axes
*/
protected mYMax: number = -Number.MAX_VALUE;
/**
* the minimum y-value in the value array across all axes
*/
protected mYMin: number = Number.MAX... | AST#export_declaration#Left export default AST#class_declaration#Left class ChartData AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IDataSet AST#type_arguments#Left < /*T extends*/ AST#type_annotation#Left AST#primary_type#Left EntryOho... | export default class ChartData<T extends IDataSet< EntryOhos>> {
protected mYMax: number = -Number.MAX_VALUE;
protected mYMin: number = Number.MAX_VALUE;
protected mXMax: number = -Number.MAX_VALUE;
protected mXMin: number = Number.MAX_VALUE;
protected mLeftAxisMax: number = ... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L28-L314 | e6406f4f61bdbf08fa075b4f082efbc7797f46cb | gitee | |
ikunbranch666-auto/SimpleCalculator.git | ea24568014d05285ad3def5b741380294308aef2 | entry/src/main/ets/common/TitleBarComponent.ets | arkts | TitleBarComponent | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct TitleBarComponent {
private isLand: boolean = false
private isDistributed: boolean = false
private isShow: boolean = false
build() {
Row() {
Text('计算器')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ left: 20 })
}
.width('100%')
.heig... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBarComponent AST#component_body#Left { AST#property_declaration#Left private isLand : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left ... | @Component
export struct TitleBarComponent {
private isLand: boolean = false
private isDistributed: boolean = false
private isShow: boolean = false
build() {
Row() {
Text('计算器')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ left: 20 })
}
.width('100%')
.heig... | https://github.com/ikunbranch666-auto/SimpleCalculator.git/blob/ea24568014d05285ad3def5b741380294308aef2/entry/src/main/ets/common/TitleBarComponent.ets#L16-L34 | 48414c87d4cd97bbb13afc97bae28d06389f053a | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets | arkts | contains | Determine whether the cache corresponding to the key is included. | public contains(key: string): boolean {
return this.lruCache.contains(key);
} | AST#method_declaration#Left public contains AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R... | public contains(key: string): boolean {
return this.lruCache.contains(key);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets#L51-L53 | 830579f585b6fccaa219b6dbf3a0458d1dd792e0 | gitee |
Zairgs/ArKTSMovie.git | 1586c977f12722333eee7d74a71f006ba0606ade | ets/pages/TicketReservation.ets | arkts | formatCountdown | 格式化倒计时显示 | private formatCountdown(saleTime: number): string {
const diff = saleTime - this.currentTime
if (diff <= 0) {
return "00天00时00分00秒"
}
const days = Math.floor(diff / (1000 * 60 * 60 * 24))
const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
const minutes = Math.floo... | AST#method_declaration#Left private formatCountdown AST#parameter_list#Left ( AST#parameter#Left saleTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | private formatCountdown(saleTime: number): string {
const diff = saleTime - this.currentTime
if (diff <= 0) {
return "00天00时00分00秒"
}
const days = Math.floor(diff / (1000 * 60 * 60 * 24))
const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
const minutes = Math.floo... | https://github.com/Zairgs/ArKTSMovie.git/blob/1586c977f12722333eee7d74a71f006ba0606ade/ets/pages/TicketReservation.ets#L136-L148 | bddbd976358871e373f0ce418daade06495ba25f | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets | arkts | getAdaptiveSymbolFontSize | get adaptive for symbol font size | getAdaptiveSymbolFontSize(): string {
let fontScale : number | undefined = this.fontSizeScale;
if (!this.isFollowingSystemFontScale || fontScale === undefined) {
fontScale = MIN_FONT_SCALE;
}
fontScale = Math.min(MIN_SYMBOL_FONT_SCALE, fontScale);
fontScale = Math.max(fontScale, MIN_FONT_SCALE... | AST#method_declaration#Left getAdaptiveSymbolFontSize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left... | getAdaptiveSymbolFontSize(): string {
let fontScale : number | undefined = this.fontSizeScale;
if (!this.isFollowingSystemFontScale || fontScale === undefined) {
fontScale = MIN_FONT_SCALE;
}
fontScale = Math.min(MIN_SYMBOL_FONT_SCALE, fontScale);
fontScale = Math.max(fontScale, MIN_FONT_SCALE... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets#L264-L272 | 34eaaaf00c9116161f6b007ad2dc003a27074428 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | getFormatDate | 获取格式化日期,将传入的日期格式化为Date
@param date
@returns | static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) { //无参数
date = new Date();
} else if (typeof date == "string") { //字符串日期
if (date.length == 0) {
date = new Date();
} else {
if (date.toString().length == 10 || date.toString().le... | AST#method_declaration#Left static getFormatDate AST#parameter_list#Left ( AST#parameter#Left date ? : 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... | static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) {
date = new Date();
} else if (typeof date == "string") {
if (date.length == 0) {
date = new Date();
} else {
if (date.toString().length == 10 || date.toString().length == 13) ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L63-L102 | 3488ef8d98b27e0f11ed1142a9e905079f27fb83 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/JList.ets | arkts | 列表中当前的位置 | constructor() {
this.dataSource = [];
this.listSize = 0; // 列表的大小
this.pos = 0; // 列表中当前的位置
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#membe... | constructor() {
this.dataSource = [];
this.listSize = 0;
this.pos = 0;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/JList.ets#L22-L26 | 77592b4a87caf68d850a11bab09a3d89095bacce | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/user/Index.ets | arkts | UserGraph | @file user 模块统一导出
@author Joker.X | export { UserGraph } from "./src/main/ets/navigation/UserGraph"; | AST#export_declaration#Left export { UserGraph } from "./src/main/ets/navigation/UserGraph" ; AST#export_declaration#Right | export { UserGraph } from "./src/main/ets/navigation/UserGraph"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/user/Index.ets#L5-L5 | 40a7834503bfb1debaebeb719e419c870524c380 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/component/BottomNavigationRow.ets | arkts | 构建底部导航行
@returns {void} 无返回值 | build(): void {
ColumnStart({ widthValue: P100 }) {
SpaceVerticalXXLarge();
RowCenter({ widthValue: P100 }) {
if (!this.divider) {
Text(this.messageText)
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_tertiary"));
} else {
... | 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 ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width... | build(): void {
ColumnStart({ widthValue: P100 }) {
SpaceVerticalXXLarge();
RowCenter({ widthValue: P100 }) {
if (!this.divider) {
Text(this.messageText)
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_tertiary"));
} else {
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/BottomNavigationRow.ets#L41-L77 | 12d84e02cb4520512a407bcbb698dd92835c71f1 | github | |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/casesfeature/cuberotateanimation/src/main/ets/mock/MockData.ets | arkts | 3D立方体旋转动画Swiper数据 | export const SWIPER_LIST: MySwiperItem[][] = [
[
new MySwiperItem('青藤活动', '最新青藤社活动信息', $r('app.media.cube_animation_picture1')),
new MySwiperItem('开源项目', '参与青藤社开源项目共建', $r('app.media.cube_animation_picture2')),
new MySwiperItem('技术交流', '青藤社技术交流与讨论', $r('app.media.cube_animation_picture3')),
new MySwip... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SWIPER_LIST : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MySwiperItem [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ A... | export const SWIPER_LIST: MySwiperItem[][] = [
[
new MySwiperItem('青藤活动', '最新青藤社活动信息', $r('app.media.cube_animation_picture1')),
new MySwiperItem('开源项目', '参与青藤社开源项目共建', $r('app.media.cube_animation_picture2')),
new MySwiperItem('技术交流', '青藤社技术交流与讨论', $r('app.media.cube_animation_picture3')),
new MySwip... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/casesfeature/cuberotateanimation/src/main/ets/mock/MockData.ets#L70-L85 | ce6548ca054b674adf86a92e4a79a98260054f3e | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | getXValuePosition | @Override | public getXValuePosition(): ValuePosition {
return this.mXValuePosition;
} | AST#method_declaration#Left public getXValuePosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ValuePosition AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST... | public getXValuePosition(): ValuePosition {
return this.mXValuePosition;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L143-L145 | d37d129d7de4e8310fc2db3a118d55ba477c4875 | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | entry/src/main/ets/pages/three/pages/WxDiscoverPage.ets | arkts | clickCell | 点击cell | clickCell(title: string) {
console.log('点击cell', title)
if (title === '朋友圈') {
router.pushUrl({ url: 'pages/three/pages/WxFriendsCirclePage' })
} else {
JhProgressHUD.showText(`点击 ${title}`)
}
} | AST#method_declaration#Left clickCell AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#L... | clickCell(title: string) {
console.log('点击cell', title)
if (title === '朋友圈') {
router.pushUrl({ url: 'pages/three/pages/WxFriendsCirclePage' })
} else {
JhProgressHUD.showText(`点击 ${title}`)
}
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/entry/src/main/ets/pages/three/pages/WxDiscoverPage.ets#L135-L142 | 6e6d06c69808fc8ab7bb93f28cef748a6a2f2a04 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the external product series represented by a string.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get brand(): string; | AST#method_declaration#Left static get AST#ERROR#Left brand AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get brand(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L65-L65 | f19a8270a74524a7cd12d37e17205b9b3292ffee | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/datatype/collections/list_002_F.ets | arkts | Introduction 集合-列表类型 | export function list_002_F(taint_src : List<string>) {
let _t = taint_src;
let _clean = new List<string>();
_clean.add("a");
taint.Sink(_clean);
} | AST#export_declaration#Left export AST#function_declaration#Left function list_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left List AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right A... | export function list_002_F(taint_src : List<string>) {
let _t = taint_src;
let _clean = new List<string>();
_clean.add("a");
taint.Sink(_clean);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/collections/list_002_F.ets#L6-L11 | 7af9f0e0e31682fd03d26440a22c4b4af5f62e96 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | setDrawZeroLine | Set this to true to draw the zero-line regardless of weather other
grid-lines are enabled or not. Default: false
@param mDrawZeroLine | public setDrawZeroLine(mDrawZeroLine: boolean): void {
this.mDrawZeroLine = mDrawZeroLine;
} | AST#method_declaration#Left public setDrawZeroLine AST#parameter_list#Left ( AST#parameter#Left mDrawZeroLine : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST... | public setDrawZeroLine(mDrawZeroLine: boolean): void {
this.mDrawZeroLine = mDrawZeroLine;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L376-L378 | 9a88dd90fe6530071e34d1f4b551e8c386a3e0fa | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/ImageEditInterface.ets | arkts | Copyright (C) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export const IMAGE_EDIT_MODULE = 'ImageEdit'
/* 跳转编辑路由页面使用样例
let imgOpt: ImageEditOption = {
pixelMap: pixMap,
callback: {
onSuccess: (result: ImageEditResult) => {
Logger.i(IMAGE_EDIT_MODULE, 'imageEdit', 'onSuccess:' + JSON.stringify(result))
Logger.i(IMAGE_EDIT_MODULE, 'imageEdit',
'onSu... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left IMAGE_EDIT_MODULE = AST#expression#Left 'ImageEdit' AST#expression#Right AST#variable_declarator#Right /* 跳转编辑路由页面使用样例
let imgOpt: ImageEditOption = {
pixelMap: pixMap,
callback: {
onSuccess: (result: ImageEditRe... | export const IMAGE_EDIT_MODULE = 'ImageEdit' | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L16-L51 | e9915f714926dff315397e23bbb4239f76297c29 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets | arkts | onArrowClicked | 1.点击返回箭头,搜索框退出搜索页面animateTo显式动画。
2.两个搜索框同时绑定同一个geometryId。 | private onArrowClicked(): void {
this.geometryId = 'search';
animateTo({
// 构造插值器弹簧曲线对象,生成一条从0到1的动画曲线
curve: curves.interpolatingSpring(0, 1, 342, 38)
}, () => {
this.searchNewListData = [];
this.isSearchPageShow = false;
this.classifyIndex = -1;
this.searchInput = '';
... | AST#method_declaration#Left private onArrowClicked 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#assignment_ex... | private onArrowClicked(): void {
this.geometryId = 'search';
animateTo({
curve: curves.interpolatingSpring(0, 1, 342, 38)
}, () => {
this.searchNewListData = [];
this.isSearchPageShow = false;
this.classifyIndex = -1;
this.searchInput = '';
this.categoryName = '';
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets#L137-L149 | 725cab7225c182aad6c1ee674f5866354d48122b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/PreferencesService.ets | arkts | getBatch | 批量获取值
@param keys 键数组
@param defaultValues 默认值对象
@returns 值对象 | async getBatch(keys: string[], defaultValues: Record<string, preferences.ValueType> = {}): Promise<Record<string, preferences.ValueType>> {
try {
this.checkInitialized();
const result: Record<string, preferences.ValueType> = {};
const promises: Promise<void>[] = [];
for (const ... | AST#method_declaration#Left async getBatch AST#parameter_list#Left ( AST#parameter#Left keys : 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#Left defaultValues : AST#type_annotation#... | async getBatch(keys: string[], defaultValues: Record<string, preferences.ValueType> = {}): Promise<Record<string, preferences.ValueType>> {
try {
this.checkInitialized();
const result: Record<string, preferences.ValueType> = {};
const promises: Promise<void>[] = [];
for (const ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L327-L338 | b1b32249fbbe5e07bffcef684366c353fa8991e5 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/BruteForce.ets | arkts | findAllMatches | 在文本中查找模式串的所有出现位置
@param text 文本字符串
@param pattern 模式串
@returns 所有匹配位置的数组 | static findAllMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const result: number[] = [];
const n = text.length;
const m = pattern.length;
for (let i = 0; i <= n - m; i++) {
let j = 0;
while (j < m && text[i + ... | AST#method_declaration#Left static findAllMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static findAllMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const result: number[] = [];
const n = text.length;
const m = pattern.length;
for (let i = 0; i <= n - m; i++) {
let j = 0;
while (j < m && text[i + ... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/BruteForce.ets#L12-L33 | 7403eee3a5cad2cb8c7c1c0b72fbd2f173875259 | github |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/shangpinxiangqing.ets | arkts | paymentDialog | 支付弹窗组件 | @Builder
paymentDialog() {
// 遮罩层
Column()
.width('100%')
.height('100%')
.backgroundColor('#000000')
.opacity(0.5)
.onClick(() => {
this.showPaymentDialog = false; // 点击遮罩层关闭弹窗
})
// 弹窗内容
Column()
{
Text('确认支付')
.fontSize(20)
.font... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right paymentDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 遮罩层 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_... | @Builder
paymentDialog() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#000000')
.opacity(0.5)
.onClick(() => {
this.showPaymentDialog = false;
})
Column()
{
Text('确认支付')
.fontSize(20)
.fontWeight(FontWeight.Bold)
... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/shangpinxiangqing.ets#L167-L227 | 511c4a4637916aa345897d25e4d90d58321c74cd | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSWantStartAbility/entry/src/main/ets/pages/Index.ets | arkts | explicitStartAbility | 显示启动Ability | private explicitStartAbility() {
try {
// 在启动Ability时指定bundleName和abilityName
let want: Want = {
deviceId: "",
bundleName: "com.waylau.hmos.arktswantstartability",
abilityName: "SecondAbility"
}
// 获取UIAbility的上下文信息
let context = this.getUIContext().getHostCont... | AST#method_declaration#Left private explicitStartAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 在启动Ability时指定bundleName和abilityName AST#statement#Left AST#variable_declaration#Left let AST#variable_decla... | private explicitStartAbility() {
try {
let want: Want = {
deviceId: "",
bundleName: "com.waylau.hmos.arktswantstartability",
abilityName: "SecondAbility"
}
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
context.st... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSWantStartAbility/entry/src/main/ets/pages/Index.ets#L29-L48 | f9cc1179abb03e90a8cfdec406ff2cb079c66c86 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/lazyForEach.d.ets | arkts | Defines move&exchange operation.
@interface DataMoveOperation
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface DataMoveOperation {
/**
* How to operate moved data.
*
* @type { DataOperationType.MOVE }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
type: DataOperationType;
/**
* Index of moved data.
*
... | AST#export_declaration#Left export AST#interface_declaration#Left interface DataMoveOperation AST#object_type#Left { /**
* How to operate moved data.
*
* @type { DataOperationType.MOVE }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ ... | export interface DataMoveOperation {
type: DataOperationType;
index: MoveIndex;
key?: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L338-L369 | c33c0ac9cdd595b723ecb4becedd45491651e2b9 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 取消关注用户
@param followerId 关注者ID(当前用户)
@param followingId 被关注者ID
@returns 操作结果 | export async function unfollowUser(followerId: number, followingId: number): Promise<void> {
console.info(`API调用: 取消关注用户, followerId: ${followerId}, followingId: ${followingId}`);
try {
// 检查参数
if (!followerId || !followingId) {
throw new Error('取消关注用户失败: 用户ID不能为空');
}
// 构建URL和请求
... | AST#export_declaration#Left export AST#function_declaration#Left async function unfollowUser AST#parameter_list#Left ( AST#parameter#Left followerId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left followingId : AST#type_an... | export async function unfollowUser(followerId: number, followingId: number): Promise<void> {
console.info(`API调用: 取消关注用户, followerId: ${followerId}, followingId: ${followingId}`);
try {
if (!followerId || !followingId) {
throw new Error('取消关注用户失败: 用户ID不能为空');
}
const url = `${BAS... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1368-L1414 | 3afbf33eba5cb1c9fe93b8355987cad6e837b3b0 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets | arkts | bottomTextStyle | Bottom text common style. | @Extend(Text) function bottomTextStyle (fontWeight: number, textAttribute: number, fontSize: Resource, fontColor: Resource) {
.fontWeight(fontWeight)
.letterSpacing(textAttribute)
.fontSize(fontSize)
.fontColor(fontColor)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function bottomTextStyle AST#parameter_list#Left ( AST#parameter#Left fontWeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Ri... | @Extend(Text) function bottomTextStyle (fontWeight: number, textAttribute: number, fontSize: Resource, fontColor: Resource) {
.fontWeight(fontWeight)
.letterSpacing(textAttribute)
.fontSize(fontSize)
.fontColor(fontColor)
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/pages/AdvertisingPage.ets#L117-L122 | 53308eeea5942acd11e1c0786dc1ef8dcae722d8 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets | arkts | connect2Server | 连接服务端 | async connect2Server() {
//绑定本地地址
await this.bind2LocalAddress()
//服务端地址
let serverAddress = { address: this.serverIp, port: this.serverPort, family: 1 }
//tls选项
let opt: socket.TLSSecureOptions = {
ca: [this.ca],
cert: this.cert,
key: this.privateKey
}
await tlsSocke... | AST#method_declaration#Left async connect2Server AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //绑定本地地址 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#... | async connect2Server() {
await this.bind2LocalAddress()
let serverAddress = { address: this.serverIp, port: this.serverPort, family: 1 }
let opt: socket.TLSSecureOptions = {
ca: [this.ca],
cert: this.cert,
key: this.privateKey
}
await tlsSocket.connect({ address: s... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L352-L373 | 678e342e8d4840168457bbe6e9c36ff48723a4af | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/user/UserNavigator.ets | arkts | toProfile | 跳转到个人中心
@returns {void} 无返回值 | static toProfile(): void {
navigateTo(UserRoutes.Profile);
} | AST#method_declaration#Left static toProfile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_exp... | static toProfile(): void {
navigateTo(UserRoutes.Profile);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/user/UserNavigator.ets#L13-L15 | d4bdf20494114a2540e54b5b1b855c23bb3c5511 | github |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | reloadData | 重新加载数据 | reloadData(): void {
this.notifyDataReload();
} | AST#method_declaration#Left reloadData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Le... | reloadData(): void {
this.notifyDataReload();
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L59-L61 | ce4e88d5acd55424dbfc0f183cbd2788beeb4437 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/eraser/src/main/ets/pages/EraserMainPage.ets | arkts | updateDrawResult | 更新绘制结果 | updateDrawResult() {
// TODO:知识点:通过组件截图componentSnapshot获取NodeContainer上当前绘制结果的pixelMap,需要设置waitUntilRenderFinished为true尽可能获取最新的渲染结果
componentSnapshot.get(Constants.NODE_CONTAINER_ID, { waitUntilRenderFinished: true })
.then(async (pixelMap: image.PixelMap) => {
if (this.currentImageNode !== null)... | AST#method_declaration#Left updateDrawResult AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // TODO:知识点:通过组件截图componentSnapshot获取NodeContainer上当前绘制结果的pixelMap,需要设置waitUntilRenderFinished为true尽可能获取最新的渲染结果 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AS... | updateDrawResult() {
componentSnapshot.get(Constants.NODE_CONTAINER_ID, { waitUntilRenderFinished: true })
.then(async (pixelMap: image.PixelMap) => {
if (this.currentImageNode !== null) {
this.currentImageNode.pixelMapHistory.push(pixelMap);
this.currentImageNode.i... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eraser/src/main/ets/pages/EraserMainPage.ets#L236-L256 | 549b0c0f5aeb4ab53837bcf9e4ada4aed7ab9860 | gitee |
buqiuz/game-puzzle.git | 605dc0fac0738466db308a8ba255b5e9094c52ac | entry/src/main/ets/model/PuzzleSolver.ets | arkts | getEmptyIndex | 获取空白块位置 | getEmptyIndex(state: number[]): number {
return state.indexOf(this._splitSize**2 - 1);
} | AST#method_declaration#Left getEmptyIndex AST#parameter_list#Left ( AST#parameter#Left state : 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_annotation#Left AST... | getEmptyIndex(state: number[]): number {
return state.indexOf(this._splitSize**2 - 1);
} | https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/src/main/ets/model/PuzzleSolver.ets#L35-L37 | 4cf7ae2468368e9d9a5d9f8e35d004a8a415253d | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getVersionName | 获取应用版本名。 | static getVersionName(): string {
return AppUtils.getBundleInfoSync().versionName
} | AST#method_declaration#Left static getVersionName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_ex... | static getVersionName(): string {
return AppUtils.getBundleInfoSync().versionName
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L128-L130 | 5c53ff77ba24cc1af79afcf731810f9ce9ad75eb | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets | arkts | this | 节点的path更新后需要调用invalidate()方法触发重新渲染 | this.currentNode.invalidate(); | AST#method_declaration#Left this AST#ERROR#Left . currentNode . in validate AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right | this.currentNode.invalidate(); | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets#L109-L109 | 9ba5c708c0ed246144e40572995deb0b94367c8b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | getLeapMonthDays | 获取指定年份闰月的天数 | static getLeapMonthDays(year: number): number {
const leapMonth = ComprehensiveLunarDatabase.getLeapMonth(year);
if (leapMonth === 0) return 0;
const yearInfo = ComprehensiveLunarDatabase.getYearInfo(year);
return (yearInfo & 0x10000) ? 30 : 29;
} | AST#method_declaration#Left static getLeapMonthDays 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_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | static getLeapMonthDays(year: number): number {
const leapMonth = ComprehensiveLunarDatabase.getLeapMonth(year);
if (leapMonth === 0) return 0;
const yearInfo = ComprehensiveLunarDatabase.getYearInfo(year);
return (yearInfo & 0x10000) ? 30 : 29;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L142-L148 | 09f6a699f8ef763fcba2289a9df945486390e6fd | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppDataSecurity/entry/src/main/ets/pages/Index.ets | arkts | GenerateAesKey | [End get_aes_decrypt_properties] [Start generate_aes_key] | async function GenerateAesKey(): Promise<void> {
let genProperties = GetAesGenerateProperties();
let options: huks.HuksOptions = {
properties: genProperties
};
await huks.generateKeyItem(aesKeyAlias, options)
.then((data) => {
hilog.info(0x0000, 'AppDataSecurity', `promise: generate AES Key succe... | AST#function_declaration#Left async function GenerateAesKey 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 >... | async function GenerateAesKey(): Promise<void> {
let genProperties = GetAesGenerateProperties();
let options: huks.HuksOptions = {
properties: genProperties
};
await huks.generateKeyItem(aesKeyAlias, options)
.then((data) => {
hilog.info(0x0000, 'AppDataSecurity', `promise: generate AES Key succe... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppDataSecurity/entry/src/main/ets/pages/Index.ets#L206-L218 | 36b020ad137a76b224ce86be3a612b7c49f0deec | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/expression/basic_expression_operation/assign_expression_001_T.ets | arkts | Introduction 基础表达式运算-赋值表达式 | export function assign_expression_001_T(taint_src : string) {
let t = taint_src;
taint.Sink(t);
} | AST#export_declaration#Left export AST#function_declaration#Left function assign_expression_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_state... | export function assign_expression_001_T(taint_src : string) {
let t = taint_src;
taint.Sink(t);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/basic_expression_operation/assign_expression_001_T.ets#L6-L9 | f7abed3fb06ebbd283b5cd38d3918699e9e061a0 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/orientationDevelopment/entry/src/main/ets/pages/MediaQueryPage.ets | arkts | onPortrait | When the media query conditions are met, a callback is triggered | onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) {
if (mediaQueryResult.matches as boolean) {
// If the device is in landscape orientation, change the corresponding page layout
this.color = '#FFD700';
this.text = 'Landscape';
} else {
this.color = '#DB7093';
this.text = 'P... | AST#method_declaration#Left onPortrait AST#parameter_list#Left ( AST#parameter#Left mediaQueryResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mediaquery . MediaQueryResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#R... | onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) {
if (mediaQueryResult.matches as boolean) {
this.color = '#FFD700';
this.text = 'Landscape';
} else {
this.color = '#DB7093';
this.text = 'Portrait';
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/orientationDevelopment/entry/src/main/ets/pages/MediaQueryPage.ets#L14-L23 | f03ec5a3b9c23085b1c27225e10c0a6d3ee98d88 | gitee |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Grids.ets | arkts | pageStyle | 自定义样式:page | @Styles pageStyle() {
.width('100%')
.padding({
top: Constants.PAGE_HEADER_HEIGHT,
left: Constants.PAGE_PADDING_LEFT,
right: Constants.PAGE_PADDING_RIGHT,
bottom: Constants.PAGE_PADDING_BOTTOM,
})
} | AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right pageStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#exp... | @Styles pageStyle() {
.width('100%')
.padding({
top: Constants.PAGE_HEADER_HEIGHT,
left: Constants.PAGE_PADDING_LEFT,
right: Constants.PAGE_PADDING_RIGHT,
bottom: Constants.PAGE_PADDING_BOTTOM,
})
} | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Grids.ets#L25-L33 | 06ccbe35e07c79476b152da9de74d7e1b2edb00f | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/field_sensitive/references_object/field_len_004_F.ets | arkts | Introduction 路径长度 | export function field_len_004_F(taint_src : string) {
class A {
b : B
constructor () {this.b = new B()} | AST#export_declaration#Left export AST#function_declaration#Left function field_len_004_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#Lef... | export function field_len_004_F(taint_src : string) {
class A {
b : B
constructor () {this.b = new B()} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/references_object/field_len_004_F.ets#L6-L9 | eb74290d5ac88c2a912749767a348a33c350bef4 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/toggle/toggleSwitch.ets | arkts | ToggleSwitchBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function ToggleSwitchBuilder(name: string, param: Object) {
ToggleSwitchExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToggleSwitchBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p... | @Builder
export function ToggleSwitchBuilder(name: string, param: Object) {
ToggleSwitchExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/toggle/toggleSwitch.ets#L16-L19 | ab42b061ac5b3aff00d24a9585cbcac86c6d812d | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/model/Message.ets | arkts | isOutgoing | 是否"我"发出的消息 | static isOutgoing(senderId: string): boolean {
if (senderId ) {
return true;
} else {
return false;
}
} | AST#method_declaration#Left static isOutgoing AST#parameter_list#Left ( AST#parameter#Left senderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | static isOutgoing(senderId: string): boolean {
if (senderId ) {
return true;
} else {
return false;
}
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/Message.ets#L53-L59 | e6d58a28226823afba16d2224ac7e27531debf8b | gitee |
wuyukobe24/HMApp_ArkTS.git | 6d09d9b07a4fdc4713e5a13b61b85bc1e7893956 | entry/src/main/ets/common/networking/QQNetworkRequestNET.ets | arkts | get | export function getRequest(url:string, param:Object, success:(str:string)=>void, fail:(error:NetError)=>void) {
Net.get(url).setParams(param).setHeaders(header).requestString((data) => {
success(data.toString())
}, (error) => {
fail(error)
})
} | AST#export_declaration#Left export AST#function_declaration#Left function getRequest 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 param : AST#type_annotation#Left AST#pri... | export function getRequest(url:string, param:Object, success:(str:string)=>void, fail:(error:NetError)=>void) {
Net.get(url).setParams(param).setHeaders(header).requestString((data) => {
success(data.toString())
}, (error) => {
fail(error)
})
} | https://github.com/wuyukobe24/HMApp_ArkTS.git/blob/6d09d9b07a4fdc4713e5a13b61b85bc1e7893956/entry/src/main/ets/common/networking/QQNetworkRequestNET.ets#L32-L38 | 109ca44b7f976205cafee59abd255b12fd703cb7 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolinkagelist/src/main/ets/pages/VideoLinkageList.ets | arkts | timeFormat | 视频进度条时间格式化为 00:00 | timeFormat(time: number): string {
const minutes = Math.floor(time / Constants.SECONDS_PER_MINUTE);
const seconds = Math.floor(time % Constants.SECONDS_PER_MINUTE);
let minutesStr = minutes.toString();
let secondsStr = seconds.toString();
if (minutesStr.length === 1) {
minutesStr = '0' + min... | AST#method_declaration#Left timeFormat AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right ... | timeFormat(time: number): string {
const minutes = Math.floor(time / Constants.SECONDS_PER_MINUTE);
const seconds = Math.floor(time % Constants.SECONDS_PER_MINUTE);
let minutesStr = minutes.toString();
let secondsStr = seconds.toString();
if (minutesStr.length === 1) {
minutesStr = '0' + min... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/pages/VideoLinkageList.ets#L187-L201 | 8d1101ecf22f51ae79e58ae55c877c02205310dc | gitee |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/models/index.ets | arkts | 后端返回数据的类型: | export interface PageData {
total: number
pageTotal: number
rows: QuestionItem[]
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PageData AST#object_type#Left { AST#type_member#Left total : 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 pageTotal : AST#type_annotation#Left ... | export interface PageData {
total: number
pageTotal: number
rows: QuestionItem[]
} | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/models/index.ets#L4-L8 | 68c7076625836c166de4f8135d16e808d31af42e | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/network/BaseNetWorkView.ets | arkts | BaseNetWorkView | @file 网络请求通用视图组件
@author Joker.X | @ComponentV2
export struct BaseNetWorkView {
/**
* 当前网络请求 UI 状态
*/
@Param
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
/**
* 错误状态下的重试回调
*/
@Param
onRetry: () => void = () => {
};
/**
* 自定义加载内容
*/
@BuilderParam
loadingBuilder: CustomBuilder;
/**
* 自定义错误内容
*/
@... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct BaseNetWorkView AST#component_body#Left { /**
* 当前网络请求 UI 状态
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right uiState : AST#type_annotation#Left AST#primary_type#Left BaseNetWork... | @ComponentV2
export struct BaseNetWorkView {
@Param
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
@Param
onRetry: () => void = () => {
};
@BuilderParam
loadingBuilder: CustomBuilder;
@BuilderParam
errorBuilder: CustomBuilder;
@BuilderParam
content: CustomBuilder;
@... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/network/BaseNetWorkView.ets#L9-L92 | 287acf1d099896509d9beb805f8581d5849ac327 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/mine/mine.ets | arkts | memberShipBuilder | //连接后台后,当页面显示时获取用户信息 onPageShow(): void { promptAction.showToast({message:"正在获取数据"}) const params = this.getUIContext().getRouter().getParams() as Record<string, string>; if(params){ this.phoneNumber = params.phoneNumber this.token = params.token } this.getUserInfo() } | @Builder
memberShipBuilder() {
//会员
Row() {
Row() {
Image('/image/mine/memberShip.png').size({ width: 25, height: 25 });
Text("VIP会员 | 定制专属健身")
.fontColor('#FBDEB9')
.width('100%')
.fontSize(18)
.margin({ left: 5 });
}
.width('60%')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right memberShipBuilder 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... | @Builder
memberShipBuilder() {
Row() {
Row() {
Image('/image/mine/memberShip.png').size({ width: 25, height: 25 });
Text("VIP会员 | 定制专属健身")
.fontColor('#FBDEB9')
.width('100%')
.fontSize(18)
.margin({ left: 5 });
}
.width('60%')
.... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/mine/mine.ets#L173-L216 | f2251027b57a672eeca5e5d466fd8a63631f17ab | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/VideoConstants.ets | arkts | State of video play. | export enum PlayState {
STOP = 0,
START = 1,
PAUSE = 2
} | AST#export_declaration#Left export AST#enum_declaration#Left enum PlayState AST#enum_body#Left { AST#enum_member#Left STOP = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left START = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left PAUSE = AST... | export enum PlayState {
STOP = 0,
START = 1,
PAUSE = 2
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/VideoConstants.ets#L43-L47 | c8a1b84d552ba73c4b22f2969222393b540dc3c2 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/PickerUtil.ets | arkts | saveDocument | 通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。
@param options
newFileNames Array<string> 拉起documentPicker进行保存的文件名,若无此参数,则默认需要用户自行输入。
defaultFilePathUri string 指定保存的文件或者目录路径。
fileSuffixChoices Array<string> 保存文件的后缀类型。传入字符串数组,每一项代表一个后缀选项,每一项内部用"|"分为两部分,第一部分为描述,第二部分为要保存的后缀。没有"|"则没有描述,该项整体是一个保存的后缀。默认没有后缀类型。
pickerMode DocumentPic... | static async saveDocument(options?: picker.DocumentSaveOptions): Promise<Array<string>> {
const documentPicker = new picker.DocumentViewPicker(getContext());
return documentPicker.save(options);
} | AST#method_declaration#Left static async saveDocument AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . DocumentSaveOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter... | static async saveDocument(options?: picker.DocumentSaveOptions): Promise<Array<string>> {
const documentPicker = new picker.DocumentViewPicker(getContext());
return documentPicker.save(options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L143-L146 | b7b0668848f58875221c8a45002b8b16fcfc9328 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/StrUtils.ets | arkts | isNull | 判断字符串是否为空(undefined、null)
@param str 被检测的字符串
@returns 是否为空 | static isNull(str: number | string | undefined | null): boolean {
return str === undefined || str === null;
} | AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left str : 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 undefined AST#primary_type#Right | AST#primary_type#... | static isNull(str: number | string | undefined | null): boolean {
return str === undefined || str === null;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/StrUtils.ets#L12-L14 | 3d1d8122423b68cb487afc4074e2900d86e18f43 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/lottie/LottieView.ets | arkts | resize | 刷新动画布局
@since 8
@design | resize() {
this.animationItem?.resize()
} | AST#method_declaration#Left resize 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 this AST#e... | resize() {
this.animationItem?.resize()
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L239-L241 | fbfe7f329b3f1bcf24a5e6615b505a78effb7136 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWebHelper.ets | arkts | runJavaScriptExt | 异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScriptExt需要在loadUrl完成后,比如onPageEnd中调用。
@param webController
@param script JavaScript脚本。
@returns | static async runJavaScriptExt(webController: webview.WebviewController, script: string | ArrayBuffer): Promise<webview.JsMessageExt> {
return webController.runJavaScriptExt(script);
} | AST#method_declaration#Left static async runJavaScriptExt AST#parameter_list#Left ( AST#parameter#Left webController : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#pa... | static async runJavaScriptExt(webController: webview.WebviewController, script: string | ArrayBuffer): Promise<webview.JsMessageExt> {
return webController.runJavaScriptExt(script);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L81-L83 | 67a10e8958fc36f5f83e17143789e44ef774283c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets | arkts | createSession | 创建AVSession实例
@param eventListener AVSession事件回调
@returns {Promise<void>} | async createSession(eventListener: AVSessionEventListener): Promise<void> {
// TODO:知识点:创建AVSession实例
this.session = await AVSessionManager.createAVSession(this.bindContext!, this.avSessionTag, this.avSessionType);
// TODO:知识点:注册AVSession事件
this.registerSessionListener(eventListener);
// TODO:知识点:激活... | AST#method_declaration#Left async createSession AST#parameter_list#Left ( AST#parameter#Left eventListener : AST#type_annotation#Left AST#primary_type#Left AVSessionEventListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | async createSession(eventListener: AVSessionEventListener): Promise<void> {
this.session = await AVSessionManager.createAVSession(this.bindContext!, this.avSessionTag, this.avSessionType);
this.registerSessionListener(eventListener);
await this.session.activate().catch((error: BusinessError) ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L70-L81 | 49b3e38922e101ace9c6e42126c920641588782b | gitee |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/game/core/world.ets | arkts | calcPlayerExpByActionOnce | 用户一次挖掘动作获取的经验值 | function calcPlayerExpByActionOnce(step: number, w: WORLD): number {
let exp = 1 + utils.getRandomInt(10, 50) / 100
return utils.formatToDecimal(exp)
} | AST#function_declaration#Left function calcPlayerExpByActionOnce AST#parameter_list#Left ( AST#parameter#Left step : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left w : AST#type_annotation#Left AST#primary_type#Left WORLD AS... | function calcPlayerExpByActionOnce(step: number, w: WORLD): number {
let exp = 1 + utils.getRandomInt(10, 50) / 100
return utils.formatToDecimal(exp)
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/world.ets#L83-L86 | 3bb44013bb4169fda93d726d9337eb3484604c41 | github |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/LoginPage.ets | arkts | doLoginImpl | 真正的登陆信息发送实现方法。 | doLoginImpl(loginUserId: string, loginToken: string) {
// * 立即显示登陆处理进度提示等(并将同时启动超时检查线程)
this.isLogining = true;
// * 将要提交的登陆信息对象
let loginInfo: PLoginInfo = new PLoginInfo();
loginInfo.loginUserId = loginUserId;
loginInfo.loginToken = loginToken;
// * 发送登陆数据包(提交登陆名和密码)
let code: number... | AST#method_declaration#Left doLoginImpl AST#parameter_list#Left ( AST#parameter#Left loginUserId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left loginToken : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | doLoginImpl(loginUserId: string, loginToken: string) {
this.isLogining = true;
let loginInfo: PLoginInfo = new PLoginInfo();
loginInfo.loginUserId = loginUserId;
loginInfo.loginToken = loginToken;
let code: number = LocalDataSender.getInstance().sendLogin(loginInfo);
if(code == ... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/LoginPage.ets#L91-L109 | 6a27524c36f99bd401cbefa7273eef505a7b6a76 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/TabNode.ets | arkts | getSize | Calculate FlowItem width/height | getSize() {
let ret = Math.floor(new SecureRandom().nextInt(this.maxSize));
return (ret > this.minSize ? ret : this.minSize);
}
// Set the width/height group for FlowItem
setItemSizeArray() {
for (let i = 0; i < 100; i++) {
this.itemWidthArray.push(this.getSize());
this.itemHeightArray.pu... | AST#method_declaration#Left getSize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ret = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math... | getSize() {
let ret = Math.floor(new SecureRandom().nextInt(this.maxSize));
return (ret > this.minSize ? ret : this.minSize);
}
setItemSizeArray() {
for (let i = 0; i < 100; i++) {
this.itemWidthArray.push(this.getSize());
this.itemHeightArray.push(this.getSize());
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/TabNode.ets#L47-L57 | 6ce8a59a8c2e310dcc9b75eda8bb4d52cb6e378b | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets | arkts | isTopGroup | 置顶分组 | async isTopGroup(id: number|number[], isTop: boolean) {
let Ids:number[] = []
if (typeof id === 'number'){
Ids.push(id)
} else {
Ids = id
}
Ids.forEach((item:number)=>{
BookGroupsDao.isUpdateGroupTop(item, isTop)
})
} | AST#method_declaration#Left async isTopGroup AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type... | async isTopGroup(id: number|number[], isTop: boolean) {
let Ids:number[] = []
if (typeof id === 'number'){
Ids.push(id)
} else {
Ids = id
}
Ids.forEach((item:number)=>{
BookGroupsDao.isUpdateGroupTop(item, isTop)
})
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets#L17-L28 | 31c266a61f397e363a70cfbfcbaacc507203e174 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets | arkts | scalingContentComponent | 缩放组件成员 | @Builder
scalingContentComponent(item: string) {
Column() {
Image('')
.borderRadius(8)
.objectFit(ImageFit.Contain)
.width(this.keyboardHeight > 0 ? $r('app.string.key_board_scenes_item_small_image_height') :
$r('app.string.key_board_scenes_item_big_image_height'))
.h... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right scalingContentComponent AST#parameter_list#Left ( AST#parameter#Left item : 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#builder_funct... | @Builder
scalingContentComponent(item: string) {
Column() {
Image('')
.borderRadius(8)
.objectFit(ImageFit.Contain)
.width(this.keyboardHeight > 0 ? $r('app.string.key_board_scenes_item_small_image_height') :
$r('app.string.key_board_scenes_item_big_image_height'))
.h... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets#L142-L178 | 7c545ddfd250212cb58e9b641161fe9ef77905b4 | gitee |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/model/DeviceModel.ets | arkts | determineStatus | 根据当前值和阈值,计算设备状态 | static determineStatus(value: number, threshold: number): DeviceStatus {
if (value >= threshold) {
return DeviceStatus.DANGER;
} else if (value >= threshold * 0.8) {
return DeviceStatus.WARNING;
}
return DeviceStatus.NORMAL;
} | AST#method_declaration#Left static determineStatus AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left threshold : AST#type_annotation#Left AST#primary_type#Left number AST#pr... | static determineStatus(value: number, threshold: number): DeviceStatus {
if (value >= threshold) {
return DeviceStatus.DANGER;
} else if (value >= threshold * 0.8) {
return DeviceStatus.WARNING;
}
return DeviceStatus.NORMAL;
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/model/DeviceModel.ets#L26-L33 | 6a94ea0ed2df56d84c2e25c72ea57de24abe2f54 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/NotePadOpenHarmony/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class CommonConstants {
/**
* Preference instance name.
*/
static readonly PREFERENCE_INSTANCE_NAME: string = 'myStore';
/**
* Preferences note key.
*/
static readonly PREFERENCE_NOTE_KEY: string = 'noteIdArr';
/**
* Add note.
*/
static readonly ADD_NOTE: string = 'add';
... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Preference instance name.
*/ AST#property_declaration#Left static readonly PREFERENCE_INSTANCE_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annota... | export default class CommonConstants {
static readonly PREFERENCE_INSTANCE_NAME: string = 'myStore';
static readonly PREFERENCE_NOTE_KEY: string = 'noteIdArr';
static readonly ADD_NOTE: string = 'add';
static readonly MODIFY_NOTE: string = 'modify';
static readonly SAVE_DIALOG: string = 'sa... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/NotePadOpenHarmony/entry/src/main/ets/common/constants/CommonConstants.ets#L16-L66 | 53ab9468d72dbaf3b5e8f80b25a37f1e081a994c | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets | arkts | 删除任务
@param id 任务ID
@returns 无返回值 | export function deleteTask(id: number): Promise<void> {
try {
return request<void>(
RequestMethod.DELETE,
`/tasks/${id}`
);
} catch (error) {
console.error(`删除任务失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`删除任务失败: ${error instanceof Error ? error.mess... | AST#export_declaration#Left export AST#function_declaration#Left function deleteTask AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim... | export function deleteTask(id: number): Promise<void> {
try {
return request<void>(
RequestMethod.DELETE,
`/tasks/${id}`
);
} catch (error) {
console.error(`删除任务失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`删除任务失败: ${error instanceof Error ? error.mess... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L289-L299 | 62f7f48538fb71d8fdb2fee5997b7b44b494d179 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.