nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
pcs/pcs_arkts_assist/entry/src/main/ets/KeyboardController.ets
arkts
onDestroy
应用生命周期销毁
public onDestroy(): void { this.unRegisterListener(); // 去注册事件监听 if(this.panel) { // 销毁窗口 inputMethodAbility.destroyPanel(this.panel); } if(this.mContext) { this.mContext.destroy(); } }
AST#method_declaration#Left public onDestroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express...
public onDestroy(): void { this.unRegisterListener(); if(this.panel) { inputMethodAbility.destroyPanel(this.panel); } if(this.mContext) { this.mContext.destroy(); } }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/pcs/pcs_arkts_assist/entry/src/main/ets/KeyboardController.ets#L23-L31
c035a746446fd2393b3acdd7e2956cf44ef9b66f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/DataManager.ets
arkts
deleteDate
从缓存的Preferences实例中删除名为给定Key的存储键值对,并使数据持久化 @param { Context } Context - 应用上下文 @param { function } callback - 回调函数
static deleteDate(context: Context, callback: () => void) { try { let promise = dataPreferences.getPreferences(context, 'date') promise.then((object: dataPreferences.Preferences) => { try { // 从缓存的Preferences实例中删除名为selectedDate的存储键值对 let deletePromise = object.delete('selecte...
AST#method_declaration#Left static deleteDate 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#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_l...
static deleteDate(context: Context, callback: () => void) { try { let promise = dataPreferences.getPreferences(context, 'date') promise.then((object: dataPreferences.Preferences) => { try { let deletePromise = object.delete('selectedDate') deletePromise.then(() => ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/DataManager.ets#L114-L143
de64aef1db96870bc3938564199dc1ac116af600
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/SoundEffect/SEManager.ets
arkts
loadSound
加载单个音效 @param type 音效类型
private async loadSound(type: SEType): Promise<boolean> { if (!this.soundPool || !this.context) { console.error('SoundPool or context not initialized'); return false; } try { // 获取资源文件描述符 let resourceManager = this.context.resourceManager; let rawFileValue = await resourceMana...
AST#method_declaration#Left private async loadSound AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left SEType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
private async loadSound(type: SEType): Promise<boolean> { if (!this.soundPool || !this.context) { console.error('SoundPool or context not initialized'); return false; } try { let resourceManager = this.context.resourceManager; let rawFileValue = await resourceManager.getRawFd...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L123-L149
9c9ba8a9be66383e47c472918bcb927969a17847
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/components/SwipeCardStack.ets
arkts
addCards
添加新的卡片数据 @param newCards - 新的卡片数据数组
public addCards(newCards: object[]): void { if (newCards.length === 0) { return; } // 添加新卡片到数组末尾 - ArkTS规范:手动循环替代扩展运算符 for (let i = 0; i < newCards.length; i++) { this.cardDataList.push(newCards[i]); } }
AST#method_declaration#Left public addCards AST#parameter_list#Left ( AST#parameter#Left newCards : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left object [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef...
public addCards(newCards: object[]): void { if (newCards.length === 0) { return; } for (let i = 0; i < newCards.length; i++) { this.cardDataList.push(newCards[i]); } }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L72-L81
72a9eefe94cbd42715eae5e5649604acaffd6175
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/main/sub/report/GraphInfoPanel.ets
arkts
小数点后几位,如:12.5%, 会自动四舍五入
build() { Column({ space: 10 }) { // up "概况" Text(this.title) .fontSize(16) .fontColor(this.titleColor) .margin({top: 10, left: 10}) // mid 主面板 Column() { // 圆环图 CircleView({ parts: this.parts, allCount: this.allCount, ...
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(this.title) .fontSize(16) .fontColor(this.titleColor) .margin({top: 10, left: 10}) Column() { CircleView({ parts: this.parts, allCount: this.allCount, ringWidth: 28, ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/GraphInfoPanel.ets#L15-L70
7fa8b5e2dfca7229f16b9618474d009e3fbeb9cd
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/device/OnKey.ets
arkts
OnKey
[Start listen_response_key_event]
@Entry @Component export struct OnKey { @State buttonText: string = ''; @State buttonType: string = ''; @State columnText: string = ''; @State columnType: string = ''; build() { NavDestination() { Column({ space: 12 }) { Column() { Button('onKeyEvent') .defaultFocus(t...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct OnKey AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right buttonText : AST#type_annotation#Left AST#primary_type#Left s...
@Entry @Component export struct OnKey { @State buttonText: string = ''; @State buttonType: string = ''; @State columnText: string = ''; @State columnType: string = ''; build() { NavDestination() { Column({ space: 12 }) { Column() { Button('onKeyEvent') .defaultFocus(t...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/device/OnKey.ets#L17-L77
826e17053658d95e1dc73ff525c526db4a658f6f
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/widget/ToolBarComponent.ets
arkts
ToolBarComponent
底部工具栏组件 提供画板颜色选择、马赛克尺寸选择、裁剪框旋转、文本颜色选择功能
@ComponentV2 export struct ToolBarComponent { @Param @Require selectedFunctionType: ImageEditFunctionType = ImageEditFunctionType.PALETTE; @Param @Require functionTypes: Array<ImageEditFunctionType> = []; @Param @Require actions: ToolbarActions; build() { Stack({ alignContent: Alignment.Center }) { F...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ToolBarComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right selectedFunctionType : AST#type_annotation#Lef...
@ComponentV2 export struct ToolBarComponent { @Param @Require selectedFunctionType: ImageEditFunctionType = ImageEditFunctionType.PALETTE; @Param @Require functionTypes: Array<ImageEditFunctionType> = []; @Param @Require actions: ToolbarActions; build() { Stack({ alignContent: Alignment.Center }) { F...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/widget/ToolBarComponent.ets#L54-L138
d99cd4e5301dd2f37d2b01218ea4564875d77372
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/special_expression/optional_chaining_operator_002_F.ets
arkts
Introduction 可选链操作符
export function optional_chaining_operator_002_F(taint_src : string) { let _t = taint_src; let a = new A("_"); taint.Sink(a?.data); }
AST#export_declaration#Left export AST#function_declaration#Left function optional_chaining_operator_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#bl...
export function optional_chaining_operator_002_F(taint_src : string) { let _t = taint_src; let a = new A("_"); taint.Sink(a?.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/optional_chaining_operator_002_F.ets#L6-L10
5e663d5a6217193f07d452ade9e164c20d1b87d7
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets
arkts
addSpecifyIndexData
插入指定位置数据
public addSpecifyIndexData(index: number, data: T): void { if (index < 0 || index > this.originDataArray.length) { throw new Error("Index out of bounds"); } this.originDataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addSpecifyIndexData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_...
public addSpecifyIndexData(index: number, data: T): void { if (index < 0 || index > this.originDataArray.length) { throw new Error("Index out of bounds"); } this.originDataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L31-L37
a880b67bca1f7107215b778a13fc980f586ac8cb
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets
arkts
checkFruitData
Verifies that the data entered is not empty. @param fruit Fruit data.
checkFruitData(fruit: Fruit) { if (fruit.fruitName === '' || fruit.fruitNum === '') { this.showToastMessage($r('app.string.fruit_input_null_msg')); return true; } return false; }
AST#method_declaration#Left checkFruitData AST#parameter_list#Left ( AST#parameter#Left fruit : AST#type_annotation#Left AST#primary_type#Left Fruit AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AS...
checkFruitData(fruit: Fruit) { if (fruit.fruitName === '' || fruit.fruitNum === '') { this.showToastMessage($r('app.string.fruit_input_null_msg')); return true; } return false; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L112-L118
76b2c77861aba22062f0a61d2afb3299f574072d
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DisplayUtil.ets
arkts
getDefaultDisplaySync
获取当前默认的display对象。 @returns
static getDefaultDisplaySync(): display.Display { return display.getDefaultDisplaySync() }
AST#method_declaration#Left static getDefaultDisplaySync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Display AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left...
static getDefaultDisplaySync(): display.Display { return display.getDefaultDisplaySync() }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L32-L34
f7a6c171b8e2477a3a81462cd494e8cac7d7e669
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
getBoolean
获取布尔值 @param key 键 @param defaultValue 默认值 @returns 布尔值
async getBoolean(key: string, defaultValue: boolean = false): Promise<boolean> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as boolean; } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `F...
AST#method_declaration#Left async getBoolean 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 defaultValue : AST#type_annotation#Left AST#primary_type#Left boolean AST#primar...
async getBoolean(key: string, defaultValue: boolean = false): Promise<boolean> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as boolean; } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `F...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L150-L159
932788eb8517abad333edf5643107c3935c6f4f6
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/AI/AICharacterRecognition/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * The size of arraybuffer size. */ static readonly ARRAYBUFFER_SIZE: number = 4069; /** * The device outputs the sequence number. */ static readonly OUTPUT_DEVICE_INDEX: number = 5; /** * The device inputs the sequence number. */ static readonly I...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The size of arraybuffer size. */ AST#property_declaration#Left static readonly ARRAYBUFFER_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation...
export default class CommonConstants { static readonly ARRAYBUFFER_SIZE: number = 4069; static readonly OUTPUT_DEVICE_INDEX: number = 5; static readonly INPUT_DEVICE_INDEX: number = 0; static readonly IMAGE_RECEIVER_WIDTH: number = 640; static readonly IMAGE_RECEIVER_HEIGHT: number = 480; ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/AI/AICharacterRecognition/entry/src/main/ets/common/constants/CommonConstants.ets#L18-L91
a860a9b70e8a376e3a8b4048a21a694599b69d51
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/TokenStoreRepository.ets
arkts
saveToken
保存 Token @param {string} token Token @returns {Promise<void>} Promise<void>
saveToken(token: string): Promise<void> { return this.dataSource.setToken(token); }
AST#method_declaration#Left saveToken AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise ...
saveToken(token: string): Promise<void> { return this.dataSource.setToken(token); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/TokenStoreRepository.ets#L26-L28
03a93f5b0cdaf7359d30a6c5ae3b3a21afe55bc5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomEmitter/feature/emitter/src/main/ets/components/feature/CustomEmitter.ets
arkts
clearListenerCounts
取消订阅购买事件后将购买事件订阅者数量结果返回
public clearListenerCounts(callback: (counts: number) => void) { emitter.off(EmitterConst.BUY_EVENT_ID); callback(emitter.getListenerCount(EmitterConst.BUY_EVENT_ID)); }
AST#method_declaration#Left public clearListenerCounts AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left counts : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#...
public clearListenerCounts(callback: (counts: number) => void) { emitter.off(EmitterConst.BUY_EVENT_ID); callback(emitter.getListenerCount(EmitterConst.BUY_EVENT_ID)); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomEmitter/feature/emitter/src/main/ets/components/feature/CustomEmitter.ets#L120-L123
98651b12218641213af350195c15d1c67230de15
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/BackgroundTaskManagement/ReminderAgentManager/entry/src/main/ets/util/TimeConversion.ets
arkts
dateToMillisecond
Converts the time units obtained in the date selection component to milliseconds
dateToMillisecond(year: number, month: number, day: number, hour: number, minute: number) { let nowTime: Date = new Date let nowAllTime: number = nowTime.getFullYear() * YEAR_SECONDS + (nowTime.getMonth() + 1) * MONTH_SECONDS + nowTime.getDate() * DAY_SECONDS + nowTime.getHours() * HOUR_SECONDS + nowTime.ge...
AST#method_declaration#Left dateToMillisecond AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
dateToMillisecond(year: number, month: number, day: number, hour: number, minute: number) { let nowTime: Date = new Date let nowAllTime: number = nowTime.getFullYear() * YEAR_SECONDS + (nowTime.getMonth() + 1) * MONTH_SECONDS + nowTime.getDate() * DAY_SECONDS + nowTime.getHours() * HOUR_SECONDS + nowTime.ge...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/BackgroundTaskManagement/ReminderAgentManager/entry/src/main/ets/util/TimeConversion.ets#L39-L49
c73d73af45ea5295713c0a2268419ae44279d4e4
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets
arkts
animateXY
Animates values along both the X and Y axes. @param durationMillisX animation duration along the X axis @param durationMillisY animation duration along the Y axis @param easingX EasingFunction for the X axis @param easingY EasingFunction for the Y axis
public animateXY(durationMillisX: number, durationMillisY: number, easingX: EasingFunction, easingY: EasingFunction) { let xAnimator = xAnimator(durationMillisX, easingX); let yAnimator = yAnimator(durationMillisY, easingY); if (durationMillisX > durationMillisY) { xAnimator.addUpdateListener(mListen...
AST#method_declaration#Left public animateXY AST#parameter_list#Left ( AST#parameter#Left durationMillisX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left durationMillisY : AST#type_annotation#Left AST#primary_type#Left num...
public animateXY(durationMillisX: number, durationMillisY: number, easingX: EasingFunction, easingY: EasingFunction) { let xAnimator = xAnimator(durationMillisX, easingX); let yAnimator = yAnimator(durationMillisY, easingY); if (durationMillisX > durationMillisY) { xAnimator.addUpdateListener(mListen...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L109-L121
46617de9a9380a8df334eb7d90ded71930b9e094
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/MD5.ets
arkts
hex_md5
These are the functions you'll usually want to call They take string arguments and return either hex or base-64 encoded strings
hex_md5(s: string): string { return this.rstr2hex(this.rstr_md5(this.str2rstr_utf8(s))); }
AST#method_declaration#Left hex_md5 AST#parameter_list#Left ( AST#parameter#Left s : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#ty...
hex_md5(s: string): string { return this.rstr2hex(this.rstr_md5(this.str2rstr_utf8(s))); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/MD5.ets#L83-L85
f7f1d59f451cdfd45c1b01f37e4566e4b0b7c1d6
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/utils/navigationList.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 interface NavListItem { name: string; path: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NavListItem AST#object_type#Left { AST#type_member#Left name : 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 path : AST#type_annotation#Left A...
export interface NavListItem { name: string; path: string; }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/utils/navigationList.ets#L16-L19
96e2f7c720cec14f516f31b40665984be590cacb
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets
arkts
VideoPlayer
[Start video_player]
@Component export struct VideoPlayer{ private controller:VideoController | undefined; @State videoSrc: string= 'https://www.example.com/example.mp4' //Please replace it with the actual video loading URL when using it. build(){ Column() { Video({ src: this.videoSrc, controller: this.contr...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoPlayer AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left VideoController AST#primary_type#Right | AST#primary_type#Lef...
@Component export struct VideoPlayer{ private controller:VideoController | undefined; @State videoSrc: string= 'https://www.example.com/example.mp4' build(){ Column() { Video({ src: this.videoSrc, controller: this.controller }) } } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L363-L375
30e8d99862517bd1684e5f64519eee5ea5472a7c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
LunarCalendar_Fixed.ets
arkts
verify2025TotalDays
🔧 验证2025年总天数
public static verify2025TotalDays(): boolean { const monthDays = AccurateLunarMonthDays.data2025; const leapDays = AccurateLunarMonthDays.getLeapMonthDays(2025); const total = monthDays.reduce((sum, days) => sum + days, 0) + leapDays; console.log(`2025年农历月份天数验证:`); console.log(`正月到腊月总天数: ${mont...
AST#method_declaration#Left public static verify2025TotalDays 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#variable_declaration#Left const AST#variable_decl...
public static verify2025TotalDays(): boolean { const monthDays = AccurateLunarMonthDays.data2025; const leapDays = AccurateLunarMonthDays.getLeapMonthDays(2025); const total = monthDays.reduce((sum, days) => sum + days, 0) + leapDays; console.log(`2025年农历月份天数验证:`); console.log(`正月到腊月总天数: ${mont...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L185-L198
bb65f4fadbeeb68ab406e90b7636d12b615efeed
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
getSearchKeywordList
查询搜索关键词列表 @returns 搜索关键词列表
async getSearchKeywordList(): Promise<NetworkResponse<GoodsSearchKeyword[]>> { return this.networkDataSource.getSearchKeywordList(); }
AST#method_declaration#Left async getSearchKeywordList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Lef...
async getSearchKeywordList(): Promise<NetworkResponse<GoodsSearchKeyword[]>> { return this.networkDataSource.getSearchKeywordList(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/GoodsRepository.ets#L55-L57
3a51aa60b128891dec08dd626e75fc552af737a1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets
arkts
changeFavoriteCount
点击收藏按钮的回调函数
private changeFavoriteCount() { if (!this.isFavorite) { this.favoriteCount++; } else { this.favoriteCount--; } animateTo({ duration: CONFIGURATION.TABCONTENT_OVERFLOW_DURATION, curve: Curve.EaseInOut }, () => { this.isFavorite = !this.isFavorite; }) }
AST#method_declaration#Left private changeFavoriteCount AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Rig...
private changeFavoriteCount() { if (!this.isFavorite) { this.favoriteCount++; } else { this.favoriteCount--; } animateTo({ duration: CONFIGURATION.TABCONTENT_OVERFLOW_DURATION, curve: Curve.EaseInOut }, () => { this.isFavorite = !this.isFavorite; }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets#L44-L53
2c3e5641374312d368ca7cae3aae59b20a364c74
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
getTextSize
returns the text size that is currently set for the labels, in pixels @return
public getTextSize(): number { return this.mTextSize; }
AST#method_declaration#Left public getTextSize 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_expre...
public getTextSize(): number { return this.mTextSize; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L135-L137
c33b65c3adcb213ae4e37a70d742f54975fa68ac
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onDestroy
Ability销毁时的回调
onDestroy(): void { console.log('[EntryAbility] Ability onDestroy'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onDestroy'); // 清理资源 this.cleanupServices(); }
AST#method_declaration#Left onDestroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Lef...
onDestroy(): void { console.log('[EntryAbility] Ability onDestroy'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onDestroy'); this.cleanupServices(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L33-L39
d456136f9f6510901ad3bf64992137f0409db8df
github
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/common/AliYunTaskPollingUtil.ets
arkts
delay
延迟执行 @param ms 延迟毫秒数
private static delay(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
AST#method_declaration#Left private static delay AST#parameter_list#Left ( AST#parameter#Left ms : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
private static delay(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/AliYunTaskPollingUtil.ets#L117-L119
d9085debd7f132ee9cd96f17bf5586a9a666d97f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets
arkts
TitleExpansion
功能描述: 1. 标题栏跟随手势产生移动、放缩以及显隐动效 2. 菜单栏跟随手势产生移动动效 3. 手势松开后,标题栏、菜单栏可以跳转或回弹至对应位置 实现原理: 1. 标题高度变化,通过状态变量heightValue控制,通过onScrollFrameBegin获取list偏移,并将其分配给标题高度变化和实际list偏移 2. 标题展开继续下拉偏移,通过状态变量curOffset控制,通过onDidScroll获取标题展开后,标题继续下拉的偏移 3. 滚动停止动画,通过onScrollStop获取滚动停止时的标题高度。当标题高度大于阈值时,产生展开标题动画;相反,则产生收缩标题动画 @param {TitleAttribute...
@Component export struct TitleExpansion { // 主标题属性 titleAttribute: TitleAttribute = new TitleAttribute(Constants.MEMO_TITLE, new TitleAttributeModifier()); // 子标题属性 subTitleAttribute: TitleAttribute = new TitleAttribute(Constants.MEMO_SUB_TITLE, new SubTitleAttributeModifier()); // 主标题及子标题位置 titlePosition: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleExpansion AST#component_body#Left { // 主标题属性 AST#property_declaration#Left titleAttribute : AST#type_annotation#Left AST#primary_type#Left TitleAttribute AST#primary_type#Right AST#type_annotation#Right = AST#exp...
@Component export struct TitleExpansion { titleAttribute: TitleAttribute = new TitleAttribute(Constants.MEMO_TITLE, new TitleAttributeModifier()); subTitleAttribute: TitleAttribute = new TitleAttribute(Constants.MEMO_SUB_TITLE, new SubTitleAttributeModifier()); titlePosition: HorizontalAlign = Horizontal...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets#L39-L250
3de35761c93c04979ab4b6010a19f8db3958388e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/model/AttributeModifier.ets
arkts
applyNormalAttribute
定义组件普通状态时的样式 @param instance
applyNormalAttribute(instance: GridItemAttribute): void { instance.translate({ x: this.offsetX, y: this.offsetY }); instance.opacity(this.opacity); }
AST#method_declaration#Left applyNormalAttribute AST#parameter_list#Left ( AST#parameter#Left instance : AST#type_annotation#Left AST#primary_type#Left GridItemAttribute AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void ...
applyNormalAttribute(instance: GridItemAttribute): void { instance.translate({ x: this.offsetX, y: this.offsetY }); instance.opacity(this.opacity); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/AttributeModifier.ets#L31-L34
ca118e55f86df3f9af350277ee48d59cf0113569
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/smartfill/src/main/ets/components/Address.ets
arkts
Address
地址类
@Observed export class Address { name?: string; phone?: string; address?: string; detailAddress?: string; constructor(name: string, phone: string, address: string, detailAddress: string) { this.name = name; this.phone = phone; this.address = address; this.detailAddress = detailAddress; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class Address AST#class_body#Left { AST#property_declaration#Left name ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_d...
@Observed export class Address { name?: string; phone?: string; address?: string; detailAddress?: string; constructor(name: string, phone: string, address: string, detailAddress: string) { this.name = name; this.phone = phone; this.address = address; this.detailAddress = detailAddress; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/smartfill/src/main/ets/components/Address.ets#L19-L32
f36c30a3ec268f7161c739a2d411b5ac1d21987c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
scheduleBirthdayReminder
为特定生日创建定时提醒
public async scheduleBirthdayReminder(contact: Contact, reminderDate: Date, reminderTime: string): Promise<boolean> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Scheduling birthday reminder for ${contact.name} at ${reminderTime}`); // 解析提醒时间 con...
AST#method_declaration#Left public async scheduleBirthdayReminder AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reminderDate : AST#type_annotation#Left AST#primary_ty...
public async scheduleBirthdayReminder(contact: Contact, reminderDate: Date, reminderTime: string): Promise<boolean> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Scheduling birthday reminder for ${contact.name} at ${reminderTime}`); const timePa...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L271-L317
93e2018600ed28d75812bf9f901befc115e01d08
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/entryability/EntryAbility.ets
arkts
日志标签
export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(DOMAIN, 'testTag', `%{public}s`, 'Ability onCreate'); } onDestroy(): void { hilog.info(DOMAIN, 'testTag', `%{public}s`, 'Ability onDestroy'); } onWindowStageCreate(...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#ty...
export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(DOMAIN, 'testTag', `%{public}s`, 'Ability onCreate'); } onDestroy(): void { hilog.info(DOMAIN, 'testTag', `%{public}s`, 'Ability onDestroy'); } onWindowStageCreate(...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/entryability/EntryAbility.ets#L23-L61
497d1b6dd8b3a29b74cdfdf67b975a4d40b98a7c
gitee
Million-mo/tree-sitter-arkts.git
2fd0ad75e2d848709edcf4be038f27b178114ef6
examples/decorators_complete.ets
arkts
concurrentTask
============================================ 其他装饰器 ============================================ @Concurrent - 并发函数标记(用于TaskPool)
@Concurrent function concurrentTask(data: string): string { return data.toUpperCase(); }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function concurrentTask AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ...
@Concurrent function concurrentTask(data: string): string { return data.toUpperCase(); }
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/decorators_complete.ets#L196-L199
735b27f49ccb98c443bec936d552cea90e102c95
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/types/SwipeCardTypes.ets
arkts
卡片状态枚举
export const enum CardState { IDLE = 'idle', DRAGGING = 'dragging', SWIPING = 'swiping', ANIMATING = 'animating' }
AST#export_declaration#Left export AST#enum_declaration#Left const enum CardState AST#enum_body#Left { AST#enum_member#Left IDLE = AST#expression#Left 'idle' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DRAGGING = AST#expression#Left 'dragging' AST#expression#Right AST#enum_member#Right , AST#enum_...
export const enum CardState { IDLE = 'idle', DRAGGING = 'dragging', SWIPING = 'swiping', ANIMATING = 'animating' }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L24-L29
79fe94ad18abce369f2fcb42323e86cdebba5602
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/FloatingButton.ets
arkts
[EndExclude floating_button]
build() { // [StartExclude floating_button] NavDestination() { // [EndExclude floating_button] Stack() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number) => { ListItem() { Text(`${item}`) .width('100%') ...
AST#build_method#Left build ( ) AST#build_body#Left { // [StartExclude floating_button] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { // [EndExclude floating_button] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST...
build() { NavDestination() { Stack() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number) => { ListItem() { Text(`${item}`) .width('100%') .height(100) .fontSize(16) .te...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/FloatingButton.ets#L29-L81
eb845278de4f091efeb454cb03ee52041e4c7b17
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/utils/TimerUtil.ets
arkts
1s
export declare type Observer = (count: number) => void;
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type Observer = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ...
export declare type Observer = (count: number) => void;
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/utils/TimerUtil.ets#L23-L23
3a04cb78e54ce0f6168fb1a88a49cf84577c56bb
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
common/index.ets
arkts
CheckingDots
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { CheckingDots } from './src/main/ets/component/CheckingDots';
AST#export_declaration#Left export { CheckingDots } from './src/main/ets/component/CheckingDots' ; AST#export_declaration#Right
export { CheckingDots } from './src/main/ets/component/CheckingDots';
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/index.ets#L16-L16
345a57982d9f27e8378fb6e1a867ba839d62a7af
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/HttpsRequestDemo/entry/src/main/ets/pages/Index.ets
arkts
copyCaFile2Sandisk
复制ca文件到沙箱路径
async copyCaFile2Sandisk() { let context = getContext(this) let segments = this.caFileUri.split('/') //文件名称 let fileName = segments[segments.length-1] //计划复制到的目标路径 this.caFileSandPath = context.cacheDir + "/" + fileName //复制选择的文件到沙箱cache文件夹 try { let file = await fs.open(this.caF...
AST#method_declaration#Left async copyCaFile2Sandisk AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Righ...
async copyCaFile2Sandisk() { let context = getContext(this) let segments = this.caFileUri.split('/') let fileName = segments[segments.length-1] this.caFileSandPath = context.cacheDir + "/" + fileName try { let file = await fs.open(this.caFileUri); fs.copyFileSync(file.fd...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpsRequestDemo/entry/src/main/ets/pages/Index.ets#L131-L148
c1271f92da1445b8783493fd4bee6230e932c16c
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets
arkts
getDataSetCount
ONLY GETTERS AND SETTERS BELOW THIS returns the number of LineDataSets this object contains @return
public getDataSetCount(): number { if (this.mDataSets == null) { return 0; } return this.mDataSets.listSize; }
AST#method_declaration#Left public getDataSetCount 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#if_statement#Left if ( AST#expression#Left AST#binary_express...
public getDataSetCount(): number { if (this.mDataSets == null) { return 0; } return this.mDataSets.listSize; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L189-L195
9bbf469db376677af36f98dd3bea817a53390730
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/utils/Utils.ets
arkts
格式化日期的函数
export function dateFormat(date: Date) { return date.getFullYear() + YEAR + padTo2Digits(date.getMonth() + 1) + MONTH + padTo2Digits(date.getDate()) + DAY; }
AST#export_declaration#Left export AST#function_declaration#Left function dateFormat AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#stat...
export function dateFormat(date: Date) { return date.getFullYear() + YEAR + padTo2Digits(date.getMonth() + 1) + MONTH + padTo2Digits(date.getDate()) + DAY; }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/utils/Utils.ets#L27-L29
818e4f8e0ce94a4846425f9512e635f13ab69e4a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
isWeekend
判断指定的日期在日历中是否为周末 @param date @returns
static isWeekend(date?: number | string | Date) { const day = DateUtil.getFormatDate(date).getDay(); //getDay() 方法返回值:0(周日) 到 6(周六) return day === 0 || day === 6; //周六(6)或周日(0)都视为周末 }
AST#method_declaration#Left static isWeekend AST#parameter_list#Left ( AST#parameter#Left date ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Rig...
static isWeekend(date?: number | string | Date) { const day = DateUtil.getFormatDate(date).getDay(); return day === 0 || day === 6; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L229-L232
9b419bd1568453155e61b8bd6c87c5efe386a0ed
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/dialog/params/ResourceColor.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export const backgroundColorTestList: (ResourceColor|undefined)[] = [ //1 不设置 , //2 str-16进制 '#BBB2C8', //3 str非法值 'rgba(red, green, blue, op)', //4 Color枚举 Color.Orange, //5 rgba 'rgba(182, 197, 209, 100)', //6 num 0xA6C2BE, //7 undefined undefined, //8 res $r('app.color.Color_pink'), ...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left backgroundColorTestList : AST#ERROR#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left...
export const backgroundColorTestList: (ResourceColor|undefined)[] = [ , '#BBB2C8', 'rgba(red, green, blue, op)', Color.Orange, 'rgba(182, 197, 209, 100)', 0xA6C2BE, undefined, $r('app.color.Color_pink'), $r('app.string.MainAbility_label'), Color.Transparent, '#ffc9...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/dialog/params/ResourceColor.ets#L16-L39
72152a94588fa7b532e90d3654afce770b5870e7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
textAreaDialog
多行文本输入弹出框
textAreaDialog(index: number) { if (index == 0) { //简单使用 DialogHelper.showTextAreaDialog({ text: this.inputText, onChange: (text) => { console.error("onChange: " + text); }, onAction: (action, dialogId, content) => { if (action == DialogAction.SURE) { ...
AST#method_declaration#Left textAreaDialog AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statem...
textAreaDialog(index: number) { if (index == 0) { DialogHelper.showTextAreaDialog({ text: this.inputText, onChange: (text) => { console.error("onChange: " + text); }, onAction: (action, dialogId, content) => { if (action == DialogAction.SURE) { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L548-L611
6481af0496d02ffb00b7d6ff69252e8b5120b309
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
isArrayBufferView
Check whether the type is included in the isAnyArrayBuffer. @param { Object } value - A included in the isAnyArrayBuffer value @returns { boolean } Returns true if the value is an instance of one of the ArrayBuffer views, such as typed array objects or DataView. @syscap SystemCapability.Utils.Lang @crossplatform @atom...
isArrayBufferView(value: Object): boolean;
AST#method_declaration#Left isArrayBufferView AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
isArrayBufferView(value: Object): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1145-L1145
84f64ee191c3b94e79d7fd7248489ab81f4b1fff
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/sync/CloudStorageProvider.ets
arkts
华为云存储实现
export class HuaweiCloudStorageProvider extends CloudStorageProvider { private accessToken: string | null = null; private tokenExpiry: number = 0; async initialize(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initializing Huawei Cloud Storage'); await this.a...
AST#export_declaration#Left export AST#class_declaration#Left class HuaweiCloudStorageProvider extends AST#type_annotation#Left AST#primary_type#Left CloudStorageProvider AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private accessToken : AST#type_annotation#Left A...
export class HuaweiCloudStorageProvider extends CloudStorageProvider { private accessToken: string | null = null; private tokenExpiry: number = 0; async initialize(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initializing Huawei Cloud Storage'); await this.a...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/sync/CloudStorageProvider.ets#L36-L325
096dc3baeeaf45669d21dad32a0e6254397ccb6f
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Flexes.ets
arkts
bodyBuilder
内容展示(自定义builder渲染)
@Builder bodyBuilder() { Column(){ // 横向排列 Text('横向排列 Row') .fontSize(14) .margin({ top:20, bottom: 12}) Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { Text('1').width('20%').height(30).backgroundColor(0xF5DEB3) Text('2').width('20%').height...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 横向排列 AST#arkts...
@Builder bodyBuilder() { Column(){ Text('横向排列 Row') .fontSize(14) .margin({ top:20, bottom: 12}) Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { Text('1').width('20%').height(30).backgroundColor(0xF5DEB3) Text('2').width('20%').height(30).ba...
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Flexes.ets#L41-L352
bf2fafc78d825fd0cac60a7a7842eade40e9966d
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/CommentItem.ets
arkts
CommentImagePreview
评论图片预览 @param {string[]} images - 图片列表 @returns {void} 无返回值
@Builder private CommentImagePreview(images: string[]): void { Stack({ alignContent: Alignment.BottomEnd }) { NetWorkImage({ model: images[0], sizeValue: 60, showBackground: true, cornerRadius: $r("app.float.radius_small") }); if (images.length > 1) { Tex...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CommentImagePreview AST#parameter_list#Left ( AST#parameter#Left images : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter...
@Builder private CommentImagePreview(images: string[]): void { Stack({ alignContent: Alignment.BottomEnd }) { NetWorkImage({ model: images[0], sizeValue: 60, showBackground: true, cornerRadius: $r("app.float.radius_small") }); if (images.length > 1) { Tex...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/CommentItem.ets#L77-L108
056792d4e43c7a19cd9abed714678b22327c7f46
github
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.common2D.ets
arkts
Coordinates in the font layout. @typedef Point @syscap SystemCapability.Graphics.Drawing @since 12
export interface Point { /** * X-axis coordinate. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 12 */ x: number; /** * Y-axis coordinate. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 12 */ y: number; ...
AST#export_declaration#Left export AST#interface_declaration#Left interface Point AST#object_type#Left { /** * X-axis coordinate. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 12 */ AST#type_member#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
export interface Point { x: number; y: number; }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.common2D.ets#L108-L124
ffa04a797d72a4aee5b948c2875c31d0436c2392
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
AVSession会话交互事件监听接口
export interface AVSessionEventListener { onPlay: Function, onPause: Function, onStop: Function, onSeek: Function, onSetLoopMode: Function, onPlayNext: Function, onPlayPrevious: Function }
AST#export_declaration#Left export AST#interface_declaration#Left interface AVSessionEventListener AST#object_type#Left { AST#type_member#Left onPlay : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left onPause : AST#type...
export interface AVSessionEventListener { onPlay: Function, onPause: Function, onStop: Function, onSeek: Function, onSetLoopMode: Function, onPlayNext: Function, onPlayPrevious: Function }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L339-L347
94b91f407cca8f0a5a310588381ad3690ecca435
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/AppState.ets
arkts
waitForStorageReady
新增:等待存储初始化完成
public async waitForStorageReady(): Promise<void> { return new Promise((resolve) => { const check = () => { if (this.isStorageReady) { resolve(); } else { setTimeout(check, 50); } }; check(); }); }
AST#method_declaration#Left public async waitForStorageReady AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ...
public async waitForStorageReady(): Promise<void> { return new Promise((resolve) => { const check = () => { if (this.isStorageReady) { resolve(); } else { setTimeout(check, 50); } }; check(); }); }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/AppState.ets#L56-L67
addec0a0be2fac9c10d393e97136f6f8e4b3240a
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
transcode
视频转码
public static transcode(input: string, output: string, bitrate?: string): string[] { const cmd: string[] = [ 'ffmpeg', '-i', input, '-c:v', FFmpegFactory.HW_CODEC ]; if (bitrate !== undefined) { cmd.push('-b:v', bitrate); } cmd.push('-c:a', 'aac', '-y', output); return cm...
AST#method_declaration#Left public static transcode AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
public static transcode(input: string, output: string, bitrate?: string): string[] { const cmd: string[] = [ 'ffmpeg', '-i', input, '-c:v', FFmpegFactory.HW_CODEC ]; if (bitrate !== undefined) { cmd.push('-b:v', bitrate); } cmd.push('-c:a', 'aac', '-y', output); return cm...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L156-L167
59218f1ef03558711734763156661d637b49a272
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildMembersChunk.ets
arkts
Emitted whenever a chunk of guild members is received (all members come from the same guild). @event Client#guildMembersChunk @param {GuildMember[]} members The members in the chunk @param {Guild} guild The guild related to the member chunk 应用约束61:使用ES6 export语法
export default GuildMembersChunkHandler;
AST#export_declaration#Left export default AST#expression#Left GuildMembersChunkHandler AST#expression#Right ; AST#export_declaration#Right
export default GuildMembersChunkHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildMembersChunk.ets#L37-L37
05370501590d4996165c0980e7b304c6f34290b3
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/common/startup/HMRouterTask.ets
arkts
@author open_9527 @date 2025/5/23 @desc 描述信息
@Sendable export default class HMRouterTask extends StartupTask { constructor() { super(); } async init(context: common.AbilityStageContext): Promise<TaskResult> { LogUtils.debug('AppStartupConfigEntry', `HMRouterTask init`) let time = systemDateTime.getTime(false) LogUtils.debug('AppStartupConfi...
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export default AST#class_declaration#Left class HMRouterTask extends AST#type_annotation#Left AST#primary_type#Left StartupTask AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left ...
@Sendable export default class HMRouterTask extends StartupTask { constructor() { super(); } async init(context: common.AbilityStageContext): Promise<TaskResult> { LogUtils.debug('AppStartupConfigEntry', `HMRouterTask init`) let time = systemDateTime.getTime(false) LogUtils.debug('AppStartupConfi...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/common/startup/HMRouterTask.ets#L12-L28
2cc0fd5fab46258787273a99ef7d407f0adebb85
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
validateToday
验证今天的农历公历对应关系 @returns 验证结果
static validateToday(): TodayValidationResult { try { const today = new Date(); const solarDate: SolarDate = { year: today.getFullYear(), month: today.getMonth() + 1, day: today.getDate() }; // 公历转农历 const lunarDate = LunarCalendar.solarToLunar(solarDate.year, ...
AST#method_declaration#Left static validateToday AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TodayValidationResult AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left ...
static validateToday(): TodayValidationResult { try { const today = new Date(); const solarDate: SolarDate = { year: today.getFullYear(), month: today.getMonth() + 1, day: today.getDate() }; const lunarDate = LunarCalendar.solarToLunar(solarDate.year, solarDat...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L606-L668
9634ae36bccfd1aa7d745ee0c08e476050004f32
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/view/position/FlowItemView.ets
arkts
FlowItemView
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct FlowItemView { @Link _position: Position; private componentKey: string; private parentWidth: number; private parentHeight: number; private parentComponentKey: string; private referenceComponentKey: string; build() { Column({ space: 2 }) { WaterFlow() { FlowItem(...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlowItemView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_an...
@Component export struct FlowItemView { @Link _position: Position; private componentKey: string; private parentWidth: number; private parentHeight: number; private parentComponentKey: string; private referenceComponentKey: string; build() { Column({ space: 2 }) { WaterFlow() { FlowItem(...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/view/position/FlowItemView.ets#L16-L61
6ecf91f798939c0f80021ad68fab035805198c11
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setGridLineWidth
Sets the width of the grid lines that are drawn away from each axis label. @param width
public setGridLineWidth(width: number): void { this.mGridLineWidth = Utils.handleDataValues(width); }
AST#method_declaration#Left public setGridLineWidth AST#parameter_list#Left ( AST#parameter#Left width : 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...
public setGridLineWidth(width: number): void { this.mGridLineWidth = Utils.handleDataValues(width); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L304-L306
3e9c33cf59f313e95d52b3af462d158a8bfb7e69
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
goBackward_onWorkingTab
Try to go backward on current main tab. @returns true if success. @returns false if failed, perhaps there is no way backward.
goBackward_onWorkingTab() { if (this.Tabs[this.main_tab_idx].controller?.accessBackward()) { this.Tabs[this.main_tab_idx].controller?.backward(); return true; } return false; }
AST#method_declaration#Left goBackward_onWorkingTab AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST...
goBackward_onWorkingTab() { if (this.Tabs[this.main_tab_idx].controller?.accessBackward()) { this.Tabs[this.main_tab_idx].controller?.backward(); return true; } return false; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L114-L120
39ab92d4cc76a426e2c373b9d85f89c3e5bcfe06
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
isDrawRoundedSlicesEnabled
Returns true if the chart is set to draw each end of a pie-slice "rounded". @return
public isDrawRoundedSlicesEnabled(): boolean { return this.mDrawRoundedSlices; }
AST#method_declaration#Left public isDrawRoundedSlicesEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left ...
public isDrawRoundedSlicesEnabled(): boolean { return this.mDrawRoundedSlices; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L761-L763
4f9b3d144d73384d6befe15824c9522dfcdf4c45
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBusCore.ets
arkts
offAll
注销所有事件监听
offAll(): void { EventBusCore.events = new Map(); }
AST#method_declaration#Left offAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expr...
offAll(): void { EventBusCore.events = new Map(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L81-L83
17ff0b9f39e6be942874247e09c08b75f449662f
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/OHMailETS/entry/src/main/ets/MainAbility/pages/index.ets
arkts
sendMessageToRemoteService
连接成功后发送消息
async function sendMessageToRemoteService(dataList) { if (mRemote == null) { prompt.showToast({ message: "mRemote is null" }); return; } let option = new rpc.MessageOption(); let data = new rpc.MessageParcel(); let reply = new rpc.MessageParcel(); data.writeStringArray(JSON.parse(dataList)...
AST#function_declaration#Left async function sendMessageToRemoteService AST#parameter_list#Left ( AST#parameter#Left dataList AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left mRemote...
async function sendMessageToRemoteService(dataList) { if (mRemote == null) { prompt.showToast({ message: "mRemote is null" }); return; } let option = new rpc.MessageOption(); let data = new rpc.MessageParcel(); let reply = new rpc.MessageParcel(); data.writeStringArray(JSON.parse(dataList)...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OHMailETS/entry/src/main/ets/MainAbility/pages/index.ets#L150-L169
a5f047f76565fa195715cc472afa3ed7bf725782
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/pages/TaskReviewView.ets
arkts
loadFlaws
加载故障列表
async loadFlaws() { try { const httpRequest = http.createHttp(); const response = await httpRequest.request(`${AppConstants.API_BASE_URL}/agv/flaw/list?taskId=${this.taskId}`); if (response.responseCode === 200) { const data: Record<string, Object> = JSON.parse(response.result as st...
AST#method_declaration#Left async loadFlaws AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left httpRequest = AST#expression#Left AST#c...
async loadFlaws() { try { const httpRequest = http.createHttp(); const response = await httpRequest.request(`${AppConstants.API_BASE_URL}/agv/flaw/list?taskId=${this.taskId}`); if (response.responseCode === 200) { const data: Record<string, Object> = JSON.parse(response.result as st...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L163-L183
b957c9b5137fdc2edb44371f0d27940c8fbf251b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/CommentDetailView.ets
arkts
handleCount
加载聊天列表数据,到参数传入的懒加载数据列表中 @param count 数值
handleCount(count: number) { if (count > Constants.UNIT_10000) { return `${(count / Constants.UNIT_10000).toFixed(1)}w`; } else if (count > Constants.UNIT_1000 && count < Constants.UNIT_10000) { return `${(count / Constants.UNIT_1000).toFixed(1)}k`; } else { return count.toString() } ...
AST#method_declaration#Left handleCount AST#parameter_list#Left ( AST#parameter#Left count : 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#if_statement#Left if ( AST#...
handleCount(count: number) { if (count > Constants.UNIT_10000) { return `${(count / Constants.UNIT_10000).toFixed(1)}w`; } else if (count > Constants.UNIT_1000 && count < Constants.UNIT_10000) { return `${(count / Constants.UNIT_1000).toFixed(1)}k`; } else { return count.toString() } ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/CommentDetailView.ets#L284-L292
795b4a04921d0dfcba1e548771e63931e6597d28
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
MenuItem
菜单项组件
@Builder MenuItem(title: string, icon: string) { Row() { Text(icon) .fontSize(24) .margin({ right: 12 }) Text(title) .fontSize(16) .fontColor('#333333') .layoutWeight(1) Text('›') .fontSize(24) .fontColor('#CCCCCC') } ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MenuItem 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 icon : AST#type_annotation#Left AST#p...
@Builder MenuItem(title: string, icon: string) { Row() { Text(icon) .fontSize(24) .margin({ right: 12 }) Text(title) .fontSize(16) .fontColor('#333333') .layoutWeight(1) Text('›') .fontSize(24) .fontColor('#CCCCCC') } ...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L1652-L1673
b71e461773e42080e4754e309b703db5c066f847
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/views/CubeRotateAnimationSamplePage.ets
arkts
functionGird
功能图标网格UI
@Builder functionGird() { Grid() { ForEach(this.gridItems, (item: MyGridItem) => { GridItem() { Column() { Image(item.icon) .width($r('app.integer.cube_animation_icon_size')) .height($r('app.integer.cube_animation_icon_size')) Text(item.t...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right functionGird 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 Grid ( ) AST#container_content_body#Left { AST#ui_control_flo...
@Builder functionGird() { Grid() { ForEach(this.gridItems, (item: MyGridItem) => { GridItem() { Column() { Image(item.icon) .width($r('app.integer.cube_animation_icon_size')) .height($r('app.integer.cube_animation_icon_size')) Text(item.t...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/views/CubeRotateAnimationSamplePage.ets#L164-L191
0d21781d300b7e128faa8f087a8f981f9f8f2754
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PhotoBrowserRange. include ALL and SELECTED_ONLY @enum { number } PhotoBrowserRange @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare enum PhotoBrowserRange { /** * ALL. all photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ ALL = 0, /** * SELECTED_ONLY. only selected photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAcces...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PhotoBrowserRange AST#enum_body#Left { /** * ALL. all photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member#Left ALL = ...
export declare enum PhotoBrowserRange { ALL = 0, SELECTED_ONLY = 1, }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L1112-L1130
cb4af3bedcb1cde4149bcb36c3e1bc4df6b44af2
gitee
lentozi/DailyPlan.git
96ce0bec8f545511c51b577c4aa8327c2c5bb0c8
entry/src/main/ets/datalist/CurrentDateList.ets
arkts
返回本月的 DateItem 列表
export function getDayList(currentDate: DateItem): Array<DateItem> { const C: number = Math.floor(currentDate.year / 100); let Y: number = currentDate.year % 100; let M: number = currentDate.month; const D: number = 1; // 如果 M 小于2,则 M 加 12, Y 减1 if (M < 2) { M += 12; Y -= 1; } // 根据当前的年月日计算出这个月的...
AST#export_declaration#Left export AST#function_declaration#Left function getDayList AST#parameter_list#Left ( AST#parameter#Left currentDate : AST#type_annotation#Left AST#primary_type#Left DateItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Le...
export function getDayList(currentDate: DateItem): Array<DateItem> { const C: number = Math.floor(currentDate.year / 100); let Y: number = currentDate.year % 100; let M: number = currentDate.month; const D: number = 1; if (M < 2) { M += 12; Y -= 1; } const firstDay: number = Math.abs(Math.fl...
https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/datalist/CurrentDateList.ets#L18-L62
ba3add75ab395076f5ad2dedd60cf25a364d8ed4
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
updateConfig
更新配置
async updateConfig(index: number, updates: Partial<LLMConfig>): Promise<boolean> { try { if (index < 0 || index >= this.configs.length) { return false; } // 如果更新为默认配置,清除其他配置的默认状态 if (updates.isDefault) { this.configs.forEach(c => c.isDefault = false); } const ex...
AST#method_declaration#Left async updateConfig AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
async updateConfig(index: number, updates: Partial<LLMConfig>): Promise<boolean> { try { if (index < 0 || index >= this.configs.length) { return false; } if (updates.isDefault) { this.configs.forEach(c => c.isDefault = false); } const existingConfig = this.conf...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L130-L159
10d4cfa7ee7017c29c802ec22ddc5196091c0a98
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/treeview/source/treeview.ets
arkts
once
Event registration and processing. After the event is processed once, it will be destroyed. @param { type } event Registered Events. @param callback. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Event registration and processing. After the event is processed once, it will be destroyed. @param { type } even...
public once(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void { if (Array.isArray(type)) { this.off(type, callback); } else { (this._once_events[type] || (this._once_events[type] = [])).push(callback); } }
AST#method_declaration#Left public once AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_l...
public once(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void { if (Array.isArray(type)) { this.off(type, callback); } else { (this._once_events[type] || (this._once_events[type] = [])).push(callback); } }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L835-L841
39ebe289063359e485bae1b9559feabcfe22fe6c
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/SettingsService.ets
arkts
setThemeMode
设置主题模式
async setThemeMode(mode: ThemeMode): Promise<void> { this.settings.themeMode = mode; await this.saveSettings(); this.applyTheme(mode); }
AST#method_declaration#Left async setThemeMode AST#parameter_list#Left ( AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
async setThemeMode(mode: ThemeMode): Promise<void> { this.settings.themeMode = mode; await this.saveSettings(); this.applyTheme(mode); }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/SettingsService.ets#L118-L122
d615021901b80b0501cfd49758919f2050d829a7
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppDataSecurity/entry/src/main/ets/pages/Index.ets
arkts
GetAesEncryptProperties
[End get_aes_generate_properties] [Start get_aes_encrypt_properties]
function GetAesEncryptProperties(): Array<huks.HuksParam> { let properties: Array<huks.HuksParam> = [{ tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_AES }, { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 }, { tag: huks.HuksTag.HUKS_T...
AST#function_declaration#Left function GetAesEncryptProperties AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left huks . HuksParam AST#qualified...
function GetAesEncryptProperties(): Array<huks.HuksParam> { let properties: Array<huks.HuksParam> = [{ tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_AES }, { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 }, { tag: huks.HuksTag.HUKS_T...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppDataSecurity/entry/src/main/ets/pages/Index.ets#L156-L177
35bb72e96676aa419e8d002f6a36945a2addebb8
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/RabinKarp.ets
arkts
findNonOverlappingMatches
查找所有不重叠的匹配位置 @param text 文本字符串 @param pattern 模式串 @returns 不重叠的匹配位置数组
static findNonOverlappingMatches(text: string, pattern: string): number[] { if (!text || !pattern || pattern.length === 0) { return []; } const result: number[] = []; const m = pattern.length; const n = text.length; const patternHash = RabinKarp.hash(pattern); let textHash = RabinKarp...
AST#method_declaration#Left static findNonOverlappingMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string...
static findNonOverlappingMatches(text: string, pattern: string): number[] { if (!text || !pattern || pattern.length === 0) { return []; } const result: number[] = []; const m = pattern.length; const n = text.length; const patternHash = RabinKarp.hash(pattern); let textHash = RabinKarp...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L220-L250
e837249dd0d20a6e16c6655f6e0a0297fe127702
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
@Author csx @DateTime 2024/3/18 21:29 @TODO StrAndUintUtil 字符串和Uint8Array工具类
export class StrAndUintUtil { /** * 字符串转uint8Array * @param str 待转换字符串 * @param coding 转换结果编码 * @returns */ static str2Uint8Array(str: string, coding: buffer.BufferEncoding) { return new Uint8Array(buffer.from(str, coding).buffer); } /** * 将字节流以16进制字符串输出 * @param arr Uint8Array数组 ...
AST#export_declaration#Left export AST#class_declaration#Left class StrAndUintUtil AST#class_body#Left { /** * 字符串转uint8Array * @param str 待转换字符串 * @param coding 转换结果编码 * @returns */ AST#method_declaration#Left static str2Uint8Array AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation...
export class StrAndUintUtil { static str2Uint8Array(str: string, coding: buffer.BufferEncoding) { return new Uint8Array(buffer.from(str, coding).buffer); } static unitArray2String(arr: Uint8Array, isC1C3C2?: boolean): string { let asn1Str = buffer.from(arr).toString('hex'); ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L26-L229
01c785d64b51554071db900e9d875c99ae9f2519
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
initialize
初始化AI服务
async initialize(context: Context): Promise<void> { try { this.context = context; this.preferences = await preferences.getPreferences(context, StorageKeys.AI_ASSISTANT_PREFS); // 加载AI配置 await this.loadAIConfig(); // 初始化默认会话 await this.startNewConversation(); ...
AST#method_declaration#Left async initialize 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_type#Lef...
async initialize(context: Context): Promise<void> { try { this.context = context; this.preferences = await preferences.getPreferences(context, StorageKeys.AI_ASSISTANT_PREFS); await this.loadAIConfig(); await this.startNewConversation(); hilog.info(Lo...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L295-L311
6a96168ecb16bc96beb0a2fc3a56ea6b221d2b7d
github
knight6236/Pomodoro-Timer.git
7810017895bdfaad31cb5b664edd08a712272080
entry/src/main/ets/pages/Index.ets
arkts
showDeleteConfirm
修改显示删除确认方法
private showDeleteConfirm(task: Task) { this.taskToDelete = task; this.deleteDialogController.open(); }
AST#method_declaration#Left private showDeleteConfirm AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST...
private showDeleteConfirm(task: Task) { this.taskToDelete = task; this.deleteDialogController.open(); }
https://github.com/knight6236/Pomodoro-Timer.git/blob/7810017895bdfaad31cb5b664edd08a712272080/entry/src/main/ets/pages/Index.ets#L419-L422
b1aa908581e6aef61adf8f85342330153012a4e9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/SymbolMenu.ets
arkts
SymbolMenu
符号键盘
@Component export struct SymbolMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; private symbolList: sourceListType[] = symbolSourceListData; private spaceWidth: Resource = this.inputStyle.spaceButtonWidth_2; private returnWidth: Resou...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SymbolMenu AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Left A...
@Component export struct SymbolMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; private symbolList: sourceListType[] = symbolSourceListData; private spaceWidth: Resource = this.inputStyle.spaceButtonWidth_2; private returnWidth: Resou...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/SymbolMenu.ets#L25-L81
e61a20a98b3f1064a5cf28db8c568c4a690f5f81
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
drawOutCircle
Draw outer disc, small circle.
drawOutCircle() { // Draw outer disc. this.fillArc(new FillArcData(0, 0, this.screenWidth * CommonConstants.OUT_CIRCLE_RATIOS, 0, Math.PI * CommonConstants.TWO), ColorConstants.OUT_CIRCLE_COLOR); let beginAngle = this.startAngle; // Draw small circle. for (let i = 0; i < CommonConstants.SMALL...
AST#method_declaration#Left drawOutCircle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // Draw outer disc. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressi...
drawOutCircle() { this.fillArc(new FillArcData(0, 0, this.screenWidth * CommonConstants.OUT_CIRCLE_RATIOS, 0, Math.PI * CommonConstants.TWO), ColorConstants.OUT_CIRCLE_COLOR); let beginAngle = this.startAngle; for (let i = 0; i < CommonConstants.SMALL_CIRCLE_COUNT; i++) { this.canvasC...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets#L111-L127
3efc4a41e02b7a62f7500bb6c6a9ab4ec17c4f3f
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/constants/LayoutPercent.ets
arkts
45% 百分比
export const P45: string = "45%";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P45 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "45%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right...
export const P45: string = "45%";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L54-L54
82f601ca7880cb363051b4d941204fac02b53822
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/ContactsPage.ets
arkts
getRelationColor
获取关系颜色
private getRelationColor(relation: RelationType): string { const colors: Record<RelationType, string> = { [RelationType.FAMILY]: '#ff6b6b', [RelationType.FRIEND]: '#4ecdc4', [RelationType.COLLEAGUE]: '#45b7d1', [RelationType.OTHER]: '#96ceb4' }; return colors[relation] || '#96ceb4'; ...
AST#method_declaration#Left private getRelationColor AST#parameter_list#Left ( AST#parameter#Left relation : AST#type_annotation#Left AST#primary_type#Left RelationType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string...
private getRelationColor(relation: RelationType): string { const colors: Record<RelationType, string> = { [RelationType.FAMILY]: '#ff6b6b', [RelationType.FRIEND]: '#4ecdc4', [RelationType.COLLEAGUE]: '#45b7d1', [RelationType.OTHER]: '#96ceb4' }; return colors[relation] || '#96ceb4'; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L485-L493
8d52495e6bf154d3e40fb87d6e27e3a5954f47d8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
使用增长趋势数据接口
export interface UsageGrowthTrend { period: string; sessions: number; change: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UsageGrowthTrend AST#object_type#Left { AST#type_member#Left period : 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 sessions : AST#type_annota...
export interface UsageGrowthTrend { period: string; sessions: number; change: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L194-L198
93f728976de8fa595ff709512dde2a02427200d9
github
ChangweiZhang/chardet-arkts.git
3a214882ec6a2753c0fed84162952aa659341c19
src/main/ets/components/encoding/mbcs.ets
arkts
The charset recognize for EUC-JP. A singleton instance of this class is created and kept by the public CharsetDetector class
export class euc_jp extends mbcs { name() { return 'EUC-JP'; } language() { return 'ja'; } // TODO: This set of data comes from the character frequency- // of-occurrence analysis tool. The data needs to be moved // into a resource and loaded from there. commonChars = [ 0xa1a...
AST#export_declaration#Left export AST#class_declaration#Left class euc_jp extends AST#type_annotation#Left AST#primary_type#Left mbcs AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left name AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { A...
export class euc_jp extends mbcs { name() { return 'EUC-JP'; } language() { return 'ja'; } commonChars = [ 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a6, 0xa1bc, 0xa1ca, 0xa1cb, 0xa1d6, 0xa1d7, 0xa4a2, 0xa4a4, 0xa4a6, 0xa4a8, 0xa4aa, 0xa4ab, 0xa4ac, 0xa4ad, 0xa4af, 0xa4b1, 0xa4b3, 0xa4b5, 0xa4b...
https://github.com/ChangweiZhang/chardet-arkts.git/blob/3a214882ec6a2753c0fed84162952aa659341c19/src/main/ets/components/encoding/mbcs.ets#L363-L390
0367f35da5aa15f4d0086ea6871b564f05511908
github
seasonZhu/HarmonyStudy.git
b55e58c962e9b39d5211337590bdd45f2c2349b3
entry/src/main/ets/viewModel/HomeViewModel.ets
arkts
networkRequest
/ 这个地方的返回值写了很久,另外大写的Object与object是两个东西
public networkRequest(type: ScrollActionType): Promise<AxiosResponse<Object>[]> { if (type == ScrollActionType.refresh) { this.pageNum = 1 return Promise.all<AxiosResponse>([this.getBanner(), this.getHotArticle(), this.getNormalArticle(this.pageNum)]) } else { this.pageNum = this.pageNum + 1 ...
AST#method_declaration#Left public networkRequest AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ScrollActionType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
public networkRequest(type: ScrollActionType): Promise<AxiosResponse<Object>[]> { if (type == ScrollActionType.refresh) { this.pageNum = 1 return Promise.all<AxiosResponse>([this.getBanner(), this.getHotArticle(), this.getNormalArticle(this.pageNum)]) } else { this.pageNum = this.pageNum + 1 ...
https://github.com/seasonZhu/HarmonyStudy.git/blob/b55e58c962e9b39d5211337590bdd45f2c2349b3/entry/src/main/ets/viewModel/HomeViewModel.ets#L32-L40
e6ccab04c4d05e154b20dc6a78ccdc577a04bebe
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LineScatterCandleRadarRenderer.ets
arkts
drawHighlightLines
Draws vertical & horizontal highlight-lines if enabled. @param c @param x x-position of the highlight line intersection @param y y-position of the highlight line intersection @param set the currently drawn dataset
protected drawHighlightLines(x: number, y: number, dataSet: ILineScatterCandleRadarDataSet<any>): Paint[] { let pathPaints: Paint[] = []; // set color and stroke-width this.mHighlightPaint.setColor(dataSet.getHighLightColor()); this.mHighlightPaint.setStrokeWidth(dataSet.getHighlightLineWidth()); ...
AST#method_declaration#Left protected drawHighlightLines AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
protected drawHighlightLines(x: number, y: number, dataSet: ILineScatterCandleRadarDataSet<any>): Paint[] { let pathPaints: Paint[] = []; this.mHighlightPaint.setColor(dataSet.getHighLightColor()); this.mHighlightPaint.setStrokeWidth(dataSet.getHighlightLineWidth()); this.mHighlightPaint.set...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LineScatterCandleRadarRenderer.ets#L44-L76
052e404458a08491254f803ca7b9e718e3f0a2db
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/util/AlarmClockUtils.ets
arkts
获取下一个闹钟提醒时间。 @param alarm 闹钟项 @returns 下一个闹钟的时间
export function getNextAlarmTime(alarm: AlarmItem): Date { // 根据 alarm 的具体属性计算下一个响铃时间 let now = new Date(); let nextAlarmDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), alarm.hour, alarm.minute); if (alarm.repeatType === RepeatType.NoRepeat) { // 如果不重复,检查是否已经过了今天的响铃时间 if (nextAlarmDat...
AST#export_declaration#Left export AST#function_declaration#Left function getNextAlarmTime AST#parameter_list#Left ( AST#parameter#Left alarm : AST#type_annotation#Left AST#primary_type#Left AlarmItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#L...
export function getNextAlarmTime(alarm: AlarmItem): Date { let now = new Date(); let nextAlarmDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), alarm.hour, alarm.minute); if (alarm.repeatType === RepeatType.NoRepeat) { if (nextAlarmDate < now) { nextAlarmDate.setDate(next...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/AlarmClockUtils.ets#L53-L75
ef3f88bccaca8162cc2ebff460508f216aef2140
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildGreetingItem
祝福语库项目
@Builder buildGreetingItem(text: string, isFavorite: boolean) { Row({ space: 12 }) { Text(text) .fontSize(14) .fontColor(this.COLORS.textPrimary) .lineHeight(20) .layoutWeight(1) Row({ space: 8 }) { // 复制按钮 Text('📋') .fontSize(14) ....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingItem AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isFavorite : AST#type_annotat...
@Builder buildGreetingItem(text: string, isFavorite: boolean) { Row({ space: 12 }) { Text(text) .fontSize(14) .fontColor(this.COLORS.textPrimary) .lineHeight(20) .layoutWeight(1) Row({ space: 8 }) { Text('📋') .fontSize(14) .padding...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3268-L3316
6d6e6c9ab0943d715ce9b176604c51f3944306d8
github
batiluoxuanwan/MomentFlow.git
e57aa461223abca74f48893afc2ccf7c2d73e9b8
frontend/entry/src/main/ets/api/AIApi.ets
arkts
AI 回复的消息体
export interface AiMessage { role: string; content: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AiMessage AST#object_type#Left { AST#type_member#Left role : 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 content : AST#type_annotation#Left ...
export interface AiMessage { role: string; content: string; }
https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/AIApi.ets#L5-L8
404901244a5bb52b2b66454b70de6cca6d595603
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
fsync
同步文件数据,使用Promise异步回调。 @param fd number 已打开的文件描述符。 @returns
static fsync(fd: number): Promise<void> { return fs.fsync(fd); }
AST#method_declaration#Left static fsync AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise ...
static fsync(fd: number): Promise<void> { return fs.fsync(fd); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L736-L738
2ac43e10f169020a0534ad37387ca369d06bffb7
gitee
common-apps/dsbrigde-harmony-os
bb03e4e95984db32939a1ad609f688537b5a92e8
library/src/main/ets/wait/TaskWait.ets
arkts
通过taskWait方法可以在主线程同步方法内执行串行异步并发任务,主线程会同步等待异步结果 不建议做耗时过长的任务,当任务超过3s,无论是否执行完毕都会结束,数据可能会丢失 为何是3s呢,当主线程阻塞超过3s时,系统会发生anr无响应异常,闪退。 @param args @returns
export function taskWait<T extends BaseSendable>(args: BaseSendable): T { const task: taskpool.Task = new taskpool.Task(run, args) taskpool.execute(task) let currentTime = Date.now() while (true) { if (Date.now() - currentTime < 3000) { if (args.isCompleted) { break } } else { ...
AST#export_declaration#Left export AST#function_declaration#Left function taskWait AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left BaseSendable AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_...
export function taskWait<T extends BaseSendable>(args: BaseSendable): T { const task: taskpool.Task = new taskpool.Task(run, args) taskpool.execute(task) let currentTime = Date.now() while (true) { if (Date.now() - currentTime < 3000) { if (args.isCompleted) { break } } else { ...
https://github.com/common-apps/dsbrigde-harmony-os/blob/bb03e4e95984db32939a1ad609f688537b5a92e8/library/src/main/ets/wait/TaskWait.ets#L24-L53
7a2e49a4dc93f0c063fe7b8132597294beb80208
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/banner/BannerNetworkDataSource.ets
arkts
@file 轮播图相关数据源接口 @author Joker.X
export interface BannerNetworkDataSource { /** * 查询轮播图列表 * @param params 请求参数 * @returns 轮播图列表响应 */ getBannerList(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface BannerNetworkDataSource AST#object_type#Left { /** * 查询轮播图列表 * @param params 请求参数 * @returns 轮播图列表响应 */ AST#type_member#Left getBannerList AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_ty...
export interface BannerNetworkDataSource { getBannerList(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/banner/BannerNetworkDataSource.ets#L7-L14
1120d5d27283efd99b528ea6bf9391cedf1e57f4
github
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
updateUserVerificationStatus
更新用户认证状态
updateUserVerificationStatus(isVerified: boolean): void { this.userInfo.isVerified = isVerified; }
AST#method_declaration#Left updateUserVerificationStatus AST#parameter_list#Left ( AST#parameter#Left isVerified : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void ...
updateUserVerificationStatus(isVerified: boolean): void { this.userInfo.isVerified = isVerified; }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L178-L180
dc8978608cdb6300d7f53d93a2a81009fa9e6913
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets
arkts
aboutToReuse
aboutToReuse从复用缓存中加入到组件树之前调用,可在此处更新组件的状态变量以展示正确的内容。aboutToReuse参数类型已不支持any,这里使用 Record指定明确的数据类型。Record用于构造一个对象类型,其属性键为Keys,属性值为Type。
aboutToReuse(params: Record<string, number>) { this.item = params.item; }
AST#method_declaration#Left aboutToReuse AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotatio...
aboutToReuse(params: Record<string, number>) { this.item = params.item; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets#L83-L85
2dad2e98345202a97021617e199b7bbeeae04747
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
addToQueue
添加到待听队列
async addToQueue(episode: Episode) { try { await this.dbService.addToQueue(episode.id); await this.loadQueue(); console.info(`[MainPage] Added to queue: ${episode.title}`); UIUtils.showToast(new ToastOptions('已添加到队列', 2000)); } catch (error) { console.error('[MainPage] Failed to ad...
AST#method_declaration#Left async addToQueue AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left ...
async addToQueue(episode: Episode) { try { await this.dbService.addToQueue(episode.id); await this.loadQueue(); console.info(`[MainPage] Added to queue: ${episode.title}`); UIUtils.showToast(new ToastOptions('已添加到队列', 2000)); } catch (error) { console.error('[MainPage] Failed to ad...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L306-L316
0f2aa8cb53992e8b85d4561a6b9e9d91aec25432
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/CombinedChartModel.ets
arkts
setDrawBarShadow
If set to true, a grey area is drawn behind each bar that indicates the maximum value. Enabling his will reduce performance by about 50%. @param enabled
public setDrawBarShadow(enabled: boolean): void { this.mDrawBarShadow = enabled; }
AST#method_declaration#Left public setDrawBarShadow AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prim...
public setDrawBarShadow(enabled: boolean): void { this.mDrawBarShadow = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L200-L202
e677b672013a686c26dc7ed5de21c1d5176a42d9
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/PlayerService.ets
arkts
播放器服务 - 支持后台播放
export class PlayerService { private static instance: PlayerService; private avPlayer: media.AVPlayer | null = null; private session: avSession.AVSession | null = null; private currentEpisode: Episode | null = null; private state: PlayerState = PlayerState.IDLE; private playbackSpeed: number = 1.0; privat...
AST#export_declaration#Left export AST#class_declaration#Left class PlayerService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left PlayerService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_decl...
export class PlayerService { private static instance: PlayerService; private avPlayer: media.AVPlayer | null = null; private session: avSession.AVSession | null = null; private currentEpisode: Episode | null = null; private state: PlayerState = PlayerState.IDLE; private playbackSpeed: number = 1.0; privat...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PlayerService.ets#L26-L157
c1162bea1b8c7d126fd778c3e89a68b46a1df8bd
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
农历日期接口
export interface LunarDate { year: number; month: number; day: number; isLeapMonth: boolean; monthName: string; dayName: string; zodiac: string; // 生肖 ganZhi: string; // 干支年 yearCn: string; // 年份中文(兼容性) monthCn: string; // 月份中文(兼容性) dayCn: string; ...
AST#export_declaration#Left export AST#interface_declaration#Left interface LunarDate AST#object_type#Left { AST#type_member#Left year : 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 month : AST#type_annotation#Left AS...
export interface LunarDate { year: number; month: number; day: number; isLeapMonth: boolean; monthName: string; dayName: string; zodiac: string; ganZhi: string; yearCn: string; monthCn: string; dayCn: string; gzYear: string; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L23-L36
e459cae6048afed0d570d06b91cbe53b8873d3ab
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/views/DotSheetBind.ets
arkts
colorModeMenu
深浅色菜单
@Builder colorModeMenu() { Select([{ value: this.colorModeBox[0] }, { value: this.colorModeBox[1] }, { value: this.colorModeBox[2] }]) .selected(this.appGeneralData.colorModeId!!) .value(this.colorModeBox[this.appGeneralData.colorModeId]) .selectedOptionFontColor(Color.White) .selectedOpti...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right colorModeMenu 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 Select ( AST#expression#Left AST#array_literal#Left [ AST#ex...
@Builder colorModeMenu() { Select([{ value: this.colorModeBox[0] }, { value: this.colorModeBox[1] }, { value: this.colorModeBox[2] }]) .selected(this.appGeneralData.colorModeId!!) .value(this.colorModeBox[this.appGeneralData.colorModeId]) .selectedOptionFontColor(Color.White) .selectedOpti...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/views/DotSheetBind.ets#L144-L163
e03e04b9979d25d73004ff120d2f09767c4b51ef
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/pages/MoodInsightPage.ets
arkts
aboutToAppear
用于强制刷新UI
async aboutToAppear(): Promise<void> { console.info('[MoodInsightPage] 页面初始化'); setTimeout(() => { this.getUIContext().animateTo({ duration: 500, curve: Curve.EaseOut }, () => { this.pageOpacity = 1; }); }, 100); try { const context = this.getUIContext()...
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> { console.info('[MoodInsightPage] 页面初始化'); setTimeout(() => { this.getUIContext().animateTo({ duration: 500, curve: Curve.EaseOut }, () => { this.pageOpacity = 1; }); }, 100); try { const context = this.getUIContext()...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/pages/MoodInsightPage.ets#L32-L52
28e231c5fb1d9a4fa24ad494a8d34f38c04322ce
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/common/constants/CommonConstants.ets
arkts
通用常量
export default class CommonConstants { /** * 相机权限名称 */ public static readonly PERMISSION_CAMERA = 'ohos.permission.CAMERA'; /** * 相机流展示组件(XComponent)唯一标识 */ public static readonly CAMERA_XCOMPONENT_ID = 'camera_xcomponent_id'; /** * 相机流展示组件(XComponent)类型 */ public static readonly CAMERA_X...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * 相机权限名称 */ AST#property_declaration#Left public static readonly PERMISSION_CAMERA = AST#expression#Left 'ohos.permission.CAMERA' AST#expression#Right ; AST#property_declaration#Right /** * 相机流...
export default class CommonConstants { public static readonly PERMISSION_CAMERA = 'ohos.permission.CAMERA'; public static readonly CAMERA_XCOMPONENT_ID = 'camera_xcomponent_id'; public static readonly CAMERA_XCOMPONENT_TYPE = 'surface'; public static readonly TOAST_PERMISSIONS_DENIED = 2000; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/common/constants/CommonConstants.ets#L19-L114
e9ab76e7c1a49251cff998fa9b07eaaf37d8cf50
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_commonAttrsEvents/ace_ets_module_commonAttrsEvents_api13/entry/src/main/ets/MainAbility/common/Log.ets
arkts
showInfo
print info level log @param {string} tag - Page or class tag @param {string} log - Log needs to be printed
static showInfo(tag: string, log: string) { console.info(`${TAG} tag: ${tag} --> ${log}`); }
AST#method_declaration#Left static showInfo AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ...
static showInfo(tag: string, log: string) { console.info(`${TAG} tag: ${tag} --> ${log}`); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_commonAttrsEvents/ace_ets_module_commonAttrsEvents_api13/entry/src/main/ets/MainAbility/common/Log.ets#L28-L30
e967139c88a18663574b072ea0dad7e2f709e7dd
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LRUCacheUtil.ets
arkts
get
获取key对应的缓存
public get<T>(key: string): T { return this.lruCache.get(key) as T; }
AST#method_declaration#Left public get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right )...
public get<T>(key: string): T { return this.lruCache.get(key) as T; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LRUCacheUtil.ets#L56-L58
3cc620c59772415c1cba6f827b7f2e17692069bd
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/ImageEditInterface.ets
arkts
图像编辑尺寸策略,用于最终成图时决定图像尺寸如何处理
export enum ImageEditSizePolicy { /** * 适应屏幕,按照屏幕尺寸小边生成完全展示的图像尺寸,不考虑图像和屏幕尺寸比例 */ fit_screen = 1, /** * 既要考虑屏幕也考虑图像原始尺寸按照规则生成图像尺寸 */ fit_screen_and_content = 2 }
AST#export_declaration#Left export AST#enum_declaration#Left enum ImageEditSizePolicy AST#enum_body#Left { /** * 适应屏幕,按照屏幕尺寸小边生成完全展示的图像尺寸,不考虑图像和屏幕尺寸比例 */ AST#enum_member#Left fit_screen = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , /** * 既要考虑屏幕也考虑图像原始尺寸按照规则生成图像尺寸 */ AST#enum_member#Le...
export enum ImageEditSizePolicy { fit_screen = 1, fit_screen_and_content = 2 }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L190-L199
346a4d3d11ff49f15ac99aba2710e03cdbe8de70
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/panels/meowSEManager.ets
arkts
aboutToAppear
Click on default ItemCard
aboutToAppear() { console.log('[Meow][meowSEManager] Search engine Manager READY! [' + this.search_engine + ']'); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expr...
aboutToAppear() { console.log('[Meow][meowSEManager] Search engine Manager READY! [' + this.search_engine + ']'); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/panels/meowSEManager.ets#L29-L31
1635946ea50ee36c0ffdeb692aff01fc0bba7b85
gitee