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
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/models/TaskModel.ets
arkts
圈数记录模型
export interface LapRecord { index: number; time: number; lapTime: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LapRecord AST#object_type#Left { AST#type_member#Left index : 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 time : AST#type_annotation#Left AS...
export interface LapRecord { index: number; time: number; lapTime: number; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L14-L18
53454bf8bcdee9bc126ffc77b38efa8c853847f8
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderPayPage.ets
arkts
OrderPayPage
@file 订单支付页面视图 @author Joker.X
@ComponentV2 export struct OrderPayPage { /** * 订单支付页面 ViewModel */ @Local private vm: OrderPayViewModel = new OrderPayViewModel(); /** * 当前窗口安全区状态 */ @Param private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); /** * 构建订单支付页面 * @returns {void} 无返回值 */ build(...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderPayPage AST#component_body#Left { /** * 订单支付页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left OrderPa...
@ComponentV2 export struct OrderPayPage { @Local private vm: OrderPayViewModel = new OrderPayViewModel(); @Param private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); build() { AppNavDestination({ title: $r("app.string.order_pay"), viewModel: this.vm, pad...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderPayPage.ets#L18-L176
20690d55b8a4cb31b1350344ad087c7ee47c172e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ModelConfigService.ets
arkts
模型厂商枚举
export enum ModelProvider { ZHIPU = 'zhipu', // 智谱AI DEEPSEEK = 'deepseek', // DeepSeek KIMI = 'kimi', // Kimi月之暗面 CUSTOM = 'custom' // 自定义 }
AST#export_declaration#Left export AST#enum_declaration#Left enum ModelProvider AST#enum_body#Left { AST#enum_member#Left ZHIPU = AST#expression#Left 'zhipu' AST#expression#Right AST#enum_member#Right , // 智谱AI AST#enum_member#Left DEEPSEEK = AST#expression#Left 'deepseek' AST#expression#Right AST#enum_member#Right , /...
export enum ModelProvider { ZHIPU = 'zhipu', DEEPSEEK = 'deepseek', KIMI = 'kimi', CUSTOM = 'custom' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ModelConfigService.ets#L11-L16
87e6f5bc6dba7adb48bceaa4e353c532197f8c53
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/CharUtil.ets
arkts
isAscii
判断字符是否位于ASCII范围内(其中0-31是控制字符,32-127表示从A到Z的字母字符) @param char 字符 @returns
static isAscii(char: string): boolean { if (char.length === 1) { //确保输入的是单个字符 return char.charCodeAt(0) < 128; } else { return false; } }
AST#method_declaration#Left static isAscii AST#parameter_list#Left ( AST#parameter#Left char : 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...
static isAscii(char: string): boolean { if (char.length === 1) { return char.charCodeAt(0) < 128; } else { return false; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CharUtil.ets#L116-L122
2561dffb43ee58968f0023e2cb500311f17415e7
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Dialog.d.ets
arkts
Declare ButtonOptions @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare ButtonOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export declare class ButtonOptions { /** * Sets the Display Content of a Button. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the Display Content of a Button. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicse...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ButtonOptions AST#class_body#Left { /** * Sets the Display Content of a Button. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the Display Content ...
export declare class ButtonOptions { value: ResourceStr; action?: () => void; background?: ResourceColor; fontColor?: ResourceColor; buttonStyle?: ButtonStyleMode; role?: ButtonRole; defaultFocus?: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Dialog.d.ets#L46-L165
772a4178fd47ad2d88d926a757926d78a52cb7d8
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/PageRequest.ets
arkts
@file 通用分页请求模型 @author Joker.X
export class PageRequest { /** * 页码 */ page: number = 1; /** * 每页大小 */ size: number = 10; /** * 排序方式:"asc" 或 "desc" */ sort: string = "desc"; /** * @param {Partial<PageRequest>} init - 初始化数据 */ constructor(init?: Partial<PageRequest>) { if (!init) return; this.page = ini...
AST#export_declaration#Left export AST#class_declaration#Left class PageRequest AST#class_body#Left { /** * 页码 */ AST#property_declaration#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_...
export class PageRequest { page: number = 1; size: number = 10; sort: string = "desc"; constructor(init?: Partial<PageRequest>) { if (!init) return; this.page = init.page ?? this.page; this.size = init.size ?? this.size; this.sort = init.sort ?? this.sort; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/PageRequest.ets#L5-L28
6621cc29c3a9b12c9ab08910063184257d055e8d
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets
arkts
sendData
发送数据 @param data
async sendData(data: string): Promise<void> { if (!this.tcpSocket) { return; } Logger.info(`${TAG} tcp sendData data ${JSON.stringify(data)}`); try { await this.tcpSocket.send({ data: data, }); } catch (e) { Logger.error(`${TAG} tcp sendData error ${JSON.stringify(e)}...
AST#method_declaration#Left async sendData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom...
async sendData(data: string): Promise<void> { if (!this.tcpSocket) { return; } Logger.info(`${TAG} tcp sendData data ${JSON.stringify(data)}`); try { await this.tcpSocket.send({ data: data, }); } catch (e) { Logger.error(`${TAG} tcp sendData error ${JSON.stringify(e)}...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets#L102-L114
1cdd43997f2eb88ce93d0d8203c6bd1a73b09049
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/url_tools.ets
arkts
Determines if a link is downloadable. @param link The link. @returns [boolean, string(filename)] If it is downloadable.
export function is_downloadable(link: string) { try { let last_part = ((link.split('&')[0]).split('/').pop() || '').split('?')[0]; if (last_part?.includes('.')) { // Has dot let filename = last_part; if (filename.length > 233) { filename = filename.substring(filename.length - 233, fi...
AST#export_declaration#Left export AST#function_declaration#Left function is_downloadable AST#parameter_list#Left ( AST#parameter#Left link : 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 { A...
export function is_downloadable(link: string) { try { let last_part = ((link.split('&')[0]).split('/').pop() || '').split('?')[0]; if (last_part?.includes('.')) { let filename = last_part; if (filename.length > 233) { filename = filename.substring(filename.length - 233, filename.len...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L451-L468
1d8821c7790f03eb5d8a18b0a061b64f12db295a
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Tables/AccountingInfoApi.ets
arkts
deleteData
删除数据
deleteData(accountingInfo: AccountingInfo, callback: Function): void { let predicates = new dataRdb.RdbPredicates(Const.ACCOUNTING_INFO?.tableName); predicates.equalTo('date', accountingInfo.date).and().equalTo('id',accountingInfo.id); RdbUtils.del(predicates).then(result => { callback(result); })...
AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left accountingInfo : AST#type_annotation#Left AST#primary_type#Left AccountingInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function ...
deleteData(accountingInfo: AccountingInfo, callback: Function): void { let predicates = new dataRdb.RdbPredicates(Const.ACCOUNTING_INFO?.tableName); predicates.equalTo('date', accountingInfo.date).and().equalTo('id',accountingInfo.id); RdbUtils.del(predicates).then(result => { callback(result); })...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Tables/AccountingInfoApi.ets#L18-L24
a5eaa7a2265035e233427f2df61edaf913f6be5b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/diggingholescreen/src/main/ets/components/mainpage/DiggingHoleScreen.ets
arkts
DiggingHoleScreenComponent
功能描述: 本示例介绍使用屏幕属性getDefaultDisplaySync、getCutoutInfo接口实现适配挖孔屏。 推荐场景: 用于沉浸式场景中适配挖孔屏需要规避不可用区域(如顶部状态栏时间和电量显示位置)的场景。 核心组件: 1. getDefaultDisplaySync 2. getCutoutInfo 实现步骤: 1.通过窗口的getLastWindow接口获取到当前窗口实例用于后续对窗口设置。 2.通过setWindowLayoutFullScreen、setWindowSystemBarEnable将窗口设置为全屏,并且隐藏顶部状态栏。 3.通过getDefaultDisplaySync、getCutou...
@Component export struct DiggingHoleScreenComponent { @State date: Date = new Date(); @State currentTime: string = ''; // 顶部状态栏时间 @State boundingRect: display.Rect[] = []; // 不可用区域数据 @State screenWidth: number = 0; // 屏幕宽度 @State displayClass: display.Display | null = null; @State topTextMargin: TextMargin ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DiggingHoleScreenComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#t...
@Component export struct DiggingHoleScreenComponent { @State date: Date = new Date(); @State currentTime: string = ''; @State boundingRect: display.Rect[] = []; @State screenWidth: number = 0; @State displayClass: display.Display | null = null; @State topTextMargin: TextMargin = { left: 0, right: 0 }; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/diggingholescreen/src/main/ets/components/mainpage/DiggingHoleScreen.ets#L44-L102
d70830d061668675c35cf14f3a70179e8631e45c
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
sign
签名 @param str 需要签名的字符串 @param priKey 给定秘钥规格私钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64) @param isPem 是否为pem格式的key @returns string 签名对象
static sign(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding, isPem: boolean): string { //将私钥转换 let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) : CryptoSync...
AST#method_declaration#Left static sign AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right...
static sign(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding, isPem: boolean): string { let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) : CryptoSyncUtil.co...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L414-L430
09f927170f336e080792835792c6f9c258cbfb01
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.router.d.ets
arkts
replace
Replaces the current page with another one in the application. The current page is destroyed after replacement. @param { RouterOptions } options Options. @syscap SystemCapability.ArkUI.ArkUI.Lite @since 3 @deprecated since 8
static replace(options: RouterOptions): void;
AST#method_declaration#Left static replace AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left RouterOptions 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...
static replace(options: RouterOptions): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L262-L262
1863771714d7ab63be1629588939e7b2a898a4de
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets
arkts
onBackground
[EndExclude save_the_uiContext_to_localstorage_in_entry_ability] [StartExclude save_the_uiContext_to_localstorage_in_entry_ability]
onBackground(): void { // Ability has back to background hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); }
AST#method_declaration#Left onBackground AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Ability has back to background AST#expression_statement#Left AST#expression#Left AST#ca...
onBackground(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L60-L63
feb67ce4c0d3bb68037ea8bb4efc4c7825b43db6
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/pages/Index.ets
arkts
testHidebug
[End Project_Header] [Start testHidebug]
function testHidebug(event?: ClickEvent) { try { hilog.info(0x0000, 'testTag', `getSystemCpuUsage ${hidebug.getSystemCpuUsage()}`); } catch (err) { hilog.error(0x0000, 'testTag', `error message is ${(err as BusinessError).message}`); } }
AST#function_declaration#Left function testHidebug AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statem...
function testHidebug(event?: ClickEvent) { try { hilog.info(0x0000, 'testTag', `getSystemCpuUsage ${hidebug.getSystemCpuUsage()}`); } catch (err) { hilog.error(0x0000, 'testTag', `error message is ${(err as BusinessError).message}`); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/PerformanceAnalysisKit/PerformanceAnalysisTool/entry/src/main/ets/pages/Index.ets#L22-L28
577667c2b7369ac536c78c76b1a18256aff6b576
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tls/CertVerify/entry/src/main/ets/pages/Index.ets
arkts
selectSingleDocFile
选择单个文件并返回选中文件地址
async function selectSingleDocFile(context: Context): Promise<string> { let selectedFilePath: string = "" let documentPicker = new picker.DocumentViewPicker(context); await documentPicker.select({ maxSelectNumber: 1 }).then((result) => { if (result.length > 0) { selectedFilePath = result[0] } }) ...
AST#function_declaration#Left async function selectSingleDocFile AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ...
async function selectSingleDocFile(context: Context): Promise<string> { let selectedFilePath: string = "" let documentPicker = new picker.DocumentViewPicker(context); await documentPicker.select({ maxSelectNumber: 1 }).then((result) => { if (result.length > 0) { selectedFilePath = result[0] } }) ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/CertVerify/entry/src/main/ets/pages/Index.ets#L197-L206
7e6cc1ec1ed43b6c7b447c4c70a72fc1826973fd
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/SetSchemeHandler.ets
arkts
onDestroy
[End set_scheme_handler]
onDestroy(): void { }
AST#method_declaration#Left onDestroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
onDestroy(): void { }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/SetSchemeHandler.ets#L19-L21
dd0289d7c0feeb70c46b94d2be3830cb42466c09
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/EmitterUtil.ets
arkts
onSubscribe
订阅事件 @param eventId 事件ID,string类型的eventId不支持空字符串。 @param callback 事件的回调处理函数。
static onSubscribe<T>(eventId: string | number, callback: Callback<T>) { emitter.on(eventId.toString(), (eventData: emitter.GenericEventData<T>) => { callback(eventData.data); }); }
AST#method_declaration#Left static onSubscribe AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left eventId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_t...
static onSubscribe<T>(eventId: string | number, callback: Callback<T>) { emitter.on(eventId.toString(), (eventData: emitter.GenericEventData<T>) => { callback(eventData.data); }); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/EmitterUtil.ets#L45-L49
42efc889fb3587554f521fc87346ecbe6a934cc3
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/form/src/main/ets/default/view/FormManagerComponent.ets
arkts
getChooseCard
Get choose card info from current form information. @return {any} formCardItem
private getChooseCard() { this.chooseCardId = this.mFormIdMap.get(this.mSwiperIndex); let formCardItem: CardItemInfo = new CardItemInfo(); formCardItem.cardId = this.mFormIdMap.get(this.mSwiperIndex); let count = 0; let isStop = false; for (let i = 0; i < this.formItem.length; i++) { if (i...
AST#method_declaration#Left private getChooseCard 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 . chooseCardId AS...
private getChooseCard() { this.chooseCardId = this.mFormIdMap.get(this.mSwiperIndex); let formCardItem: CardItemInfo = new CardItemInfo(); formCardItem.cardId = this.mFormIdMap.get(this.mSwiperIndex); let count = 0; let isStop = false; for (let i = 0; i < this.formItem.length; i++) { if (i...
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/form/src/main/ets/default/view/FormManagerComponent.ets#L88-L114
0e8f5d415e8f91cb969db72481ae0f92fb2b4217
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets
arkts
addData
在指定索引位置增加一个元素 @param index
public addData(index: number, data: FileItem): void { this.fileList.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left FileItem AST#primary_type#...
public addData(index: number, data: FileItem): void { this.fileList.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets#L41-L44
ae3fc35ab45b93b509a220a06e89487ec5b7ecde
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template10/Index.ets
arkts
pushPath
overwrite function of NavPathStack
pushPath(info: NavPathInfo, animated?: boolean): void pushPath(info: NavPathInfo, options?: NavigationOptions): void pushPath(info: NavPathInfo, secArg?: boolean | NavigationOptions): void { console.log('[derive-test] reached DerivedNavPathStack\'s pushPath'); if (typeof secArg === 'boolean') { super....
AST#method_declaration#Left pushPath AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left NavPathInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
pushPath(info: NavPathInfo, animated?: boolean): void pushPath(info: NavPathInfo, options?: NavigationOptions): void pushPath(info: NavPathInfo, secArg?: boolean | NavigationOptions): void { console.log('[derive-test] reached DerivedNavPathStack\'s pushPath'); if (typeof secArg === 'boolean') { super....
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template10/Index.ets#L30-L39
b74f520411dd669e360f1517f997e5bf231fc3ab
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/component/TextInputDialogView.ets
arkts
isLargeScreen
是否是大屏,大于手机屏幕宽度500vp
private isLargeScreen(): boolean { return this.getDisplayWidth() > 500; }
AST#method_declaration#Left private isLargeScreen AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_e...
private isLargeScreen(): boolean { return this.getDisplayWidth() > 500; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/component/TextInputDialogView.ets#L181-L183
63a211c3038f1ce1fcd53abd9dbd8831c80974a0
gitee
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/SubscriptionManager.ets
arkts
loadSubscriptions
从本地存储加载订阅列表
private async loadSubscriptions(): Promise<void> { try { if (!this.preferences) { console.warn('⚠️ Preferences 未初始化') return } const jsonStr = await this.preferences.get('subscriptions', '[]') as string const data = JSON.parse(jsonStr) as SubscriptionInfo[] this.subscri...
AST#method_declaration#Left private async loadSubscriptions 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 >...
private async loadSubscriptions(): Promise<void> { try { if (!this.preferences) { console.warn('⚠️ Preferences 未初始化') return } const jsonStr = await this.preferences.get('subscriptions', '[]') as string const data = JSON.parse(jsonStr) as SubscriptionInfo[] this.subscri...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L217-L233
6fc2cdbe30d8de5871491ce1409e4972ce79c03f
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets
arkts
[StartExclude cold_start_speed_optimization]
build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_...
build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets#L31-L41
086099d3c015082ad953b158da61817bda1acfd8
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getAppInfo
获取应用程序的配置信息 @returns
static async getAppInfo(): Promise<bundleManager.ApplicationInfo> { return (await AppUtil.getBundleInfo()).appInfo; }
AST#method_declaration#Left static async getAppInfo 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#qualified_type#Left bundleManager . ApplicationInfo AST#qua...
static async getAppInfo(): Promise<bundleManager.ApplicationInfo> { return (await AppUtil.getBundleInfo()).appInfo; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L474-L476
d6a20542b11b338ebdf775c44cfa638d3efdf75b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/booksUtils.ets
arkts
updateBooks
@author 2008 @param id 需要移动的书籍Id @param group 移动到的分组Id updateBooks 书籍批量移动
async updateBooks(id:number|number[], group:number){ let BookGroupId: Record<number, number> = {} //循环更新 let bookId:number[] = toolsUtils.numberArrays(id) //根据书籍获取旧的分组Id BookGroupId = await BooksDao.getBookIdsByGroupId(bookId) if (Object.values(BookGroupId).map(o=>o).length === 0){ await ...
AST#method_declaration#Left async updateBooks 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#typ...
async updateBooks(id:number|number[], group:number){ let BookGroupId: Record<number, number> = {} let bookId:number[] = toolsUtils.numberArrays(id) BookGroupId = await BooksDao.getBookIdsByGroupId(bookId) if (Object.values(BookGroupId).map(o=>o).length === 0){ await bookGroupUtils.updat...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/booksUtils.ets#L64-L82
aaac844b75765d501743b5adbba5741c46868416
github
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/common/utils/ColorUtil.ets
arkts
@param pixelMap @returns
export function getImageMainColor(pixelMap: image.PixelMap): Promise<effectKit.Color> { return new Promise((resolve, reject) => { effectKit.createColorPicker(pixelMap).then((colorPicker) => { colorPicker.getMainColor().then((color: effectKit.Color) => { resolve(color); }).catch((err) => { ...
AST#export_declaration#Left export AST#function_declaration#Left function getImageMainColor AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parame...
export function getImageMainColor(pixelMap: image.PixelMap): Promise<effectKit.Color> { return new Promise((resolve, reject) => { effectKit.createColorPicker(pixelMap).then((colorPicker) => { colorPicker.getMainColor().then((color: effectKit.Color) => { resolve(color); }).catch((err) => { ...
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/common/utils/ColorUtil.ets#L59-L73
602cd68e0d1c5e00e354985b3bee4629e2336737
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/types/SwipeCardTypes.ets
arkts
滑动配置接口
export interface SwipeConfig { /** * 最大可见卡片数量 * @default 4 */ maxVisibleCards?: number; /** * 触发栈即将为空事件的最小卡片数量 * @default 2 */ minStackSize?: number; /** * 卡片旋转角度(度) * @default 15 */ rotationAngle?: number; /** * 卡片缩放比例 * @default 0.95 */ scaleRatio?: number; /*...
AST#export_declaration#Left export AST#interface_declaration#Left interface SwipeConfig AST#object_type#Left { /** * 最大可见卡片数量 * @default 4 */ AST#type_member#Left maxVisibleCards ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /...
export interface SwipeConfig { maxVisibleCards?: number; minStackSize?: number; rotationAngle?: number; scaleRatio?: number; swipeThreshold?: number; animationDuration?: number; enableSpringBack?: boolean; cardSpacing?: number; preloadThreshold?: number; }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L110-L164
a9777f278d5cf56ff27a7a0053a3c3681a7abdb8
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Performance.ets
arkts
initCurveData
初始化数据 @param count 曲线图点的个数 @param range y轴范围
private initCurveData(): LineData { let values = new JArrayList<EntryOhos>(); for (let index: number = 0; index < this.gpData.length; index++) { const gpDataCur = this.gpData[index]; if (gpDataCur.fps == '' || gpDataCur.fps === undefined) { continue } this.fpsValues.push(parseI...
AST#method_declaration#Left private initCurveData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LineData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left v...
private initCurveData(): LineData { let values = new JArrayList<EntryOhos>(); for (let index: number = 0; index < this.gpData.length; index++) { const gpDataCur = this.gpData[index]; if (gpDataCur.fps == '' || gpDataCur.fps === undefined) { continue } this.fpsValues.push(parseI...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Performance.ets#L160-L202
766ce2927f0108750fa9aab4e56b281010e4cb45
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
面试轮次枚举
export enum InterviewRound { HR = 'hr', // HR面试 TECHNICAL = 'technical', // 技术面试 MANAGER = 'manager', // 主管面试 FINAL = 'final', // 终面 ONSITE = 'onsite' // 现场面试 }
AST#export_declaration#Left export AST#enum_declaration#Left enum InterviewRound AST#enum_body#Left { AST#enum_member#Left HR = AST#expression#Left 'hr' AST#expression#Right AST#enum_member#Right , // HR面试 AST#enum_member#Left TECHNICAL = AST#expression#Left 'technical' AST#expression#Right AST#enum_member#Right , // 技...
export enum InterviewRound { HR = 'hr', TECHNICAL = 'technical', MANAGER = 'manager', FINAL = 'final', ONSITE = 'onsite' }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L14-L20
7df3535d023c831c171bf172a000d83eff65335c
github
TianQvQ/WeChat_ArkTs.git
077ddcdb8e8032f71f45540461fbd66f2d49c973
entry/src/main/ets/pages/Index.ets
arkts
TabCreate
底部标签实现
@Builder TabCreate(index:number){ Stack({alignContent:Alignment.Center}){ Badge({count: this.tabTipCounts[index],maxCount:99,//最大消息数 position:BadgePosition.RightTop,//位置 style:{color:'#FFFFFF',fontSize:13,badgeSize:20,badgeColor:Color.Red}})//自定义UI { Column(){ //底部图标 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabCreate AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left...
@Builder TabCreate(index:number){ Stack({alignContent:Alignment.Center}){ Badge({count: this.tabTipCounts[index],maxCount:99, position:BadgePosition.RightTop, style:{color:'#FFFFFF',fontSize:13,badgeSize:20,badgeColor:Color.Red}}) { Column(){ Image(this.curre...
https://github.com/TianQvQ/WeChat_ArkTs.git/blob/077ddcdb8e8032f71f45540461fbd66f2d49c973/entry/src/main/ets/pages/Index.ets#L62-L88
1a5d4b5fae34df97b801c03dad675ec16122d742
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/DynamicSyncUtil.ets
arkts
dynamicKey
动态协商密钥 @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流 @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流 @param symAlgName 秘钥规格 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns 共享密钥
static dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { //公钥数据 let pubKeyArray: Uint8Array = new Uint8Array(); //私钥数据 let priKeyArray: Uint8Array =...
AST#method_declaration#Left static dynamicKey AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Righ...
static dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { let pubKeyArray: Uint8Array = new Uint8Array(); let priKeyArray: Uint8Array = new Uint8Ar...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/DynamicSyncUtil.ets#L38-L74
b437c750a7ad1c259f9626d5437115b63297f169
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/component/CartBottomBar.ets
arkts
构建购物车底部操作栏 @returns {void} 无返回值
build(): void { Column() { RowSpaceBetweenCenter({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium"), top: $r("app.float.space_vertical_medium"), bottom: this.safeAreaEnabled &...
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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_el...
build(): void { Column() { RowSpaceBetweenCenter({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium"), top: $r("app.float.space_vertical_medium"), bottom: this.safeAreaEnabled &...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/CartBottomBar.ets#L66-L148
95af1990e03d671a098a59e0a5c1db1a2916829e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
loadFontConfigs
加载字体配置
private async loadFontConfigs(): Promise<void> { this.fontConfigs = [ { id: 'default', name: 'default', displayName: '默认字体', fontFamily: 'HarmonyHeiTi', sizeMultiplier: 1.0, letterSpacing: 0, lineHeight: 1.4 }, { id: 'rounded', ...
AST#method_declaration#Left private async loadFontConfigs 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 > A...
private async loadFontConfigs(): Promise<void> { this.fontConfigs = [ { id: 'default', name: 'default', displayName: '默认字体', fontFamily: 'HarmonyHeiTi', sizeMultiplier: 1.0, letterSpacing: 0, lineHeight: 1.4 }, { id: 'rounded', ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L682-L721
73cb333319c73915a719bee1de7be2aa368a6de5
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieDataSet.ets
arkts
getValueLinePart1Length
When valuePosition is OutsideSlice, indicates length of first half of the line @Override
public getValueLinePart1Length(): number { return this.mValueLinePart1Length; }
AST#method_declaration#Left public getValueLinePart1Length AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#...
public getValueLinePart1Length(): number { return this.mValueLinePart1Length; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L229-L231
a18f7ef2d6b0686e9037397e01c4df66c37e2986
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
isBlank
判断字符串是否为空和空白符(空白符包括空格、制表符、全角空格和不间断空格)。true为空,否则false @param str @returns
static isBlank(str: string | undefined | null): boolean { let length: number; if ((str == undefined) || (str == null) || ((length = str.length) == 0)) { return true; } for (let i = 0; i < length; i++) { // 只要有一个非空字符即为非空字符串 if (false == CharUtils.isBlankChar(str.charCodeAt(i))) { ...
AST#method_declaration#Left static isBlank AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right...
static isBlank(str: string | undefined | null): boolean { let length: number; if ((str == undefined) || (str == null) || ((length = str.length) == 0)) { return true; } for (let i = 0; i < length; i++) { if (false == CharUtils.isBlankChar(str.charCodeAt(i))) { return false; ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L58-L70
28c86cc64c19b94028a0257bf21dd94560f926f9
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/StringCipherArkTS/entry/src/main/ets/common/utils/DataTransformUtil.ets
arkts
uint8ArrayToString
Converting uint8Array bytes to stream strings. @param content Uint8Array data. @returns Converted string.
uint8ArrayToString(content: Uint8Array): string { let arrayString = ''; for (let i = 0; i < content.length; i++) { arrayString += String.fromCharCode(content[i]); } return arrayString; }
AST#method_declaration#Left uint8ArrayToString AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left Uint8Array 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#prim...
uint8ArrayToString(content: Uint8Array): string { let arrayString = ''; for (let i = 0; i < content.length; i++) { arrayString += String.fromCharCode(content[i]); } return arrayString; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/common/utils/DataTransformUtil.ets#L67-L73
1fd70cb339256e709627d2c72794902214d81e13
gitee
from-north-to-north/OpenHarmony_p7885
f6ea526c039db535a7c958fa154ccfcb3668b37c
hap/easy_demo/float_windows/float_windows_3.5.14.43/entry/src/main/ets/controller/FloatWindowController.ets
arkts
initWindowStage
ability调用,监听windowStage状态变化
async initWindowStage(context: common.UIAbilityContext, windowStage: window.WindowStage) { this.windowStage = windowStage; let mainWin = await windowStage.getMainWindow(); await mainWin.setWindowSystemBarProperties({ statusBarColor: '#182431', navigationBarColor: '#182431' }); windowSt...
AST#method_declaration#Left async initWindowStage AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left win...
async initWindowStage(context: common.UIAbilityContext, windowStage: window.WindowStage) { this.windowStage = windowStage; let mainWin = await windowStage.getMainWindow(); await mainWin.setWindowSystemBarProperties({ statusBarColor: '#182431', navigationBarColor: '#182431' }); windowSt...
https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/float_windows/float_windows_3.5.14.43/entry/src/main/ets/controller/FloatWindowController.ets#L32-L48
a0c299ac3766ed011f786847331664953c6cd535
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebCompSecPriv/entry/src/main/ets/pages/DisAdsBlockSpecDomPages_two.ets
arkts
resourceToString
[StartExclude set_up_page_level_ad_filtering_switch]
function resourceToString(resource: Resource) { return getContext().resourceManager.getStringSync(resource); }
AST#function_declaration#Left function resourceToString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return...
function resourceToString(resource: Resource) { return getContext().resourceManager.getStringSync(resource); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebCompSecPriv/entry/src/main/ets/pages/DisAdsBlockSpecDomPages_two.ets#L19-L21
68bd87ee1cab4bd4236a0ac69ed8e5db42665a0b
gitee
langwudong/browser.git
f44fff759c50c162739c1585149018e6f0277471
entry/src/main/ets/view/SettingDialog.ets
arkts
AboutBuilder
关于我们
@Builder AboutBuilder() { Row() { Text("关于我们") .margin({left: 15}) .fontSize(17) Text(CommonConstants.APP_NAME + " " + CommonConstants.VERSION) .margin({right: 15}) .fontSize(10) .fontColor(Color.Gray) } .height(this.itemHeight) .width("100%") .jus...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AboutBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_elemen...
@Builder AboutBuilder() { Row() { Text("关于我们") .margin({left: 15}) .fontSize(17) Text(CommonConstants.APP_NAME + " " + CommonConstants.VERSION) .margin({right: 15}) .fontSize(10) .fontColor(Color.Gray) } .height(this.itemHeight) .width("100%") .jus...
https://github.com/langwudong/browser.git/blob/f44fff759c50c162739c1585149018e6f0277471/entry/src/main/ets/view/SettingDialog.ets#L133-L146
9db7bf2820ea1803a550c2822ba61ad72da3e3e7
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/model/KeyboardController.ets
arkts
deleteForward
删除光标前固定长度的文本
public deleteForward(length: number): void { inputString = inputString.substring(0, inputString.length - length); this.addLog('deleteForward'); if (this.mTextInputClient !== undefined) { // 向操作栈中压入backSpace操作 this.operatorCheck.pushBackSpace(); this.mTextInputClient.deleteForward(length); ...
AST#method_declaration#Left public deleteForward AST#parameter_list#Left ( AST#parameter#Left length : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t...
public deleteForward(length: number): void { inputString = inputString.substring(0, inputString.length - length); this.addLog('deleteForward'); if (this.mTextInputClient !== undefined) { this.operatorCheck.pushBackSpace(); this.mTextInputClient.deleteForward(length); } else { th...
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/model/KeyboardController.ets#L140-L153
ce4e10014343bd46245131314d233d351dcf7251
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/PublishMultimediaUpdate/publishmultimediaupdate/src/main/ets/constants/ListConstants.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 class ListConstants { // 自动分配剩余空间 public static readonly LAYOUT_WEIGHT: number = 1; // 列表默认间隔 public static readonly LIST_SPACE: number = 10; }
AST#export_declaration#Left export AST#class_declaration#Left class ListConstants AST#class_body#Left { // 自动分配剩余空间 AST#property_declaration#Left public static readonly LAYOUT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expr...
export class ListConstants { public static readonly LAYOUT_WEIGHT: number = 1; public static readonly LIST_SPACE: number = 10; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/PublishMultimediaUpdate/publishmultimediaupdate/src/main/ets/constants/ListConstants.ets#L16-L21
341bc8e4903d5cc082eede432307944af754f622
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/Bluetooth/entry/src/main/ets/uicomponents/EmptyPage.ets
arkts
EmptyPage
Copyright (c) 2023 Hunan OpenValley 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...
@Component export default struct EmptyPage { private img: string | PixelMap | Resource = $r('app.media.bg_empty_page') private message: ResourceStr = $r('app.string.tv_no_device') build() { Column() { Image(this.img) .width(120) .aspectRatio(1) Text(this.message) .fontSiz...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct EmptyPage AST#component_body#Left { AST#property_declaration#Left private img : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left PixelMap...
@Component export default struct EmptyPage { private img: string | PixelMap | Resource = $r('app.media.bg_empty_page') private message: ResourceStr = $r('app.string.tv_no_device') build() { Column() { Image(this.img) .width(120) .aspectRatio(1) Text(this.message) .fontSiz...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/Bluetooth/entry/src/main/ets/uicomponents/EmptyPage.ets#L16-L37
e18f7a7d20c2497da7dd196985e9b2ec678dadf8
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
uncollectUrl
取消收藏网站 @param id
async uncollectUrl(id: number) { try { const response = await wanHttpClient.uncollectUrl(id) if (response.data.errorCode === 0) { EventBus.getInstance().post(WanEventId.EVENT_UNCOLLECT_URL, new UncollectEvent(true, id)) } else { EventBus.getInstance() .post(WanEventId.EVE...
AST#method_declaration#Left async uncollectUrl AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try ...
async uncollectUrl(id: number) { try { const response = await wanHttpClient.uncollectUrl(id) if (response.data.errorCode === 0) { EventBus.getInstance().post(WanEventId.EVENT_UNCOLLECT_URL, new UncollectEvent(true, id)) } else { EventBus.getInstance() .post(WanEventId.EVE...
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets#L52-L65
b736f03f6284c7592efd1f105e314fdebc3a3fc9
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
get
获取值
get(key: K): V | null { const index = this.hash(key); let current = this.table[index]; while (current) { if (current.key === key) { return current.value; } current = current.next; } return null; }
AST#method_declaration#Left get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left V AST#primary_type#Righ...
get(key: K): V | null { const index = this.hash(key); let current = this.table[index]; while (current) { if (current.key === key) { return current.value; } current = current.next; } return null; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L77-L88
5135c676f48f621a397c4df5eb762799d2d032ef
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextInputBuilderProxy.ets
arkts
passwordRules
密码生成规则 @description 触发自动填充时,该规则会传递给密码保险箱用于生成新密码 @param passwordRules @returns
passwordRules(passwordRules: string) { this.builderOptions.passwordRules = passwordRules; return this }
AST#method_declaration#Left passwordRules AST#parameter_list#Left ( AST#parameter#Left passwordRules : 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#expression_statem...
passwordRules(passwordRules: string) { this.builderOptions.passwordRules = passwordRules; return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextInputBuilderProxy.ets#L57-L60
5bfd07824b7e974adf2698498c32d1297ca08ee4
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/model/BreakpointModel.ets
arkts
@file 断点模型定义 @author Joker.X 断点类型
export enum BreakpointType { /** * 超小断点 */ XS = "xs", /** * 小断点 */ SM = "sm", /** * 中断点 */ MD = "md", /** * 大断点 */ LG = "lg" }
AST#export_declaration#Left export AST#enum_declaration#Left enum BreakpointType AST#enum_body#Left { /** * 超小断点 */ AST#enum_member#Left XS = AST#expression#Left "xs" AST#expression#Right AST#enum_member#Right , /** * 小断点 */ AST#enum_member#Left SM = AST#expression#Left "sm" AST#expression#Right AST#enum_me...
export enum BreakpointType { XS = "xs", SM = "sm", MD = "md", LG = "lg" }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/model/BreakpointModel.ets#L9-L26
27951d90603fa3021f5113a081b354073c339969
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/WindowManager.ets
arkts
immerseFullScreenAsync
经测试,异步WindowManager.statusBarHeight,WindowManager.navBarHeight也可以及时赋上值 ,如果各位项目遇到未拿到值得情况可以使用immerseFullScreenSync同步方法,同步方法也没啥性能和卡顿损耗 沉浸式全屏(全屏屏幕,且显示状态栏、导航栏) 异步方法:适合动态监听状态栏,导航栏并做相应调整的方式。这种方案比较麻烦,但是用户体验和性能更好。 仅在Ability使用(Ability全局,且初始化状态栏和导航栏的高度),建议在 Ability --> onWindowStageCreate 中执行
static async immerseFullScreenAsync(windowStage: window.WindowStage) { let windowClass: window.Window = await windowStage.getMainWindow() // 获取状态栏和导航栏的高度 windowClass.on("avoidAreaChange", async data => { if (data.type == window.AvoidAreaType.TYPE_SYSTEM) { // 将值保存到静态变量中,以便后续使用 WindowMa...
AST#method_declaration#Left static async immerseFullScreenAsync AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param...
static async immerseFullScreenAsync(windowStage: window.WindowStage) { let windowClass: window.Window = await windowStage.getMainWindow() windowClass.on("avoidAreaChange", async data => { if (data.type == window.AvoidAreaType.TYPE_SYSTEM) { WindowManager.statusBarHeight = px2vp(data....
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/WindowManager.ets#L33-L58
f643cde14b527edd8c459459d25b39b9c64daf2d
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets
arkts
loadAccount
读取账号 @returns {Promise<void>} Promise<void>
async loadAccount(): Promise<void> { this.storedAccount = await this.repository.loadAccount(); }
AST#method_declaration#Left async loadAccount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
async loadAccount(): Promise<void> { this.storedAccount = await this.repository.loadAccount(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets#L50-L52
ae360fedd2d1b6af3d0f9e87c3171b7d2daeeefc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/ShowData.ets
arkts
页面展示数据类型
export class ShowData { // 车型的不同部件 sticky: string = ''; // 不同部件对应的详细参数 sub: BasicDataSource<PartInfo> = new BasicDataSource(); // 每一个部件对应的控制器数组,与详细参数一一对应 scrollerArray: Scroller[] = []; }
AST#export_declaration#Left export AST#class_declaration#Left class ShowData AST#class_body#Left { // 车型的不同部件 AST#property_declaration#Left sticky : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declara...
export class ShowData { sticky: string = ''; sub: BasicDataSource<PartInfo> = new BasicDataSource(); scrollerArray: Scroller[] = []; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/ShowData.ets#L19-L26
3f70eef05d0b831cbeef93ab7692d9eb0850d798
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/TitleBar.ets
arkts
TitleBar
Page title bar
@Component export struct TitleBar { private title!: Resource; build() { Column() { Row() { Image($r('app.media.ic_back')) .width(40) .height(40) .objectFit(ImageFit.Contain) .onClick(() => { router.back() }) .id('backBtn') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title AST#ERROR#Left ! AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Righ...
@Component export struct TitleBar { private title!: Resource; build() { Column() { Row() { Image($r('app.media.ic_back')) .width(40) .height(40) .objectFit(ImageFit.Contain) .onClick(() => { router.back() }) .id('backBtn') ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/TitleBar.ets#L19-L45
aa7c9c1ba6f851314bf05549d2b3614451b891b7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets
arkts
publicFinishFunc
调用finishSession结束操作
async function publicFinishFunc(handle: number, huksOptions: huks.HuksOptions) { console.info(`enter promise doFinish`); let throwObject: ThrowObject = { isThrow: false }; try { await finishSession(handle, huksOptions, throwObject) .then((data) => { finishOutData = data.outData as Uint8Array; ...
AST#function_declaration#Left async function publicFinishFunc AST#parameter_list#Left ( AST#parameter#Left handle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left...
async function publicFinishFunc(handle: number, huksOptions: huks.HuksOptions) { console.info(`enter promise doFinish`); let throwObject: ThrowObject = { isThrow: false }; try { await finishSession(handle, huksOptions, throwObject) .then((data) => { finishOutData = data.outData as Uint8Array; ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets#L261-L282
b88658540ade34509ad165071bcceb0b1b3626e9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/view/FlowItemNode.ets
arkts
FlowItemNode
自定义组件复用池瀑布流子组件
@Component export struct FlowItemNode { @State type: string = ''; @State item: ViewItem = new ViewItem(); @State itemHeight: number = 0; @State itemColor: Color = 0; @State builder: WrappedBuilder<ESObject> | null = null; private nodeItem: NodeItem = new NodeItem(); aboutToAppear(): void { this.nodeI...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlowItemNode AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati...
@Component export struct FlowItemNode { @State type: string = ''; @State item: ViewItem = new ViewItem(); @State itemHeight: number = 0; @State itemColor: Color = 0; @State builder: WrappedBuilder<ESObject> | null = null; private nodeItem: NodeItem = new NodeItem(); aboutToAppear(): void { this.nodeI...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/view/FlowItemNode.ets#L29-L53
d7da69494b3733e470b6e916ff6fef2dd5fc7a92
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
isEmptyArr
Check array is empty @param {Array}array @return {boolean} true(empty)
isEmptyArr(array: Object | Object[]): boolean { return this.isEmpty(array) || (array as Object[]).length === 0; }
AST#method_declaration#Left isEmptyArr AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left Object [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_an...
isEmptyArr(array: Object | Object[]): boolean { return this.isEmpty(array) || (array as Object[]).length === 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets#L123-L125
3d21d04199c8ce0f1545bc95c98dd2039755d748
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
login
登录 @param username wanandroid账号 @param password 密码
async login(username: string, password: string) { try { const result = await WanHttpClient.login(username, password); if (result.response.errorCode === 0) { await this.updateLoginInfo(result.response.data, result.cookies.join(';'), password); EventBus.getInstance().post(WanEventId.EVENT_...
AST#method_declaration#Left async login AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
async login(username: string, password: string) { try { const result = await WanHttpClient.login(username, password); if (result.response.errorCode === 0) { await this.updateLoginInfo(result.response.data, result.cookies.join(';'), password); EventBus.getInstance().post(WanEventId.EVENT_...
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L146-L160
6cf0cf6faab934fcea04e35b54fa594684d12425
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setMaxWidth
Sets the maximum width that the axis can take (in vp). @param maxWidth
public setMaxWidth(maxWidth: number): void { this.mMaxWidth = maxWidth; }
AST#method_declaration#Left public setMaxWidth AST#parameter_list#Left ( AST#parameter#Left maxWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t...
public setMaxWidth(maxWidth: number): void { this.mMaxWidth = maxWidth; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L220-L222
388858c75adbf7e8e270d144c2a0dad8d2f24500
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/exception_throw/exception_try_001_T.ets
arkts
Introduction 异常抛出-try块
export function exception_try_001_T(taint_src : string) { try { taint.Sink(taint_src); } catch (e) {} }
AST#export_declaration#Left export AST#function_declaration#Left function exception_try_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_statement...
export function exception_try_001_T(taint_src : string) { try { taint.Sink(taint_src); } catch (e) {} }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/exception_throw/exception_try_001_T.ets#L6-L10
f95aa15d9b0a9f408a37b68b11a76db4f5732aa0
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/DataRenderer.ets
arkts
initBuffers
Initializes the buffers used for rendering with a new size. Since this method performs memory allocations, it should only be called if necessary.
public abstract initBuffers();
AST#method_declaration#Left public abstract initBuffers AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
public abstract initBuffers();
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/DataRenderer.ets#L139-L139
ba3dac620e0145c70539292549ae9b28f46d7417
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setDrawGridLines
Set this to true to enable drawing the grid lines for this axis. @param enabled
public setDrawGridLines(enabled: boolean): void { this.mDrawGridLines = enabled; }
AST#method_declaration#Left public setDrawGridLines AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prim...
public setDrawGridLines(enabled: boolean): void { this.mDrawGridLines = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L194-L196
7bb47f0926dca1f7889ef79e235363afc9700e54
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/keyboardavoid/src/main/ets/basicDataResource/BasicDataSource.ets
arkts
getData
获取索引对应的数据 @param index 数组索引 @returns
public getData(index: number): string { return this.dataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
public getData(index: number): string { return this.dataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/keyboardavoid/src/main/ets/basicDataResource/BasicDataSource.ets#L35-L37
6bd691781ad5e899d62881ac1a6bf45ad3e9df40
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
instance
获取路由操作的实例,如跳转、返回等操作 @deprecated @param stackName 栈名,如果有多个Navigation,需要设置,如果一个应用只有一个,可不设置 @returns
public static instance<T>(stackName: string = DEFAULT_STACK_NAME): NavDestBuilder<T> { if (ZRouter.routerMgr === undefined) { ZRouter.routerMgr = ZRouter.getRouterMgr() } return NavDestBuilder.create<T>(ZRouter.routerMgr, stackName) }
AST#method_declaration#Left public static instance AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left stackName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = A...
public static instance<T>(stackName: string = DEFAULT_STACK_NAME): NavDestBuilder<T> { if (ZRouter.routerMgr === undefined) { ZRouter.routerMgr = ZRouter.getRouterMgr() } return NavDestBuilder.create<T>(ZRouter.routerMgr, stackName) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L184-L189
cf923c3ec80da155eb456f139d74cc3a30fda96d
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
arkts
hotItems
UI
@Builder hotItems(item: Type1, index: number) { Row({ space: 10 }) { Checkbox() .select(item.selected) .onChange((checked: boolean) => { item.selected = checked; this.toggleSelection(index); // 更新单个商品的选中状态 }) Image(item.img) .width(120) .heig...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right hotItems AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Type1 AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#pr...
@Builder hotItems(item: Type1, index: number) { Row({ space: 10 }) { Checkbox() .select(item.selected) .onChange((checked: boolean) => { item.selected = checked; this.toggleSelection(index); }) Image(item.img) .width(120) .height(120) ...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L309-L377
e2159714c4d163e5440ccf8666dba9808bb11ab4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/immersive/src/main/ets/view/NavImmersive.ets
arkts
NavImmersive
字体设置透明度
@Component export struct NavImmersive { @Provide navPathStack: NavPathStack = new NavPathStack(); @StorageLink('avoidAreaTopToModule') avoidAreaTop: number = 0; @Builder pageMap(name: string) { NavDestination() { if (name === 'goodsDetail') { GoodsDetails() } else if (name === 'WebImmer...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavImmersive AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right navPathStack : AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right A...
@Component export struct NavImmersive { @Provide navPathStack: NavPathStack = new NavPathStack(); @StorageLink('avoidAreaTopToModule') avoidAreaTop: number = 0; @Builder pageMap(name: string) { NavDestination() { if (name === 'goodsDetail') { GoodsDetails() } else if (name === 'WebImmer...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/immersive/src/main/ets/view/NavImmersive.ets#L41-L162
6f3d6b93ebac07605284ef293eb7833183dacaa6
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/constraint.ets
arkts
2025年01月05日
export const DATE_FORMAT16: string = "HH时mm分ss秒";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT16 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "HH时mm分ss秒" AST#expression#Right AST#variable_declarator#Right ; AST#variable_d...
export const DATE_FORMAT16: string = "HH时mm分ss秒";
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L34-L34
f8342d3ca1170087fcdca70f1d1c528e175f78ec
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/model/Schedule.ets
arkts
日程数据类型。
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/Schedule.ets#L6-L6
0621693b536d88b8ac66b9ee9628d9e6aac3070c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/AlbumScrollBar.ets
arkts
AlbumScrollBar
Copyright (c) 2023 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...
@Component export struct AlbumScrollBar { scroller: Scroller | null = null; @State isClickScrollBar: boolean = false; @Consume isHideScrollBar: boolean; hasSideBar: boolean = true; build() { if (this.scroller !== null && this.scroller !== undefined) { ScrollBar({ scroller: this.scroller, direction:...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AlbumScrollBar AST#component_body#Left { AST#property_declaration#Left scroller : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Scroller AST#primary_type#Right | AST#primary_type#Left null AST#pri...
@Component export struct AlbumScrollBar { scroller: Scroller | null = null; @State isClickScrollBar: boolean = false; @Consume isHideScrollBar: boolean; hasSideBar: boolean = true; build() { if (this.scroller !== null && this.scroller !== undefined) { ScrollBar({ scroller: this.scroller, direction:...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/AlbumScrollBar.ets#L16-L52
107ec51ed6cb93f9f45f0d8cbe087709d42ec3be
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
aboutToAppear
页面生命周期 - 即将出现
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'GreetingsPage aboutToAppear'); this.loadGreetings(); }
AST#method_declaration#Left aboutToAppear 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 hilog AST#expression#Right . info AST#member_expre...
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'GreetingsPage aboutToAppear'); this.loadGreetings(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L36-L39
3e21bd5f4701a02c99f6cf1dfff992c08d73c66a
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets
arkts
updateImageList
更新选择的图片列表 @param {IBestUploaderFile[]} list - 图片列表 @returns {void} 无返回值
updateImageList(list: IBestUploaderFile[]): void { this.imageList = list; }
AST#method_declaration#Left updateImageList AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IBestUploaderFile [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat...
updateImageList(list: IBestUploaderFile[]): void { this.imageList = list; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets#L64-L66
a9f215612ce6f266c6e36f4a71bd52b2ceec2217
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
calcAngle
calculates the needed angle for a given value @param value @param yValueSum @return
private calcAngle(value: number, yValueSum: number): number { return value / yValueSum * this.mMaxAngle; }
AST#method_declaration#Left private calcAngle 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 yValueSum : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
private calcAngle(value: number, yValueSum: number): number { return value / yValueSum * this.mMaxAngle; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L355-L357
ec0a0f49700563a7879d639f300a41c1f9840054
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
TaskPoolPractice/entry/src/main/ets/pages/sample6/Sample6.ets
arkts
returnModule
[Start return_1] Sample6.ets
@Concurrent async function returnModule() { let module = await import('./a'); return module; }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function returnModule AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left module = AST#expression#Left AST#await...
@Concurrent async function returnModule() { let module = await import('./a'); return module; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample6/Sample6.ets#L7-L11
f950026d38aa2ae1ebf6e53e1299a016c4c71290
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/model/RouterModel.ets
arkts
Routing information. [Start build_routerModel] 路由信息类,便于跳转时传递更多信息
export class RouterModel { // 路由页面别名,形式为${包名}_${页面名} builderName: string = ""; // 路由栈名称 routerName: string = ""; // 需要传入页面的参数 param?: object = new Object(); }
AST#export_declaration#Left export AST#class_declaration#Left class RouterModel AST#class_body#Left { // 路由页面别名,形式为${包名}_${页面名} AST#property_declaration#Left builderName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right...
export class RouterModel { builderName: string = ""; routerName: string = ""; param?: object = new Object(); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/model/RouterModel.ets#L20-L27
d272b956348a6321585127c44c17eafb1d7210e7
gitee
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
commonModule/src/main/ets/utils/HttpUtils.ets
arkts
get
GET请求
static get<T>(url: string, params?: object) { return request<T>(url, http.RequestMethod.GET, params) }
AST#method_declaration#Left static get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ,...
static get<T>(url: string, params?: object) { return request<T>(url, http.RequestMethod.GET, params) }
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/commonModule/src/main/ets/utils/HttpUtils.ets#L68-L70
029fc8cde2f2126f52bb561a657a29632ddeeb28
github
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/common/components/listitem/MessageListItem.ets
arkts
sendMsgLayout
发送消息布局 该布局包含发送文字、图片、视频、语音
@Builder sendMsgLayout(){ Flex({ direction: FlexDirection.RowReverse , justifyContent: FlexAlign.End}){ //头像 this.header_layout() //消息内容 Flex({ direction: FlexDirection.Row , justifyContent:FlexAlign.End , alignItems:ItemAlign.Center}){ if(this.msgItem.type == msgType.Text){ /...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right sendMsgLayout 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 Flex ( AST#component_parameters#Left { AST#component_paramet...
@Builder sendMsgLayout(){ Flex({ direction: FlexDirection.RowReverse , justifyContent: FlexAlign.End}){ this.header_layout() Flex({ direction: FlexDirection.Row , justifyContent:FlexAlign.End , alignItems:ItemAlign.Center}){ if(this.msgItem.type == msgType.Text){ ...
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/common/components/listitem/MessageListItem.ets#L32-L83
218e18985484b61e69e0a13bfa04d2f2b11ef047
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets
arkts
大写字母键盘数据,真实业务场景网络请求下发的数据
export const upperCaseKeyData: IKeyAttribute[] = [ { label: 'Q', value: 'Q', fontSize: 16, fontColor: Color.White, type: EKeyType.INPUT, backgroundColor: Color.Gray, position: [0, 0, 0, 1], }, { label: 'W', value: 'W', fontSize: 16, fontColor: Color.White, type: EKe...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left upperCaseKeyData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IKeyAttribute [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [...
export const upperCaseKeyData: IKeyAttribute[] = [ { label: 'Q', value: 'Q', fontSize: 16, fontColor: Color.White, type: EKeyType.INPUT, backgroundColor: Color.Gray, position: [0, 0, 0, 1], }, { label: 'W', value: 'W', fontSize: 16, fontColor: Color.White, type: EKe...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets#L449-L726
25eaa56f3e8be06bf8a95325b71d18366feb2e99
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/navdestination/AppNavDestination.ets
arkts
aboutToRecycle
组件即将回收 @returns {void} 无返回值
aboutToRecycle(): void { this.viewModel.aboutToRecycle(); }
AST#method_declaration#Left aboutToRecycle 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#expressio...
aboutToRecycle(): void { this.viewModel.aboutToRecycle(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/navdestination/AppNavDestination.ets#L105-L107
0607c58f570bd495897ba2d2b0716ade7c5575ac
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/array_lib_func_008_F.ets
arkts
Introduction 库函数-array_shift
export function array_lib_func_008_F(taint_src : string) { let arr : string[] = ["_","a","b"]; let t = arr.shift(); taint.Sink(t!); }
AST#export_declaration#Left export AST#function_declaration#Left function array_lib_func_008_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_statemen...
export function array_lib_func_008_F(taint_src : string) { let arr : string[] = ["_","a","b"]; let t = arr.shift(); taint.Sink(t!); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/array_lib_func_008_F.ets#L6-L10
a5d3d04ba7ef7009973c9c43f9ab9d1d081453d7
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/harB/src/main/ets/components/mainpage/B2.ets
arkts
harBuilder
[Start function_har_builder_b2]
@Builder export function harBuilder(value: object) { NavDestination() { Column() { // [StartExclude function_har_builder_b2] Button($r("app.string.to_harb_pageB3"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onClick(() => { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function harBuilder AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST...
@Builder export function harBuilder(value: object) { NavDestination() { Column() { Button($r("app.string.to_harb_pageB3"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onClick(() => { buildRouterModel(RouterNameCons...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/harB/src/main/ets/components/mainpage/B2.ets#L18-L61
56439a652712bd63302c3840a00f86e89eeeee2a
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
arkts
getCartData
从数据库获取购物车数据
async getCartData(): Promise<void> { try { this.isLoading = true; const httpRequest = http.createHttp(); const response = await httpRequest.request( 'http://192.168.32.1:8080/api/cart/get', { method: http.RequestMethod.GET, header: { 'Content-Type': ...
AST#method_declaration#Left async getCartData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
async getCartData(): Promise<void> { try { this.isLoading = true; const httpRequest = http.createHttp(); const response = await httpRequest.request( 'http://192.168.32.1:8080/api/cart/get', { method: http.RequestMethod.GET, header: { 'Content-Type': ...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L149-L183
bae70051c8e386e8974e8145e2ca27b7f07c643f
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Stacks.ets
arkts
stackStyle
自定义样式:stack
@Styles stackStyle(){ .width('100%') .height(100) .backgroundColor(('#CCCCCC')) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right stackStyle 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 . height ( AST#exp...
@Styles stackStyle(){ .width('100%') .height(100) .backgroundColor(('#CCCCCC')) }
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Stacks.ets#L41-L45
157c026b49c9f99fab6408d276869ffbbe883650
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildThemeAppearanceSettings
主题外观设置
@Builder buildThemeAppearanceSettings() { Column({ space: 16 }) { Row() { Text('🎨 主题外观') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .layoutWeight(1) Text('自定义') .fontSize(14) .fontColor(this.C...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildThemeAppearanceSettings 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#...
@Builder buildThemeAppearanceSettings() { Column({ space: 16 }) { Row() { Text('🎨 主题外观') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .layoutWeight(1) Text('自定义') .fontSize(14) .fontColor(this.C...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3685-L3731
b478030178fc0b7501f3568d700a5ad83dadfe03
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/pages/WatchVodPage.ets
arkts
onDelAnnouncement
@description 删除公告
onDelAnnouncement(msgModel?: VHAnnouncementMessage) { console.log('删除公告:', msgModel) }
AST#method_declaration#Left onDelAnnouncement AST#parameter_list#Left ( AST#parameter#Left msgModel ? : AST#type_annotation#Left AST#primary_type#Left VHAnnouncementMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_sta...
onDelAnnouncement(msgModel?: VHAnnouncementMessage) { console.log('删除公告:', msgModel) }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/pages/WatchVodPage.ets#L162-L164
6f3ee86e8f585a3907d57cb57c046234b183949c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/model/WindowModel.ets
arkts
setMainWindowImmersive
当前主窗口是否开启沉浸模式 @param enable 是否开启 @returns {void}
setMainWindowImmersive(enable: boolean): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain the main window. Code:${er...
AST#method_declaration#Left setMainWindowImmersive AST#parameter_list#Left ( AST#parameter#Left enable : 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#primar...
setMainWindowImmersive(enable: boolean): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain the main window. Code:${er...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/WindowModel.ets#L85-L108
5f7b0e78de63de7aa2f35c076f7120e9edc293bf
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets
arkts
animateXY
Animates values along both the X and Y axes. @param durationMillisX animation duration along the X axis @param durationMillisY animation duration along the Y axis @param easing EasingFunction for both axes
public animateXY(durationMillisX: number, durationMillisY: number, easing: EasingFunction) { let xAnimator = xAnimator(durationMillisX, easing); let yAnimator = yAnimator(durationMillisY, easing); if (durationMillisX > durationMillisY) { xAnimator.addUpdateListener(mListener); } else { yAni...
AST#method_declaration#Left public animateXY AST#parameter_list#Left ( AST#parameter#Left durationMillisX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left durationMillisY : AST#type_annotation#Left AST#primary_type#Left num...
public animateXY(durationMillisX: number, durationMillisY: number, easing: EasingFunction) { let xAnimator = xAnimator(durationMillisX, easing); let yAnimator = yAnimator(durationMillisY, easing); if (durationMillisX > durationMillisY) { xAnimator.addUpdateListener(mListener); } else { yAni...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L86-L98
064162323f74a225d0497cf76ebce2dbf118ece0
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/LoadingDialog.ets
arkts
LoadingDialog
常用设置底部弹窗视图
@Component export struct LoadingDialog { build() { Column() { LoadingProgress() .color(Color.White) .width(80) .height(80) Text('努力加载中') .fontSize(16) .fontColor(Color.White) } .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingDialog AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Le...
@Component export struct LoadingDialog { build() { Column() { LoadingProgress() .color(Color.White) .width(80) .height(80) Text('努力加载中') .fontSize(16) .fontColor(Color.White) } .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/LoadingDialog.ets#L10-L27
adefc642b0bcff61b73f38bcd9c3b6afa1b5de50
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets
arkts
isNullorEmpty
判断数组为空或未定义 param 数组对象Array<Object> @returns boolean
static isNullorEmpty(list: Array<Object> | undefined): boolean { return null === list || undefined === list || list.length === 0; }
AST#method_declaration#Left static isNullorEmpty AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#R...
static isNullorEmpty(list: Array<Object> | undefined): boolean { return null === list || undefined === list || list.length === 0; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets#L47-L49
ecf8021f7cab9285ba52516685ba49439033ae1d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/CommemorationDAO.ets
arkts
insertCommemoration
插入新纪念日 @param commemoration 纪念日实体 @returns 插入的记录ID
async insertCommemoration(commemoration: CommemorationEntity): Promise<number> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { throw new Error('Database not initialized'); } try { const currentTime = new Date().toISOString(); const valueBucket: relationalStore.Values...
AST#method_declaration#Left async insertCommemoration AST#parameter_list#Left ( AST#parameter#Left commemoration : AST#type_annotation#Left AST#primary_type#Left CommemorationEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_typ...
async insertCommemoration(commemoration: CommemorationEntity): Promise<number> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { throw new Error('Database not initialized'); } try { const currentTime = new Date().toISOString(); const valueBucket: relationalStore.Values...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/CommemorationDAO.ets#L54-L82
7224488249a80fef9b345c2f8b51b0b2d52cb997
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegManager.ets
arkts
dispatchCallback
分发回调到主线程
private dispatchCallback(task: Task, type: string, data?: number | Error): void { // 使用 setTimeout 切换到主线程 setTimeout(() => { try { const callback = task.getCallback(); switch (type) { case 'start': callback.onStart(); break; case 'progre...
AST#method_declaration#Left private dispatchCallback AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
private dispatchCallback(task: Task, type: string, data?: number | Error): void { setTimeout(() => { try { const callback = task.getCallback(); switch (type) { case 'start': callback.onStart(); break; case 'progress': callba...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegManager.ets#L339-L353
db211dbf557fd9cdaa638f4c5d8b88420552d481
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
更新应用设置参数接口
export interface UpdateAppSettingsParams { theme?: Partial<ThemeSettings>; notification?: Partial<NotificationSettings>; reminder?: Partial<ReminderSettings>; privacy?: Partial<PrivacySettings>; ai?: Partial<AISettings>; data?: Partial<DataSettings>; security?: Partial<SecuritySettings>; accessibility?:...
AST#export_declaration#Left export AST#interface_declaration#Left interface UpdateAppSettingsParams AST#object_type#Left { AST#type_member#Left theme ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ThemeSettings AS...
export interface UpdateAppSettingsParams { theme?: Partial<ThemeSettings>; notification?: Partial<NotificationSettings>; reminder?: Partial<ReminderSettings>; privacy?: Partial<PrivacySettings>; ai?: Partial<AISettings>; data?: Partial<DataSettings>; security?: Partial<SecuritySettings>; accessibility?:...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L253-L263
33d8a16f76b94c711729789bc2e41387d26de878
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets
arkts
addCriticalAsset
[End query_user_auth_critical_asset] [Start add_critical_asset]
async function addCriticalAsset(): Promise<string> { let result: string = ''; let attr: asset.AssetMap = new Map(); attr.set(asset.Tag.SECRET, stringToArray('demo_pwd')); attr.set(asset.Tag.ALIAS, stringToArray('demo_alias')); attr.set(asset.Tag.ACCESSIBILITY, asset.Accessibility.DEVICE_FIRST_UNLOCKED); att...
AST#function_declaration#Left async function addCriticalAsset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Rig...
async function addCriticalAsset(): Promise<string> { let result: string = ''; let attr: asset.AssetMap = new Map(); attr.set(asset.Tag.SECRET, stringToArray('demo_pwd')); attr.set(asset.Tag.ALIAS, stringToArray('demo_alias')); attr.set(asset.Tag.ACCESSIBILITY, asset.Accessibility.DEVICE_FIRST_UNLOCKED); att...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets#L134-L155
3a057d0ff8bdbe02c49fa0779e7f575270c4bc8f
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/views/CreateSurveyView.ets
arkts
createMenu
创建问题菜单
@Builder createMenu() { Menu() { // 单选 MenuItem({ symbolStartIcon: this.menuIconModifier1, content: $r('app.string.single_choice_text') }) .onClick(() => { // 开启菜单项触动反馈 if (this.appGeneralData.isHapticMenu) { StartVibrator() } // 跳转到内容页面 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right createMenu 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 Menu ( ) AST#container_content_body#Left { // 单选 AST#arkts_ui_e...
@Builder createMenu() { Menu() { MenuItem({ symbolStartIcon: this.menuIconModifier1, content: $r('app.string.single_choice_text') }) .onClick(() => { if (this.appGeneralData.isHapticMenu) { StartVibrator() } if (this.attributeSh...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/CreateSurveyView.ets#L85-L173
c845e00de9da759b3e951c0e713232577462c8be
github
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/api/UserApi.type.ets
arkts
登录接口的传参
export interface LoginParam { /** * 账号 */ account: string /** * 密码 */ password: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface LoginParam AST#object_type#Left { /** * 账号 */ AST#type_member#Left account : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /** * 密码 */ AST#type_member#Le...
export interface LoginParam { account: string password: string }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/UserApi.type.ets#L4-L13
91522fc5b7398f3ea27433e117a1c869ac3795de
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/ThemeManager.ets
arkts
简化的主题管理器
export class AppThemeManager { private static instance: AppThemeManager; private pageControllers: Map<string, PageThemeController> = new Map(); private static globalThemeChangeCallbacks: (() => void)[] = []; private constructor() {} static getInstance(): AppThemeManager { if (!AppThemeManager.instance) ...
AST#export_declaration#Left export AST#class_declaration#Left class AppThemeManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left AppThemeManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_...
export class AppThemeManager { private static instance: AppThemeManager; private pageControllers: Map<string, PageThemeController> = new Map(); private static globalThemeChangeCallbacks: (() => void)[] = []; private constructor() {} static getInstance(): AppThemeManager { if (!AppThemeManager.instance) ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L35-L254
35d6ade1a60b2efd20bff1fabbd8955832c2f74e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
This is a pop-up window tool class, which is used to encapsulate dialog code. Developers can directly invoke the methods in.
export class CommonUtils { /** * Alert dialog dialog */ alertDialog(context: Context.UIAbilityContext) { AlertDialog.show({ message: $r('app.string.alert_dialog_message'), alignment: DialogAlignment.Bottom, offset: { dx: 0, dy: CommonConstants.DY_OFFSET }, pri...
AST#export_declaration#Left export AST#class_declaration#Left class CommonUtils AST#class_body#Left { /** * Alert dialog dialog */ AST#method_declaration#Left alertDialog AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Context . UIAbili...
export class CommonUtils { alertDialog(context: Context.UIAbilityContext) { AlertDialog.show({ message: $r('app.string.alert_dialog_message'), alignment: DialogAlignment.Bottom, offset: { dx: 0, dy: CommonConstants.DY_OFFSET }, primaryButton: { value: $r('a...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets#L24-L126
ba6048f1c26b0f40988952d45461fe872f26a536
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets
arkts
listNoRepeatDate
删除数组中重复元素 param 数组对象 @returns Array
static listNoRepeatDate<T>(list: T[]) { if (null === list || undefined === list || list.length === 0) { return; } return Array.from(new Set(list)); }
AST#method_declaration#Left static listNoRepeatDate AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type...
static listNoRepeatDate<T>(list: T[]) { if (null === list || undefined === list || list.length === 0) { return; } return Array.from(new Set(list)); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets#L26-L31
1442c023ca34839606bb8eef9c55c397aea439d0
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
fetchList
获取列表数据 @returns {Promise<void>} Promise<void>
private async fetchList(): Promise<void> { this.items = await this.demoRepository.getAll(); }
AST#method_declaration#Left private async fetchList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#typ...
private async fetchList(): Promise<void> { this.items = await this.demoRepository.getAll(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets#L160-L162
d1a0872b2376c83fd8f078c235ef9e87bc0c1385
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
notifyDataDelete
通知LazyForEach组件需要在index对应索引处删除该子组件 @param {number} index - 索引值
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L116-L120
6a4ebc29d8817fb9b0c60ac7df996762080ef27b
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history.ets
arkts
search_with_index
Search all histories with help of index @param key the search key @param max_result_number max result number. if not filled then unlimited. @returns label-link string[][]
static search_with_index(key: string, max_result_number?: number): string[][] { // Timer let s = Date.now(); // console.log('[Meow][bunch_of_history_index] Start Searching with Index! Start: ' + s.toString()) let search_number = max_result_number; if (search_number) { search_number *= 10; ...
AST#method_declaration#Left static search_with_index AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max_result_number ? : AST#type_annotation#Left AST#primary_type#Left num...
static search_with_index(key: string, max_result_number?: number): string[][] { let s = Date.now(); let search_number = max_result_number; if (search_number) { search_number *= 10; } let result = bunch_of_history_index.search_history_label_link(key, search_number); result ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L178-L198
9cdc6c066015648d5b9808f1f7d23e74e6ebd195
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
aboutToAppear
页面出现前加载列表 @returns {void} 无返回值
aboutToAppear(): void { void this.refreshList(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { void this.refreshList(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets#L44-L46
666d7081589d537eacf2aea340d63135c61b170e
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/DateUtils.ets
arkts
diffDays
计算两个日期的差值(天数)
static diffDays(date1: Date, date2: Date): number { const diff = Math.abs(date1.getTime() - date2.getTime()); return Math.floor(diff / (1000 * 60 * 60 * 24)); }
AST#method_declaration#Left static diffDays AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Righ...
static diffDays(date1: Date, date2: Date): number { const diff = Math.abs(date1.getTime() - date2.getTime()); return Math.floor(diff / (1000 * 60 * 60 * 24)); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/DateUtils.ets#L74-L77
98447516aba82e6019218457dd597803f934f72e
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets
arkts
onCastPlayPosition
投屏播放当前位置。 @param position:number 播放当前进度 ,单位ms
onCastPlayPosition(position: number) { }
AST#method_declaration#Left onCastPlayPosition AST#parameter_list#Left ( AST#parameter#Left position : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right ...
onCastPlayPosition(position: number) { }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets#L313-L315
a89330914d229ccbef56f5fc8299cfeb55593fed
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets
arkts
MultipleFilesDownloadComponent
0个下载任务 功能描述: 多文件下载监听在应用开发中是一个非常常见的需求。本示例将介绍如何使用request上传下载模块实现多文件下载监听,如监听每个文件下载任务的进度,任务暂停,下载完成等下载情况。 每个应用最多支持创建10个未完成的任务,相关规格说明请参考request.agent.create。 推荐场景: 多文件下载 核心组件: 1. FileDownloadItem 实现步骤: 1.配置下载参数。一个下载任务需要配置对应一套下载参数request.agent.Config。本例中使用downloadConfig方法简单配置了下载文件的url,实际业务 中请按实际情况按需配置。 2.创建多个文件下载监听实例。单个文件...
@Component export struct MultipleFilesDownloadComponent { // 是否全部开始下载 @State isStartAllDownload: boolean = false; // 待下载任务数量 @State downloadCount: number = 0; // 下载失败任务数量。当所有任务下载失败时,"全部暂停"状态重置为"全部开始"。 @State downloadFailCount: number = 0; // 分段按钮,仅用于ux展示 @State tabOptions: SegmentButtonOptions = Segment...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MultipleFilesDownloadComponent AST#component_body#Left { // 是否全部开始下载 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isStartAllDownload : AST#type_annotation#Left AST#primary_type#Left boo...
@Component export struct MultipleFilesDownloadComponent { @State isStartAllDownload: boolean = false; @State downloadCount: number = 0; @State downloadFailCount: number = 0; @State tabOptions: SegmentButtonOptions = SegmentButtonOptions.tab({ buttons: [{ text: $r('app.string.multiple_files_downl...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets#L54-L232
c345d2febc860b2960a9d732bb804684929841d5
gitee