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
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ModelConfigService.ets
arkts
模型配置接口
export interface ModelConfig { provider: ModelProvider; modelId: string; apiKey: string; baseUrl?: string; maxTokens?: number; temperature?: number; isCustom: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ModelConfig AST#object_type#Left { AST#type_member#Left provider : AST#type_annotation#Left AST#primary_type#Left ModelProvider AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left modelId : AST#type_ann...
export interface ModelConfig { provider: ModelProvider; modelId: string; apiKey: string; baseUrl?: string; maxTokens?: number; temperature?: number; isCustom: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ModelConfigService.ets#L29-L37
76c9d71c6639869d2e669b8f4a5261001897f6dc
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/settings/SettingsService.ets
arkts
loadSettings
加载设置 @returns 加载的设置
private async loadSettings(): Promise<AppSettings | null> { try { const settings = await this.preferencesService.getObject<AppSettings>( SettingsService.SETTINGS_KEYS.APP_SETTINGS ); return settings ?? null; } catch (error) { hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_A...
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#union_type#Left AST#primary_type#Left AppSettings AST#primary_type#Right | AST...
private async loadSettings(): Promise<AppSettings | null> { try { const settings = await this.preferencesService.getObject<AppSettings>( SettingsService.SETTINGS_KEYS.APP_SETTINGS ); return settings ?? null; } catch (error) { hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_A...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L758-L768
be472a0c6a6d4fe3f2125ab64f6b6735e1f66481
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextInputBuilderProxy.ets
arkts
cancelButton
清除按钮样式配置 @description 设置输入框右侧的清除按钮样式 @param cancelButton @returns
cancelButton(cancelButton: CancelButtonOptions) { this.builderOptions.cancelButton = cancelButton; return this }
AST#method_declaration#Left cancelButton AST#parameter_list#Left ( AST#parameter#Left cancelButton : AST#type_annotation#Left AST#primary_type#Left CancelButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expres...
cancelButton(cancelButton: CancelButtonOptions) { this.builderOptions.cancelButton = cancelButton; return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextInputBuilderProxy.ets#L68-L71
fc85bef70dba641bf5966b6adeea2c9786cc60e2
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
customTextImgBuilder
自定义文本和图片
@Builder customTextImgBuilder(content: ResourceStr, src: Resource) { CustomImageView({ content: content, src: src }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customTextImgBuilder AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left src : AST#type_ann...
@Builder customTextImgBuilder(content: ResourceStr, src: Resource) { CustomImageView({ content: content, src: src }) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L1307-L1310
4094a17d35138c4a1e4f41109602c5b79735264a
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/class.ets
arkts
aboutToAppear
**************************build**************************//
aboutToAppear(): void { this.getShowContent() this.getShowTrainContent() }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { this.getShowContent() this.getShowTrainContent() }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/class.ets#L575-L578
28b9b720196dfdada564afc04a8f60d324d200c5
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/lazyForEach.d.ets
arkts
Defines delete operation. @interface DataDeleteOperation @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export interface DataDeleteOperation { /** * How to operate deleted data. * * @type { DataOperationType.DELETE } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ type: DataOperationType; /** * Index of deleted data. ...
AST#export_declaration#Left export AST#interface_declaration#Left interface DataDeleteOperation AST#object_type#Left { /** * How to operate deleted data. * * @type { DataOperationType.DELETE } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 ...
export interface DataDeleteOperation { type: DataOperationType; index: number; count?: number; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L156-L189
5a1e045de9ca0e4e3960d8876dd720ea6bffe3ed
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/timeto/TimeToManager.ets
arkts
isTimeToByName
------------------------- 按 typeName 操作的通用方法 ------------------------- 检查指定 typeName 是否已到执行时间
public static isTimeToByName(typeName: string, limitMinute: number): boolean { try { const prefs = TimeToManager._getPrefs(); const lastTimeStr = prefs.getSync(TimeToKeys.lastTime(typeName), '') as string; if (lastTimeStr) { const lastTime = DateUtils.toDate(lastTimeStr); if (last...
AST#method_declaration#Left public static isTimeToByName AST#parameter_list#Left ( AST#parameter#Left typeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left limitMinute : AST#type_annotation#Left AST#primary_type#Left nu...
public static isTimeToByName(typeName: string, limitMinute: number): boolean { try { const prefs = TimeToManager._getPrefs(); const lastTimeStr = prefs.getSync(TimeToKeys.lastTime(typeName), '') as string; if (lastTimeStr) { const lastTime = DateUtils.toDate(lastTimeStr); if (last...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/timeto/TimeToManager.ets#L68-L89
ad171d08b5ee5e08ea28e87f21a11358fea4d0c8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/SimpleLunarCalendar.ets
arkts
runTest
测试验证方法
static runTest(): string { const testCases: TestCase[] = [ { date: [2025, 1, 29], expected: '春节', desc: '2025-01-29应显示春节' }, { date: [2025, 2, 27], expected: '正月三十', desc: '2025-02-27应显示正月三十' }, { date: [2025, 2, 28], expected: '二月初一', desc: '2025-02-28应显示二月初一' }, { date: [2025, 9, 10], expe...
AST#method_declaration#Left static runTest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left testCase...
static runTest(): string { const testCases: TestCase[] = [ { date: [2025, 1, 29], expected: '春节', desc: '2025-01-29应显示春节' }, { date: [2025, 2, 27], expected: '正月三十', desc: '2025-02-27应显示正月三十' }, { date: [2025, 2, 28], expected: '二月初一', desc: '2025-02-28应显示二月初一' }, { date: [2025, 9, 10], expe...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/SimpleLunarCalendar.ets#L151-L180
c9e7343b1436ec1b99eb8075194c94f6080ee2d6
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
padding
Sets the left and right padding of the toolbar. @param { LengthMetrics } padding - left and right padding. @returns { ToolBarModifier } returns the instance of the ToolBarModifier. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 13
padding(padding: LengthMetrics): ToolBarModifier;
AST#method_declaration#Left padding AST#parameter_list#Left ( AST#parameter#Left padding : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier AST#pri...
padding(padding: LengthMetrics): ToolBarModifier;
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L261-L261
9403f32935689a39e03174ae7ac48c4f80ebd302
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/pages/Index.ets
arkts
onPageShow
路由返回后刷新页面
onPageShow() { AppStorage.setOrCreate('flashPage', !AppStorage.get<number>('flashPage')); }
AST#method_declaration#Left onPageShow 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 AppStorage AST#expression#Right . setOrCreate AST#mem...
onPageShow() { AppStorage.setOrCreate('flashPage', !AppStorage.get<number>('flashPage')); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/pages/Index.ets#L54-L56
c609b4dd42312b82bde5ef07ccaaa7a180e33964
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/eventbus/EventBus.ets
arkts
emit
发送事件
emit(event: string, data?: EventData): void { const callbacks = this.events.get(event); if (callbacks) { callbacks.forEach(callback => { try { callback(data); } catch (error) { Logger.error('EventBus', `Error in event callback: ${String(error)}`); } }); ...
AST#method_declaration#Left emit AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left EventData AST#primary_type#Right A...
emit(event: string, data?: EventData): void { const callbacks = this.events.get(event); if (callbacks) { callbacks.forEach(callback => { try { callback(data); } catch (error) { Logger.error('EventBus', `Error in event callback: ${String(error)}`); } }); ...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/eventbus/EventBus.ets#L70-L82
f47c6490c24f2a02dc6d3a2905084d99de910015
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets
arkts
buildCookies
构建请求的cookies @param headers 传入的自定义cookies @returns 拼接完公共系列全部完整cookies
private static buildCookies(cookies?: Record<string, string>): rcp.RequestCookies { //需要添加的header对象 let addCookie: rcp.RequestCookies = {}; //获取全局header配置 let cfg = efRcp.builder().configuration; //如果配置中有headers if (cfg && cfg.cookies) { Object.entries(cfg.cookies).forEach((row) => { ...
AST#method_declaration#Left private static buildCookies AST#parameter_list#Left ( AST#parameter#Left cookies ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , ...
private static buildCookies(cookies?: Record<string, string>): rcp.RequestCookies { let addCookie: rcp.RequestCookies = {}; let cfg = efRcp.builder().configuration; if (cfg && cfg.cookies) { Object.entries(cfg.cookies).forEach((row) => { addCookie[row[0]] = row[1]; }); ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L81-L99
086abf8bf17bdde106f2d3fb12afb64a354f9fab
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/permission.ets
arkts
openPermissionSetting
第二次申请
async openPermissionSetting(list: Permissions[]) { let manager = abilityAccessCtrl.createAtManager() // 创建权限管理实例 let ctx = AppStorage.get<Context>('context') if (ctx) { let res = await manager.requestPermissionOnSetting(ctx, list) return res.every(item => item == abilityAccessCtrl.GrantStatus.PE...
AST#method_declaration#Left async openPermissionSetting AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_st...
async openPermissionSetting(list: Permissions[]) { let manager = abilityAccessCtrl.createAtManager() let ctx = AppStorage.get<Context>('context') if (ctx) { let res = await manager.requestPermissionOnSetting(ctx, list) return res.every(item => item == abilityAccessCtrl.GrantStatus.PERMISSION_GR...
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/permission.ets#L25-L34
c371ee8db6f2ea5d8f3940d8b760d914e3f020cf
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
Q2/DxinTranslate/entry/src/main/ets/model/Data.ets
arkts
发请求的参数类型
export class ReqParams{ api:string //接口地址 key:string //个人中心的key constructor
AST#export_declaration#Left export AST#ERROR#Left class ReqParams { api : string //接口地址 key : string AST#ERROR#Right //个人中心的key AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class ReqParams{ api:string key:string constructor
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q2/DxinTranslate/entry/src/main/ets/model/Data.ets#L13-L17
a9ab968e39d43372e905af9bccffae69b593323c
gitee
FantasyWind/fwrouter
eea785a7bf728862de1f88de487ef3857dee3364
router/src/main/ets/RouterManagerForNavigation.ets
arkts
getBuilder
通过名称获取builder
public getBuilder(builderName: string): WrappedBuilder<[params?: ESObject]> { const builder: WrappedBuilder<[params?: ESObject]> | undefined = this.builderMap.get(builderName); if (!builder) { const MSG = "not found builder"; console.info(MSG + builderName); } return builder as WrappedBuilde...
AST#method_declaration#Left public getBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : 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...
public getBuilder(builderName: string): WrappedBuilder<[params?: ESObject]> { const builder: WrappedBuilder<[params?: ESObject]> | undefined = this.builderMap.get(builderName); if (!builder) { const MSG = "not found builder"; console.info(MSG + builderName); } return builder as WrappedBuilde...
https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/router/src/main/ets/RouterManagerForNavigation.ets#L93-L100
b92648f357fc6ea8c445ce8a6d7295ca8c784775
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets
arkts
createPreviewOutputFn
创建previewOutput输出对象
createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile, surfaceId: string): camera.PreviewOutput | undefined { let previewOutput: camera.PreviewOutput | undefined = undefined; try { previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId); ...
AST#method_declaration#Left createPreviewOutputFn 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 ...
createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile, surfaceId: string): camera.PreviewOutput | undefined { let previewOutput: camera.PreviewOutput | undefined = undefined; try { previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets#L191-L201
5441be6189c6fabd1fb8b5907bba0ebfeba88d96
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
dynamicKeySync
密钥协商,同步 @param algName 密钥协商算法规格(ECC256、X25519、DH_modp1536、等) @param pubKey 公钥(一般为外部传入) @param priKey 私钥 @param coding 编码方式(base64/hex/utf8/utf-8) @returns 共享密钥
static dynamicKeySync(algName: string, pubKey: Uint8Array | string, priKey: Uint8Array | string, coding: crypto.BhuCoding): string { if (typeof pubKey === 'string') { pubKey = CryptoHelper.strToUint8Array(pubKey, coding); } if (typeof priKey === 'string') { priKey = CryptoHelper.strToUint8Array(...
AST#method_declaration#Left static dynamicKeySync AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#...
static dynamicKeySync(algName: string, pubKey: Uint8Array | string, priKey: Uint8Array | string, coding: crypto.BhuCoding): string { if (typeof pubKey === 'string') { pubKey = CryptoHelper.strToUint8Array(pubKey, coding); } if (typeof priKey === 'string') { priKey = CryptoHelper.strToUint8Array(...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L469-L485
3b8af814faf34e77d67a6b2b6109f14d33ce5d16
gitee
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/core/meditation.ets
arkts
按级别计算打坐点数上限
export function meditationPointsMaxByLevel(level: number) { return level * 5 }
AST#export_declaration#Left export AST#function_declaration#Left function meditationPointsMaxByLevel AST#parameter_list#Left ( AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem...
export function meditationPointsMaxByLevel(level: number) { return level * 5 }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/meditation.ets#L84-L86
8160bb7ec0d149822c297c2114c9533f42144bc9
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/UnknownFields.ets
arkts
UnknownFields.ets 未知字段存储 - SwiftProtobuf 兼容性设计 用途: 1. 前后兼容性 - 旧客户端接收新服务器的消息时,保留未知字段 2. 消息转发 - 中间服务器不需要理解所有字段也能转发消息 3. 版本演进 - 允许 proto 定义向前兼容 设计理念: - 存储原始二进制数据(不解析) - 在序列化时追加到消息末尾 - 零拷贝设计,高效内存使用 Version: 1.0.0 ArkTS 2025 兼容 未知字段存储类 当解码消息时遇到未知的字段编号(field number), 会将该字段的原始二进制数据保存在此对象中。 重新编码消息时,这些未知字段会被追加到消息末尾。 示例场...
export class UnknownFields { /** * 原始二进制数据 * * ArkTS 注意:使用 Uint8Array 而不是 Buffer */ private data: Uint8Array /** * 构造函数 */ constructor
AST#export_declaration#Left export AST#ERROR#Left class UnknownFields { /** * 原始二进制数据 * * ArkTS 注意:使用 Uint8Array 而不是 Buffer */ private data : Uint8Array AST#ERROR#Right /** * 构造函数 */ AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_dec...
export class UnknownFields { private data: Uint8Array constructor
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/UnknownFields.ets#L33-L44
a1a87efd746db769c2da2d3b984a322af96e8cb0
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets
arkts
[Start audio_player_service] [Start audio_player_service1] commons\audioplayer\src\main\ets\service\AudioPlayerService.ets
export class AudioPlayerService { private static instance: AudioPlayerService | null = null; // [StartExclude audio_player_service] // [StartExclude audio_player_service1] // private constructor private constructor() { this.initAudioPlayer(); } // [EndExclude audio_player_service] // [EndExclude aud...
AST#export_declaration#Left export AST#class_declaration#Left class AudioPlayerService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AudioPlayerService AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#...
export class AudioPlayerService { private static instance: AudioPlayerService | null = null; private constructor() { this.initAudioPlayer(); } public static getInstance(): AudioPlayerService { if (!AudioPlayerService.instance) { AudioPlayerService.instance = new AudioPlayerService()...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets#L19-L61
6d32725e2194b142380339f27967e6d91732c437
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/PreferenceModel.ets
arkts
isNull
检查参数是否为null
isNull(value: any) { if (value === null) { return false } return true }
AST#method_declaration#Left isNull AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expressi...
isNull(value: any) { if (value === null) { return false } return true }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L63-L68
b8dd47c8509cf0c4676e819c73c5641c2260f1b8
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/MessageCollector.ets
arkts
添加构造函数参数类型(约束1)
constructor( channel: TextBasedChannel, filter: CollectorFilter, options: MessageCollectorOptions = {} ) { super(channel.client, filter, options); this.channel = channel; // 处理max/maxMatches向后兼容(约束1) if (options.max) options.maxProcessed = options.max; if (options.maxMatches) options...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left channel : AST#type_annotation#Left AST#primary_type#Left TextBasedChannel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filter : AST#type_annotation#Left AST#primary_type#Left CollectorF...
constructor( channel: TextBasedChannel, filter: CollectorFilter, options: MessageCollectorOptions = {} ) { super(channel.client, filter, options); this.channel = channel; if (options.max) options.maxProcessed = options.max; if (options.maxMatches) options.max = options.maxMatches; ...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/MessageCollector.ets#L34-L55
937d1a0564877aceee4e144df876ce1c03acf084
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
hasInvalid
判断是否存在无效消息 @param messages 消息数组 @returns true 如果存在至少一个无效消息 使用示例: ```typescript const people = [person1, invalidPerson, person3] if (MessageUtils.hasInvalid(people)) { console.warn('Found invalid messages') } ```
static hasInvalid<T extends Message>(messages: T[]): boolean { return messages.some(m => !m.isValid()) }
AST#method_declaration#Left static hasInvalid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : ...
static hasInvalid<T extends Message>(messages: T[]): boolean { return messages.some(m => !m.isValid()) }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L254-L256
bf4ba8120824af050efed5532650e21b5f994ba3
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/SimpleWebserver/entry/src/main/ets/pages/Index.ets
arkts
buildRespString
构造给客户端的应答内容
function buildRespString(content: string) { let result: string = "" let bodyContent = "<html>" bodyContent += "<head>" bodyContent += "<title>" bodyContent += "HTTP服务器模拟" bodyContent += "</title>" bodyContent += "</head>" bodyContent += "<body>" bodyContent += "<h1>" bodyContent += "浏览器发送的请求信息" bo...
AST#function_declaration#Left function buildRespString 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 { AST#statement#Left AST#variable_d...
function buildRespString(content: string) { let result: string = "" let bodyContent = "<html>" bodyContent += "<head>" bodyContent += "<title>" bodyContent += "HTTP服务器模拟" bodyContent += "</title>" bodyContent += "</head>" bodyContent += "<body>" bodyContent += "<h1>" bodyContent += "浏览器发送的请求信息" bo...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/SimpleWebserver/entry/src/main/ets/pages/Index.ets#L190-L218
fbaada1a0dbf6923806df9d71400b5497edbdf53
gitee
weiwei0928/Eyepetizer-harmony.git
fd5947c6f616c22d42256f36ba752093b782a910
entry/src/main/ets/common/widget/VideoPlaySlider.ets
arkts
sliderOnchange
video slider component onchange callback
sliderOnchange(value: number, mode: SliderChangeMode) { this.currentTime = Number.parseInt(value.toString()); this.controller.setCurrentTime(Number.parseInt(value.toString()), SeekMode.Accurate); if (mode === SliderChangeMode.Begin || mode === SliderChangeMode.Moving) { this.isOpacity = false; } ...
AST#method_declaration#Left sliderOnchange AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left SliderChangeMode AST#prima...
sliderOnchange(value: number, mode: SliderChangeMode) { this.currentTime = Number.parseInt(value.toString()); this.controller.setCurrentTime(Number.parseInt(value.toString()), SeekMode.Accurate); if (mode === SliderChangeMode.Begin || mode === SliderChangeMode.Moving) { this.isOpacity = false; } ...
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/widget/VideoPlaySlider.ets#L101-L110
ad9a4994e3d9dd1745e237e7263392d0d5b5feab
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/PaddingConstants.ets
arkts
@author 2008 @datetime 2024/6/28 23:00 @className: PaddingConstants padding/margin常量
export default class PaddingConstants{ static readonly PADDING_1:number = 1 static readonly PADDING_2:number = 2 static readonly PADDING_3:number = 3 static readonly PADDING_4:number = 4 static readonly PADDING_5:number = 5 static readonly PADDING_6:number = 6 static readonly PADDING_8:number = 8 static...
AST#export_declaration#Left export default AST#class_declaration#Left class PaddingConstants AST#class_body#Left { AST#property_declaration#Left static readonly PADDING_1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right...
export default class PaddingConstants{ static readonly PADDING_1:number = 1 static readonly PADDING_2:number = 2 static readonly PADDING_3:number = 3 static readonly PADDING_4:number = 4 static readonly PADDING_5:number = 5 static readonly PADDING_6:number = 6 static readonly PADDING_8:number = 8 static...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/PaddingConstants.ets#L7-L32
0fd7bace7efb25cbf42888342e5856c22721bb82
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/keyAgree/X25519.ets
arkts
@Author csx @DateTime 2024/3/20 21:29 @TODO X25519
export class X25519 { /** * X25519动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @returns 256位共享密钥字符串 */ static async x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<OutDTO<string>> { ...
AST#export_declaration#Left export AST#class_declaration#Left class X25519 AST#class_body#Left { /** * X25519动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @returns 256位共享密钥字符串 */ AST#method_declaration#Left static...
export class X25519 { static async x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<OutDTO<string>> { return DynamicUtil.dynamicKey(pubKey, priKey, 'X25519', 256); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/keyAgree/X25519.ets#L25-L35
69f7a771ad8df11ab2d9b27b85cab171b5c9d2e7
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/WindowUtil.ets
arkts
createWindow
根据参数创建窗口 @param options @returns
static async createWindow(options: WinOptions): Promise<void> { if (!options) { options = new WinOptions(); } if (!options.name) { options.name = 'eftool'; } if (options.windowType == undefined) { options.windowType = window.WindowType.TYPE_DIALOG; } if (!options.bgColor) {...
AST#method_declaration#Left static async createWindow AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left WinOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
static async createWindow(options: WinOptions): Promise<void> { if (!options) { options = new WinOptions(); } if (!options.name) { options.name = 'eftool'; } if (options.windowType == undefined) { options.windowType = window.WindowType.TYPE_DIALOG; } if (!options.bgColor) {...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/WindowUtil.ets#L39-L73
4ec012cad8c83e31caa13c34fe0988960a72a9d5
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
XiaoyiAgentDemo/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
[Start onNewWant]
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(DOMAIN, 'testTag', 'Received URI:', want.uri); const uri = want.uri; let pathname = ''; if (uri) { try { const urlObj = url.URL.parseURL(uri); pathname = urlObj.pathname; } catch (error) { ...
AST#method_declaration#Left onNewWant 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 Abi...
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(DOMAIN, 'testTag', 'Received URI:', want.uri); const uri = want.uri; let pathname = ''; if (uri) { try { const urlObj = url.URL.parseURL(uri); pathname = urlObj.pathname; } catch (error) { ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/XiaoyiAgentDemo/entry/src/main/ets/entryability/EntryAbility.ets#L75-L92
2d7098258100796116ed51f066f87b21ed3405d7
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/empty/EmptyCart.ets
arkts
EmptyCart
@file 购物车缺省页 @author Joker.X
@ComponentV2 export struct EmptyCart { /** * 构建购物车缺省页视图 * @returns {void} 无返回值 */ build(): void { Empty({ description: $r("app.string.empty_cart"), imageRes: $r("app.media.ic_empty_cart") }); } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct EmptyCart AST#component_body#Left { /** * 构建购物车缺省页视图 * @returns {void} 无返回值 */ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotatio...
@ComponentV2 export struct EmptyCart { build(): void { Empty({ description: $r("app.string.empty_cart"), imageRes: $r("app.media.ic_empty_cart") }); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/empty/EmptyCart.ets#L7-L19
8795b26c3de0183ad510dea6793515bb446b1342
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
initialize
初始化国际化管理器
async initialize(context: Context): Promise<void> { try { this.context = context; this.preferences = await preferences.getPreferences(context, StorageKeys.I18N_PREFS); // 加载配置 await this.loadConfig(); // 检测系统语言 if (this.config.autoDetect) { await this.detect...
AST#method_declaration#Left async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
async initialize(context: Context): Promise<void> { try { this.context = context; this.preferences = await preferences.getPreferences(context, StorageKeys.I18N_PREFS); await this.loadConfig(); if (this.config.autoDetect) { await this.detectSystemLanguage()...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L270-L293
2f32649eaa6f4652f0a8007b027753870a843f20
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/view/all/PictureSort.ets
arkts
PictureSort
Picture sort.
@Component export struct PictureSort { @State photos: Array<PictureItem> = []; @State private sortName: Resource = $r('app.string.recently'); private initType: string = ''; aboutToAppear() { if (PictureType.RECENTLY === this.initType) { this.sortName = $r('app.string.recently'); this.photos = i...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PictureSort AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right photos : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments...
@Component export struct PictureSort { @State photos: Array<PictureItem> = []; @State private sortName: Resource = $r('app.string.recently'); private initType: string = ''; aboutToAppear() { if (PictureType.RECENTLY === this.initType) { this.sortName = $r('app.string.recently'); this.photos = i...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/all/PictureSort.ets#L38-L86
98ef9424b10f843fae25f1bd5034492519086688
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/llm/LLMService.ets
arkts
getConfig
获取所有支持的提供商 获取当前配置
getConfig(): LLMConfig | null { return this.config; }
AST#method_declaration#Left getConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LLMConfig AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { A...
getConfig(): LLMConfig | null { return this.config; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L285-L287
5fd5f20bbad5f638e88dc0161cae20aed7a87392
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/array/SectionDatas.ets
arkts
allDatas
⭐ 超高速版本 allDatas() - 内有缓存 → 每次调用都是 O(1)
allDatas(): T[] { if (this.cachedAllDatas != null) return this.cachedAllDatas; let total = 0; for (const section of this.sectionOrder) { total += this.sectionMap.get(section)!.length; } const result = new Array<T>(total); let offset = 0; for (const section of this.sectionOrder) { ...
AST#method_declaration#Left allDatas AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expressi...
allDatas(): T[] { if (this.cachedAllDatas != null) return this.cachedAllDatas; let total = 0; for (const section of this.sectionOrder) { total += this.sectionMap.get(section)!.length; } const result = new Array<T>(total); let offset = 0; for (const section of this.sectionOrder) { ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/SectionDatas.ets#L66-L81
cfa1a77f7fa82af319d07132194e2d8573a4b0a2
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkcompiler/esmodule/esmodule_entry/har/src/main/ets/components/mainpage/MainPage.ets
arkts
MainPage
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct MainPage { @State message: string = 'Hello World' build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio...
@Component export struct MainPage { @State message: string = 'Hello World' build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_entry/har/src/main/ets/components/mainpage/MainPage.ets#L15-L30
d2b8f7bc75b87b0b6639e5706df374815776d45f
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/util.ets
arkts
Serialize google.protobuf.Duration to string: "Xs" or "X.Ys"
export function durationToJson(seconds: bigint, nanos: number): string { const sign = seconds < 0n || nanos < 0 ? '-' : '' const absSec = seconds < 0n ? -seconds : seconds const absNanos = nanos < 0 ? -nanos : nanos let frac = '' if (absNanos > 0) { const nanosStr = (absNanos + 1000000000).toString().subs...
AST#export_declaration#Left export AST#function_declaration#Left function durationToJson AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left bigint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left nanos : AST#type_annotation#Left...
export function durationToJson(seconds: bigint, nanos: number): string { const sign = seconds < 0n || nanos < 0 ? '-' : '' const absSec = seconds < 0n ? -seconds : seconds const absNanos = nanos < 0 ? -nanos : nanos let frac = '' if (absNanos > 0) { const nanosStr = (absNanos + 1000000000).toString().subs...
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/util.ets#L167-L180
079c0364e040a81864557a3a965dd8c7f8047f26
github
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
common/base/src/main/ets/constants/BreakpointConstants.ets
arkts
Constants for breakpoint.
export class BreakpointConstants { /** * Breakpoints that represent smaller device types. */ static readonly BREAKPOINT_XS: string = 'xs'; /** * Breakpoints that represent small device types. */ static readonly BREAKPOINT_SM: string = 'sm'; /** * Breakpoints that represent middle device types. ...
AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /** * Breakpoints that represent smaller device types. */ AST#property_declaration#Left static readonly BREAKPOINT_XS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#typ...
export class BreakpointConstants { static readonly BREAKPOINT_XS: string = 'xs'; static readonly BREAKPOINT_SM: string = 'sm'; static readonly BREAKPOINT_MD: string = 'md'; static readonly BREAKPOINT_LG: string = 'lg'; static readonly BREAKPOINT_XL: string = 'xl'; static readonly BREAKPOINT_S...
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/common/base/src/main/ets/constants/BreakpointConstants.ets#L19-L49
2504cf8eabe21dd037221095b9162d3d8680f869
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/TabsSample/entry/src/main/ets/constants/Constants.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 Constants { // 普通面板 static readonly ORDINARY_MENU: number = 1; // 折叠面板 static readonly COLLAPSE_MENU: number = 2; }
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { // 普通面板 AST#property_declaration#Left static readonly ORDINARY_MENU : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; ...
export class Constants { static readonly ORDINARY_MENU: number = 1; static readonly COLLAPSE_MENU: number = 2; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/constants/Constants.ets#L16-L21
17c3d4942c65876464f38520e2d6023e4ff18677
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinPoetry/entry/src/main/ets/view/IndexTop.ets
arkts
IndexTop
@des 顶部的图文自定义组件 @author dxin
@Component export default struct IndexTop { build() { Stack() { Image('/images/bg0.jpg') .width('100%') .height('100%') .borderRadius(10) Text('醉诗词') .fontSize(20) .fontWeight(FontWeight.Bold) .margin({ top: -50 }) Text('以诗词为灵魂,以代码为技巧,润养生活乐趣') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct IndexTop AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#...
@Component export default struct IndexTop { build() { Stack() { Image('/images/bg0.jpg') .width('100%') .height('100%') .borderRadius(10) Text('醉诗词') .fontSize(20) .fontWeight(FontWeight.Bold) .margin({ top: -50 }) Text('以诗词为灵魂,以代码为技巧,润养生活乐趣') ...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/view/IndexTop.ets#L5-L29
ae0c21bc3ffdfc4496c56648f79bd2d939b495fb
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets
arkts
sendMsg2Server
发送消息到服务端
sendMsg2Server() { tlsSocket.send(this.sendMsg + "\r\n") .then(async () => { this.msgHistory += "我:" + this.sendMsg + await getCurrentTimeString() + "\r\n" }) .catch((e) => { this.msgHistory += '发送失败' + e.message + "\r\n"; }) }
AST#method_declaration#Left sendMsg2Server AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#...
sendMsg2Server() { tlsSocket.send(this.sendMsg + "\r\n") .then(async () => { this.msgHistory += "我:" + this.sendMsg + await getCurrentTimeString() + "\r\n" }) .catch((e) => { this.msgHistory += '发送失败' + e.message + "\r\n"; }) }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L234-L242
ce0c3a7b0529c4d847b5c9ce33fba0a303b0026c
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/button/buttonJudgment.ets
arkts
ButtonJudgmentBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function ButtonJudgmentBuilder(name: string, param: Object) { ButtonJudgmentExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ButtonJudgmentBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left...
@Builder export function ButtonJudgmentBuilder(name: string, param: Object) { ButtonJudgmentExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/button/buttonJudgment.ets#L16-L19
11a3380960b1132405a0ec71399d1b8ebda6856c
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CustomAnimationTab/customanimationtab/src/main/ets/model/ComponentFactory.ets
arkts
组件工厂,可以注册TabInfo对象并使用
export class ComponentFactory { // tabInfo对象集合 private tabsInfo: Map<string, TabInfo>; // 注册标题集合 private keys: string[] = []; /** * 构造器 */ public constructor() { this.tabsInfo = new Map(); } /** * 设置tab项内容 * @param name - tab项标题 * @param content - tab项内容 */ public set(name: st...
AST#export_declaration#Left export AST#class_declaration#Left class ComponentFactory AST#class_body#Left { // tabInfo对象集合 AST#property_declaration#Left private tabsInfo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left str...
export class ComponentFactory { private tabsInfo: Map<string, TabInfo>; private keys: string[] = []; public constructor() { this.tabsInfo = new Map(); } public set(name: string, tabInfo: TabInfo) { this.tabsInfo.set(name, tabInfo); } public getContent(name: string): WrappedBuild...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/model/ComponentFactory.ets#L22-L96
ad26913067618ed4fb7eab7786a52aa71ad6c340
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets
arkts
pushData
添加数据
public pushData(data: string): void { this.tabContent.push(data); this.notifyDataAdd(this.tabContent.length - 1); }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
public pushData(data: string): void { this.tabContent.push(data); this.notifyDataAdd(this.tabContent.length - 1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L80-L83
7f3c215177df26116703d14e60422e35532f1f3f
gitee
jiwangyihao/FlameChase.git
446275e6972bd5f92a3c5b7eba354ca83d504594
entry/src/main/ets/pages/ChroniclePage.ets
arkts
decreaseDate
【新增】减少一天日期的函数
private decreaseDate(): void { this.displayDate.setDate(this.displayDate.getDate() - 1); // 更新日期后,重新格式化字符串以刷新UI this.currentDate = this.getFormattedDate(this.displayDate); }
AST#method_declaration#Left private decreaseDate 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#exp...
private decreaseDate(): void { this.displayDate.setDate(this.displayDate.getDate() - 1); this.currentDate = this.getFormattedDate(this.displayDate); }
https://github.com/jiwangyihao/FlameChase.git/blob/446275e6972bd5f92a3c5b7eba354ca83d504594/entry/src/main/ets/pages/ChroniclePage.ets#L567-L571
c431ac32e60b6d51dea19c5aa5bcc425da6234da
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Scroll.ets
arkts
HorizontalScroll
水平滚动布局
@ComponentV2 export struct HorizontalScroll { /** * 滚动控制器 */ @Param scroller: Scroller = new Scroller(); /** * 内容内边距 */ @Param paddingValue: Padding | Length | LocalizedPadding | undefined = undefined; /** * 外边距 */ @Param marginValue: Margin | Length | LocalizedMargin | undefined = u...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HorizontalScroll AST#component_body#Left { /** * 滚动控制器 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#pri...
@ComponentV2 export struct HorizontalScroll { @Param scroller: Scroller = new Scroller(); @Param paddingValue: Padding | Length | LocalizedPadding | undefined = undefined; @Param marginValue: Margin | Length | LocalizedMargin | undefined = undefined; @Param fillMaxSize: boolean = false; ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Scroll.ets#L292-L391
c21fdf4fd418a1464142970a7764f9d37cef4528
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets
arkts
自定义日历样式。仅用于月、周视图。
export interface CalendarStyle { textScaling?: number; // 月视图和周视图中的公历、农历、星期、年月信息标题文字缩放比例。 backgroundColor?: Color | number | string | Resource; // 今天选中日期的背景色 monthDayColor?: Color | number | string | Resource; // 本月公历日期颜色 noMonthDayColor?: Color | number | string | Resource; // 非本月公历日期颜色,仅对月视图有效。 lunarColor?:...
AST#export_declaration#Left export AST#interface_declaration#Left interface CalendarStyle AST#object_type#Left { AST#type_member#Left textScaling ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 月视图和周视图中的公历、农历、星期、年月信息标题文字缩放比例。 AST#type...
export interface CalendarStyle { textScaling?: number; backgroundColor?: Color | number | string | Resource; monthDayColor?: Color | number | string | Resource; noMonthDayColor?: Color | number | string | Resource; lunarColor?: Color | number | string | Resource; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets#L21-L27
2fbdf77ea197bf515658d7498ee195aa65ef7fbf
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/treeview/source/treeview.ets
arkts
getInstance
TreeViewNodeItemFactory singleton function @returns TreeViewNodeItemFactory
public static getInstance(): TreeViewNodeItemFactory { if (!TreeViewNodeItemFactory.instance) { TreeViewNodeItemFactory.instance = new TreeViewNodeItemFactory(); } return TreeViewNodeItemFactory.instance; }
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TreeViewNodeItemFactory AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST...
public static getInstance(): TreeViewNodeItemFactory { if (!TreeViewNodeItemFactory.instance) { TreeViewNodeItemFactory.instance = new TreeViewNodeItemFactory(); } return TreeViewNodeItemFactory.instance; }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L292-L297
6c34c5438694c29d42834a70cdbfdf120fba8ce3
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/viewmodel/SettingsViewModel.ets
arkts
getSupportList
获取所有列表数据(返回副本防止外部修改)
getSupportList(): SettingsListItemModel[] { return [...this.supportList]; }
AST#method_declaration#Left getSupportList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SettingsListItemModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_st...
getSupportList(): SettingsListItemModel[] { return [...this.supportList]; }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/viewmodel/SettingsViewModel.ets#L94-L96
becf085b71bda50dbc0b7e386fe7ca270128fa82
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
addItem
Add an element to the specified index location
public addItem(index: number): void { this.dataArray.splice(index, 0, this.dataArray.length); this.notifyDataAdd(index); }
AST#method_declaration#Left public addItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
public addItem(index: number): void { this.dataArray.splice(index, 0, this.dataArray.length); this.notifyDataAdd(index); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L106-L109
984a60e3648646117d5682e21d26cbbcd546aaa4
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets
arkts
Saving and manipulating data displayed on the page.
export class DataModel { /** * Saved data. */ private targetData: Array<TaskItemViewModel> = []; /** * Get the latest data. */ getData(): Array<TaskItemViewModel> { return this.targetData; } /** * Delete the selected data. * * @param selectArr: An array indicating whether histori...
AST#export_declaration#Left export AST#class_declaration#Left class DataModel AST#class_body#Left { /** * Saved data. */ AST#property_declaration#Left private targetData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type...
export class DataModel { private targetData: Array<TaskItemViewModel> = []; getData(): Array<TaskItemViewModel> { return this.targetData; } deleteData(selectArr: Array<boolean>) { if (!selectArr) { Logger.error(TAG, 'Failed to delete data because selectArr is ' + selectArr); } ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets#L26-L95
4a381a6ed1d0ffd57cafca24b00043fb1471882e
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseDataSet.ets
arkts
addColor
Adds a new color to the colors array of the DataSet. @param color
public addColor(color: number): void { if (this.mColors == null) { this.mColors = new JArrayList<Number>(); } this.mColors.add(color); }
AST#method_declaration#Left public addColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Ri...
public addColor(color: number): void { if (this.mColors == null) { this.mColors = new JArrayList<Number>(); } this.mColors.add(color); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L190-L195
e6515fbe5a9139386769fcc17008865ce699c2d9
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/views/CreateSurveyView.ets
arkts
itemEnd
划出组件 —— 当前用于删除问题
@Builder itemEnd(questionIndex: number) { Row({ space: 16 }) { Button() { SymbolGlyph($r('sys.symbol.trash_fill')) .fontSize(24) .fontColor([Color.White]) } .width(40) .height(40) .backgroundColor(Color.Red) .onClick(() => { // 开启按钮触感反馈 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemEnd AST#parameter_list#Left ( AST#parameter#Left questionIndex : 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_bod...
@Builder itemEnd(questionIndex: number) { Row({ space: 16 }) { Button() { SymbolGlyph($r('sys.symbol.trash_fill')) .fontSize(24) .fontColor([Color.White]) } .width(40) .height(40) .backgroundColor(Color.Red) .onClick(() => { if (this...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/CreateSurveyView.ets#L203-L226
78e983005f1f274d4547811cf642ce4ad47a2c77
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api15/entry/src/main/ets/MainAbility/pages/data/BasicDataSource.ets
arkts
notifyDataDelete
通知LazyForEach组件需要在index对应索引处删除该子组件
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); // 写法2:listener.onDatasetChange([{type: DataOperationType.DELETE, index: index}]); }) }
AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api15/entry/src/main/ets/MainAbility/pages/data/BasicDataSource.ets#L69-L74
01d901d603b4c8f25f9368f72eec61c5d0fa6f90
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
resetToDefault
重置为默认主题
async resetToDefault() { try { await this.themeManager.resetToDefault(); await this.initializePage(); } catch (error) { console.error('Failed to reset theme:', error); } }
AST#method_declaration#Left async resetToDefault 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#call_expression#Left AST#expression#Left AST#...
async resetToDefault() { try { await this.themeManager.resetToDefault(); await this.initializePage(); } catch (error) { console.error('Failed to reset theme:', error); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L156-L163
f0152fab5929c1b49a7e10ab8e86b9d027cc4868
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets
arkts
logoff
注销账号 @param {Record<string, unknown>} params - 注销参数 @returns {Promise<NetworkResponse<Unknown>>} 注销结果
async logoff(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("user/info/logoff", params); return resp.data; }
AST#method_declaration#Left async logoff AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotatio...
async logoff(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("user/info/logoff", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets#L38-L42
1543262a93039fe34b3c255c0227830615a6356f
github
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/PreferenceModel.ets
arkts
deletePreferences
删除preferences实例对应的首选项
async deletePreferences() { try { await dataPreferences.deletePreferences(context, 'mystore') } catch (err) { console.error(err) } preference = null }
AST#method_declaration#Left async deletePreferences 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#call_expression#Left AST#expression#Left A...
async deletePreferences() { try { await dataPreferences.deletePreferences(context, 'mystore') } catch (err) { console.error(err) } preference = null }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L17-L24
5c455536c12a62707fc931816ddee82f09ea1040
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets
arkts
evaluateBound
TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换
evaluateBound(): void { const xBol = constrainOffsetAndAnimation({ dimensionWH: ImageFitType.TYPE_WIDTH, imageDefaultSize: this.imageDefaultSize, imageOffsetInfo: this.imageOffsetInfo, scaleValue: this.imageScaleInfo.scaleValue, rotate: this.imageRotateInfo.lastRotate, TogglePerc...
AST#method_declaration#Left evaluateBound 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 const AST#variable_declarator#Left xBol = AST#...
evaluateBound(): void { const xBol = constrainOffsetAndAnimation({ dimensionWH: ImageFitType.TYPE_WIDTH, imageDefaultSize: this.imageDefaultSize, imageOffsetInfo: this.imageOffsetInfo, scaleValue: this.imageScaleInfo.scaleValue, rotate: this.imageRotateInfo.lastRotate, TogglePerc...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets#L188-L246
bfc9dcf51ea91987f60e77f77ea9823915a7e291
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/highlight/ChartHighlighter.ets
arkts
buildHighlights
An array of `Highlight` objects corresponding to the selected xValue and dataSetIndex. @param set @param dataSetIndex @param xVal @param rounding @return
protected buildHighlights(set: IDataSet<EntryOhos>, dataSetIndex: number, xVal: number, rounding: Rounding): JArrayList<Highlight> { let highlights: JArrayList<Highlight> = new JArrayList<Highlight>(); //noinspection unchecked let entries: JArrayList<EntryOhos> | null = set.getEntriesForXValue(xVal); ...
AST#method_declaration#Left protected buildHighlights AST#parameter_list#Left ( AST#parameter#Left set : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right > AST...
protected buildHighlights(set: IDataSet<EntryOhos>, dataSetIndex: number, xVal: number, rounding: Rounding): JArrayList<Highlight> { let highlights: JArrayList<Highlight> = new JArrayList<Highlight>(); let entries: JArrayList<EntryOhos> | null = set.getEntriesForXValue(xVal); if (entries) { if ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/ChartHighlighter.ets#L183-L222
c044e853b4b5c3eca75d0961f9a40d4f891fcbdf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/model/ToolInterface.ets
arkts
工具项UI入参
export interface ToolInterface { // 静态参数 params?: CustomParams; // 动效参数 animation?: CustomAnimation; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ToolInterface AST#object_type#Left { // 静态参数 AST#type_member#Left params ? : AST#type_annotation#Left AST#primary_type#Left CustomParams AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 动效参数 AST#type_member#Left anima...
export interface ToolInterface { params?: CustomParams; animation?: CustomAnimation; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/ToolInterface.ets#L22-L27
57ae59e52f2223ae09212efa21bd6f611294280e
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/pages/NavPathManager.ets
arkts
popBack
弹出一个页面
popBack(animated?: boolean) { this._navPath.pop(animated ?? true) }
AST#method_declaration#Left popBack AST#parameter_list#Left ( AST#parameter#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressi...
popBack(animated?: boolean) { this._navPath.pop(animated ?? true) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L51-L53
176db817fb24d73877bc5d572fb645036f519fab
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/notify/NotificationHelper.ets
arkts
logError
error级别日志打印 @param message 日志内容
logError(message: string): void { LogUtils.error('NotificationHelper', message); }
AST#method_declaration#Left logError AST#parameter_list#Left ( AST#parameter#Left message : 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 void AST#primary_type#Right A...
logError(message: string): void { LogUtils.error('NotificationHelper', message); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/notify/NotificationHelper.ets#L249-L251
86bd642b32ceebd7e9bbbe3c531a26eeb53c4054
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PermissionUtil.ets
arkts
getGrantSuccess
判断是否授权成功
private static getGrantSuccess(data: PermissionRequestResult | Array<abilityAccessCtrl.GrantStatus>): boolean { let result: boolean = true; //鉴权结果 let grantStatus: Array<number> = Array.isArray(data) ? data : data.authResults; for (let i = 0; i < grantStatus.length; i++) { if (grantStatus[i] !== abili...
AST#method_declaration#Left private static getGrantSuccess AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PermissionRequestResult AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotati...
private static getGrantSuccess(data: PermissionRequestResult | Array<abilityAccessCtrl.GrantStatus>): boolean { let result: boolean = true; let grantStatus: Array<number> = Array.isArray(data) ? data : data.authResults; for (let i = 0; i < grantStatus.length; i++) { if (grantStatus[i] !== abilityAcce...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L146-L152
16466a2338343c5fff2c65d2444955bf989de5cb
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/model/WindowModel.ets
arkts
getInstance
获取WindowModel单例实例 @returns {WindowModel} WindowModel
static getInstance(): WindowModel { if (!WindowModel.instance) { WindowModel.instance = new WindowModel(); } return WindowModel.instance; }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WindowModel AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AS...
static getInstance(): WindowModel { if (!WindowModel.instance) { WindowModel.instance = new WindowModel(); } return WindowModel.instance; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/WindowModel.ets#L35-L41
2292c7cbe3abcf690daa3e25d28f4ff89366cfea
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/applicationexception/src/main/ets/model/DataSource.ets
arkts
persistenceStorage
TODO:知识点:持久化存储异常信息集合
persistenceStorage(): void { PreferencesManager.putFaultMessage(this.faultMessage); }
AST#method_declaration#Left persistenceStorage 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#expre...
persistenceStorage(): void { PreferencesManager.putFaultMessage(this.faultMessage); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/DataSource.ets#L104-L106
5907ed0b4d06bfd7d5ec3d78971d753a85932a0e
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
发送HTTP请求的通用方法 @param method HTTP方法 @param endpoint API端点 @param params 请求参数 @param data 请求体数据 @returns 响应数据
export async function request<T>(method: RequestMethod, endpoint: string, params: QueryParams = {}, data: RequestData = {}): Promise<T> { // 确保endpoint以/开头,避免BASE_URL末尾的/api与endpoint之间缺少分隔符 const formattedEndpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`; // 构建URL let url = `${BASE_URL}${format...
AST#export_declaration#Left export AST#function_declaration#Left async function request AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left RequestMethod AST#primary...
export async function request<T>(method: RequestMethod, endpoint: string, params: QueryParams = {}, data: RequestData = {}): Promise<T> { const formattedEndpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`; let url = `${BASE_URL}${formattedEndpoint}`; if (Object.keys(params).length > 0) { ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L234-L331
5e839fe08e5f95853e98a478cf3276b8766b73ca
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/sorting/CountingSort.ets
arkts
计数排序实现
export class CountingSort { /** * 计数排序算法 * @param arr 需要排序的数组 * @returns 排序后的数组 */ public static sort(arr: number[]): number[] { if (arr.length === 0) { return []; } // 找到数组中的最大值和最小值 const max = Math.max(...arr); const min = Math.min(...arr); const range = max - min + 1; ...
AST#export_declaration#Left export AST#class_declaration#Left class CountingSort AST#class_body#Left { /** * 计数排序算法 * @param arr 需要排序的数组 * @returns 排序后的数组 */ AST#property_declaration#Left public static sort AST#ERROR#Left AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primar...
export class CountingSort { public static sort(arr: number[]): number[] { if (arr.length === 0) { return []; } const max = Math.max(...arr); const min = Math.min(...arr); const range = max - min + 1; const count: number[] = new Array(range).fill(0); const output: numbe...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/CountingSort.ets#L4-L32
fc6ebd6876ef72aaff0f75126742e4ef76ca89a5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sendmessage/src/main/ets/components/mainpage/MessageView.ets
arkts
showToast
弹窗函数
showToast() { promptAction.showToast({ message: $r('app.string.send_message_toast') }) }
AST#method_declaration#Left showToast 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 promptAction AST#expression#Right . showToast AST#memb...
showToast() { promptAction.showToast({ message: $r('app.string.send_message_toast') }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sendmessage/src/main/ets/components/mainpage/MessageView.ets#L44-L48
c1352cfa3d1275cd63cbc00550ee3957993ec7b1
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
setUpdateState
设置升级状态缓存数据 @param value 状态
setUpdateState(value): void { if (this._updateStatus !== Number(value) && value !== undefined && value !== null) { this._updateStatus = Number(value); AppStorage.Set('updateStatus', this._updateStatus); } }
AST#method_declaration#Left setUpdateState AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statemen...
setUpdateState(value): void { if (this._updateStatus !== Number(value) && value !== undefined && value !== null) { this._updateStatus = Number(value); AppStorage.Set('updateStatus', this._updateStatus); } }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L238-L243
3d93cb8deec6b65ab0328db830a84a808a0df088
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/default/model/FoodData.ets
arkts
Copyright (c) 2021 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export enum Category { Fruit, Vegetable, Nut, Seafood, Dessert }
AST#export_declaration#Left export AST#enum_declaration#Left enum Category AST#enum_body#Left { AST#enum_member#Left Fruit AST#enum_member#Right , AST#enum_member#Left Vegetable AST#enum_member#Right , AST#enum_member#Left Nut AST#enum_member#Right , AST#enum_member#Left Seafood AST#enum_member#Right , AST#enum_member#...
export enum Category { Fruit, Vegetable, Nut, Seafood, Dessert }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/eTSDefiningPageLayoutAndConnection/entry/src/main/ets/default/model/FoodData.ets#L16-L22
9164f2b070aaf3c1b991cdd091e037cfbc634fd3
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
onCancel
The Gesture group is successfully recognized and a callback is triggered when the touch cancel event is received. @param { Callback<void> } event @returns { GestureGroup } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
onCancel(event: Callback<void>): GestureGroup;
AST#method_declaration#Left onCancel AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Righ...
onCancel(event: Callback<void>): GestureGroup;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L752-L752
bf84288902d32578ec9ff390b5b8a5e0f9d7b19b
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
batchInsert
批量插入账目数据
batchInsert(accounts: Account[], callback: Function) { // 将账户数据转换为值桶数组 const valueBuckets: relationalStore.ValuesBucket[] = accounts.map((account) => generateBucket(account)); // 调用 Rdb 对象的批量插入数据方法,并传入回调函数 this.accountTable.batchInsert(valueBuckets, callback) }
AST#method_declaration#Left batchInsert AST#parameter_list#Left ( AST#parameter#Left accounts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Account [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Lef...
batchInsert(accounts: Account[], callback: Function) { const valueBuckets: relationalStore.ValuesBucket[] = accounts.map((account) => generateBucket(account)); this.accountTable.batchInsert(valueBuckets, callback) }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/database/tables/AccountTable.ets#L40-L45
9d19f2dc75661ac13664d88965a41afe5229f461
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets
arkts
text
设置默认文本 @param defaultText 默认文本 @returns
text(defaultText: ResourceStr) { this.builderOptions.text = defaultText; return this }
AST#method_declaration#Left text AST#parameter_list#Left ( AST#parameter#Left defaultText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Le...
text(defaultText: ResourceStr) { this.builderOptions.text = defaultText; return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets#L16-L19
ab0b03556f187d5b2b4ffb4afadefed7f533e179
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/ArkTSComponents/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSecondGridData
Get data of the second grid. @return {Array<PageResource>} secondGridData.
getSecondGridData(): Array<ItemData> { let secondGridData: ItemData[] = [ new ItemData($r('app.string.mainPage_top'), $r('app.media.top'), $r('app.string.mainPage_text_top')), new ItemData($r('app.string.mainPage_new'), $r('app.media.new'), $r('app.string.mainPage_text_new')), new ItemData($r('app...
AST#method_declaration#Left getSecondGridData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
getSecondGridData(): Array<ItemData> { let secondGridData: ItemData[] = [ new ItemData($r('app.string.mainPage_top'), $r('app.media.top'), $r('app.string.mainPage_text_top')), new ItemData($r('app.string.mainPage_new'), $r('app.media.new'), $r('app.string.mainPage_text_new')), new ItemData($r('app...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ArkTSComponents/entry/src/main/ets/viewmodel/MainViewModel.ets#L63-L71
bdce24f8aa3332a2507a0b91e0882ddee00d52cb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/components/ComponentSingletonTimer.ets
arkts
ComponentSingletonTimer
结合单例TimerUtil,实现单例timer组件
@Component export default struct ComponentSingletonTimer { @State time: string = '00:00'; private mTextColor: ResourceColor = $r('app.color.color_fff'); private mTextSize: Length = 18; private observer: Observer | null = null; build() { Text(this.time) .id('componentSingletonTimer') .fontColo...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct ComponentSingletonTimer AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ...
@Component export default struct ComponentSingletonTimer { @State time: string = '00:00'; private mTextColor: ResourceColor = $r('app.color.color_fff'); private mTextSize: Length = 18; private observer: Observer | null = null; build() { Text(this.time) .id('componentSingletonTimer') .fontColo...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/components/ComponentSingletonTimer.ets#L21-L55
c19d4bd054d8e56f3d45875efaebc54b41fea497
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/view/components/CommandTile.ets
arkts
changeRunningState
设置条目运行状态 设置本地运行状态参数,控制加载覆盖层的显示 再向回调函数传出运行状态,供主页面控制本条目的启用/禁用
private changeRunningState(isRunning: boolean) { this.isRunning = isRunning; this.onRunningStateChange(isRunning); }
AST#method_declaration#Left private changeRunningState AST#parameter_list#Left ( AST#parameter#Left isRunning : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement...
private changeRunningState(isRunning: boolean) { this.isRunning = isRunning; this.onRunningStateChange(isRunning); }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/view/components/CommandTile.ets#L30-L33
cd41b47704c9086623dc0fcb042da480848c48dd
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
hasData
判断系统剪贴板中是否有内容,使用Promise异步回调。 @returns
static async hasData(): Promise<boolean> { return PasteboardUtil.getSystemPasteboard().hasData(); }
AST#method_declaration#Left static async hasData 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#typ...
static async hasData(): Promise<boolean> { return PasteboardUtil.getSystemPasteboard().hasData(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L52-L54
839596714d49115eb0babde7a0db16a844138788
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSA.ets
arkts
generate2048RSAKey
生成2048位RSA的非对称密钥 @returns 2048位RSA密钥{publicKey:2048位公钥,privateKey:2048位私钥}
static async generate2048RSAKey(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('RSA2048'); }
AST#method_declaration#Left static async generate2048RSAKey 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 CryptoKey AST#primary_type#Right AST#type_annotation#Ri...
static async generate2048RSAKey(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('RSA2048'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L42-L44
5ab1e389ab5fb94a70d6116fd642831f472ecb32
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/entry3ability/Entry3Ability.ets
arkts
[StartExclude create_main_window]
export default class Entry3Ability extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } // [EndExclude creat...
AST#export_declaration#Left export default AST#class_declaration#Left class Entry3Ability extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#t...
export default class Entry3Ability extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } onWindowStageCre...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L23-L63
d97b4b8ae911f12ddb6700ac65bb7c81db70f305
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
getGroupList
获取群聊列表
static async getGroupList(userId: string): Promise<ResponseDao<GroupItem[]>> { try { const params: GroupListParams = { id: userId }; const response: AxiosResponse<ResponseDao<GroupItem[]>> = await axios.post( `${BASE_URL}/ddchat/group/getList`, params, { headers: Netwo...
AST#method_declaration#Left static async getGroupList AST#parameter_list#Left ( AST#parameter#Left userId : 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_t...
static async getGroupList(userId: string): Promise<ResponseDao<GroupItem[]>> { try { const params: GroupListParams = { id: userId }; const response: AxiosResponse<ResponseDao<GroupItem[]>> = await axios.post( `${BASE_URL}/ddchat/group/getList`, params, { headers: Netwo...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L536-L552
0e736536a53f5f4db14c53d94ea9ebe428becbc9
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/common/Constants.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 Constants { /** * XComponent的宽度 */ static readonly X_COMPONENT_SURFACE_WIDTH = 1920; // 1920*1080 stride->1920 /** * XComponent的高度 */ static readonly X_COMPONENT_SURFACE_HEIGHT = 1080; /** * image+cropSync方案说明 */ static readonly CROP_SYNC_DES = '应用通过image.ImageReceiver注册imageA...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { /** * XComponent的宽度 */ AST#property_declaration#Left static readonly X_COMPONENT_SURFACE_WIDTH = AST#expression#Left 1920 AST#expression#Right ; AST#property_declaration#Right // 1920*1080 stride->1920 /** * XCo...
export class Constants { static readonly X_COMPONENT_SURFACE_WIDTH = 1920; static readonly X_COMPONENT_SURFACE_HEIGHT = 1080; static readonly CROP_SYNC_DES = '应用通过image.ImageReceiver注册imageArrival图像回调方法,获取每帧图像数据实例image.Image,创建pixelMap,使用getComponent获取rowStride值。通过在Image中传入变量PixelMap进行数据刷新,图片送显。当分辨率的wid...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/common/Constants.ets#L16-L37
eac5d30358ddfcb4114a327b3eb61604784593e0
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationManagementUtil.ets
arkts
getAllNotifications
获取当前所有消息及数量
async getAllNotifications() { let result: getAllNotificationsResultType = { groupNotifications: this.typeNotifications, countsByType: this.countsByType } return result; }
AST#method_declaration#Left async getAllNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left getAllNotificationsResultType AST#primary_type#R...
async getAllNotifications() { let result: getAllNotificationsResultType = { groupNotifications: this.typeNotifications, countsByType: this.countsByType } return result; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationManagementUtil.ets#L83-L89
d309f28e38007f24db1b406dba511b6bf2be2bd0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/navigationparametertransfer/src/main/ets/components/UserBookingInfo.ets
arkts
generateRandSeatNo
获取随机座位号
generateRandSeatNo(): number { this.seatNo = Math.floor(Math.random() * (200 - 1) + 1); // 获取200以内随机号 return this.seatNo; }
AST#method_declaration#Left generateRandSeatNo 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#expression_statement#Left AST#expression#Left AST#assignment_expr...
generateRandSeatNo(): number { this.seatNo = Math.floor(Math.random() * (200 - 1) + 1); return this.seatNo; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationparametertransfer/src/main/ets/components/UserBookingInfo.ets#L30-L33
f80db3ead218d00ac5494dcf7ec2d33a2ba26fe5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/AttributeModifier.ets
arkts
自定义class实现Text的AttributeModifier接口
export class CommodityText implements AttributeModifier<TextAttribute> { textType: TextType = TextType.TYPE_ONE; textSize: number = 15; constructor(textType: TextType, textSize: number) { this.textType = textType; this.textSize = textSize; } applyNormalAttribute(instance: TextAttribute): void { ...
AST#export_declaration#Left export AST#class_declaration#Left class CommodityText AST#implements_clause#Left implements AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TextAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Rig...
export class CommodityText implements AttributeModifier<TextAttribute> { textType: TextType = TextType.TYPE_ONE; textSize: number = 15; constructor(textType: TextType, textSize: number) { this.textType = textType; this.textSize = textSize; } applyNormalAttribute(instance: TextAttribute): void { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/AttributeModifier.ets#L35-L68
8f4d8c613592170543418264b2adf549d3a5ff8b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets
arkts
tabBuilder
[EndExclude switch_the_tab_to_a_specific_tab]
@Builder tabBuilder(title: ResourceStr, targetIndex: number) { Column() { Text(title) .fontColor(this.currentIndex === targetIndex ? '#F111C1' : '#6B6B6B') } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilder AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetIndex : AST#type_annotat...
@Builder tabBuilder(title: ResourceStr, targetIndex: number) { Column() { Text(title) .fontColor(this.currentIndex === targetIndex ? '#F111C1' : '#6B6B6B') } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets#L31-L37
5653896b81434920396cf3caca9ea716ce24c495
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseManager.ets
arkts
checkAndUpgradeDatabase
检查并执行数据库升级
private async checkAndUpgradeDatabase(): Promise<void> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { console.info('[DatabaseManager] Starting database upgrade check...'); // 检查表结构 await this.checkAndFixTableStructure(); console.info('[DatabaseM...
AST#method_declaration#Left private async checkAndUpgradeDatabase 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#R...
private async checkAndUpgradeDatabase(): Promise<void> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { console.info('[DatabaseManager] Starting database upgrade check...'); await this.checkAndFixTableStructure(); console.info('[DatabaseManager] ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseManager.ets#L114-L131
7c520baa007da44913d12826ebfdf24fa5e184c2
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets
arkts
draw
新建路径对象,用于绘制手指移动轨迹 RenderNode进行绘制时会调用draw方法
draw(context: DrawContext): void { const canvas = context.canvas; // 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制 const pen = new drawing.Pen(); // 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑 pen.setAntiAlias(true); // 设置画笔颜色为黑色 const pen_color: common2D.Color = { alpha: 0xFF, red: 0x00, green: 0x00, blue: 0x00 }; pen.se...
AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left DrawContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ...
draw(context: DrawContext): void { const canvas = context.canvas; const pen = new drawing.Pen(); pen.setAntiAlias(true); const pen_color: common2D.Color = { alpha: 0xFF, red: 0x00, green: 0x00, blue: 0x00 }; pen.setColor(pen_color); pen.setDither(true); pen.setStroke...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets#L26-L43
f1aa410d2d657747d04921588cecc17477d915ee
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/frame/AbilityKit/StartAbility/entry/src/main/ets/pages/Index.ets
arkts
startSecondAbility
TODO 启动SecondAbility
startSecondAbility() { }
AST#method_declaration#Left startSecondAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
startSecondAbility() { }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/frame/AbilityKit/StartAbility/entry/src/main/ets/pages/Index.ets#L262-L264
43f62cbdd79a3fa0e135feeb9c144620a238d32c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verifycode/src/main/ets/constants/VerifyCodeConstants.ets
arkts
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 class VerifyCodeConstants { static readonly VERIFY_CODE_FONTWEIGHT: number = 60; }
AST#export_declaration#Left export AST#class_declaration#Left class VerifyCodeConstants AST#class_body#Left { AST#property_declaration#Left static readonly VERIFY_CODE_FONTWEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 60 AST#express...
export class VerifyCodeConstants { static readonly VERIFY_CODE_FONTWEIGHT: number = 60; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verifycode/src/main/ets/constants/VerifyCodeConstants.ets#L16-L18
d64b5b9a191cdad20a94e56b81f647c611d4a1bc
gitee
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets
arkts
Defines the keyword city class.
export class CityGroup { public name: string; public city: string[]; constructor(name: string, city: string[]) { this.name = name; this.city = city; } }
AST#export_declaration#Left export AST#class_declaration#Left class CityGroup AST#class_body#Left { AST#property_declaration#Left public name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left public cit...
export class CityGroup { public name: string; public city: string[]; constructor(name: string, city: string[]) { this.name = name; this.city = city; } }
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets#L28-L36
eb12ee614f68e652ffc932e35f351fcde1936319
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
The callback of onVideoPlayStateChanged event @typedef { function } videoPlayStateChangedCallback @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 14
export type videoPlayStateChangedCallback = (state: VideoPlayerState) => void;
AST#export_declaration#Left export AST#type_declaration#Left type videoPlayStateChangedCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left VideoPlayerState AST#primary_type#Right AST#type_annotation#Right AST#para...
export type videoPlayStateChangedCallback = (state: VideoPlayerState) => void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L216-L216
44cfd8fcd0327c30122a41fbddf845cee03b6ad0
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
取按钮点击行为 @param status 状态 @return 按钮点击行为
export function getButtonClickAction(status: number): UpdateAction { return OtaUpdateManager.getInstance().getStateObj(status).buttonClickAction; }
AST#export_declaration#Left export AST#function_declaration#Left function getButtonClickAction AST#parameter_list#Left ( AST#parameter#Left status : 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...
export function getButtonClickAction(status: number): UpdateAction { return OtaUpdateManager.getInstance().getStateObj(status).buttonClickAction; }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L81-L83
5ce5810268e94c5958d9ce90256b2118116bb2c8
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/common/Utils.ets
arkts
异步延时函数。 @param ms 延时时长,单位 ms。 @returns Promise 对象,执行回调。
export function sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
AST#export_declaration#Left export AST#function_declaration#Left function sleep AST#parameter_list#Left ( AST#parameter#Left ms : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t...
export function sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/common/Utils.ets#L21-L23
0c6f191606cde104d774bad9b359140f87a34512
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FoldableGuilde/entry/src/main/ets/modules/AsideColum.ets
arkts
AsideColumn
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...
@Component export struct AsideColumn { @State l_width: string = '100%'; build() { Row() { Column() { Text('1') } .backgroundColor(Color.Pink) .onClick(() => { this.l_width = this.l_width === '100%' ? '50%' : '100%'; }) .height('100%') .width(this.l_widt...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AsideColumn AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right l_width : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annota...
@Component export struct AsideColumn { @State l_width: string = '100%'; build() { Row() { Column() { Text('1') } .backgroundColor(Color.Pink) .onClick(() => { this.l_width = this.l_width === '100%' ? '50%' : '100%'; }) .height('100%') .width(this.l_widt...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/modules/AsideColum.ets#L16-L40
90a33bfaf0648de04e23e15a11f997b1f5fe1eaf
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
日期范围接口
export interface DateRange { startDate: Date; endDate: Date; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DateRange AST#object_type#Left { AST#type_member#Left startDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left endDate : AST#type_annotation#Le...
export interface DateRange { startDate: Date; endDate: Date; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L137-L140
c23acaac6f73e7e4afd2b56683ea21be5b979f55
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets
arkts
初始化需要UIContext对象,UIContext对象可通过窗口或自定义组件的getUIContext方法获取
export const createNWeb = (url: string, uiContext: UIContext) => { // 创建WebviewController let webController = new webview.WebviewController() ; // 创建BuilderNode let builderNode : BuilderNode<[Data]> = new BuilderNode(uiContext); // 创建动态Web组件 builderNode.build(wrap, new Data(url, webController)); // 保存Bui...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left createNWeb = AST#expression#Left AST#arrow_function#Left 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#param...
export const createNWeb = (url: string, uiContext: UIContext) => { let webController = new webview.WebviewController() ; let builderNode : BuilderNode<[Data]> = new BuilderNode(uiContext); builderNode.build(wrap, new Data(url, webController)); builderNodeMap.set(url, builderNode); webControlle...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets#L95-L109
adb431395856e9d4e6c20d14638e3d7ce706f331
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothClient.ets
arkts
onConnectBluetoothDeviceChange
连接设备变化事件
onConnectBluetoothDeviceChange(): void { Log.showInfo(TAG, `onConnectBluetoothDeviceChange: connectBluetoothDevice = ${JSON.stringify(this.connectBluetoothDevice)}`); this.connectBluetoothDevice1 = this.connectBluetoothDevice; }
AST#method_declaration#Left onConnectBluetoothDeviceChange 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#Le...
onConnectBluetoothDeviceChange(): void { Log.showInfo(TAG, `onConnectBluetoothDeviceChange: connectBluetoothDevice = ${JSON.stringify(this.connectBluetoothDevice)}`); this.connectBluetoothDevice1 = this.connectBluetoothDevice; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothClient.ets#L76-L80
6cd570544f8d8a4d5c2ac0d62031b534d3072316
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/settings/LanguageSettingsPage.ets
arkts
buildDetectedLanguageItem
构建检测到的语言项
@Builder buildDetectedLanguageItem(language: SupportedLanguage) { Row({ space: 12 }) { Text(this.getLanguageInfo(language)?.flag || '🌐') .fontSize(16) Column({ space: 2 }) { Text(this.getLanguageInfo(language)?.nativeName || '') .fontSize(14) .fontColor($r('app.co...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDetectedLanguageItem AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
@Builder buildDetectedLanguageItem(language: SupportedLanguage) { Row({ space: 12 }) { Text(this.getLanguageInfo(language)?.flag || '🌐') .fontSize(16) Column({ space: 2 }) { Text(this.getLanguageInfo(language)?.nativeName || '') .fontSize(14) .fontColor($r('app.co...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/settings/LanguageSettingsPage.ets#L273-L312
8ffdbcc88af111674dc8b1f225a98ca8b2ac829a
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets
arkts
shouldDrawValues
Returns true if the DataSet values should be drawn, false if not. @param set @return
protected shouldDrawValues(dataSet: IDataSet<EntryOhos>): boolean { return dataSet.isVisible() && (dataSet.isDrawValuesEnabled() || dataSet.isDrawIconsEnabled()); }
AST#method_declaration#Left protected shouldDrawValues AST#parameter_list#Left ( AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right ...
protected shouldDrawValues(dataSet: IDataSet<EntryOhos>): boolean { return dataSet.isVisible() && (dataSet.isDrawValuesEnabled() || dataSet.isDrawIconsEnabled()); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets#L89-L91
bc959ee8758abef906d50a01577eff97a71ceebc
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
‘6.6%’
export const THOUSANDTH_80: string = '8%';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_80 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '8%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarat...
export const THOUSANDTH_80: string = '8%';
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L51-L51
3931f41418a65e6f5c2d9269083aed8d314ce79f
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FramedRendering/entry/src/main/ets/model/BasicDataSource.ets
arkts
product detail data model
export class ProductDetailModel { id: string; title: ResourceStr; icon: Resource; des: ResourceStr; price: ResourceStr; constructor(id: string, title: ResourceStr, icon: Resource, des: ResourceStr, price: ResourceStr) { this.id = id; this.title = title; this.icon = icon; this.des = des; ...
AST#export_declaration#Left export AST#class_declaration#Left class ProductDetailModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left title : AS...
export class ProductDetailModel { id: string; title: ResourceStr; icon: Resource; des: ResourceStr; price: ResourceStr; constructor(id: string, title: ResourceStr, icon: Resource, des: ResourceStr, price: ResourceStr) { this.id = id; this.title = title; this.icon = icon; this.des = des; ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FramedRendering/entry/src/main/ets/model/BasicDataSource.ets#L61-L75
d1f5122949eb0379d8c8eff17384fc049c869190
gitee