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
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/util/Snowflake.ets
arkts
generate
应用约束:1. 强制类型标注,10. 禁止any类型
static generate(timestamp: number | Date = Date.now()): string { if (timestamp instanceof Date) timestamp = timestamp.getTime(); if (typeof timestamp !== 'number' || isNaN(timestamp)) { throw new TypeError( `"timestamp" argument must be a number (received ${isNaN(timestamp as...
AST#method_declaration#Left static generate AST#parameter_list#Left ( AST#parameter#Left timestamp : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left A...
static generate(timestamp: number | Date = Date.now()): string { if (timestamp instanceof Date) timestamp = timestamp.getTime(); if (typeof timestamp !== 'number' || isNaN(timestamp)) { throw new TypeError( `"timestamp" argument must be a number (received ${isNaN(timestamp as...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/util/Snowflake.ets#L25-L41
de4114df45971401eb470b9d2c1fcc462c9a2cb1
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets
arkts
Media session tool class.
export class AvSessionUtil { /** * Initializing the playback control center. * * @param context Context. */ public static initAvSession(playBarModel: PlayBarModel) { return new Promise<string>(async () => { try { // Sets the current music metadata. let metadata = { as...
AST#export_declaration#Left export AST#class_declaration#Left class AvSessionUtil AST#class_body#Left { /** * Initializing the playback control center. * * @param context Context. */ AST#method_declaration#Left public static initAvSession AST#parameter_list#Left ( AST#parameter#Left playBarModel : AST#type_...
export class AvSessionUtil { public static initAvSession(playBarModel: PlayBarModel) { return new Promise<string>(async () => { try { let metadata = { assetId: playBarModel!.musicItem!.id.toString(), title: playBarModel!.musicItem!.name, artist: playBarModel...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets#L27-L106
b05743e18fa1dc78bccc14cd870476ccdac85c7f
gitee
MissTeven/ArkTS-demo.git
fd9f7695fa29889ad4a9ecf3330fda9991aca24c
entry/src/main/ets/view/LoginComponent.ets
arkts
LoginComponent
Login page component.
@Component export struct LoginComponent { @StorageProp('isMinHeight') isMinHeight: boolean = false; @State userName: string = ''; @State password: string = ''; build() { GridRow({ columns: { sm: CommonConstants.GRID_ROW_SM, md: CommonConstants.GRID_ROW_MD, lg: CommonConstants....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoginComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'isMinHeight' AST#expression#Right ) AST#decorator#Right isMinHeight : AST#type_annotation#...
@Component export struct LoginComponent { @StorageProp('isMinHeight') isMinHeight: boolean = false; @State userName: string = ''; @State password: string = ''; build() { GridRow({ columns: { sm: CommonConstants.GRID_ROW_SM, md: CommonConstants.GRID_ROW_MD, lg: CommonConstants....
https://github.com/MissTeven/ArkTS-demo.git/blob/fd9f7695fa29889ad4a9ecf3330fda9991aca24c/entry/src/main/ets/view/LoginComponent.ets#L7-L134
d88cafe1260e4d617772821d0714859cd078d9b8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/ReminderScheduler.ets
arkts
startBackgroundTask
启动后台任务
private async startBackgroundTask(): Promise<void> { try { const request = { bgMode: backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgent: null // 在实际实现中需要创建WantAgent }; this.backgroundTaskId = await backgroundTaskManager.requestSuspendDelay('birthday_reminder_background'...
AST#method_declaration#Left private async startBackgroundTask 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 startBackgroundTask(): Promise<void> { try { const request = { bgMode: backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgent: null }; this.backgroundTaskId = await backgroundTaskManager.requestSuspendDelay('birthday_reminder_background', () => { hilo...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L100-L115
77c5d8080a2fd042a2bd541936e4f39af57276b5
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/EntryOhos.ets
arkts
copy
returns an exact copy of the entry @return
public copy(): EntryOhos { let data: Object | null = this.getData(); if (data === null) { return new EntryOhos(this.x, this.getY()); } else { return new EntryOhos(this.x, this.getY(), undefined, data); } }
AST#method_declaration#Left public copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data : AST...
public copy(): EntryOhos { let data: Object | null = this.getData(); if (data === null) { return new EntryOhos(this.x, this.getY()); } else { return new EntryOhos(this.x, this.getY(), undefined, data); } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/EntryOhos.ets#L56-L63
c82bace8871998a6700c70160f81c2fbe83fba0c
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets
arkts
getTmpSoundDir
获取临时音频目录路径 @returns 临时目录路径
private static getTmpSoundDir(): string { const context = getAppContext() return `${context.cacheDir}/WC_Audio_Tmp_Files`; }
AST#method_declaration#Left private static getTmpSoundDir AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarato...
private static getTmpSoundDir(): string { const context = getAppContext() return `${context.cacheDir}/WC_Audio_Tmp_Files`; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets#L111-L114
bd7b886a1817e154282946ec5730c5710722f1c0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
initializeDatabase
初始化数据库服务 @param context 应用上下文
async initializeDatabase(context: Context): Promise<void> { if (this.isInitialized) { console.info('[DatabaseService] Database already initialized'); return; } try { await this.dbManager.initDatabase(context); this.isInitialized = true; console.info('[DatabaseService] Database...
AST#method_declaration#Left async initializeDatabase 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 AST#generic_...
async initializeDatabase(context: Context): Promise<void> { if (this.isInitialized) { console.info('[DatabaseService] Database already initialized'); return; } try { await this.dbManager.initDatabase(context); this.isInitialized = true; console.info('[DatabaseService] Database...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L50-L68
7c8da8915d2f772eb0bcf53efd6c2bc20ca3481a
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/component/PhoneInputField.ets
arkts
构建手机号输入组件 @returns {void} 无返回值
build(): void { ColumnStart({ widthValue: P100 }) { IBestField({ value: this.phone, type: "phone", showLabel: false, labelWidth: 0, inputAlign: "left", inputFontSize: 16, inputFontColor: $r("app.color.text_primary"), placeholder: this.placeholder...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width...
build(): void { ColumnStart({ widthValue: P100 }) { IBestField({ value: this.phone, type: "phone", showLabel: false, labelWidth: 0, inputAlign: "left", inputFontSize: 16, inputFontColor: $r("app.color.text_primary"), placeholder: this.placeholder...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/PhoneInputField.ets#L37-L69
cd7be52937e05e4710aa3157c38b818ca691d450
github
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/39.路由创建及跳转和传参.ets
arkts
新建页面需要@Entry修饰,还要在main_pages.json注册 页面栈,最大容量32个页面
build() { Column({ space: 10 }) { Text('首页') .fontSize(20) Button('跳转到详情页') .onClick(() => { // Single路由模式,会将页面栈中相同的替换掉,默认路由模式是Standard router.pushUrl({ url: 'pages/DetailPage', params: { msg: '传递一个参数' } }, r...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Righ...
build() { Column({ space: 10 }) { Text('首页') .fontSize(20) Button('跳转到详情页') .onClick(() => { router.pushUrl({ url: 'pages/DetailPage', params: { msg: '传递一个参数' } }, router.RouterMode.Single) }) ...
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/39.路由创建及跳转和传参.ets#L11-L48
ef0491e08e362a7f804b45ed85ea6d635808c149
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/navigation/LoginNav.ets
arkts
LoginNav
@file 登录页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function LoginNav(): void { LoginPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LoginNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_compo...
@Builder export function LoginNav(): void { LoginPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/navigation/LoginNav.ets#L8-L11
2ba6848e2ec83c744c5a2294230816d48c5015b0
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Scroll.ets
arkts
buildScrollModifier
构建滚动容器属性修饰器 @returns {AttributeModifier<ScrollAttribute>} 滚动容器属性修饰器
private buildScrollModifier(): AttributeModifier<ScrollAttribute> { const fillMaxSize = this.fillMaxSize; const fillMaxWidth = this.fillMaxWidth; const width = this.widthValue; const height = this.heightValue; const padding = this.paddingValue; const margin = this.marginValue; return { ...
AST#method_declaration#Left private buildScrollModifier AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ScrollAttribute AST#primary_type#Right AST#type_a...
private buildScrollModifier(): AttributeModifier<ScrollAttribute> { const fillMaxSize = this.fillMaxSize; const fillMaxWidth = this.fillMaxWidth; const width = this.widthValue; const height = this.heightValue; const padding = this.paddingValue; const margin = this.marginValue; return { ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Scroll.ets#L77-L109
4dd28af248034b6849f9d474b3ca0fe572dd49c4
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/SHA1.ets
arkts
sig2hex
将签名转换为16进制字符串
private static sig2hex(sig: number[]): string { const hexChars: string = '0123456789abcdef'; let hex: string = ''; for (let i: number = 0; i < 20; i++) { hex += hexChars.charAt((sig[i] >>> 4) & 0xF); hex += hexChars.charAt(sig[i] & 0xF); } return hex; }
AST#method_declaration#Left private static sig2hex AST#parameter_list#Left ( AST#parameter#Left sig : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#L...
private static sig2hex(sig: number[]): string { const hexChars: string = '0123456789abcdef'; let hex: string = ''; for (let i: number = 0; i < 20; i++) { hex += hexChars.charAt((sig[i] >>> 4) & 0xF); hex += hexChars.charAt(sig[i] & 0xF); } return hex; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/SHA1.ets#L34-L42
d4c400794407887dc60b9bc8877f439d5885c198
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/NetConnectionUtils.ets
arkts
getNetBearType
获取网络类型
static async getNetBearType(): Promise<connection.NetBearType> { let net = await connection.getDefaultNet(); let netCapabilities = await connection.getNetCapabilities(net); let netBearType = netCapabilities.bearerTypes[0]; return netBearType; }
AST#method_declaration#Left static async getNetBearType 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 connection . NetBearType AST#qualif...
static async getNetBearType(): Promise<connection.NetBearType> { let net = await connection.getDefaultNet(); let netCapabilities = await connection.getNetCapabilities(net); let netBearType = netCapabilities.bearerTypes[0]; return netBearType; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/NetConnectionUtils.ets#L49-L54
84d1e99c82691014e8ed954d2496dde60df48946
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Gets raw text content from rawfile. @param from Path of rawfile, for example, 'home.html'. @returns The text content if success. Undefined otherwise.
export function text_from_rawfile(from: string) { try { let uint8Array: Uint8Array = meowContext().resourceManager.getRawFileContentSync(from); let bf = buffer.from(uint8Array).buffer; let r = buffer.from(bf).toString(); // console.log('[text_from_rawfile] ' + r); return r; } catch (e) { con...
AST#export_declaration#Left export AST#function_declaration#Left function text_from_rawfile AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left {...
export function text_from_rawfile(from: string) { try { let uint8Array: Uint8Array = meowContext().resourceManager.getRawFileContentSync(from); let bf = buffer.from(uint8Array).buffer; let r = buffer.from(bf).toString(); return r; } catch (e) { console.error(`[text_from_rawfile][${from}] Fa...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L583-L594
5272815819d1d594dd1f976bb6d3f12fffdd3da9
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/MainViewModel.ets
arkts
@file 主页面 ViewModel @author Joker.X
@ObservedV2 export default class MainViewModel extends BaseViewModel { /** * 当前选中的页面索引 */ @Trace currentPageIndex: number = 0; /** * 底部 Tab 配置 */ readonly tabItems: Array<MainTabItem> = [ { title: $r("app.string.home"), animationData: this.getRawFileAnimationData("home.json") }, { title: $...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class MainViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 当前选中的页面索引 */ AST...
@ObservedV2 export default class MainViewModel extends BaseViewModel { @Trace currentPageIndex: number = 0; readonly tabItems: Array<MainTabItem> = [ { title: $r("app.string.home"), animationData: this.getRawFileAnimationData("home.json") }, { title: $r("app.string.category"), animationData: this.ge...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L11-L128
afa43d623a21a621c6ca853fc90c8772a4af3ea2
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider23.ets
arkts
buildSlider23
Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
@Builder function buildSlider23(config: SliderConfiguration) { Row() { Column({space: 30}) { Button('增加').onClick(() => { config.value = config.value + config.step config.triggerChange(config.value, SliderChangeMode.Click) }) .width(100) .height(25) .fontSize(10...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildSlider23 AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left SliderConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li...
@Builder function buildSlider23(config: SliderConfiguration) { Row() { Column({space: 30}) { Button('增加').onClick(() => { config.value = config.value + config.step config.triggerChange(config.value, SliderChangeMode.Click) }) .width(100) .height(25) .fontSize(10...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider23.ets#L16-L67
ada90bea380c432484bd9a628bdb8924da7f9612
gitee
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/renderer/AxisRenderer.ets
arkts
Baseclass of all axis renderers.
export default abstract class AxisRenderer extends Renderer { /** base axis this axis renderer works with */ protected mAxis: AxisBase | null = null; /** transformer to transform values to screen pixels and return */ protected mTrans: Transformer | null = null; /** * paint object for the grid lines */ ...
AST#export_declaration#Left export default AST#class_declaration#Left abstract class AxisRenderer extends AST#type_annotation#Left AST#primary_type#Left Renderer AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** base axis this axis renderer works with */ AST#property_declaration#Left protected ...
export default abstract class AxisRenderer extends Renderer { protected mAxis: AxisBase | null = null; protected mTrans: Transformer | null = null; protected mGridPaint: Paint = new Paint(); protected mAxisLabelPaint: Paint = new Paint(); protected mAxisLinePaint: Paint = new Paint(); prot...
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/renderer/AxisRenderer.ets#L28-L246
26f27a9107890f477e0e3eb7a891ad234b7f5125
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BarLineScatterCandleBubbleDataSet.ets
arkts
Baseclass of all DataSets for Bar-, Line-, Scatter- and CandleStickChart.
export default abstract class BarLineScatterCandleBubbleDataSet<T extends EntryOhos> extends DataSet<T> implements IBarLineScatterCandleBubbleDataSet<T> { /** * default highlight color */ protected mHighLightColor: number = 0xffbb73; constructor(yVals: JArrayList<T> | null, label: string) { super(yVals...
AST#export_declaration#Left export default AST#class_declaration#Left abstract class BarLineScatterCandleBubbleDataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#typ...
export default abstract class BarLineScatterCandleBubbleDataSet<T extends EntryOhos> extends DataSet<T> implements IBarLineScatterCandleBubbleDataSet<T> { protected mHighLightColor: number = 0xffbb73; constructor(yVals: JArrayList<T> | null, label: string) { super(yVals, label); } public setHighLigh...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarLineScatterCandleBubbleDataSet.ets#L25-L54
6ee9ad16fcd1875d18f47574cfc222dc97058fe3
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DownloadUtils.ets
arkts
getArkDownloadPath
获取ArkWeb文件夹下载路径,仅SDK内部使用
static getArkDownloadPath(): string { return DownloadUtils.downloadPath; }
AST#method_declaration#Left static getArkDownloadPath AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#membe...
static getArkDownloadPath(): string { return DownloadUtils.downloadPath; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DownloadUtils.ets#L31-L33
94410b6bb64e375cc25b8876ad369bc753dbe958
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/beans/Account.ets
arkts
构造函数,用于创建 Account 类的实例
constructor( accountType: number = 0, // 初始化记账类型,默认为支出 typeText: string = '', // 初始化类型文本,默认为空字符串 amount: number = 0, // 初始化金额,默认为0 date: Date = new Date(), // 初始化日期,默认为当前日期 desc: string = '' // 初始化描述,默认为空字符串 ) { // 将传入的参数赋值给实例的各个属性 this.accountType = accountType; this.typeText = typeTe...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left accountType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , // 初始化记账类型,默认为支出 AST#parameter#Left typeText :...
constructor( accountType: number = 0, typeText: string = '', amount: number = 0, date: Date = new Date(), desc: string = '' ) { this.accountType = accountType; this.typeText = typeText; this.amount = amount; this.date = date; this.desc = desc; }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/beans/Account.ets#L22-L35
d53d41cd94cd40cdd46c9a41c0438245fbdd54c1
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/StrUtil.ets
arkts
asString
类型转换为字符串 @param s 传入要转换的值 @returns 转换后的字符串
static asString(s: object): string | undefined { return typeof s === 'string' ? s as string : undefined }
AST#method_declaration#Left static asString AST#parameter_list#Left ( AST#parameter#Left s : 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#type_annotation#Left AST#union_type#Left AST#primary_type#Left string A...
static asString(s: object): string | undefined { return typeof s === 'string' ? s as string : undefined }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L55-L57
2332851ee78c083b83c64e31dba632cda3d87ac6
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/action/ToastUtil.ets
arkts
showToast
弹出土司,默认时长为2s,距离底部默认为80vp @param message 提示消息 @param options (显示时长、距离屏幕底部的位置、是否显示在应用之上)
static showToast(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 0); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; options....
AST#method_declaration#Left static showToast AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ...
static showToast(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 0); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; options....
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/action/ToastUtil.ets#L46-L53
0dedf445c66e39c8305f5e6c339da0a83959e156
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
梦想目标完整模型 与models/Dream.ets保持一致
export interface Dream { // 基本信息 id?: number; userId: number; title: string; description: string; category: string; // 状态与进度 priority: number; // 优先级:1-5 status: number; // 状态:0-未开始,1-进行中,2-已完成,3-已放弃 completionRate: number; // 完成进度百分比:0-100 // 时间相关 deadline: string; // 截止日期,格式:YYYY-MM-DD...
AST#export_declaration#Left export AST#interface_declaration#Left interface Dream AST#object_type#Left { // 基本信息 AST#type_member#Left id ? : 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 userId : AST#type_annotation#Le...
export interface Dream { id?: number; userId: number; title: string; description: string; category: string; priority: number; status: number; completionRate: number; deadline: string; createdAt?: string; updatedAt?: string; expectedDays: number; imageUrl: string; ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L44-L75
3e3c85478e5c907e4834267d1d12c7ff01b0db5e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/DistributedFileSample/entry/src/main/ets/pages/Index.ets
arkts
createFile
设备A上在分布式路径下创建测试文件,并写入内容
function createFile(path: string, fileName: string): void { let filePath = path + '/' + fileName + '.txt'; let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); setFileLv(filePath); showToast('Successfully created file of level s0', DELAY); fs.writeSync(file.fd, 'content OpenHarmony D...
AST#function_declaration#Left function createFile AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
function createFile(path: string, fileName: string): void { let filePath = path + '/' + fileName + '.txt'; let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); setFileLv(filePath); showToast('Successfully created file of level s0', DELAY); fs.writeSync(file.fd, 'content OpenHarmony D...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/DistributedFileSample/entry/src/main/ets/pages/Index.ets#L39-L47
6c4a6c4c5be28c57fcff4b40a2911a92cdd6a269
gitee
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/component/TextInputComponent.ets
arkts
输入框的文本内容,使用 @Link 进行双向绑定
build() { Row() { // 创建一个水平布局 // 显示左侧图标 Image(this.inputImage !== undefined ? this.inputImage : '') .width(26) // 设置图标宽度为26 .height(26) // 设置图标高度为26 .margin({ left: 12 }) // 设置左边距为12 // 创建文本输入框 TextInput({ placeholder: this.hintText, text: this.text }) .fontS...
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 Image ( AST#expression#Left AST#cond...
build() { Row() { Image(this.inputImage !== undefined ? this.inputImage : '') .width(26) .height(26) .margin({ left: 12 }) TextInput({ placeholder: this.hintText, text: this.text }) .fontSize(17) .padding({ left: 12 }) .backgroundColor...
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/TextInputComponent.ets#L7-L37
0b19d66582b98f69d730b9427241816f0693d128
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LLMConfigPage.ets
arkts
onProviderChange
当提供商选择改变时
private onProviderChange(provider: LLMProvider): void { this.selectedProvider = provider; const providerInfo = this.getCurrentProviderInfo(); if (providerInfo) { this.baseUrl = providerInfo.baseUrl; this.model = providerInfo.defaultModel; } }
AST#method_declaration#Left private onProviderChange AST#parameter_list#Left ( AST#parameter#Left provider : AST#type_annotation#Left AST#primary_type#Left LLMProvider AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS...
private onProviderChange(provider: LLMProvider): void { this.selectedProvider = provider; const providerInfo = this.getCurrentProviderInfo(); if (providerInfo) { this.baseUrl = providerInfo.baseUrl; this.model = providerInfo.defaultModel; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L88-L95
fe579a4360fcca709082056d405e1e4d7c1ae9bd
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/common/src/main/ets/view/SettingsPage.ets
arkts
SettingsContent
设置页面内容视图 @returns {void} 无返回值
@Builder private SettingsContent() { Text("设置页面内容视图") }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private SettingsContent 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 Text ( AST#expression#Left "设置页面内容视图" AST#expressi...
@Builder private SettingsContent() { Text("设置页面内容视图") }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/SettingsPage.ets#L33-L36
e1ee6c0316bab6514b0417ebd489b1fd11e914cd
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseModalBuilderProxy.ets
arkts
title
弹窗标题 @param title @returns
title(title: ResourceStr) { this.builderOptions.title = title return this; }
AST#method_declaration#Left title AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AS...
title(title: ResourceStr) { this.builderOptions.title = title return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseModalBuilderProxy.ets#L13-L16
91dcf1c77435a55dd725d9e9d0e86371646c8619
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowSpaceEvenlyTop
横向均分 + 垂直顶部
@ComponentV2 export struct RowSpaceEvenlyTop { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Param ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowSpaceEvenlyTop AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_typ...
@ComponentV2 export struct RowSpaceEvenlyTop { @Param options: RowOptions | RowOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding | L...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1425-L1500
6afd07c4ad570b0d8c02d526cf6eb6b39a57199c
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Utils.ets
arkts
init
initialize method, called inside the Chart.init() method. @param context
public static init() { }
AST#method_declaration#Left public static init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
public static init() { }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L53-L54
0a0fc6eaab6944f7ff584eb8c253e92c1e2ce591
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
put
将数据缓存 @param key @param value
static async put(key: string, value: preferences.ValueType, preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<void> { let preferences = await PreferencesUtil.getPreferences(preferenceName); //获取实例 await preferences.put(key, value); await preferences.flush(); //此处一定要flush,要不然不能永久序列...
AST#method_declaration#Left static async put 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 value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left p...
static async put(key: string, value: preferences.ValueType, preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<void> { let preferences = await PreferencesUtil.getPreferences(preferenceName); await preferences.put(key, value); await preferences.flush(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L91-L96
701878029751a51168e52b68dca6bbc774a41ffe
gitee
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/pages/EnvironmentMonitoringPage.ets
arkts
handleHumidityThresholdChange
处理湿度阈值调节
private handleHumidityThresholdChange(increase: boolean) { this.environmentData.humidityThreshold = adjustHumidityThreshold( this.environmentData.humidityThreshold, increase ) this.updateEnvironmentStatus() }
AST#method_declaration#Left private handleHumidityThresholdChange AST#parameter_list#Left ( AST#parameter#Left increase : 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#builder_function_body#Left { AST#expression...
private handleHumidityThresholdChange(increase: boolean) { this.environmentData.humidityThreshold = adjustHumidityThreshold( this.environmentData.humidityThreshold, increase ) this.updateEnvironmentStatus() }
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/EnvironmentMonitoringPage.ets#L192-L198
68f57871a403bc5c1309c781fd4f713a476fb03a
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/YAxisRenderer.ets
arkts
computeAxis
Computes the axis values. @param min - the minimum value in the data object for this axis @param max - the maximum value in the data object for this axis
public computeAxis(min: number, max: number, inverted: boolean) { //The handling of the Y-axis is fully customizable if (this.mYAxis?.getEnableCustomYAxisLabels()) { if (this.mTrans && this.mViewPortHandler != null && this.mViewPortHandler.contentWidth() > 10 && !this.mViewPortHandler.isFullyZoomedOutY())...
AST#method_declaration#Left public computeAxis AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R...
public computeAxis(min: number, max: number, inverted: boolean) { if (this.mYAxis?.getEnableCustomYAxisLabels()) { if (this.mTrans && this.mViewPortHandler != null && this.mViewPortHandler.contentWidth() > 10 && !this.mViewPortHandler.isFullyZoomedOutY()) { let p1: MPPointD | undefined = this.mTr...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/YAxisRenderer.ets#L56-L99
4e28bfa7ef127ae775c61ff75ba448a02aa94e31
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/CartService.ets
arkts
updateQuantity
更新数量
async updateQuantity(productId: string, quantity: number): Promise<void> { const item = this.cartItems.find(item => item.productId === productId); if (item) { if (quantity <= 0) { await this.removeFromCart(productId); } else { item.quantity = quantity; await this.saveCart(); ...
AST#method_declaration#Left async updateQuantity AST#parameter_list#Left ( AST#parameter#Left productId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left quantity : AST#type_annotation#Left AST#primary_type#Left number AST#p...
async updateQuantity(productId: string, quantity: number): Promise<void> { const item = this.cartItems.find(item => item.productId === productId); if (item) { if (quantity <= 0) { await this.removeFromCart(productId); } else { item.quantity = quantity; await this.saveCart(); ...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L98-L108
ed40fc26fdc941333f76ff135fa75b1ec8662771
github
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
common/src/main/ets/default/uicomponents/index.ets
arkts
AppGrid
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { AppGrid } from './AppGrid'
AST#export_declaration#Left export { AppGrid } from './AppGrid' AST#export_declaration#Right
export { AppGrid } from './AppGrid'
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/common/src/main/ets/default/uicomponents/index.ets#L16-L16
b49ba25af1f8ed33c90f93c80b6634f1bef1faf8
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets
arkts
getTopSafeHeight
获取顶部安全区域高度
getTopSafeHeight() { return this.topSafeHeight; }
AST#method_declaration#Left getTopSafeHeight AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . topSafeHeight AST#member_expression#Right AST#ex...
getTopSafeHeight() { return this.topSafeHeight; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets#L19-L21
0db585317f1058b63bf56c697db3f463876203b8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
buildStatsCard
构建统计卡片
@Builder buildStatsCard(title: string, items: Array<{label: string, value: string, icon: Resource, highlight?: boolean}>) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text(title) .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fon...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildStatsCard AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left items : AST#type_annotation#Lef...
@Builder buildStatsCard(title: string, items: Array<{label: string, value: string, icon: Resource, highlight?: boolean}>) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text(title) .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fon...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L577-L620
9e3cca53d6940a69ec1c6bfc45e36f1082d6d5d4
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/word/WordDetail.ets
arkts
getWordChangeEnWords
/** * 将多个中文释义合并为一个字符串(去重) getTitleCnsJoined(): string { const titles: string[] = []; if (this.titleCn1) { titles.push(this.titleCn1); } if (this.titleCn2) { titles.push(this.titleCn2); } if (this.titleCn3) { titles.push(this.titleCn3); } return AppUtility.getJoinedStringByRemovingDuplications( titles, Constants.Titl...
getWordChangeEnWords(): string[] { return StringDealUtility.matchEnWords(this.wordChange); }
AST#method_declaration#Left getWordChangeEnWords AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#L...
getWordChangeEnWords(): string[] { return StringDealUtility.matchEnWords(this.wordChange); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/word/WordDetail.ets#L68-L70
38b977b65386172d983ccab89f2c610fe0ae3185
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
addService
添加服务路由,开发者不需要手动调用,在编译阶段会自动生成模版代码 @param name @param service
public static addService(name: string, service: IProvider) { ZRouter.serviceMgr().addService(name, service) }
AST#method_declaration#Left public static addService AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left service : AST#type_annotation#Left AST#primary_type#Left IProvider AST#...
public static addService(name: string, service: IProvider) { ZRouter.serviceMgr().addService(name, service) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L200-L202
fd2cc960ed3bdf1e2f81333d2f5e652fba8fb5d1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SyncTypes.ets
arkts
同步统计信息
export interface SyncStatistics { userId: string; totalSyncs: number; successfulSyncs: number; failedSyncs: number; lastSuccessfulSync?: string; lastFailedSync?: string; totalDataUploaded: number; // 字节数 totalDataDownloaded: number; // 字节数 averageSyncTime: number; // 毫秒 conflictResolutionRate: numbe...
AST#export_declaration#Left export AST#interface_declaration#Left interface SyncStatistics AST#object_type#Left { AST#type_member#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalSyncs : AST#type_annota...
export interface SyncStatistics { userId: string; totalSyncs: number; successfulSyncs: number; failedSyncs: number; lastSuccessfulSync?: string; lastFailedSync?: string; totalDataUploaded: number; totalDataDownloaded: number; averageSyncTime: number; conflictResolutionRate: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L269-L280
85b674c7b9797c8dc8893af8fa6224275f48d17c
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/model/DataModel.ets
arkts
pushData
Add data.
public pushData(data: VideoData): void { this.dataArray.push(data); this.notifyDataAdd(this.dataArray.length - 1); }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left VideoData 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#...
public pushData(data: VideoData): void { this.dataArray.push(data); this.notifyDataAdd(this.dataArray.length - 1); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/DataModel.ets#L119-L122
37e89f738b29e5cae27405236ac249c49e0865c7
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/ValidationUtils.ets
arkts
验证工具类 提供常用的数据验证方法
export class ValidationUtils { /** * 验证邮箱 */ static isValidEmail(email: string): boolean { const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return emailRegex.test(email); } /** * 验证手机号(中国) */ static isValidPhone(phone: string): boolean { const phoneRegex = /^1[3-9]\d{9}$/; return ...
AST#export_declaration#Left export AST#class_declaration#Left class ValidationUtils AST#class_body#Left { /** * 验证邮箱 */ AST#method_declaration#Left static isValidEmail AST#parameter_list#Left ( AST#parameter#Left email : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotat...
export class ValidationUtils { static isValidEmail(email: string): boolean { const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return emailRegex.test(email); } static isValidPhone(phone: string): boolean { const phoneRegex = /^1[3-9]\d{9}$/; return phoneRegex.test(phone); } static is...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ValidationUtils.ets#L5-L49
fdb4c154a78fd473cc1cb2492488fd1933f09fe3
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets
arkts
onCastPlayState
投屏事件回调。 @param state:VHCastPlayState
onCastPlayState(state: VHCastPickerState) { if (state == VHCastPickerState.VH_CAST_PICKER_STATE_PLAY) { this.is_start = true; this.is_playing = true; } else if (state == VHCastPickerState.VH_CAST_PICKER_STATE_PAUSE || state == VHCastPickerState.VH_CAST_PICKER_STATE_STOP) { this.is_playin...
AST#method_declaration#Left onCastPlayState AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left VHCastPickerState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#...
onCastPlayState(state: VHCastPickerState) { if (state == VHCastPickerState.VH_CAST_PICKER_STATE_PLAY) { this.is_start = true; this.is_playing = true; } else if (state == VHCastPickerState.VH_CAST_PICKER_STATE_PAUSE || state == VHCastPickerState.VH_CAST_PICKER_STATE_STOP) { this.is_playin...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L338-L346
b0fb4453164e981598e2e78af461fd98e3033f94
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/emitter/src/main/ets/components/feature/EmitterClass.ets
arkts
setShoppingCartGoodsList
持久化订阅的事件回调
public setShoppingCartGoodsList(callback: Function): void { let addGoodDataId: EventsId = new EventsId(EmitterConst.ADD_EVENT_ID); // 以持久化方式订阅购物车添加事件并接收事件回调 emitter.off(EmitterConst.ADD_EVENT_ID); emitter.on(addGoodDataId, (eventData) => { callback(eventData); }); }
AST#method_declaration#Left public setShoppingCartGoodsList AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left voi...
public setShoppingCartGoodsList(callback: Function): void { let addGoodDataId: EventsId = new EventsId(EmitterConst.ADD_EVENT_ID); emitter.off(EmitterConst.ADD_EVENT_ID); emitter.on(addGoodDataId, (eventData) => { callback(eventData); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/emitter/src/main/ets/components/feature/EmitterClass.ets#L57-L64
e53dbc1fc2d32dc78fdfd03b18d47a4d8248962f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
showPanel
打开播放面板。
static showPanel(): boolean { try { TextReader.showPanel(); return true; } catch (e) { console.error(`TextReader failed to show panel. Code: ${e.code}, message: ${e.message}`); return false; } }
AST#method_declaration#Left static showPanel 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#try_statement#Left try AST#block_statement#Left { AST#statement#Le...
static showPanel(): boolean { try { TextReader.showPanel(); return true; } catch (e) { console.error(`TextReader failed to show panel. Code: ${e.code}, message: ${e.message}`); return false; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L162-L170
1e2c56d1860a149cbea8c5fb01a4800a5f8b110d
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
splitLines
按换行符拆分字符串 @param {string} value - 原始字符串 @returns {string[]} 拆分后的行
function splitLines(value: string): string[] { if (!value) { return [""]; } return value.split("\n"); }
AST#function_declaration#Left function splitLines AST#parameter_list#Left ( AST#parameter#Left value : 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#array_type#Lef...
function splitLines(value: string): string[] { if (!value) { return [""]; } return value.split("\n"); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L211-L216
20476da71757297da3fd3555a62bf3dfc2128934
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/conditional_stmt/conditional_if_003_T.ets
arkts
Introduction 条件语句-else
export function conditional_if_003_T(taint_src : string) { if (false) { } else { taint.Sink(taint_src); } }
AST#export_declaration#Left export AST#function_declaration#Left function conditional_if_003_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_statemen...
export function conditional_if_003_T(taint_src : string) { if (false) { } else { taint.Sink(taint_src); } }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/conditional_stmt/conditional_if_003_T.ets#L6-L11
16ba436d4c5fc5b0362fa565351b67943b243bcd
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets
arkts
onPlayerVolume
播放器音量 @param volume :当前播放器音量值
onPlayerVolume(volume: number) { }
AST#method_declaration#Left onPlayerVolume AST#parameter_list#Left ( AST#parameter#Left volume : 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 AST#me...
onPlayerVolume(volume: number) { }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L274-L276
389aa3841bda01bc4008d456056327ec736280c1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sideslipintercept/src/main/ets/components/mainpage/MainPage.ets
arkts
SideslipIntercept
事件类型,固定为change 功能说明: 本示例介绍使用NavDestination组件的onBackPressed回调对返回事件进行拦截,提示用户保存编辑内容,并使用preferences实例持久化保存内容 推荐场景: 返回上一页面时需要保存当前编辑内容的场景,如:记事本返回保存内容等 核心组件: 1. SideslipIntercept.textArea 实现步骤: 1. 生命周期函数onBackPress只能在@Entry组件中使用,因此使用navigation来管理页面 2. 使用NavDestination组件的onBackPressed回调对返回事件进行拦截 2. 触发返回弹出弹窗,选择保存时,将数据写入到pre...
@Component export struct SideslipIntercept { controller: TextAreaController = new TextAreaController(); @State text: string = ''; @Provide pageStackForComponentSharedPages: NavPathStack = new NavPathStack(); @State context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; @State isBack: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SideslipIntercept AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left TextAreaController AST#primary_type#Right AST#type_annotation#Right = AST#expressio...
@Component export struct SideslipIntercept { controller: TextAreaController = new TextAreaController(); @State text: string = ''; @Provide pageStackForComponentSharedPages: NavPathStack = new NavPathStack(); @State context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; @State isBack: ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sideslipintercept/src/main/ets/components/mainpage/MainPage.ets#L38-L161
0b12a25d3a86ea0644da77b4723d030abeb6e78b
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/arkts/@arkts.collections.d.ets
arkts
flipBitByIndex
Flips the bit value by index in a bit vector.(Flip 0 to 1, flip 1 to 0) @param { number } index - The index in the bit vector. @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. @throws { BusinessError } 10200001 - The value of in...
flipBitByIndex(index: number): void;
AST#method_declaration#Left flipBitByIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
flipBitByIndex(index: number): void;
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/arkts/@arkts.collections.d.ets#L5630-L5630
1870dc2905a6bda8f0388d6cce459109741efc36
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardSwiperComponent.ets
arkts
initCardsListAndOffset
初始化 cardsList, cardsOffset 及 scaleList。读取传入的case,并添加卡片数据,初始化偏移量列表和缩放系数数组。 @param {CardInfo[]} initCardsList - 初始化数据列表
private initCardsListAndOffset(initCardsList: CardInfo[]) { // 传入case为空时,使用预置用例 if (initCardsList === undefined || initCardsList.length === 0) { initCardsList = Constants.CARD_TEST_CASE } // 将初始化list传入卡片数据列表、卡片偏移度列表 initCardsList.forEach((item, index) => { this.cardsList.push(item); ...
AST#method_declaration#Left private initCardsListAndOffset AST#parameter_list#Left ( AST#parameter#Left initCardsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CardInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST...
private initCardsListAndOffset(initCardsList: CardInfo[]) { if (initCardsList === undefined || initCardsList.length === 0) { initCardsList = Constants.CARD_TEST_CASE } initCardsList.forEach((item, index) => { this.cardsList.push(item); this.cardsOffset.push(0); this....
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardSwiperComponent.ets#L109-L123
90485f723e96d1c36c19a4957d6d5cb259fad589
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets
arkts
addedIconWithNameView
应用类别中每一个应用模块 @param data app信息和首页应用里的appName
@Builder addedIconWithNameView(data: AddedIconWithNameViewMode) { Column() { this.appItemWithNameView({ app: data.app, homeAppNames: data.homeAppNames }); } .id(data.app.name.toString()) // 绑定id信息,可通过id获取组件坐标 .width($r('app.string.grid_exchange_grid_item_width')) .height($r('app.string.grid_...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right addedIconWithNameView AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AddedIconWithNameViewMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
@Builder addedIconWithNameView(data: AddedIconWithNameViewMode) { Column() { this.appItemWithNameView({ app: data.app, homeAppNames: data.homeAppNames }); } .id(data.app.name.toString()) .width($r('app.string.grid_exchange_grid_item_width')) .height($r('app.string.grid_exchange_grid_item_he...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L118-L127
8174c1f7d55c07d87e0d5f2514f905a657595350
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/Base64Utils.ets
arkts
encodeToStrSync
编码,通过输入参数编码后输出对应文本。 @param array @returns
static encodeToStrSync(array: Uint8Array, options?: util.Type): string { let base64 = new util.Base64Helper(); let result = base64.encodeToStringSync(array, options); return result; }
AST#method_declaration#Left static encodeToStrSync AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#quali...
static encodeToStrSync(array: Uint8Array, options?: util.Type): string { let base64 = new util.Base64Helper(); let result = base64.encodeToStringSync(array, options); return result; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/Base64Utils.ets#L28-L32
c2f4e351350db7cd3897e741e6067d8809f93711
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1_oaep/RSAPKCS1OAEPSync.ets
arkts
genRsa2048KeyPairSpec
生成RSA2048密钥对参数
function genRsa2048KeyPairSpec(): cryptoFramework.RSAKeyPairSpec { let nIn = BigInt('0x9260d0750ae117eee55c3f3deaba74917521a262ee76007cdf8a56755ad73a1598a1408410a01434c3f5bc54a88b57fa19fc4328daea0750a4c44e88cff3b2382621b80f670464433e4336e6d003e8cd65bff211da144b88291c2259a00a72b711c116ef7686e8fee34e4d933c868187bdc26f7...
AST#function_declaration#Left function genRsa2048KeyPairSpec AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . RSAKeyPairSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left {...
function genRsa2048KeyPairSpec(): cryptoFramework.RSAKeyPairSpec { let nIn = BigInt('0x9260d0750ae117eee55c3f3deaba74917521a262ee76007cdf8a56755ad73a1598a1408410a01434c3f5bc54a88b57fa19fc4328daea0750a4c44e88cff3b2382621b80f670464433e4336e6d003e8cd65bff211da144b88291c2259a00a72b711c116ef7686e8fee34e4d933c868187bdc26f7...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1_oaep/RSAPKCS1OAEPSync.ets#L36-L41
bac6d6ac590637377a6aee512d0c875d40356b33
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * The entry ability tag. */ static readonly ENTRY_ABILITY_TAG: string = 'EntryAbility'; /** * The main page tag. */ static readonly MAIN_PAGE_TAG: string = 'MainPage'; /** * The entry form ability tag. */ static readonly ENTRY_FORM_ABILITY_TAG: st...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The entry ability tag. */ AST#property_declaration#Left static readonly ENTRY_ABILITY_TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right...
export default class CommonConstants { static readonly ENTRY_ABILITY_TAG: string = 'EntryAbility'; static readonly MAIN_PAGE_TAG: string = 'MainPage'; static readonly ENTRY_FORM_ABILITY_TAG: string = 'EntryFormAbility'; static readonly DATABASE_TAG: string = 'DatabaseUtils'; static readonly TAG...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/constants/CommonConstants.ets#L21-L230
4407535b540efbfa8e006ead6a60c9908d884a00
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.SelectTitleBar.d.ets
arkts
SelectTitleBar
Declaration of the selectable title bar. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declaration of the selectable title bar. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
@Component export declare struct SelectTitleBar { /** * Selected index of the initial options in the drop-down menu. The index of the first item is 0. * If this attribute is not set, the default value is -1. Which means, no menu item is selected. * @type { number }. * @syscap SystemCapability.Ar...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SelectTitleBar AST#component_body#Left { /** * Selected index of the initial options in the drop-down menu. The index of the first item is 0. * If this attribute is not...
@Component export declare struct SelectTitleBar { @Prop selected: number; options: Array<SelectOption>; menuItems?: Array<SelectTitleBarMenuItem>; subtitle?: ResourceStr; badgeValue?: number; hidesBackButton?: boolean; ...
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SelectTitleBar.d.ets#L93-L196
bbeaefea31d8c7ea456f7559dbc658c9fcd942a6
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/pages/TaskDetailPage.ets
arkts
In low-code mode, do not add anything to the build function, as it will be overwritten by the content generated by the .visual file in the build phase.
build() { }
AST#build_method#Left build ( ) AST#build_body#Left { } AST#build_body#Right AST#build_method#Right
build() { }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/pages/TaskDetailPage.ets#L57-L59
623540dc3b8551a5443d78d4173008a91b766a1f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语分析数据接口
export interface GreetingAnalytics { totalGenerated: number; totalSent: number; mostUsedStyle: GreetingStyle; mostUsedOccasion: GreetingOccasion; mostUsedMethod: GreetingMethod; avgRating: number; styleDistribution: Record<GreetingStyle, number>; occasionDistribution: Record<GreetingOccasion, number>; ...
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingAnalytics AST#object_type#Left { AST#type_member#Left totalGenerated : 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 totalSent : AST#t...
export interface GreetingAnalytics { totalGenerated: number; totalSent: number; mostUsedStyle: GreetingStyle; mostUsedOccasion: GreetingOccasion; mostUsedMethod: GreetingMethod; avgRating: number; styleDistribution: Record<GreetingStyle, number>; occasionDistribution: Record<GreetingOccasion, number>; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L379-L389
eb9c239909d7d210eca4b0aeb37683405e013d04
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/FeatureComponent.ets
arkts
CalendarViewComponent
仅用于项目调试,单独使用可删除代码内容
@AppRouter({ name: "customcalendarpickerdialog/CalendarViewComponent" }) @Component export struct CalendarViewComponent { build() { CalendarView() } }
AST#decorated_export_declaration#Left AST#decorator#Left @ AppRouter ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "customcalendarpickerdialog/CalendarViewComponent" AST#expression#Right AST#property_assignment#Righ...
@AppRouter({ name: "customcalendarpickerdialog/CalendarViewComponent" }) @Component export struct CalendarViewComponent { build() { CalendarView() } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/FeatureComponent.ets#L22-L29
36d2ab53cfc7e0ba8fd2ecba4c80a6d784bad7a5
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets
arkts
导出单例
export const storage = new Storage();
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left storage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Storage AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left...
export const storage = new Storage();
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets#L134-L134
d729ad9a2477172d10702ce0f99d829c9da1d8c3
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinN.ets
arkts
SpinN
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinN { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.2 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0;...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinN AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinN { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.2 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0;...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinN.ets#L25-L285
955edc89f591c74db4247cdb17f38988071ca61a
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
encryptDataUseSm4
模拟使用Sm4 生成密钥并进行加密
async encryptDataUseSm4(plainText: string, resultCallback: Function): Promise<void> { let sm4KeyAlias = 'test_sm4KeyAlias'; let handle: number = 0; let generateKeyProperties: HuksProperties[] = new Array(); getSm4GenerateProperties(generateKeyProperties); let generateKeyOptions: huks.HuksOptions = {...
AST#method_declaration#Left async encryptDataUseSm4 AST#parameter_list#Left ( AST#parameter#Left plainText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCallback : AST#type_annotation#Left AST#primary_type#Left Fun...
async encryptDataUseSm4(plainText: string, resultCallback: Function): Promise<void> { let sm4KeyAlias = 'test_sm4KeyAlias'; let handle: number = 0; let generateKeyProperties: HuksProperties[] = new Array(); getSm4GenerateProperties(generateKeyProperties); let generateKeyOptions: huks.HuksOptions = {...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L376-L413
ea561c885773bf69a275d8cdd0583e9cf46d8a19
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets
arkts
setListener
设置监听器
private setListener() { let listener: speechRecognizer.RecognitionListener = { // 开始 onStart:(sessionId: string, eventMessage: string) => { console.info(TAG, `onStart sessionId: ${sessionId}, eventMessage: ${eventMessage}`) this.outputText = '' }, // 事件 onEvent(sessionI...
AST#method_declaration#Left private setListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left listener : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . Recogniti...
private setListener() { let listener: speechRecognizer.RecognitionListener = { onStart:(sessionId: string, eventMessage: string) => { console.info(TAG, `onStart sessionId: ${sessionId}, eventMessage: ${eventMessage}`) this.outputText = '' }, onEvent(sessionId: string,...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets#L146-L174
f5a4533841b5bd5b381eea7176537e66fbd813a2
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceNavigation.d.ets
arkts
Title bar types. @enum { number }. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
export declare enum TitleBarType { /** * Set title bar type with squared icon. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ SQUARED_ICON = 1, /** * Set title bar type with round icon. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum TitleBarType AST#enum_body#Left { /** * Set title bar type with squared icon. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#enum_member#Left SQUARED_ICON = AST#e...
export declare enum TitleBarType { SQUARED_ICON = 1, ROUND_ICON = 2, DRAWER = 3 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets#L483-L510
8c8fe35f2853b595624fb3a5de6bc505ef3d1a89
gitee
linwu-hi/open_neteasy_cloud.git
b562a70ffdbee5e192a1c3fb7fc8a4fb27119af4
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * The placeholder of search component. Currently, component interfaces do not support the Resource type. * Therefore, you need to define constants. The default prompt in the search box does not support * internationalization. */ static readonly SEARCH_PLACEHOLDER = 'Se...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The placeholder of search component. Currently, component interfaces do not support the Resource type. * Therefore, you need to define constants. The default prompt in the search box does not support ...
export class CommonConstants { static readonly SEARCH_PLACEHOLDER = 'Search...'; static readonly SEARCH_FONT_FAMILY = 'serif'; static readonly SEARCH_WEIGHT: number = 10; static readonly INDEX_PAGE = 'pages/IndexPage'; static readonly DETAIL_PAGE = 'pages/DetailPage'; static readonly K...
https://github.com/linwu-hi/open_neteasy_cloud.git/blob/b562a70ffdbee5e192a1c3fb7fc8a4fb27119af4/entry/src/main/ets/common/constants/CommonConstants.ets#L4-L120
bc87c12b1a04d6c4927acb74a73a3d793ca3493d
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/Index.ets
arkts
CommonConstants
公共常量
export { CommonConstants } from './src/main/ets/constants/CommonContants';
AST#export_declaration#Left export { CommonConstants } from './src/main/ets/constants/CommonContants' ; AST#export_declaration#Right
export { CommonConstants } from './src/main/ets/constants/CommonContants';
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/Index.ets#L17-L17
5a6ce1c47dcd40f8a6471d77e23fdfddef63d934
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/components/FilterComponent.ets
arkts
场地信息集合
build() { Column() { Row() { Row() { Text($r('app.string.multiple_screening_filter_component_national')) .fontSize($r('app.integer.multiple_screening_filter_component_filter_text')) Image($r('app.media.multiple_screening_ic_public_spinner')) .width($r('app.i...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_...
build() { Column() { Row() { Row() { Text($r('app.string.multiple_screening_filter_component_national')) .fontSize($r('app.integer.multiple_screening_filter_component_filter_text')) Image($r('app.media.multiple_screening_ic_public_spinner')) .width($r('app.i...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/components/FilterComponent.ets#L59-L111
0604c50372ad4b861468c2a0eb1c44758d179472
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/pages/inform.ets
arkts
deleteAllNotifications
一键删除
private deleteAllNotifications() { this.notifications = []; this.unreadCount = 0; CommonVariable.unreadCount=this.unreadCount; }
AST#method_declaration#Left private deleteAllNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifications AST#m...
private deleteAllNotifications() { this.notifications = []; this.unreadCount = 0; CommonVariable.unreadCount=this.unreadCount; }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/inform.ets#L197-L201
ece80781be74a852287c907165bcff7ab7feb9f5
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/cache/MemoryLruCache.ets
arkts
remove
移除键为key的缓存
remove(key: string): ImageKnifeData | undefined { if (key == null) { throw new Error('key is null,checking the parameter'); } let remove: ImageKnifeData | undefined = this.lruCache.remove(key) if (remove !== undefined) { this.removeMemorySize(remove) } return remove }
AST#method_declaration#Left remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ImageKnifeData ...
remove(key: string): ImageKnifeData | undefined { if (key == null) { throw new Error('key is null,checking the parameter'); } let remove: ImageKnifeData | undefined = this.lruCache.remove(key) if (remove !== undefined) { this.removeMemorySize(remove) } return remove }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/cache/MemoryLruCache.ets#L71-L81
146d216815ee109dfede1e2236a57a1d6aa15593
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets
arkts
animateX
Animates values along the X axis, in a linear fashion. @param durationMillis animation duration
public animateX(durationMillis: number) { animateX(durationMillis, Easing.Linear); }
AST#method_declaration#Left public animateX AST#parameter_list#Left ( AST#parameter#Left durationMillis : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_stateme...
public animateX(durationMillis: number) { animateX(durationMillis, Easing.Linear); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L50-L52
4cf7f2985a1c1dd55330c65f39eff6a84a897ce7
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/DistributeDraw/entry/src/main/ets/entryability/EntryAbility.ets
arkts
checkPermissions
Check the permission status.
async function checkPermissions(context: common.UIAbilityContext) { let grantStatus: abilityAccessCtrl.GrantStatus = await checkAccessToken(); if (grantStatus !== abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { // Applying for the distributed data synchronization permission. let atManager: abilityAccess...
AST#function_declaration#Left async function checkPermissions 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#parame...
async function checkPermissions(context: common.UIAbilityContext) { let grantStatus: abilityAccessCtrl.GrantStatus = await checkAccessToken(); if (grantStatus !== abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); atMana...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/entryability/EntryAbility.ets#L85-L107
0e6d10d8fcf291667e382907a001eea58aa30cb7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard2x2.ets
arkts
getTextColor
获取文本颜色
private getTextColor(): ResourceColor { if (this.widgetData.isToday) { return '#FF5722'; // 今天生日使用醒目颜色 } else if (this.widgetData.isTomorrow) { return '#2196F3'; // 明天生日使用蓝色 } return $r('app.color.text_primary'); }
AST#method_declaration#Left private getTextColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_ex...
private getTextColor(): ResourceColor { if (this.widgetData.isToday) { return '#FF5722'; } else if (this.widgetData.isTomorrow) { return '#2196F3'; } return $r('app.color.text_primary'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x2.ets#L158-L165
396860065590118f1ce70d42555499fcf5fce335
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
judgeHasNet
判断当前网络是否可用 使用网络前,例如打开一个应用时,需要检查当前连接的网络是否可用。 如果可用,则正常进行网络请求;如果不可用,则需要提示用户网络不可用。 @returns 当前网络是否可用
judgeHasNet(): boolean { try { let netHandle = connection.getDefaultNetSync(); if (!netHandle || netHandle.netId === 0) { return false; } let netCapability = connection.getNetCapabilitiesSync(netHandle); let cap = netCapability.networkCap || []; if (cap.includes(connectio...
AST#method_declaration#Left judgeHasNet 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AS...
judgeHasNet(): boolean { try { let netHandle = connection.getDefaultNetSync(); if (!netHandle || netHandle.netId === 0) { return false; } let netCapability = connection.getNetCapabilitiesSync(netHandle); let cap = netCapability.networkCap || []; if (cap.includes(connectio...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L161-L182
394931c8629905d1687f8cce775e303a75412952
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/myHsp/src/main/ets/utils/Calc.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 function add(a: number, b: number) { return a + b; }
AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Lef...
export function add(a: number, b: number) { return a + b; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/myHsp/src/main/ets/utils/Calc.ets#L16-L18
ee4799795f5f66527e471f8670ecabd0cb6fe4bf
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildRoleDelete.ets
arkts
Emitted whenever a guild role is deleted. @event Client#roleDelete @param {Role} role The role that was deleted
export default GuildRoleDeleteAction;
AST#export_declaration#Left export default AST#expression#Left GuildRoleDeleteAction AST#expression#Right ; AST#export_declaration#Right
export default GuildRoleDeleteAction;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildRoleDelete.ets#L63-L63
51d41aab2767f2e48013246d56df300e6b56bf94
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets
arkts
Declare OperateItem @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare OperateItem @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export declare class OperateItem { /** * Sets the icon. * @type { ?OperateIcon } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the icon. * @type { ?OperateIcon } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class OperateItem AST#class_body#Left { /** * Sets the icon. * @type { ?OperateIcon } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the icon. * @type { ?Operate...
export declare class OperateItem { icon?: OperateIcon; subIcon?: OperateIcon; button?: OperateButton; switch?: OperateCheck; checkbox?: OperateCheck; radio?: OperateCheck; image?: ResourceStr; text?: Resource...
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L333-L460
d52d368ef4de31b2d2f5d425ae26fc928dedb962
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets
arkts
getRemainInterval
获取剩余时间
getRemainInterval(): number { return this.remainMs; }
AST#method_declaration#Left getRemainInterval 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#member_expres...
getRemainInterval(): number { return this.remainMs; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L128-L130
c8ed14cc3d435bb78d8937c0943e33414cf66f0d
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageReactionRemove.ets
arkts
handle
需要根据实际类型替换any 应用约束48:类的实例方法中可以使用this
handle(packet: any): void { // 需要根据实际类型替换any const client = this.packetManager.client; const data = packet.d; client.actions.MessageReactionRemove.handle(data); }
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#typ...
handle(packet: any): void { const client = this.packetManager.client; const data = packet.d; client.actions.MessageReactionRemove.handle(data); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageReactionRemove.ets#L11-L15
0a4e67354c9a98f8daefbeffd42d70e4d62f8499
github
fengcreate/harmony-document
798534b0f76399dc84e7940f5b14b3ae4e53c6a9
BackupRestore/entry/src/main/ets/restore/fileMigrate/FileTransferManager.ets
arkts
moveFiles
Move files from the original backup and recovery path to the directory specified in the application's sandbox path. @param context context. @return success return true, failed return false.
private moveFiles(context: common.Context): boolean { try { let cePathPrefix: string = '/data/storage/el2/backup/restore/com.example.backuprestore/ce'; let sourceFilePath: string = cePathPrefix + '/files/sourceFiles'; if (!fileIo.accessSync(sourceFilePath)) { hilog.error(0x0000, 'BackupRes...
AST#method_declaration#Left private moveFiles AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type...
private moveFiles(context: common.Context): boolean { try { let cePathPrefix: string = '/data/storage/el2/backup/restore/com.example.backuprestore/ce'; let sourceFilePath: string = cePathPrefix + '/files/sourceFiles'; if (!fileIo.accessSync(sourceFilePath)) { hilog.error(0x0000, 'BackupRes...
https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/fileMigrate/FileTransferManager.ets#L43-L76
0ce473a466cb87660a6b0971fd05c0f65dd9f9f7
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageDelete.ets
arkts
构造函数参数类型标注(规则45)
constructor(client: any) { super(client); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left client : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Lef...
constructor(client: any) { super(client); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageDelete.ets#L17-L19
1a0b3732dce133a9d052ec33b883183b98233028
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/ColumnAttribute.ets
arkts
获取纵向两端分布 + 水平居中的 Column 对齐修饰器 @returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器 @example Column() { Text("A"); Text("B"); }.attributeModifier(columnSpaceBetween());
export function columnSpaceBetween(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.SpaceBetween); instance.alignItems(HorizontalAlign.Center); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function columnSpaceBetween AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnAttrib...
export function columnSpaceBetween(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.SpaceBetween); instance.alignItems(HorizontalAlign.Center); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L57-L64
2a96e47673980686a45613b88ae32cc2e8d420e4
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/path_sensitive/loop_stmt/while_body_002_F.ets
arkts
Introduction 循环结构-body语句 Level 3
export function while_body_002_F(taint_src : string) { let i = 0 let res = "" while (i < 0) { res = taint_src i++ } taint.Sink(res) }
AST#export_declaration#Left export AST#function_declaration#Left function while_body_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Le...
export function while_body_002_F(taint_src : string) { let i = 0 let res = "" while (i < 0) { res = taint_src i++ } taint.Sink(res) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/loop_stmt/while_body_002_F.ets#L8-L16
2cbb76c45981fd3a35deb94c5d47d9e7ae7278c6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
rightThumbUpdate
更新右边滑块位置
rightThumbUpdate(deltaX: number) { let deltaPx = deltaX; // 右边距 if (deltaPx >= 0 && ((this.rightThumbRect[2] + deltaPx) >= this.componentMaxWidth - this.rightPadding)) { deltaPx = this.componentMaxWidth - this.rightPadding - this.rightThumbRect[2]; } // 左边距 if (deltaPx <= 0 && ((this.right...
AST#method_declaration#Left rightThumbUpdate AST#parameter_list#Left ( AST#parameter#Left deltaX : 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#variable_declaration#...
rightThumbUpdate(deltaX: number) { let deltaPx = deltaX; if (deltaPx >= 0 && ((this.rightThumbRect[2] + deltaPx) >= this.componentMaxWidth - this.rightPadding)) { deltaPx = this.componentMaxWidth - this.rightPadding - this.rightThumbRect[2]; } if (deltaPx <= 0 && ((this.rightThumbRect[0]...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets#L394-L423
33032481a1bee18474455da8b078fe9dc7997c3f
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_019_T.ets
arkts
Introduction 库函数-string_toLowerCase
export function string_lib_func_019_T(taint_src : string) { let t = taint_src.toLowerCase(); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_019_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_stateme...
export function string_lib_func_019_T(taint_src : string) { let t = taint_src.toLowerCase(); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_019_T.ets#L7-L10
0b285dd01f9428ae679fc02fd9ada4edf22156b5
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Image/entry/src/main/ets/pages/example/ImageExample022.ets
arkts
aboutToAppear
请填写一个具体的网络图片地址。
async aboutToAppear(): Promise<void> { // 提供缓存下载任务的配置选项。 let options: cacheDownload.CacheDownloadOptions = {}; try { // 进行缓存下载,资源若下载成功会被缓存到应用内存或应用沙箱目录的特定文件中。 cacheDownload.download(this.src, options); console.error(`successs to download the resource. `); } catch (err) { console.e...
AST#method_declaration#Left async aboutToAppear 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_ar...
async aboutToAppear(): Promise<void> { let options: cacheDownload.CacheDownloadOptions = {}; try { cacheDownload.download(this.src, options); console.error(`successs to download the resource. `); } catch (err) { console.error(`Failed to download the resource. err: ${JSON.string...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Image/entry/src/main/ets/pages/example/ImageExample022.ets#L26-L36
b5bc8f7d4d92599b21249fcab141867d0039f13c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
getFavoritesByType
根据类型获取收藏
getFavoritesByType(type: 'greeting' | 'gift'): Favorite[] { return this.favorites.filter(f => f.type === type); }
AST#method_declaration#Left getFavoritesByType AST#parameter_list#Left ( AST#parameter#Left type AST#parameter#Right AST#ERROR#Left : 'greeting' | 'gift' AST#ERROR#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Favorite [ ] AST#array_type#Right AST#primary_type#Rig...
getFavoritesByType(type: 'greeting' | 'gift'): Favorite[] { return this.favorites.filter(f => f.type === type); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L102-L104
84e597172ed580a55aa449c9d420ba0526f485eb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/watermark/src/main/ets/utils/WaterMarkModel.ets
arkts
addImageWaterMark
图片添加水印。通过OffscreenCanvas绘制水印,并生成一个新的pixelMap对象进行保存 @param {image.PixelMap} pixelMap - 原图pixelMap数据 @param {Size} imageInfo - 图片尺寸 @param {TextModify} textModify - 水印文本属性 @returns {image.PixelMap} 返回带水印pixelMap数据
async addImageWaterMark(pixelMap: image.PixelMap, imageInfo: Size, textModify: TextModify) { // TODO:知识点:通过OffscreenCanvasRenderingContext2D绘制水印 const offScreenCanvas = new OffscreenCanvas(imageInfo.width, imageInfo.height); const offScreenContext: OffscreenCanvasRenderingContext2D = offScreenCanvas.getCont...
AST#method_declaration#Left async addImageWaterMark 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#parameter#Right , AST#parameter#Left imageInfo...
async addImageWaterMark(pixelMap: image.PixelMap, imageInfo: Size, textModify: TextModify) { const offScreenCanvas = new OffscreenCanvas(imageInfo.width, imageInfo.height); const offScreenContext: OffscreenCanvasRenderingContext2D = offScreenCanvas.getContext('2d'); offScreenContext.drawImage(pixelMap,...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/utils/WaterMarkModel.ets#L31-L50
2a92d9496a296060462110d37e3c13141b50757d
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
getGuide
功能引导 弹窗(如:指定组件、指定区域 高亮显示) @returns
static getGuide(uiContext?: UIContext): GuideBuilderProxy { return new GuideBuilderProxy(uiContext) }
AST#method_declaration#Left static getGuide AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GuideBuilderPro...
static getGuide(uiContext?: UIContext): GuideBuilderProxy { return new GuideBuilderProxy(uiContext) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L165-L167
8f3b166967f207df2982d782f9f5fb6ef14cd61c
github
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/pages/StoreAppPage.ets
arkts
publishComment
发布评论
async publishComment(): Promise<void> { const parentComment = this.commentList.getParentData(this.replyId); let revPerson= new ReviewPersonModel() let replyPerson=new StoreReviewWithReply() revPerson.user_id=this.userId; revPerson.store_id=String(this.getParams.store_id); revPerson.access_token=...
AST#method_declaration#Left async publishComment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
async publishComment(): Promise<void> { const parentComment = this.commentList.getParentData(this.replyId); let revPerson= new ReviewPersonModel() let replyPerson=new StoreReviewWithReply() revPerson.user_id=this.userId; revPerson.store_id=String(this.getParams.store_id); revPerson.access_token=...
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/pages/StoreAppPage.ets#L106-L168
90fce788108072e932ce0f1b9564765b63286716
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_cbc_encryption_decryption/sm4_cbc_encryption_decryption_synchronous.ets
arkts
encryptMessage
加密消息
function encryptMessage(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('SM4_128|CBC|PKCS7'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, iv); let encryptData = cipher.doFinalSync(plainText); return encryptData; }
AST#function_declaration#Left function encryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p...
function encryptMessage(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('SM4_128|CBC|PKCS7'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, iv); let encryptData = cipher.doFinalSync(plainText); return encryptData; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_cbc_encryption_decryption/sm4_cbc_encryption_decryption_synchronous.ets#L38-L43
6642b0cd2723c33208eb6f0c129cfd6e1ab8edb9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/common/WebParamsModel.ets
arkts
subWeb入参类型
export interface IWebParams { // 网页url url: ResourceStr, // 网页title title?: string, // 内存缓存大小 memoryCacheCapacity?: number, // 硬盘缓存大小 diskCacheCapacity?: number, // 需要缓存的资源url数组,例如js、json、图片、css cacheableResourceUrls?: Array<string>, // 磁盘缓存路径 diskCachePath?: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface IWebParams AST#object_type#Left { // 网页url AST#type_member#Left url : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , // 网页title AST#type_member#Left title ? : ...
export interface IWebParams { url: ResourceStr, title?: string, memoryCacheCapacity?: number, diskCacheCapacity?: number, cacheableResourceUrls?: Array<string>, diskCachePath?: string }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/WebParamsModel.ets#L17-L35
9b7f1bdf2434acdbfca4f309acb4ced8ec523cf0
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets
arkts
CustomDialogComponent
Custom pop-up window.
@CustomDialog export default struct CustomDialogComponent { controller: CustomDialogController = new CustomDialogController({ 'builder': '' }); cancel: Function = () => { } confirm: Function = () => { } build() { Column() { Text($r('app.string.dialog_text_title')) .width(CommonConstants.D...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct CustomDialogComponent AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Ri...
@CustomDialog export default struct CustomDialogComponent { controller: CustomDialogController = new CustomDialogController({ 'builder': '' }); cancel: Function = () => { } confirm: Function = () => { } build() { Column() { Text($r('app.string.dialog_text_title')) .width(CommonConstants.D...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets#L23-L87
c5b925484479bf3af5742a75d1c6b6f5e30d11f3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/TimedReminderService.ets
arkts
scheduleReminder
调度提醒(简化实现)
private async scheduleReminder(config: ReminderConfig): Promise<boolean> { try { // 检查是否已存在相同提醒 if (this.activeReminders.has(config.id)) { await this.cancelReminder(config.id); } // 简化的提醒请求 const reminderRequest: reminderAgentManager.ReminderRequestAlarm = { reminderTy...
AST#method_declaration#Left private async scheduleReminder AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left ReminderConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ...
private async scheduleReminder(config: ReminderConfig): Promise<boolean> { try { if (this.activeReminders.has(config.id)) { await this.cancelReminder(config.id); } const reminderRequest: reminderAgentManager.ReminderRequestAlarm = { reminderType: reminderAgentManager...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L130-L161
3e23c35e0ff16ae57301d0432776e55d34ff53cd
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/ThreadCommunication/Index.ets
arkts
IndependentTask
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { IndependentTask } from './src/main/ets/pages/IndependentTask';
AST#export_declaration#Left export { IndependentTask } from './src/main/ets/pages/IndependentTask' ; AST#export_declaration#Right
export { IndependentTask } from './src/main/ets/pages/IndependentTask';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadCommunication/Index.ets#L16-L16
aee2c57c09fb4189affb2ae5a2d81e3b0a37ddf6
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
encodeGCM
加密-GCM模式 @param str 待加密的字符串 @param aesKey AES密钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64 @returns
static encodeGCM(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { //转换key let symKey = CryptoSyncUtil.convertKeyFromStr(aesKey, 'AES256', 256, keyCoding); // 初始化加解密操作环境 let mode = crypto.CryptoMode.ENCRYPT_MODE; //创建加密器 ...
AST#method_declaration#Left static encodeGCM AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static encodeGCM(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { let symKey = CryptoSyncUtil.convertKeyFromStr(aesKey, 'AES256', 256, keyCoding); let mode = crypto.CryptoMode.ENCRYPT_MODE; let cipher = crypto.createC...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L91-L112
c7ea745df4c98efa263db29614ced995ae9946a9
gitee
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/http/Api.ets
arkts
获取登录用户信息
export function info() { return instance.get('/word/user/info') }
AST#export_declaration#Left export AST#function_declaration#Left function info AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Le...
export function info() { return instance.get('/word/user/info') }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/http/Api.ets#L47-L49
cc1ea1b6180d2ea08e332d4d0870f35cdf87f218
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets
arkts
轻量级类型安全事件总线(静态方法版) 功能:事件订阅(on)、取消订阅(off)、一次性订阅(once)、事件触发(emit)
export class SimpleEventBus { // 存储常规事件监听器(事件名 => 处理器数组) private static listeners: Map<string, Function[]> = new Map(); // 存储一次性事件监听器(事件名 => 处理器数组) private static onceListeners: Map<string, Function[]> = new Map(); /** * 触发事件 * @param event 事件名称 * @param data 事件数据(泛型T,默认为void) */ static emit<T ...
AST#export_declaration#Left export AST#class_declaration#Left class SimpleEventBus AST#class_body#Left { // 存储常规事件监听器(事件名 => 处理器数组) AST#property_declaration#Left private static listeners : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#pri...
export class SimpleEventBus { private static listeners: Map<string, Function[]> = new Map(); private static onceListeners: Map<string, Function[]> = new Map(); static emit<T = void>(event: string, data?: T): void { const handlers = SimpleEventBus.listeners.get(event); handlers?.forEach(hand...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets#L5-L116
ab6f5a3053b5f494ba89785ea80cffe85df1f8d3
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/AddBill.ets
arkts
DeleteButton
删除按钮组件
@Builder DeleteButton() { Column() { Text('⌫') .fontSize(24) .fontColor('#333333') } .width('25%') .height(55) .backgroundColor('#FFFFFF') .justifyContent(FlexAlign.Center) .border({ width: { top: 1 }, color: '#D0D0D0' }) .onClick(() => { if (this.amount.len...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeleteButton AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_ele...
@Builder DeleteButton() { Column() { Text('⌫') .fontSize(24) .fontColor('#333333') } .width('25%') .height(55) .backgroundColor('#FFFFFF') .justifyContent(FlexAlign.Center) .border({ width: { top: 1 }, color: '#D0D0D0' }) .onClick(() => { if (this.amount.len...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddBill.ets#L333-L350
357f6461bb5ab4f969a6be62e64e1db6c366e965
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseDataSet.ets
arkts
getColors
###### ###### COLOR GETTING RELATED METHODS ##### ######
public getColors(): JArrayList<Number> { return this.mColors; }
AST#method_declaration#Left public getColors AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#type_...
public getColors(): JArrayList<Number> { return this.mColors; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L118-L120
e645e06477700df85126f4e28c5df37ffa0918a8
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/otherCharts/ScrollCombinedChartPage.ets
arkts
generateBubbleData
生成bubbleData
private generateBubbleData(combinedData: CombinedData): void { /** 初始化 bubbleData 对象 */ let bubbleData: BubbleData = new BubbleData(); /** 创建一个 JArrayList 对象,用于存储 BubbleEntry 类型的数据 */ let bubbleEntry: JArrayList<BubbleEntry> = new JArrayList(); /** 循环生成 1 到 count 的随机数据,并添加到 bubbleEntry 中 */ for ...
AST#method_declaration#Left private generateBubbleData AST#parameter_list#Left ( AST#parameter#Left combinedData : AST#type_annotation#Left AST#primary_type#Left CombinedData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ...
private generateBubbleData(combinedData: CombinedData): void { let bubbleData: BubbleData = new BubbleData(); let bubbleEntry: JArrayList<BubbleEntry> = new JArrayList(); for (let i = 0; i < this.count; i++) { bubbleEntry.add(new BubbleEntry(i, i * 100, 40)); } let bubbleDa...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/otherCharts/ScrollCombinedChartPage.ets#L107-L124
ccaa858bc8ebfbcf3f37ce13588157023a672766
gitee