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
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/model/BasicDataSource.ets
arkts
addData
在指定索引位置增加一个元素 @param index 数组索引
public addData(index: number, data: T): void { this.originDataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right A...
public addData(index: number, data: T): void { this.originDataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/BasicDataSource.ets#L43-L46
ffeb5a0f6e34642802680287cc70e8daea052a1f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/parentchildcomponentsync/uniandbidirectionsync/UniAndBidirectionSyncCode.ets
arkts
初始化圆形的可设置颜色
export const COLOR_DATA = { GREY: '#eebebeba', BLUE: '#4A90E2', PINK: '#8DF8BEBE', RED: '#FFF30823', }
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COLOR_DATA = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left GREY AST#property_name#Right : AST#expression#Left '#eebebeba' AST#expression#Right AST#property_assignment#R...
export const COLOR_DATA = { GREY: '#eebebeba', BLUE: '#4A90E2', PINK: '#8DF8BEBE', RED: '#FFF30823', }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/parentchildcomponentsync/uniandbidirectionsync/UniAndBidirectionSyncCode.ets#L20-L25
a3c9ef19a72b8f82012989ddbb62e47e03387b51
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ChatbotEngine.ets
arkts
对话状态枚举
export enum ConversationState { IDLE = 'idle', WAITING_FOR_INPUT = 'waiting_for_input', PROCESSING = 'processing', CONFIRMING = 'confirming', COLLECTING_INFO = 'collecting_info', EXECUTING_ACTION = 'executing_action' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ConversationState AST#enum_body#Left { AST#enum_member#Left IDLE = AST#expression#Left 'idle' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left WAITING_FOR_INPUT = AST#expression#Left 'waiting_for_input' AST#expression#Right AST#enum_memb...
export enum ConversationState { IDLE = 'idle', WAITING_FOR_INPUT = 'waiting_for_input', PROCESSING = 'processing', CONFIRMING = 'confirming', COLLECTING_INFO = 'collecting_info', EXECUTING_ACTION = 'executing_action' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L22-L29
9a3b43a1911494c322af0ec35075dc2771a7f191
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/start.ets
arkts
handleLogin
处理登录请求
private async handleLogin() { // 验证输入 if (!this.username.trim() || !this.password.trim()) { this.errorMessage = '邮箱和密码不能为空'; return; } // 检查邮箱格式 const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailPattern.test(this.username)) { this.errorMessage = '请输入有效的邮箱地址'; ...
AST#method_declaration#Left private async handleLogin 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_expressio...
private async handleLogin() { if (!this.username.trim() || !this.password.trim()) { this.errorMessage = '邮箱和密码不能为空'; return; } const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailPattern.test(this.username)) { this.errorMessage = '请输入有效的邮箱地址'; return; } ...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/start.ets#L51-L114
48f9e22d7e0e11a2f2db2bcc035376299af2f663
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.router.d.ets
arkts
Defines the option of router back. @interface BackRouterOptions @syscap SystemCapability.ArkUI.ArkUI.Full @since 7 @deprecated since 8 @useinstead ohos.router#RouterOptions
export interface BackRouterOptions { /** * Returns to the page of the specified path. * If the page with the specified path does not exist in the page stack, router.back() is called by default. * * @type { ?string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 8 *...
AST#export_declaration#Left export AST#interface_declaration#Left interface BackRouterOptions AST#object_type#Left { /** * Returns to the page of the specified path. * If the page with the specified path does not exist in the page stack, router.back() is called by default. * * @type { ?string } * @syscap...
export interface BackRouterOptions { uri?: string; params?: Object; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L68-L89
d12a05461aa8827131823c1c93b8cda824ac2ecd
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets
arkts
getHardwareName
获取硬件对应名称
getHardwareName(type: batteryStats.ConsumptionType) { if (this.hardwareNames.size === 0) { this.hardwareNames.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_INVALID, $r("app.string.battery_stats_type_invalid")); this.hardwareNames.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH, $r("app.s...
AST#method_declaration#Left getHardwareName AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left batteryStats . ConsumptionType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right A...
getHardwareName(type: batteryStats.ConsumptionType) { if (this.hardwareNames.size === 0) { this.hardwareNames.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_INVALID, $r("app.string.battery_stats_type_invalid")); this.hardwareNames.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH, $r("app.s...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets#L227-L239
3f75215cfc51a15c48fc366cddd03290e40033b8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets
arkts
translateImage
向右下移动图片
private translateImage() { if (this.pixelMap != undefined) { // [Start pixelmap_translate_image] // 向下偏移100 // 向右偏移100 this.pixelMap.translate(100, 100).then(() => { // [End pixelmap_translate_image] // 偏移后图片变为800×800,重新裁剪为700×700 if (this.imageInfo!.size.height == 70...
AST#method_declaration#Left private translateImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expre...
private translateImage() { if (this.pixelMap != undefined) { this.pixelMap.translate(100, 100).then(() => { if (this.imageInfo!.size.height == 700) { this.pixelMap!.crop({ x: 0, y: 0, size: { height: 700, width: 700 } }).then(() => { this.up...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L254-L271
31816ef96b051b8e0048e0eb6a2431e451b2c6f4
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets
arkts
brightChange
亮度调节
async brightChange(): Promise<void> { let headFilter: effectKit.Filter = effectKit.createEffect(this.brightnessOriginBM); if (headFilter !== null) { headFilter.brightness(this.brightnessValue); this.pixelMap = headFilter.getPixelMap(); this.flushPage(); } }
AST#method_declaration#Left async brightChange AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arg...
async brightChange(): Promise<void> { let headFilter: effectKit.Filter = effectKit.createEffect(this.brightnessOriginBM); if (headFilter !== null) { headFilter.brightness(this.brightnessValue); this.pixelMap = headFilter.getPixelMap(); this.flushPage(); } }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets#L192-L199
c2d3f4f0b095d385aff1ed9db73d1c82719c6755
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/CanvasGetResult.ets
arkts
aboutToAppear
3. 在MyNodeController的aboutToAppear中创建PixeMap
aboutToAppear(): void { let task = new taskpool.Task(createPixelMapAsync); taskpool.execute(task).then((pixel:Object)=>{ this.myRenderNode.setPixelMap(pixel as image.PixelMap); this.myRenderNode.invalidate(); }) }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left task = AST#ex...
aboutToAppear(): void { let task = new taskpool.Task(createPixelMapAsync); taskpool.execute(task).then((pixel:Object)=>{ this.myRenderNode.setPixelMap(pixel as image.PixelMap); this.myRenderNode.invalidate(); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/CanvasGetResult.ets#L107-L113
02de23d769fb4511bcbc6b2fffdf9f9142c74f1f
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/models/ThemeModel.ets
arkts
saveTheme
保存主题设置
private async saveTheme(): Promise<void> { try { // TODO: 保存主题设置到持久化存储 // await StorageUtils.putString(ThemeManager.STORAGE_KEY, this.currentTheme.type); console.log(`Theme saved: ${this.currentTheme.type}`); } catch (error) { console.error('Failed to save theme:', error); } }
AST#method_declaration#Left private async saveTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#typ...
private async saveTheme(): Promise<void> { try { console.log(`Theme saved: ${this.currentTheme.type}`); } catch (error) { console.error('Failed to save theme:', error); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L183-L191
9d4da31bdb29e962108f6661e8a09d69fb3969bc
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets
arkts
totalCount
获取数据源列表长度
public totalCount(): number { return this.regionArray.length; }
AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
public totalCount(): number { return this.regionArray.length; }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets#L200-L202
0e9e24253e70af65497f328b39e88dd0be5be489
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/listener/ChartTouchListener.ets
arkts
performHighlight
Perform a highlight operation. @param e
protected performHighlight(h: Highlight, e?: TouchEvent) { if (h == null || Utils.isHighLightEquals(h, this.mLastHighlighted)) { // this.mChart.highlightValue(0,undefined,undefined, undefined,true); this.mChart.highlightValueForObject(null, true); this.mLastHighlighted = null; } else { ...
AST#method_declaration#Left protected performHighlight AST#parameter_list#Left ( AST#parameter#Left h : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left e ? : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#p...
protected performHighlight(h: Highlight, e?: TouchEvent) { if (h == null || Utils.isHighLightEquals(h, this.mLastHighlighted)) { this.mChart.highlightValueForObject(null, true); this.mLastHighlighted = null; } else { this.mChart.highlightValueForObject(h, true); this.mLastHighlig...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/ChartTouchListener.ets#L131-L141
3b2abfdb92b1771784722b1f4525138bea863ea9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/Index.ets
arkts
BluetoothView
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { BluetoothView } from './src/main/ets/pages/BluetoothView';
AST#export_declaration#Left export { BluetoothView } from './src/main/ets/pages/BluetoothView' ; AST#export_declaration#Right
export { BluetoothView } from './src/main/ets/pages/BluetoothView';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/Index.ets#L16-L16
2e9cc0cac82f0f65e8a9596cc7b1ae568163eca0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets
arkts
monthChange
当前月份信息,用于自动化用例
monthChange() { // 当前显示的月份 let month = this.currentShowMonth; emitter.emit({ eventId: 0, priority: 0 }, { data: { month: month } }); }
AST#method_declaration#Left monthChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 当前显示的月份 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left month = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curr...
monthChange() { let month = this.currentShowMonth; emitter.emit({ eventId: 0, priority: 0 }, { data: { month: month } }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets#L124-L132
5ca32a3b0453e43a07b00993cd53ec5c4072095a
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/pages/Register.ets
arkts
handleRegister
注册
async handleRegister(): Promise<void> { if (!this.username || !this.password) { this.errorMessage = '请输入用户名和密码'; return; } if (this.password !== this.confirmPassword) { this.errorMessage = '两次输入的密码不一致'; return; } this.loading = true; this.errorMessage = ''; try { ...
AST#method_declaration#Left async handleRegister AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
async handleRegister(): Promise<void> { if (!this.username || !this.password) { this.errorMessage = '请输入用户名和密码'; return; } if (this.password !== this.confirmPassword) { this.errorMessage = '两次输入的密码不一致'; return; } this.loading = true; this.errorMessage = ''; try { ...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/pages/Register.ets#L30-L63
4952d942ccd0dd9a8e2fd43bc8f5ba68231a0b86
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CartRepository.ets
arkts
addToCart
添加商品到购物车 @param {Cart} cart 购物车商品 @returns {Promise<void>} Promise<void>
addToCart(cart: Cart): Promise<void> { return this.dataSource.addToCart(cart); }
AST#method_declaration#Left addToCart AST#parameter_list#Left ( AST#parameter#Left cart : AST#type_annotation#Left AST#primary_type#Left Cart 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 AST...
addToCart(cart: Cart): Promise<void> { return this.dataSource.addToCart(cart); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L27-L29
eb19ee98d24b7a93170f2338632d98989a21b2dd
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppContext.ets
arkts
get
获取全局 ApplicationContext。 若未初始化则抛出错误。
static get appContext(): common.UIAbilityContext { if (!AppContext._appContext) { throw new Error('[AppContext] ApplicationContext 尚未初始化,请先调用 initAppContext()。') } return AppContext._appContext }
AST#method_declaration#Left static get AST#ERROR#Left appContext AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_sta...
static get appContext(): common.UIAbilityContext { if (!AppContext._appContext) { throw new Error('[AppContext] ApplicationContext 尚未初始化,请先调用 initAppContext()。') } return AppContext._appContext }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppContext.ets#L49-L54
18b51ba81934aab20cd5ebc565f160377bba95a0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/TodoTypes.ets
arkts
分组项目接口
export interface GroupItem { key: string; title: string; color: string; icon?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GroupItem AST#object_type#Left { AST#type_member#Left key : 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 title : AST#type_annotation#Left AST...
export interface GroupItem { key: string; title: string; color: string; icon?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L156-L161
0cf1c031e7d5add926126960eb49d1606e8da0a1
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/repeat.d.ets
arkts
Defines the Repeat component attribute functions. @typedef RepeatAttribute<T> @syscap SystemCapability.ArkUI.ArkUI.Full @since 20
export interface RepeatAttribute<T> { /** * Executes itemGenerator of each item. * * @param { RepeatItemBuilder<T> } itemGenerator * @returns { this } RepeatAttribute instance * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 20 */ each(itemGenerator: RepeatItemBuilder<T>): this; /** * ...
AST#export_declaration#Left export AST#interface_declaration#Left interface RepeatAttribute AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { /** * Executes itemGenerator of each item. * * @param { RepeatItemBuilder<T> } itemGenerat...
export interface RepeatAttribute<T> { each(itemGenerator: RepeatItemBuilder<T>): this; key(keyGenerator: KeyGeneratorFunc<T>): this; virtualScroll(virtualScrollOptions?: VirtualScrollOptions): this; template(type: string, itemBuilder: RepeatItemBuilder<T>, templateOptions?: TemplateOptions): this; ...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/repeat.d.ets#L190-L239
e92140316fa273c067d1be57d89c69c30699b47a
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseDataSet.ets
arkts
This is the base dataset of all DataSets. It's purpose is to implement critical methods provided by the IDataSet interface.
export default abstract class BaseDataSet<T extends EntryOhos> implements IDataSet<T> { /** * List representing all colors that are used for this DataSet */ protected mColors: JArrayList<Number> = new JArrayList<Number>(); /** * List representing all colors that are used for drawing the actual values for...
AST#export_declaration#Left export default AST#class_declaration#Left abstract class BaseDataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST...
export default abstract class BaseDataSet<T extends EntryOhos> implements IDataSet<T> { protected mColors: JArrayList<Number> = new JArrayList<Number>(); protected mValueColors: JArrayList<Number> = new JArrayList<Number>(); private mLabel: string = "DataSet"; protected mAxisDependency: AxisDependen...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L32-L511
a7fdbb3807ef4e0afa4e767fac85a720ef8e44c2
gitee
wangfh5/AICalendar-ArkTS.git
1551ca6690b1682c896eee5a1a963140d1323e00
entry/src/main/ets/entryability/EntryAbility.ets
arkts
AI解析相关接口和类
export interface ParsedEventData { summary: string; startTime: string; endTime: string; location?: string; description?: string; reminderMinutes: number; isRecurring: boolean; recurrenceFrequency?: string; recurrenceCount?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ParsedEventData AST#object_type#Left { AST#type_member#Left summary : 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 startTime : AST#type_annot...
export interface ParsedEventData { summary: string; startTime: string; endTime: string; location?: string; description?: string; reminderMinutes: number; isRecurring: boolean; recurrenceFrequency?: string; recurrenceCount?: number; }
https://github.com/wangfh5/AICalendar-ArkTS.git/blob/1551ca6690b1682c896eee5a1a963140d1323e00/entry/src/main/ets/entryability/EntryAbility.ets#L14-L24
188d844eca2d9da517cff6f8eb8461b200cda039
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/feature/ComputeFeature.ets
arkts
计算尺寸和坐标的变化 输入值: 输出值: 两个四边形, 一个是外部的四边形,宽高和父容器相同 二个是内部的四边形,四个角就是内部四个点的圆心 两个四边形中心点相同 内部核心参数: 中心点: width height
export default class ComputeFeature { /** * 初始化参数 */ // 容器宽高 containerWidth: number = 0; containerHeight: number = 0; imageWidth: number = 0; imageHeight: number = 0; materialWidth: number = 0; materialHeight: number = 0; // 素材最大和最小尺寸 minScale = 0.5; maxMaterialWidth: number = 0; maxMater...
AST#export_declaration#Left export default AST#class_declaration#Left class ComputeFeature AST#class_body#Left { /** * 初始化参数 */ // 容器宽高 AST#property_declaration#Left containerWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#...
export default class ComputeFeature { containerWidth: number = 0; containerHeight: number = 0; imageWidth: number = 0; imageHeight: number = 0; materialWidth: number = 0; materialHeight: number = 0; minScale = 0.5; maxMaterialWidth: number = 0; maxMaterialHeight: number = 0; minMaterialWid...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/feature/ComputeFeature.ets#L35-L135
507e5e1f24015da52e38db16f77129a39c5562a5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets
arkts
管理全局弹窗
export class GlobalStateDialogManager { private static globalStateDialogController: GlobalStateDialogNodeController = new GlobalStateDialogNodeController(); static getGlobalStateDialogNodeController(): GlobalStateDialogNodeController { return GlobalStateDialogManager.globalStateDialogController; } /** ...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalStateDialogManager AST#class_body#Left { AST#property_declaration#Left private static globalStateDialogController : AST#type_annotation#Left AST#primary_type#Left GlobalStateDialogNodeController AST#primary_type#Right AST#type_annotation#Right = ...
export class GlobalStateDialogManager { private static globalStateDialogController: GlobalStateDialogNodeController = new GlobalStateDialogNodeController(); static getGlobalStateDialogNodeController(): GlobalStateDialogNodeController { return GlobalStateDialogManager.globalStateDialogController; } stat...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets#L117-L136
446fcc36319331816e9c72cbc5a0dbfca78ae568
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/address/AddressCard.ets
arkts
buildAddressContent
构建地址内容区域 @param {Address} address - 地址数据 @returns {void} 无返回值
@Builder private buildAddressContent(address: Address): void { this.buildAddressHeader(address); if (this.showBottomBar) { this.buildDivider(); this.buildAddressBottomBar(address); } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildAddressContent AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left Address AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#typ...
@Builder private buildAddressContent(address: Address): void { this.buildAddressHeader(address); if (this.showBottomBar) { this.buildDivider(); this.buildAddressBottomBar(address); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/address/AddressCard.ets#L68-L76
9e70075265afad475f64924aabf7273bd35a69a6
github
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
arkts
loadHotCities
加载热门城市 - 连接真实后端API
private async loadHotCities() { try { this.isLoading = true; let httpRequest = http.createHttp(); let response = await httpRequest.request(`${Config.API.HOT_CITIES}?limit=10&with_weather=true`, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json'...
AST#method_declaration#Left private async loadHotCities AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_...
private async loadHotCities() { try { this.isLoading = true; let httpRequest = http.createHttp(); let response = await httpRequest.request(`${Config.API.HOT_CITIES}?limit=10&with_weather=true`, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json'...
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L81-L112
a07b59b50d9c4ff72d7b0a7f372a27538d54e2e8
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/model/AppRouterInfo.ets
arkts
路由表
export class RouterMapModel { routerMap: AppRouterInfo[] = []; }
AST#export_declaration#Left export AST#class_declaration#Left class RouterMapModel AST#class_body#Left { AST#property_declaration#Left routerMap : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AppRouterInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#L...
export class RouterMapModel { routerMap: AppRouterInfo[] = []; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/model/AppRouterInfo.ets#L28-L30
c34e37b1052b611a2f75a8841593406f9bb12895
gitee
ali5669/ArkTSShopping.git
7065d61468d80c143788532337c499eb9eaa5ffd
entry/src/main/ets/viewmodel/ItemModel.ets
arkts
购物车物品
export class CartItem{ item: Item quantity: number styles? : number[] = [] constructor
AST#export_declaration#Left export AST#ERROR#Left class CartItem { item : AST#ERROR#Left Item quantity : number styles ? : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_l...
export class CartItem{ item: Item quantity: number styles? : number[] = [] constructor
https://github.com/ali5669/ArkTSShopping.git/blob/7065d61468d80c143788532337c499eb9eaa5ffd/entry/src/main/ets/viewmodel/ItemModel.ets#L25-L31
08d1a2afeb4caa05a44059daf32318ab10f92bfd
github
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
Extract metadata for multiple online videos. A failure in one entry will not break the entire batch. @param videosSrc List of video URLs. @returns Extracted VideoInfo array (failed entries are skipped).
export async function extractOnlineVideosInfo(videosSrc: string[]): Promise<VideoInfo[]> { if (isEmpty(videosSrc)) { return []; } const validSources = videosSrc.filter(src => !isEmpty(src)); if (validSources.length === 0) { return []; } const settled = await Promise.allSettled( validSources.ma...
AST#export_declaration#Left export AST#function_declaration#Left async function extractOnlineVideosInfo AST#parameter_list#Left ( AST#parameter#Left videosSrc : 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#paramet...
export async function extractOnlineVideosInfo(videosSrc: string[]): Promise<VideoInfo[]> { if (isEmpty(videosSrc)) { return []; } const validSources = videosSrc.filter(src => !isEmpty(src)); if (validSources.length === 0) { return []; } const settled = await Promise.allSettled( validSources.ma...
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L73-L97
a5469164463790c499af51ce79f1f34a08bcea00
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/src/main/ets/util/Style.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Style { /** * Grid item card height. */ static readonly CARD_HEIGHT = 192; /** * List item weather width. */ static readonly WEATHER_ITEM_WIDTH = 80; /** * normal padding. */ static readonly NORMAL_PADDING = 14; /** * normal margin. */ static readonly NORMAL_MARGIN =...
AST#export_declaration#Left export AST#class_declaration#Left class Style AST#class_body#Left { /** * Grid item card height. */ AST#property_declaration#Left static readonly CARD_HEIGHT = AST#expression#Left 192 AST#expression#Right ; AST#property_declaration#Right /** * List item weather width. */ AST#prop...
export class Style { static readonly CARD_HEIGHT = 192; static readonly WEATHER_ITEM_WIDTH = 80; static readonly NORMAL_PADDING = 14; static readonly NORMAL_MARGIN = 14; static readonly NORMAL_SPACE = 12; static readonly GRID_GUTTER = 12; static readonly NORMAL_RADIUS = 16; stati...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/util/Style.ets#L16-L81
db3ab49c19315e93698f8e5a0235e178cf6365e6
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.prompt.d.ets
arkts
showActionMenu
Displays the menu. @param { ShowActionMenuOptions } options - Options. @syscap SystemCapability.ArkUI.ArkUI.Full @since 6 Displays the menu. @param { ShowActionMenuOptions } options - Options. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
static showActionMenu(options: ShowActionMenuOptions): void;
AST#method_declaration#Left static showActionMenu AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ShowActionMenuOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v...
static showActionMenu(options: ShowActionMenuOptions): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.prompt.d.ets#L441-L441
a9f7221a09e300d28b9df21d67dd3621dac3a114
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/model/ImageKnifeData.ets
arkts
request子线程处理时的请求参数
export interface RequestJobRequest { context: common.UIAbilityContext, src: string | number, headers?: Array<HeaderOptions>, allHeaders: Map<string, Object>, componentWidth: number, componentHeight: number, customGetImage?: (context: Context, src: string | PixelMap | Resource,headers?: Record<string,Objec...
AST#export_declaration#Left export AST#interface_declaration#Left interface RequestJobRequest AST#object_type#Left { AST#type_member#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right A...
export interface RequestJobRequest { context: common.UIAbilityContext, src: string | number, headers?: Array<HeaderOptions>, allHeaders: Map<string, Object>, componentWidth: number, componentHeight: number, customGetImage?: (context: Context, src: string | PixelMap | Resource,headers?: Record<string,Objec...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/model/ImageKnifeData.ets#L130-L159
3f04c0d8df6c06a90fe8e222eb7aef2943191aa2
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/mock/InterviewArticleMockData.ets
arkts
incrementViewCount
增加文章浏览量
static incrementViewCount(articleId: number): void { const article = InterviewArticleMockData.articles.find(a => a.id === articleId); if (article) { article.viewCount++; } }
AST#method_declaration#Left static incrementViewCount AST#parameter_list#Left ( AST#parameter#Left articleId : 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#p...
static incrementViewCount(articleId: number): void { const article = InterviewArticleMockData.articles.find(a => a.id === articleId); if (article) { article.viewCount++; } }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/mock/InterviewArticleMockData.ets#L976-L981
64a831cdf6f28f472d52700e34f0957ac10125e2
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
isDrawAxisLineEnabled
Returns true if the line alongside the axis should be drawn. @return
public isDrawAxisLineEnabled(): boolean { return this.mDrawAxisLine; }
AST#method_declaration#Left public isDrawAxisLineEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#m...
public isDrawAxisLineEnabled(): boolean { return this.mDrawAxisLine; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L221-L223
d1edeb73aa35828f627f7f17e02d714da233ce52
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SliderExample/entry/src/main/ets/common/Constants.ets
arkts
The config is a option of Slider which control scale.
export enum SliderScale { MIN = 0.5, MAX = 2.5, STEP = 0.1, };
AST#export_declaration#Left export AST#enum_declaration#Left enum SliderScale AST#enum_body#Left { AST#enum_member#Left MIN = AST#expression#Left 0.5 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MAX = AST#expression#Left 2.5 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left STEP = A...
export enum SliderScale { MIN = 0.5, MAX = 2.5, STEP = 0.1, };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SliderExample/entry/src/main/ets/common/Constants.ets#L37-L41
e1d4ac29a52410b3af916948b91d1c6cedc5533b
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/context/ContextUtil.ets
arkts
getHostCtx
获得当前元能力的 Context @returns {common.Context | undefined} hostContext;获取失败返回 undefined
static getHostCtx(): common.Context | undefined { return ContextUtil.getUICtx().getHostContext(); }
AST#method_declaration#Left static getHostCtx AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#un...
static getHostCtx(): common.Context | undefined { return ContextUtil.getUICtx().getHostContext(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/context/ContextUtil.ets#L67-L69
21b93066cfc86265de3589f10969ae204cd29ea0
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWarmPlayerView.ets
arkts
onCastPlayDeviceState
投屏设备状体事件回调。 @param state. 0 设备已准备好可以播放。1:设备已断开
onCastPlayDeviceState(state: number){ this.isCasting = state == 0? true :false; }
AST#method_declaration#Left onCastPlayDeviceState AST#parameter_list#Left ( AST#parameter#Left state : 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#expression_statement#Left AST#...
onCastPlayDeviceState(state: number){ this.isCasting = state == 0? true :false; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L229-L231
3d8e50c0f786262c1e93716a8b77ef31aaa82685
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/EditSchedule.ets
arkts
getEndDateString
获取结束日期字符串。
private getEndDateString(): string { if (this.schedule.endYear === this.currentTime.getFullYear() && this.schedule.endMonth === this.currentTime.getMonth() + 1 && this.schedule.endDate === this.currentTime.getDate()) { return '今日到期'; } else if (this.schedule.endYear === this.currentTime.getFullYea...
AST#method_declaration#Left private getEndDateString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_express...
private getEndDateString(): string { if (this.schedule.endYear === this.currentTime.getFullYear() && this.schedule.endMonth === this.currentTime.getMonth() + 1 && this.schedule.endDate === this.currentTime.getDate()) { return '今日到期'; } else if (this.schedule.endYear === this.currentTime.getFullYea...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/EditSchedule.ets#L1053-L1065
dd149709e98c6d819ce3a0a2abfb9536cee6f454
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarUtils.ets
arkts
getMonthName
获取农历月份名称 @param month 农历月份 @param isLeapMonth 是否闰月 @returns 月份名称
static getMonthName(month: number, isLeapMonth: boolean = false): string { const monthName = LunarUtils.LUNAR_MONTHS[month - 1] || ''; return isLeapMonth ? `闰${monthName}` : monthName; }
AST#method_declaration#Left static getMonthName AST#parameter_list#Left ( AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : AST#type_annotation#Left AST#primary_type#Left boolean AST#pr...
static getMonthName(month: number, isLeapMonth: boolean = false): string { const monthName = LunarUtils.LUNAR_MONTHS[month - 1] || ''; return isLeapMonth ? `闰${monthName}` : monthName; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L396-L399
d410e8683ac81e548476ef65321bfbf6c011d164
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/IMClientManager.ets
arkts
registerSocketEvent
注册MobileIMSDK框架开放各种事件监听。
private registerSocketEvent() { let emiter: common.EventHub = this.getEmitter(); /* * 本地用户的登陆结果回调事件通知(此事件发生时表示客户端已登陆/连接或重连完成)。 * * @param loginInfoRes 即PLoginInfoResponse对象,API文档地址:http://docs.52im.net/extend/docs/api/mobileimsdk/server_tcp/net/x52im/mobileimsdk/server/protocal/s/PLoginInfoResp...
AST#method_declaration#Left private registerSocketEvent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left emiter : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . EventHub AST#...
private registerSocketEvent() { let emiter: common.EventHub = this.getEmitter(); emiter.on(SocketEvent.SOCKET_EVENT_ON_LOGIN_RESPONSE, (loginInfoRes: PLoginInfoResponse) => { if (loginInfoRes) { let code = loginInfoRes.code; this.getLog().info('[应用层] 本客户端 SOCKET_EVENT_ON_L...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/IMClientManager.ets#L115-L255
fc388990f694eb3602e6966fb9da190baab49758
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.sendableResourceManager.d.ets
arkts
Contains resource descriptor information. @typedef {_Resource} @syscap SystemCapability.Global.ResourceManager @crossplatform @atomicservice @since 12
export type Resource = _Resource;
AST#export_declaration#Left export AST#type_declaration#Left type Resource = AST#type_annotation#Left AST#primary_type#Left _Resource AST#primary_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
export type Resource = _Resource;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.sendableResourceManager.d.ets#L72-L72
cccb6bda23b9c09acaa3a5c9cbbb6b14fefc9360
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/model/ColorModel.ets
arkts
表示 RGB 颜色模型的类。 RGB 颜色模型由红色、绿色和蓝色三种颜色组成。 每种颜色的值范围为 0 到 255。
export class RgbType { /** 红色分量,范围为 0-255。默认为 0。 */ red: number = 0; /** 绿色分量,范围为 0-255。默认为 0。 */ green: number = 0; /** 蓝色分量,范围为 0-255。默认为 0。 */ blue: number = 0; }
AST#export_declaration#Left export AST#class_declaration#Left class RgbType AST#class_body#Left { /** 红色分量,范围为 0-255。默认为 0。 */ AST#property_declaration#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#pro...
export class RgbType { red: number = 0; green: number = 0; blue: number = 0; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/ColorModel.ets#L22-L29
5f94933496889c7a33fb1179dbce56c851025923
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UsingWebMultimedia/entry2/src/main/ets/entry2ability/Entry2Ability.ets
arkts
onCreate
[StartExclude allow_subsequent_rendering_to_use_ui]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UsingWebMultimedia/entry2/src/main/ets/entry2ability/Entry2Ability.ets#L23-L25
580d60efb3c12b0827b837325801aa5f65ac9684
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.collections.d.ets
arkts
getIndexOf
Locates the first occurrence of a certain bit value within a range of bits in a bit vector. @param { number } element - Element to be Located (0 means 0, else means 1). @param { number } fromIndex - The starting position of the index, containing the value at that index position. @param { number } toIndex - The end of ...
getIndexOf(element: number, fromIndex: number, toIndex: number): number;
AST#method_declaration#Left getIndexOf AST#parameter_list#Left ( AST#parameter#Left element : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
getIndexOf(element: number, fromIndex: number, toIndex: number): number;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L12394-L12394
07c6453ff7b7efb8814c6b01b8029673bce6224b
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerComponent.ets
arkts
toggleMode
切换模式(递增/递减)
private toggleMode() { this.stopTimer(); this.isIncrementing = !this.isIncrementing; this.isPaused = false; if (this.isIncrementing) { this.statusPrompt = '超时,' + "开始正向计时"; this.statusPromptColor = Color.Red; } // 切换模式时重置时间 this.currentSeconds = this.isIncrementing ? 0 : this.tot...
AST#method_declaration#Left private toggleMode 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 this AST#expression#Right . stopTimer AST#mem...
private toggleMode() { this.stopTimer(); this.isIncrementing = !this.isIncrementing; this.isPaused = false; if (this.isIncrementing) { this.statusPrompt = '超时,' + "开始正向计时"; this.statusPromptColor = Color.Red; } this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L200-L211
f7d5779a97ddde7d5387f63ee6e75e4badb00a30
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Calculate the size of a folder and its containing items recursively in a sync way. @param path A string, the path of the folder. @returns A number, the size of that folder.
export function get_folder_size_Sync(path: string, log: boolean) { let sum = fs.statSync(path).size; try { let dir_list = fs.listFileSync(path); for (let index = 0; index < dir_list.length; index++) { sum += get_folder_size_Sync(path + '/' + dir_list[index], false) } } catch (e) { } if (log...
AST#export_declaration#Left export AST#function_declaration#Left function get_folder_size_Sync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Lef...
export function get_folder_size_Sync(path: string, log: boolean) { let sum = fs.statSync(path).size; try { let dir_list = fs.listFileSync(path); for (let index = 0; index < dir_list.length; index++) { sum += get_folder_size_Sync(path + '/' + dir_list[index], false) } } catch (e) { } if (log...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L620-L634
ac962c61a3dde6b4099c09661fe5e99217bde6ee
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getEpisode
获取分集信息 @param id 分集id @returns
public getEpisode(id: string): Promise<FinItem> { return this.requireApi().getEpisode(id) }
AST#method_declaration#Left public getEpisode AST#parameter_list#Left ( AST#parameter#Left id : 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 Pro...
public getEpisode(id: string): Promise<FinItem> { return this.requireApi().getEpisode(id) }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L125-L127
c15d38047fe01fa5b1580a01665cfa2ac3d1b2a6
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
has
检查缓存的Preferences实例中是否包含名为给定Key的存储键值对 @param key @returns
static async has(key: string, preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<boolean> { let preferences = await PreferencesUtil.getPreferences(preferenceName); //获取实例 return preferences.has(key); }
AST#method_declaration#Left static async has 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 preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static async has(key: string, preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<boolean> { let preferences = await PreferencesUtil.getPreferences(preferenceName); return preferences.has(key); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L204-L207
ceb52de37729b1e7282d85b3b645fd8389127487
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceSearch.d.ets
arkts
Function settings in the selection area (right). @typedef OperationParams @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
export interface OperationParams { /** * Function bits attached to the search area (right). * * @type { ?OperationOption }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ auxiliaryItem?: OperationOption; /** * Function bits independent of search area (right). ...
AST#export_declaration#Left export AST#interface_declaration#Left interface OperationParams AST#object_type#Left { /** * Function bits attached to the search area (right). * * @type { ?OperationOption }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#type_member#Lef...
export interface OperationParams { auxiliaryItem?: OperationOption; independentItem?: OperationOption; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceSearch.d.ets#L739-L758
a6297db68948c000cf2f079152b56d27500cf125
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/variable_scope/static_variable/static_variable_001_T.ets
arkts
Introduction 类静态变量
export function static_variable_001_T(taint_src : string) { A.data = taint_src; taint.Sink(A.data); }
AST#export_declaration#Left export AST#function_declaration#Left function static_variable_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function static_variable_001_T(taint_src : string) { A.data = taint_src; taint.Sink(A.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/variable_scope/static_variable/static_variable_001_T.ets#L6-L10
55b041df69f3068999e95371b5307fe03351c559
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets
arkts
totalCount
获取当前数据长度 @returns
public totalCount(): number { return this.dataList.length; }
AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
public totalCount(): number { return this.dataList.length; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets#L143-L145
ab0dea2deeca69908659262155e9c87af2760efa
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MePage.ets
arkts
buildOrderSection
构建订单区域 @returns {void} 无返回值
@Builder private buildOrderSection(): void { Card() { CardTitleCell({ leftIcon: $r("app.media.ic_order_fill"), leftIconColor: $r("app.color.main_order_icon"), title: $r("app.string.my_orders"), value: $r("app.string.view_all"), onTap: (): void => OrderNavigator.toList...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildOrderSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AS...
@Builder private buildOrderSection(): void { Card() { CardTitleCell({ leftIcon: $r("app.media.ic_order_fill"), leftIconColor: $r("app.color.main_order_icon"), title: $r("app.string.my_orders"), value: $r("app.string.view_all"), onTap: (): void => OrderNavigator.toList...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L292-L305
bca69c6cbe8d534499a89dd43b70eb4eadd2281d
github
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
createPhotoOutputFn
创建photoOutPut输出对象
createPhotoOutputFn(cameraManager: camera.CameraManager, photoProfileObj: camera.Profile): camera.PhotoOutput | undefined { let photoOutput: camera.PhotoOutput | undefined = undefined; try { photoOutput = cameraManager.createPhotoOutput(photoProfileObj); Logger.info(TAG, `createPhotoOutputFn suc...
AST#method_declaration#Left createPhotoOutputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ph...
createPhotoOutputFn(cameraManager: camera.CameraManager, photoProfileObj: camera.Profile): camera.PhotoOutput | undefined { let photoOutput: camera.PhotoOutput | undefined = undefined; try { photoOutput = cameraManager.createPhotoOutput(photoProfileObj); Logger.info(TAG, `createPhotoOutputFn suc...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L435-L446
1938c24585afb37c0f0593790d01d15d8019cffa
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderPayPage.ets
arkts
PayMethodCard
支付方式卡片 @returns {void} 无返回值
@Builder private PayMethodCard(): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: $r("app.string.pay_method_alipay"), center: true, hasBorder: true, iconBuilder: (): void => this.PayMetho...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PayMethodCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui...
@Builder private PayMethodCard(): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: $r("app.string.pay_method_alipay"), center: true, hasBorder: true, iconBuilder: (): void => this.PayMetho...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderPayPage.ets#L108-L139
a808d014ad3164c2e3c1c9afbf1bf9d7bca06a10
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ComposeListItem.d.ets
arkts
Declare type OperateIcon @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare type OperateIcon @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare type OperateIcon @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export declare class OperateIcon { /** * The content of text or the address of icon. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The content of text or the address of icon. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full *...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class OperateIcon AST#class_body#Left { /** * The content of text or the address of icon. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The content of text o...
export declare class OperateIcon { value: ResourceStr; symbolStyle?: SymbolGlyphModifier; action?: () => void; accessibilityText?: ResourceStr; accessibilityDescription?: ResourceStr; accessibilityLevel?: string; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L217-L339
6b2c4ad945187bdb906390ac9ad093cfa0a10f9a
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/DetailPage.ets
arkts
initData
初始化页面数据
initData() { this.repeatSettingArr = [ new AlarmSettingItem(DetailConstants.DEFAULT_STRING_REPEAT, this.alarmItem.repeatType, AlarmSettingTypes.REPEAT) ]; this.alarmSettingInfoArr = [ new AlarmSettingItem(DetailConstants.DEFAULT_STRING_ALARM_NAME, this.alarmItem.name, AlarmSettin...
AST#method_declaration#Left initData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . repeatSettingArr AST#member_expression#Ri...
initData() { this.repeatSettingArr = [ new AlarmSettingItem(DetailConstants.DEFAULT_STRING_REPEAT, this.alarmItem.repeatType, AlarmSettingTypes.REPEAT) ]; this.alarmSettingInfoArr = [ new AlarmSettingItem(DetailConstants.DEFAULT_STRING_ALARM_NAME, this.alarmItem.name, AlarmSettin...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/DetailPage.ets#L60-L74
c06208484d2a29a70848232b71f2bbedc4189075
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/common/ErrorHandler.ets
arkts
getDefaultSuggestions
获取默认建议
private getDefaultSuggestions(type: ErrorType): string[] { const suggestionMap: Record<ErrorType, string[]> = { [ErrorType.NETWORK]: [ '检查WiFi或移动数据连接', '尝试切换网络环境', '稍后重试' ], [ErrorType.VALIDATION]: [ '检查必填字段是否完整', '确认日期格式是否正确', '验证联系方式格式' ], ...
AST#method_declaration#Left private getDefaultSuggestions AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ErrorType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#arra...
private getDefaultSuggestions(type: ErrorType): string[] { const suggestionMap: Record<ErrorType, string[]> = { [ErrorType.NETWORK]: [ '检查WiFi或移动数据连接', '尝试切换网络环境', '稍后重试' ], [ErrorType.VALIDATION]: [ '检查必填字段是否完整', '确认日期格式是否正确', '验证联系方式格式' ], ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/ErrorHandler.ets#L183-L223
083ab94eb7e1ff4fe16dd28084e24da599a15d28
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinI.ets
arkts
SpinI
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinI { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local scaleSize: number = this.spinSize * 0.75; @Local tran1: number = 0; private oldSize: number = this.spinSize; aboutToAppear(): void { this.oldSize = this.spinSize; this.scaleSiz...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinI AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinI { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local scaleSize: number = this.spinSize * 0.75; @Local tran1: number = 0; private oldSize: number = this.spinSize; aboutToAppear(): void { this.oldSize = this.spinSize; this.scaleSiz...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinI.ets#L22-L111
a13acea1da81861f54546ece7453ee73a0b8ee8c
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Box.ets
arkts
日份中的一个Box
export class Box { // MARK: - 私有属性 /** * x: 相距此Piece的base的 距离(天数) (start from 0) */ private _distance: DistanceFromBase; /** * pieceNo */ private _pieceNo: number; // MARK: - Getter 方法 /** * 获取距离 */ get distance(): DistanceFromBase { return this._distance; } /** * 获取pie...
AST#export_declaration#Left export AST#class_declaration#Left class Box AST#class_body#Left { // MARK: - 私有属性 /** * x: 相距此Piece的base的 距离(天数) (start from 0) */ AST#property_declaration#Left private _distance : AST#type_annotation#Left AST#primary_type#Left DistanceFromBase AST#primary_type#Right AST#type_annotatio...
export class Box { private _distance: DistanceFromBase; private _pieceNo: number; get distance(): DistanceFromBase { return this._distance; } get pieceNo(): number { return this._pieceNo; } get num(): number { return this.pieceNo + this.distance; } constr...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L6-L119
17c1b69fad529dbd0cae09c73611eb117c7700b7
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
arkts
getLocalDeviceInfo
Obtains local device information.
getLocalDeviceInfo(): void { if (this.myDeviceManager === undefined) { Logger.error('RemoteDeviceModel', 'getLocalDeviceInfo deviceManager has not initialized'); return; } try { this.localDevice = this.myDeviceManager.getLocalDeviceInfoSync(); this.localDevice.deviceName = CommonCon...
AST#method_declaration#Left getLocalDeviceInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Le...
getLocalDeviceInfo(): void { if (this.myDeviceManager === undefined) { Logger.error('RemoteDeviceModel', 'getLocalDeviceInfo deviceManager has not initialized'); return; } try { this.localDevice = this.myDeviceManager.getLocalDeviceInfoSync(); this.localDevice.deviceName = CommonCon...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets#L87-L100
2157473100b4d3b2faeabfa05082f724448bf9f1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
isShowing
当前弹窗是否显示 @param dialogId 目前弹框id
static isShowing(dialogId: string): boolean { return ActionBaseCore.getInstance().exist(dialogId); }
AST#method_declaration#Left static isShowing AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_...
static isShowing(dialogId: string): boolean { return ActionBaseCore.getInstance().exist(dialogId); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L303-L305
21f2b5fe611c6c14926a4802f98d60f43ce51066
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/IDateTimePickerOptions.ets
arkts
日期时间选择器(DatePicker)参数配置接口 @extends BasePickerOptions
export interface IDateTimePickerOptions extends IBasePickerOptions { /** * 日期选择类型 * @description 格式化类型(如:YmdHms、YmdHm等) */ dateType: DateType; /** * 当前选中日期(可选) * @description 未设置时默认使用系统当前日期 */ selected?: Date; /** * 可选日期范围起始值(可选) * @default 1900-01-01 00:00:00 */ start?: Date; ...
AST#export_declaration#Left export AST#interface_declaration#Left interface IDateTimePickerOptions AST#extends_clause#Left extends IBasePickerOptions AST#extends_clause#Right AST#object_type#Left { /** * 日期选择类型 * @description 格式化类型(如:YmdHms、YmdHm等) */ AST#type_member#Left dateType : AST#type_annotation#Left AS...
export interface IDateTimePickerOptions extends IBasePickerOptions { dateType: DateType; selected?: Date; start?: Date; end?: Date; onAction: ActionDateCallback; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/IDateTimePickerOptions.ets#L8-L37
ba441d63862c96008d6008de073c7c958a58d778
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/AddressDetailPage.ets
arkts
buildDefaultAddressCard
构建默认地址开关卡片 @returns {void} 无返回值
@Builder private buildDefaultAddressCard(): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: $r("app.string.set_default_address"), label: $r("app.string.default_address_tip"), center: true, ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildDefaultAddressCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#L...
@Builder private buildDefaultAddressCard(): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: $r("app.string.set_default_address"), label: $r("app.string.default_address_tip"), center: true, ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressDetailPage.ets#L180-L196
57eb62aedb14dce425fb056f134f68846f442447
github
queueit/harmony-sdk.git
ba7b4b38c03730bfbe305789acba6db0012d5f5c
entry/src/main/ets/pages/DemoPage.ets
arkts
getDemoPreferences
--- Preference Helpers for Demo App ---
async getDemoPreferences(): Promise<preferences.Preferences> { const context = this.getUIContext()?.getHostContext() as common.Context; return await preferences.getPreferences(context, DEMO_PREFS_NAME); }
AST#method_declaration#Left async getDemoPreferences AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualifie...
async getDemoPreferences(): Promise<preferences.Preferences> { const context = this.getUIContext()?.getHostContext() as common.Context; return await preferences.getPreferences(context, DEMO_PREFS_NAME); }
https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/entry/src/main/ets/pages/DemoPage.ets#L67-L70
25fad57c8c4b81ad762ce81c8dc952ff9b151f9f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/view/SmsLoginPage.ets
arkts
SmsLoginContent
短信登录页面内容视图 @returns {void} 无返回值
@Builder private SmsLoginContent(): void { AnimatedAuthPage({ title: $r("app.string.welcome_login") }) { PhoneInputField({ phone: this.phone, onPhoneChange: (value: string): void => { this.phone = value; this.vm.updatePhone(value); } }); SpaceVertical...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private SmsLoginContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#...
@Builder private SmsLoginContent(): void { AnimatedAuthPage({ title: $r("app.string.welcome_login") }) { PhoneInputField({ phone: this.phone, onPhoneChange: (value: string): void => { this.phone = value; this.vm.updatePhone(value); } }); SpaceVertical...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/SmsLoginPage.ets#L52-L108
1c5fb971877287658bbbf73e642a8e9181baee4f
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
提出问答问题 @param date @returns
export function askQuestion(content:string) { return axiosClient.post<any>({ url: `comment/lg/add`, checkResultCode:true, needJumpToLogin:true, checkLoginState:true, params: { 'articleId':8857, 'content':content, } }) }
AST#export_declaration#Left export AST#function_declaration#Left function askQuestion AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS...
export function askQuestion(content:string) { return axiosClient.post<any>({ url: `comment/lg/add`, checkResultCode:true, needJumpToLogin:true, checkLoginState:true, params: { 'articleId':8857, 'content':content, } }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L259-L270
b75249472cddfa987a65dc04a103169fbcc98307
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets
arkts
getWebData
获取网络数据
@Concurrent async function getWebData(url: string): Promise<Array<FriendMoment>> { Logger.info('getWebData onMessage start'); try { let webData: http.HttpResponse = await http.createHttp().request( url, { header: { 'Content-Type': 'application/json' }, connectTimeout: FriendMom...
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function getWebData AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right :...
@Concurrent async function getWebData(url: string): Promise<Array<FriendMoment>> { Logger.info('getWebData onMessage start'); try { let webData: http.HttpResponse = await http.createHttp().request( url, { header: { 'Content-Type': 'application/json' }, connectTimeout: FriendMom...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets#L344-L382
87529356ba3909972679efdceaf3cb26a387a332
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/danmakuplayer/src/main/ets/model/DanmakuParser.ets
arkts
弹幕解析类,提供解析弹幕数据方法以及弹幕展示方法,可根据弹幕的mock数据解析出每一条弹幕的样式、开始/结束位置、持续时间等
export class DanmakuParser extends BaseDanmakuParser { protected dispScaleX: number = 0; protected dispScaleY: number = 0; parse(): IDanmakus | ESObject { class danmakus { sortType: number = 0; duplicateMergingEnabled: boolean = false; baseComparator: ESObject; } if (this.mDataSour...
AST#export_declaration#Left export AST#class_declaration#Left class DanmakuParser extends AST#type_annotation#Left AST#primary_type#Left BaseDanmakuParser AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left protected dispScaleX : AST#type_annotation#Left AST#primary_type...
export class DanmakuParser extends BaseDanmakuParser { protected dispScaleX: number = 0; protected dispScaleY: number = 0; parse(): IDanmakus | ESObject { class danmakus { sortType: number = 0; duplicateMergingEnabled: boolean = false; baseComparator: ESObject; } if (this.mDataSour...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/danmakuplayer/src/main/ets/model/DanmakuParser.ets#L32-L93
f3783690e07f98730657b566fb211ddfa0090a3a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语历史记录接口
export interface GreetingHistory { id: string; contactId: string; greetingId?: string; content: string; occasion: GreetingOccasion; style: GreetingStyle; method: GreetingMethod; status: GreetingStatus; sentAt?: string; createdAt: string; metadata?: Record<string, string | number | boolean>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingHistory AST#object_type#Left { AST#type_member#Left id : 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 contactId : AST#type_annotation...
export interface GreetingHistory { id: string; contactId: string; greetingId?: string; content: string; occasion: GreetingOccasion; style: GreetingStyle; method: GreetingMethod; status: GreetingStatus; sentAt?: string; createdAt: string; metadata?: Record<string, string | number | boolean>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L362-L374
d66964e58c8a3abcc836f517017e2d60ea3814ff
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets
arkts
LazyForEachListPage
视频列表视图
@Builder LazyForEachListPage() { Column() { List() { LazyForEach(this.newsList, (news: NewsItem, index: number) => { ListItem() { XComponentVideo({ centerIndex: this.centerIndex, news: news, index: index }) } ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right LazyForEachListPage 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 LazyForEachListPage() { Column() { List() { LazyForEach(this.newsList, (news: NewsItem, index: number) => { ListItem() { XComponentVideo({ centerIndex: this.centerIndex, news: news, index: index }) } ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets#L124-L189
914e81cce8605ae6ee21a463b92a29539f8a636e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets
arkts
getUserData
[EndExclude Case4] Getting server-side user information in a business class
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { // 2.Storing user information data into AppStorage AppStorage.setOrCreate('userData', data); }) }
AST#method_declaration#Left getUserData 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#L...
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { AppStorage.setOrCreate('userData', data); }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets#L65-L70
e932c0254eb8b70fdff5f10bb6ed236971679194
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/components/ImageViewCrop.ets
arkts
ImageViewCrop
功能描述: 1.使用Image构建每一帧图片渲染的场景,从而形成相机效果 2.切换组件时清除不可见的页面信息,重新进入组件时重新进入相机 实现原理: 1.在初始相机模块时,调用onImageArrival(),将处理的width和height作为size,创建PixelMap,通过在Image中传入被@StorageLink修饰的变量stridePixel进行数据刷新,图片送显。 @param {boolean} isShowStridePixel - 是否显示拍摄image(必需) @param {image.PixelMap | undefined} stridePixel - 图像像素(必需) @param {number...
@Component export struct ImageViewCrop { @State isShowStridePixel: boolean = false; // 是否显示拍摄image @StorageLink('stridePixel') @Watch('onStridePixel') stridePixel: image.PixelMap | undefined = undefined; // 图像像素 @State cameraDeviceIndex: number = 0; // 相机设备索引 @State imageWidth: number = 1920; // 渲染相机的宽度 @Stat...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageViewCrop AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isShowStridePixel : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AS...
@Component export struct ImageViewCrop { @State isShowStridePixel: boolean = false; @StorageLink('stridePixel') @Watch('onStridePixel') stridePixel: image.PixelMap | undefined = undefined; @State cameraDeviceIndex: number = 0; @State imageWidth: number = 1920; @State imageHeight: number = 1080; @Storag...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/components/ImageViewCrop.ets#L34-L81
9c404296b16b0befa0d91b6721b117f27999fa7b
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/GiftComponent.ets
arkts
renderGiftItem
渲染礼物项
@Builder renderGiftItem(gift: VHGiftItem) { Column({ space: 6 }) { // 礼物图片(带红色边框选中效果) Image(gift.image_url) .width(60) .height(60) .objectFit(ImageFit.Cover) .borderRadius(8) .backgroundColor('#f0f0f0') // 选中时显示红色边框 .border({ width: this.selected...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right renderGiftItem AST#parameter_list#Left ( AST#parameter#Left gift : AST#type_annotation#Left AST#primary_type#Left VHGiftItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_b...
@Builder renderGiftItem(gift: VHGiftItem) { Column({ space: 6 }) { Image(gift.image_url) .width(60) .height(60) .objectFit(ImageFit.Cover) .borderRadius(8) .backgroundColor('#f0f0f0') .border({ width: this.selectedGiftId === gift.id ? 2 : 0, co...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/GiftComponent.ets#L64-L108
a8054d40919c5bc3c4830257ea753dbf7d0d18c9
gitee
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets
arkts
AlphabetIndexer Alphabetical index bar data.
export const TAB_VALUE = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'W', 'X', 'Y', 'Z'];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TAB_VALUE = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'A' AST#expression#Right , AST#expression#Left 'B' AST#expression#Right , AST#expression#Left 'C' AST#expression#Right , AST#expression#Left 'D...
export const TAB_VALUE = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'W', 'X', 'Y', 'Z'];
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets#L103-L104
66454d08fe0c1297653829e15b61a187e28970c4
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/pages/TaskPage.ets
arkts
In low-code mode, do not add anything to the build function, as it will be overwritten by the content generated by the .visual file in the build phase.
build() { }
AST#build_method#Left build ( ) AST#build_body#Left { } AST#build_body#Right AST#build_method#Right
build() { }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/pages/TaskPage.ets#L80-L82
26f4eb066860a0cdb5983bb106fe45ca5e7ae474
gitee
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/models/StringUtils.ets
arkts
uint8Array2String
Uint8Array 转 String @param input
uint8Array2String(input: Uint8Array) { let textDecoder = util.TextDecoder.create("utf-8", { ignoreBOM: true }) return textDecoder.decodeWithStream(input, { stream: false }); }
AST#method_declaration#Left uint8Array2String AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declarat...
uint8Array2String(input: Uint8Array) { let textDecoder = util.TextDecoder.create("utf-8", { ignoreBOM: true }) return textDecoder.decodeWithStream(input, { stream: false }); }
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/models/StringUtils.ets#L37-L40
d4202f9e3c347285a74844be55790dee6dd75e2f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/image/NetWorkImage.ets
arkts
NetWorkImage
@file 网络图片组件(仅设置背景色与圆角) @author Joker.X
@ComponentV2 export struct NetWorkImage { /** * 图片资源(URL / Resource / PixelMap) */ @Param model: string | Resource | PixelMap | null = null; /** * 图片大小(宽高相等) */ @Param sizeValue: Length | undefined = undefined; /** * 图片宽度 */ @Param widthValue: Length | undefined = undefined; /** ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct NetWorkImage AST#component_body#Left { /** * 图片资源(URL / Resource / PixelMap) */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right model : AST#type_annotation#Left AST#union_type#Left...
@ComponentV2 export struct NetWorkImage { @Param model: string | Resource | PixelMap | null = null; @Param sizeValue: Length | undefined = undefined; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param imageFit: ImageFit = Imag...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/NetWorkImage.ets#L7-L95
3e37347765f271541eef0674a759d84557b80d9d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Image Size
export const IMAGE_SIZE: number = 24;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left IMAGE_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#R...
export const IMAGE_SIZE: number = 24;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L99-L99
1abca8dfb4b2af318f83391f7679fd83ed003fce
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
mergeNotificationSettings
合并通知设置
private mergeNotificationSettings(current: NotificationSettings, updates: Partial<NotificationSettings>): NotificationSettings { const result: NotificationSettings = { enabled: updates.enabled !== undefined ? updates.enabled : current.enabled, methods: updates.methods !== undefined ? updates.methods : c...
AST#method_declaration#Left private mergeNotificationSettings AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left NotificationSettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primar...
private mergeNotificationSettings(current: NotificationSettings, updates: Partial<NotificationSettings>): NotificationSettings { const result: NotificationSettings = { enabled: updates.enabled !== undefined ? updates.enabled : current.enabled, methods: updates.methods !== undefined ? updates.methods : c...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L493-L505
767dd673754a52b40f655b6b2a88923ee8de468c
github
ClozyA/DonateAPPForHarmony.git
8eaf7f25a91137e457d43d438316eacec061c87b
entry/src/main/ets/componet/DonateComponets.ets
arkts
DonateComponets
@Entry
@Component export default struct DonateComponets { @State newitem: Array<Goods> = [] @State selectedIndex: number = -1 LeftScroller: Scroller = new Scroller() RightScroller: Scroller = new Scroller() @State itemHeight: number = 406 @State singleItemHeight: number = 101.75 @State indexNumber: number = 0 ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct DonateComponets AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right newitem : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#t...
@Component export default struct DonateComponets { @State newitem: Array<Goods> = [] @State selectedIndex: number = -1 LeftScroller: Scroller = new Scroller() RightScroller: Scroller = new Scroller() @State itemHeight: number = 406 @State singleItemHeight: number = 101.75 @State indexNumber: number = 0 ...
https://github.com/ClozyA/DonateAPPForHarmony.git/blob/8eaf7f25a91137e457d43d438316eacec061c87b/entry/src/main/ets/componet/DonateComponets.ets#L8-L82
cf1671db8b39a5d343dc7252f409f22baf8bc02e
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getAliveWords
获取活跃单词(未删除的单词)
getAliveWords(): WordUser[] { return this.allWords.filter(word => !word.deleted); }
AST#method_declaration#Left getAliveWords AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left r...
getAliveWords(): WordUser[] { return this.allWords.filter(word => !word.deleted); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L326-L328
374bd30d15c6c940910cf844f60bc8075f294107
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/view/Add/KeyBoardComponent.ets
arkts
clickItem
数字与运算符按键逻辑
clickItem(item: string) { if (this.amount.length > 12) { AlertDialog.show({ title: '呜呜', message: '您当前输入的数值过长。', autoCancel: true, alignment: DialogAlignment.Center, gridCount: 3, confirm: { value: '确认', action: () => { ...
AST#method_declaration#Left clickItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Le...
clickItem(item: string) { if (this.amount.length > 12) { AlertDialog.show({ title: '呜呜', message: '您当前输入的数值过长。', autoCancel: true, alignment: DialogAlignment.Center, gridCount: 3, confirm: { value: '确认', action: () => { ...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/Add/KeyBoardComponent.ets#L242-L268
25ea31762254dc870a6a3344d59e279901e27975
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/pages/HomePage.ets
arkts
DeviceStatusCard
设备状态卡片构建器
@Builder DeviceStatusCard() { Column({ space: 5 }) { // 卡片标题 Row({ space: 5 }) { Image($r("app.media.icon_energy")) .width(20) .height(20) Text("设备运行状态") .width(150) .fontSize(13) .fontWeight('bold') } .width('100%') .he...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeviceStatusCard AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_pa...
@Builder DeviceStatusCard() { Column({ space: 5 }) { Row({ space: 5 }) { Image($r("app.media.icon_energy")) .width(20) .height(20) Text("设备运行状态") .width(150) .fontSize(13) .fontWeight('bold') } .width('100%') .height('1...
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/HomePage.ets#L167-L222
a4f79278d8190992c452337cedae9cabcc40e21f
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/PathUtility.ets
arkts
removeLastSlashOfDirectoryIfExists
移除路径末尾的斜杠(如果存在) @param path 原始路径 @returns 处理后的路径
static removeLastSlashOfDirectoryIfExists(path: string | null): string | null { if (!path) return null; return path.endsWith('/') ? path.substring(0, path.length - 1) : path; }
AST#method_declaration#Left static removeLastSlashOfDirectoryIfExists AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AS...
static removeLastSlashOfDirectoryIfExists(path: string | null): string | null { if (!path) return null; return path.endsWith('/') ? path.substring(0, path.length - 1) : path; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L38-L41
a33ed62d24bb78cc6d33c990be249cd3d0640ae8
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/NodeOpusEngine.ets
arkts
应用约束60:使用export代替module.exports
export default NodeOpusEngine;
AST#export_declaration#Left export default AST#expression#Left NodeOpusEngine AST#expression#Right ; AST#export_declaration#Right
export default NodeOpusEngine;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/NodeOpusEngine.ets#L45-L45
5846bac366ed5b880463b06d11315c136ca8afd5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_asynchronous.ets
arkts
encryptMessagePromise
加密消息
async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('AES128|CCM'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, ccmParams); let encryptUpdate = await cipher.update(plainText); // ccm模式加密doFina...
AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par...
async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('AES128|CCM'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, ccmParams); let encryptUpdate = await cipher.update(plainText); ccmParams.aut...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_asynchronous.ets#L42-L49
a929d1bb70651456d30674b428111458eac2856d
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FuzzySceneOptimization/entry/src/main/ets/pages/MotionBlur.ets
arkts
motionBlurBuilder
modal page with dynamically blurred image settings
@Builder motionBlurBuilder() { Stack({ alignContent: Alignment.Bottom }) { Image($r('app.media.test')) .width('100%') .height('100%') .objectFit(ImageFit.Fill) .blur(13) // add motion blur effect Button('close') .width('90%') .height(40) .margin(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right motionBlurBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_pa...
@Builder motionBlurBuilder() { Stack({ alignContent: Alignment.Bottom }) { Image($r('app.media.test')) .width('100%') .height('100%') .objectFit(ImageFit.Fill) .blur(13) Button('close') .width('90%') .height(40) .margin({ bottom: this.bottomSafe...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FuzzySceneOptimization/entry/src/main/ets/pages/MotionBlur.ets#L51-L69
e19ce7cae4b3c7726798739193f088fac61c3a3e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/widgets/pages/WidgetCard2x2.ets
arkts
buildEmptyView
构建空状态视图
@Builder buildEmptyView() { Column({ space: 8 }) { Image($r('app.media.ic_birthday_empty')) .width(32) .height(32) .fillColor($r('app.color.text_secondary')) Text(this.widgetData.emptyText || '暂无生日') .fontSize(12) .fontColor($r('app.color.text_primary')) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_para...
@Builder buildEmptyView() { Column({ space: 8 }) { Image($r('app.media.ic_birthday_empty')) .width(32) .height(32) .fillColor($r('app.color.text_secondary')) Text(this.widgetData.emptyText || '暂无生日') .fontSize(12) .fontColor($r('app.color.text_primary')) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/widgets/pages/WidgetCard2x2.ets#L117-L141
e86a948473d2e1caedeca05bcf5a4b1425be548e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/CameraService.ets
arkts
createCamera
创建相机
async createCamera(surfaceId: string) { Logger.info("createCamera start") // 根据context获取CameraManager let cameraManager = camera.getCameraManager(AppStorage.Get('context')) // 获取Camera对象数组 let cameras = cameraManager.getSupportedCameras() // 没有相机就停止 if (cameras.length === 0) { Logger.e...
AST#method_declaration#Left async createCamera AST#parameter_list#Left ( AST#parameter#Left surfaceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_state...
async createCamera(surfaceId: string) { Logger.info("createCamera start") let cameraManager = camera.getCameraManager(AppStorage.Get('context')) let cameras = cameraManager.getSupportedCameras() if (cameras.length === 0) { Logger.error("createCamera: cameras length is 0.") ret...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/CameraService.ets#L56-L93
130453c8a88e349e17add343a24a568103158c6c
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleNotificationManager.ets
arkts
loadSettings
加载设置
private async loadSettings(): Promise<void> { try { const savedSettings = await StorageUtils.getObject<SimpleReminderSettings>('simple_notification_settings', this.reminderSettings); if (savedSettings) { this.reminderSettings = savedSettings; } hilog.info(0x0000, 'SimpleNotificationM...
AST#method_declaration#Left private async loadSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#...
private async loadSettings(): Promise<void> { try { const savedSettings = await StorageUtils.getObject<SimpleReminderSettings>('simple_notification_settings', this.reminderSettings); if (savedSettings) { this.reminderSettings = savedSettings; } hilog.info(0x0000, 'SimpleNotificationM...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L41-L51
f0d1f72629ad117a1942af659e4d74a3a559c261
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets
arkts
getSearchKeywordList
查询搜索关键词列表 @returns 搜索关键词列表响应
async getSearchKeywordList(): Promise<NetworkResponse<GoodsSearchKeyword[]>> { const resp: AxiosResponse<NetworkResponse<GoodsSearchKeyword[]>> = await NetworkClient.http.post("goods/search/keyword/list"); return resp.data; }
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[]>> { const resp: AxiosResponse<NetworkResponse<GoodsSearchKeyword[]>> = await NetworkClient.http.post("goods/search/keyword/list"); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets#L48-L52
3c812c92e2b8e8b97dc6d1667a8fb10372b0e600
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fontdynamicregistration/Index.ets
arkts
FontDynamicRegistration
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { FontDynamicRegistration } from './src/main/ets/components/FontDynamicRegistration';
AST#export_declaration#Left export { FontDynamicRegistration } from './src/main/ets/components/FontDynamicRegistration' ; AST#export_declaration#Right
export { FontDynamicRegistration } from './src/main/ets/components/FontDynamicRegistration';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fontdynamicregistration/Index.ets#L15-L15
143858e0096af5ad805b201d6eb0f02958a0574a
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets
arkts
onEncrypt
生成dlp文件
async onEncrypt() { Logger.info(TAG + 'new file and encrypt'); let flag = wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_PERSISTABLE_URI_PERMISSION; let targetBundleName = 'com.ohos.dlpmanager'; uriPermissionManager.grantUriPermission(this.myUri, flag, targetBundleN...
AST#method_declaration#Left async onEncrypt AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info ...
async onEncrypt() { Logger.info(TAG + 'new file and encrypt'); let flag = wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_PERSISTABLE_URI_PERMISSION; let targetBundleName = 'com.ohos.dlpmanager'; uriPermissionManager.grantUriPermission(this.myUri, flag, targetBundleN...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets#L200-L224
b1df73c0c796399857269323743978ecb570f2bb
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/AddressListPage.ets
arkts
构建地址列表页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.address_list_title"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { ColumnStart({ f...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.address_...
build() { AppNavDestination({ title: $r("app.string.address_list_title"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { ColumnStart({ f...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressListPage.ets#L41-L78
0cdd1d8e62326c63b78e29c513afe0a0026d2ee0
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/TextToSpeechService.ets
arkts
clearWatchdog
清除超时看门狗
private clearWatchdog() { if (this.watchdogTimer !== -1) { clearTimeout(this.watchdogTimer); this.watchdogTimer = -1; } }
AST#method_declaration#Left private clearWatchdog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expres...
private clearWatchdog() { if (this.watchdogTimer !== -1) { clearTimeout(this.watchdogTimer); this.watchdogTimer = -1; } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L289-L294
f7ed654132974e46480e428693106ba8c6e258f7
github
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/view/dust/DustMonitorCard.ets
arkts
getPm10Color
辅助函数:根据PM10值返回颜色
private getPm10Color(pm10: number): string { if (pm10 > 200) return '#FF4D4F'; // 红色:重度污染 if (pm10 > 150) return '#FAAD14'; // 黄色:中度污染 if (pm10 > 50) return '#FADB14'; // 浅黄色:轻度污染 return '#52C41A'; // 绿色:良好 }
AST#method_declaration#Left private getPm10Color AST#parameter_list#Left ( AST#parameter#Left pm10 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
private getPm10Color(pm10: number): string { if (pm10 > 200) return '#FF4D4F'; if (pm10 > 150) return '#FAAD14'; if (pm10 > 50) return '#FADB14'; return '#52C41A'; }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/view/dust/DustMonitorCard.ets#L155-L160
bd033f8a9db1037c4316c8e83fc9694492b99946
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets
arkts
Uint8Array转十六进制
export function uint8ArrayToHexStr(data: Uint8Array): string { let hexString = ''; let i: number; for (i = 0; i < data.length; i++) { let char = ('00' + data[i].toString(16)).slice(-2); hexString += char; } return hexString; }
AST#export_declaration#Left export AST#function_declaration#Left function uint8ArrayToHexStr AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation...
export function uint8ArrayToHexStr(data: Uint8Array): string { let hexString = ''; let i: number; for (i = 0; i < data.length; i++) { let char = ('00' + data[i].toString(16)).slice(-2); hexString += char; } return hexString; }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L113-L121
c1d49ea065f5752e9030c7960c1e46e40caba939
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
通用阴影接口
export interface CommonShadow { radius: number; color: string; offsetX: number; offsetY: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CommonShadow AST#object_type#Left { AST#type_member#Left radius : 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 color : AST#type_annotation#Le...
export interface CommonShadow { radius: number; color: string; offsetX: number; offsetY: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L315-L320
d0db9bbcaa9ac99e3b87ecb59d61d289100d0fad
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/DBPlan_Piece_Box_learn.ets
arkts
MARK: - Plan的Day的Box / 该结构体表示一个学习计划中某个Piece的盒子(Box)信息
export class DBBox { planId : number | null = null; // 计划ID num : number | null = null; // Box编号 distance : number | null = null; // 距离值 pieceNo : number | null = null; // 该Box所属的Piece编号 }
AST#export_declaration#Left export AST#class_declaration#Left class DBBox AST#class_body#Left { AST#property_declaration#Left planId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annota...
export class DBBox { planId : number | null = null; num : number | null = null; distance : number | null = null; pieceNo : number | null = null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlan_Piece_Box_learn.ets#L23-L28
537f31937129d31dcf3f8f4a770aa317aad06b67
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/common/TagRow.ets
arkts
TagRow
标签行组件 水平排列标签,支持自动换行
@Component export struct TagRow { @Prop tags: string[]; build() { Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row }) { ForEach(this.tags, (tag: string, index: number) => { Text(tag) .fontSize(11) .fontColor($r('app.color.tag_text')) .backgroundColor($r('app....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TagRow AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right tags : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AS...
@Component export struct TagRow { @Prop tags: string[]; build() { Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row }) { ForEach(this.tags, (tag: string, index: number) => { Text(tag) .fontSize(11) .fontColor($r('app.color.tag_text')) .backgroundColor($r('app....
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/common/TagRow.ets#L6-L23
300b55771b9d3356f015bbf2c419cc880f501926
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhToast.ets
arkts
hide
/ 隐藏加载框
public static hide() { DialogHelper.closeLoading(); }
AST#method_declaration#Left public static hide 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 DialogHelper AST#expression#Right . closeLoad...
public static hide() { DialogHelper.closeLoading(); }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhToast.ets#L79-L81
3d3f8a3bbca5a04dbac505916b117cf856144021
github