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
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getFormatRange
格式化时间日期段字符串(DateTimeFormat) @param startDate 时间日期对象 @param endDate 时间日期对象 @param options 时间日期格式化选项 @param locale 包含区域设置信息的字符串,包括语言以及可选的脚本和区域 @returns
static getFormatRange(startDate: Date, endDate: Date, options: intl.DateTimeOptions = { dateStyle: "short", timeStyle: "short", hourCycle: "h24" }, locale: string = "zh-CN"): string { const dateTimeFormat = new intl.DateTimeFormat(locale, options); return dateTimeFormat.formatRange(startDate, endDate); ...
AST#method_declaration#Left static getFormatRange AST#parameter_list#Left ( AST#parameter#Left startDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endDate : AST#type_annotation#Left AST#primary_type#Left Date AST#prima...
static getFormatRange(startDate: Date, endDate: Date, options: intl.DateTimeOptions = { dateStyle: "short", timeStyle: "short", hourCycle: "h24" }, locale: string = "zh-CN"): string { const dateTimeFormat = new intl.DateTimeFormat(locale, options); return dateTimeFormat.formatRange(startDate, endDate); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L370-L375
a27bca16cd67e0c2bab060b90e89c8646a63dd87
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
ability/ability_runtime/startup/startupmanualhelp1/entry/src/main/ets/MainAbility/PageAbility10.ets
arkts
0 undefined 1 c 2 [] 3 {} 4 第一个参数为不存在的启动框架 Sample_100
export default class PageAbility10 extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam){ hilog.info(0x0000, 'StartupTest PageAbility10', '%{public}s', 'Ability onCreate'); if (want.parameters && want.parameters?.keepAlive) { console.info('StartupTest PageAbility10 keepAliv...
AST#export_declaration#Left export default AST#class_declaration#Left class PageAbility10 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 PageAbility10 extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam){ hilog.info(0x0000, 'StartupTest PageAbility10', '%{public}s', 'Ability onCreate'); if (want.parameters && want.parameters?.keepAlive) { console.info('StartupTest PageAbility10 keepAliv...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/ability/ability_runtime/startup/startupmanualhelp1/entry/src/main/ets/MainAbility/PageAbility10.ets#L37-L152
e0be1bd586e2c34cc67ea993efc236c5412c6274
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/image/MediumAvatar.ets
arkts
构建中等尺寸头像 @returns {void} 无返回值
build(): void { Avatar({ src: this.src, avatarSize: 48, onTap: this.onTap }); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Avatar ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left A...
build(): void { Avatar({ src: this.src, avatarSize: 48, onTap: this.onTap }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/MediumAvatar.ets#L24-L30
d70f9ec50ad67a13178990c82936ebf176acad46
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
reset_global_custom_UA
Resets the custom user agent to ArkWeb default.
reset_global_custom_UA() { let default_ua = this.get_global_default_UA(); for (let index = 0; index < this.Tabs.length; index++) { this.Tabs[index].controller?.setCustomUserAgent(default_ua) } }
AST#method_declaration#Left reset_global_custom_UA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left default_ua = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AS...
reset_global_custom_UA() { let default_ua = this.get_global_default_UA(); for (let index = 0; index < this.Tabs.length; index++) { this.Tabs[index].controller?.setCustomUserAgent(default_ua) } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L179-L184
434633feb8555de49e9a64320a4ea291bf0251fb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleOptimize.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 let dataOptimize1 = 'data from module';
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left dataOptimize1 = AST#expression#Left 'data from module' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export let dataOptimize1 = 'data from module';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleOptimize.ets#L16-L16
85fc9f10b7270e22d82257b7ff80bb865363e1f6
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/pages/TodoPage.ets
arkts
addNewTodo
添加新的待办事项
async addNewTodo() { // 创建一个新的todo事项 const newTodo: Todo = { name: this.newTodoName, date: this.newTodoDate, isFinished: false, restTime:0, priority: this.priority.PriorityLevel }; try{ let task = new taskpool.Task(computeRestDays,newTodo.date) newTodo.restTime...
AST#method_declaration#Left async addNewTodo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 创建一个新的todo事项 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newTodo : AST#type_annotation#Left AST#primary_type#Left Todo AST#primary_type#Right AST#type_a...
async addNewTodo() { const newTodo: Todo = { name: this.newTodoName, date: this.newTodoDate, isFinished: false, restTime:0, priority: this.priority.PriorityLevel }; try{ let task = new taskpool.Task(computeRestDays,newTodo.date) newTodo.restTime = await taskpo...
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/pages/TodoPage.ets#L68-L93
6d9eab6ed908ef68f327ff27447ab637795c4935
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/patternlock/src/main/ets/components/PatternLockMainPage.ets
arkts
PatternLockMainPage
功能说明: 本示例介绍使用图案密码锁组件与振动接口实现图形锁屏场景 推荐场景: 需要手势密码的场景,如:手机开锁、隐私应用开启等场景 核心组件: 1. PatternLockComponent 实现步骤: 1.使用PatternLock组件展示图形密码锁界面 2.在onPatternComplete事件中进行图形密码设置与验证 3.使用startVibration接口实现振动效果
@Component export struct PatternLockMainPage { // 初始密码:解锁图案为大写字母Z @State initalPasswords: number[] = [0, 1, 2, 4, 6, 7, 8]; @State passwords: number[] = []; // 主页上方提示信息 @State message: ResourceStr = $r('app.string.pattern_lock_message_1'); // PatternLock组件控制器,可用于控制组件状态重置 private patternLockController: Pat...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PatternLockMainPage AST#component_body#Left { // 初始密码:解锁图案为大写字母Z AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right initalPasswords : AST#type_annotation#Left AST#primary_type#Left AST#array_...
@Component export struct PatternLockMainPage { @State initalPasswords: number[] = [0, 1, 2, 4, 6, 7, 8]; @State passwords: number[] = []; @State message: ResourceStr = $r('app.string.pattern_lock_message_1'); private patternLockController: PatternLockController = new PatternLockController(); onPageH...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/patternlock/src/main/ets/components/PatternLockMainPage.ets#L32-L132
08703516385d4aa2af2df4404ac9acee8fa15aa2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets
arkts
setOnMessageReceivedListener
订阅消息 @param callback
setOnMessageReceivedListener(callback: (buffer: ArrayBuffer) => void): void { if (!this.tcpSocket) { return; } this.tcpSocket.on('message', (data) => { Logger.info(`${TAG} TCP data: ` + JSON.stringify(data)); let buffer = data.message; callback(buffer); }); }
AST#method_declaration#Left setOnMessageReceivedListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Rig...
setOnMessageReceivedListener(callback: (buffer: ArrayBuffer) => void): void { if (!this.tcpSocket) { return; } this.tcpSocket.on('message', (data) => { Logger.info(`${TAG} TCP data: ` + JSON.stringify(data)); let buffer = data.message; callback(buffer); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets#L139-L149
93c4c9109d0c84cf42826aae20ba275796cceccb
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
clear
清空哈希表
clear(): void { this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null); this.size = 0; }
AST#method_declaration#Left clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expre...
clear(): void { this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null); this.size = 0; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L131-L134
213fa21b716ac4969f1b881d330e48b600292ae3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/models/ContactModel.ets
arkts
update
更新联系人信息
update(params: UpdateContactParams): Contact { const updatedContact: Contact = { id: this.contact.id, name: this.contact.name, avatar: this.contact.avatar, phone: this.contact.phone, email: this.contact.email, relation: this.contact.relation, gender: this.contact.gender, ...
AST#method_declaration#Left update AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left UpdateContactParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary...
update(params: UpdateContactParams): Contact { const updatedContact: Contact = { id: this.contact.id, name: this.contact.name, avatar: this.contact.avatar, phone: this.contact.phone, email: this.contact.email, relation: this.contact.relation, gender: this.contact.gender, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L165-L229
f4a1ff8d8d96e0b5bd80eddbc4c23917cf735a8f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
initialize
初始化设置 加载现有设置或创建默认设置
async initialize(): Promise<void> { try { this.settings = await this.loadSettings(); if (!this.settings) { this.settings = this.createDefaultSettings(); await this.saveSettings(this.settings); } hilog.info(0x0001, 'BirthdayReminder', 'SettingsService initialized succes...
AST#method_declaration#Left async initialize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
async initialize(): Promise<void> { try { this.settings = await this.loadSettings(); if (!this.settings) { this.settings = this.createDefaultSettings(); await this.saveSettings(this.settings); } hilog.info(0x0001, 'BirthdayReminder', 'SettingsService initialized succes...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L99-L115
ef1a63cb38833127b317256df3e452b3aeb93217
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/MultiDeviceAppDev/AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/data/applications/Applications.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export const ApplicationsData: Resource [] = [ $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.strin...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ApplicationsData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#...
export const ApplicationsData: Resource [] = [ $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.string.multiScene_application'), $r('app.strin...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/data/applications/Applications.ets#L16-L51
14165c912fe832bbfcbcc8ee08c641ff64829e52
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets
arkts
convertOrderGoodsToCart
将订单商品列表转换为购物车结构 @param {Order} order - 订单数据 @returns {Cart[]} 购物车列表
private convertOrderGoodsToCart(order: Order): Cart[] { return order.goodsList?.length ? this.buildCartList(order.goodsList) : []; }
AST#method_declaration#Left private convertOrderGoodsToCart AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array...
private convertOrderGoodsToCart(order: Order): Cart[] { return order.goodsList?.length ? this.buildCartList(order.goodsList) : []; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L161-L163
1f5a772304520e4d5a69895bed7bdb7dc13b305e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TransitionAnimation/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
adaptDimension
Obtains the screen horizontal adaptation value. @return number
static adaptDimension(value: number): number { let deviceDisplay: display.Display = GlobalContext.getContext().getObject('display') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WID...
AST#method_declaration#Left static adaptDimension 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_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
static adaptDimension(value: number): number { let deviceDisplay: display.Display = GlobalContext.getContext().getObject('display') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WID...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/utils/DimensionUtil.ets#L41-L48
87eaba35794b92983212b2d1222d4db844ac394a
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HapAndHarDependHar/entry/oh_modules/har_library/Index.ets
arkts
MainPage
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 { MainPage } from './src/main/ets/components/mainpage/MainPage';
AST#export_declaration#Left export { MainPage } from './src/main/ets/components/mainpage/MainPage' ; AST#export_declaration#Right
export { MainPage } from './src/main/ets/components/mainpage/MainPage';
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HapAndHarDependHar/entry/oh_modules/har_library/Index.ets#L16-L16
63611c72010edfe2ed9b93a9992e9913b7cde48a
gitee
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/comm/CommentPage.ets
arkts
CommentPage
字体粗细
@Component export struct CommentPage { // 评论 @State commonData: CommentModel = new CommentModel("", "", "", "", "", "", new Date(), new CommentData()); // 评论中的文字 @Link replyId: string; // 回复人昵称 @Link replyUser: string; // 当前用户 @State curUser: string = ""; @State commentTimeText: string = ''; @State...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommentPage AST#component_body#Left { // 评论 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right commonData : AST#type_annotation#Left AST#primary_type#Left CommentModel AST#primary_type#Right ...
@Component export struct CommentPage { @State commonData: CommentModel = new CommentModel("", "", "", "", "", "", new Date(), new CommentData()); 中的文字 @Link replyId: string; @Link replyUser: string; @State curUser: string = ""; @State commentTimeText: string = ''; @State replyTimeText:String='';...
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/comm/CommentPage.ets#L21-L202
1608f7a61e9f71b633cdcaea677dc9cffac00dd6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
通知震动配置接口
export interface NotificationVibrationConfig { enabled: boolean; pattern?: number[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationVibrationConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left pattern ? : A...
export interface NotificationVibrationConfig { enabled: boolean; pattern?: number[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L299-L302
fc514052c5041039fd647a8ee746e64a5bb29145
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/ArkTSComponents/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * Input length of the account. */ static readonly INPUT_ACCOUNT_LENGTH = 11; /** * Input length of the password. */ static readonly INPUT_PASSWORD_LENGTH = 8; /** * Left padding of the input box */ static readonly INPUT_PADDING_LEFT = 0; /*...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Input length of the account. */ AST#property_declaration#Left static readonly INPUT_ACCOUNT_LENGTH = AST#expression#Left 11 AST#expression#Right ; AST#property_declaration#Right /** * Input ...
export default class CommonConstants { static readonly INPUT_ACCOUNT_LENGTH = 11; static readonly INPUT_PASSWORD_LENGTH = 8; static readonly INPUT_PADDING_LEFT = 0; static readonly LOGIN_DELAY_TIME = 2000; static readonly COMMON_SPACE = 12; static readonly HOME_TITLE = '首页'; sta...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ArkTSComponents/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L79
cd68014011eee167716ab65d537da313b88166d4
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/GlobalContext.ets
arkts
get
获取缓存中的数据
public get<T>(key: string): T { return this._objects.get(key) as T; }
AST#method_declaration#Left public get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right )...
public get<T>(key: string): T { return this._objects.get(key) as T; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/GlobalContext.ets#L52-L54
829ea9ad5df36bd72cdc305f922bebf5d79d63d6
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_settings.ets
arkts
A settings_item item, consists of a key and its value. @param key A string, the key of this setting. @param value A string | boolean | number, the value of this setting.
constructor(key: string, value: string | boolean | number) { this.key = key; this.value = value; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left strin...
constructor(key: string, value: string | boolean | number) { this.key = key; this.value = value; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L428-L431
4c0e3f86b98c1b5879e05758528ed74d6900cdb0
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
getCurrentVersionInfo
取当前版本数据 @return resolve 当前版本信息/reject 错误信息
async getCurrentVersionInfo(): Promise<UpgradeData<update.CurrentVersionInfo>> { return this.updateManager.getCurrentVersionInfo(); }
AST#method_declaration#Left async getCurrentVersionInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left UpgradeData AST#type_arguments#Left <...
async getCurrentVersionInfo(): Promise<UpgradeData<update.CurrentVersionInfo>> { return this.updateManager.getCurrentVersionInfo(); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L220-L222
5d6f958b5e7afb6331b7ea9788b124895bd349b8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
getMediaFileInfo
获取媒体文件信息
async getMediaFileInfo(filePath: string): Promise<MediaFileInfo> { try { const stat = fs.statSync(filePath); const fileExtension = filePath.split('.').pop()?.toLowerCase() || ''; const mediaType = this.getMediaTypeByExtension(fileExtension); let width: number | undefined; let height: ...
AST#method_declaration#Left async getMediaFileInfo AST#parameter_list#Left ( AST#parameter#Left filePath : 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_ty...
async getMediaFileInfo(filePath: string): Promise<MediaFileInfo> { try { const stat = fs.statSync(filePath); const fileExtension = filePath.split('.').pop()?.toLowerCase() || ''; const mediaType = this.getMediaTypeByExtension(fileExtension); let width: number | undefined; let height: ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L531-L586
16a765eb066235fb0a7c98b72205a4dab2a47432
github
openharmony/global_resource_management
abbbae9556ca674a754d58c65039a821b72357ae
interfaces/ets/ani/resourceManager/ets/global/resource.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export interface Resource { bundleName: string; moduleName: string; id: number; params?: Array<Object | undefined>; type?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Resource AST#object_type#Left { AST#type_member#Left bundleName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left moduleName : AST#type_annotati...
export interface Resource { bundleName: string; moduleName: string; id: number; params?: Array<Object | undefined>; type?: number; }
https://github.com/openharmony/global_resource_management/blob/abbbae9556ca674a754d58c65039a821b72357ae/interfaces/ets/ani/resourceManager/ets/global/resource.ets#L16-L22
d74c1754c50d829d0098508162590bd924cc9d5b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
hidePanel
隐藏播放面板。
static hidePanel(): boolean { try { TextReader.hidePanel(); return true; } catch (e) { console.error(`TextReader failed to hide panel. Code: ${e.code}, message: ${e.message}`); return false; } }
AST#method_declaration#Left static hidePanel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Le...
static hidePanel(): boolean { try { TextReader.hidePanel(); return true; } catch (e) { console.error(`TextReader failed to hide panel. Code: ${e.code}, message: ${e.message}`); return false; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L149-L157
95cd044bc4714a0aaca6d0e44dd08d9153d149fd
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets
arkts
预览文件,成功预览返回true,否则返回false
export async function preViewFile(context: Context, localFilePath: string, mineType: string): Promise<boolean> { //要预览的文件信息 let fileInfo: filePreview.PreviewInfo = { uri: localFilePath, mimeType: mineType }; //是否可预览 let canPreview = await filePreview.canPreview(context, localFilePath) if (canPrevie...
AST#export_declaration#Left export AST#function_declaration#Left async function preViewFile AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left localFilePath : AST#type_ann...
export async function preViewFile(context: Context, localFilePath: string, mineType: string): Promise<boolean> { let fileInfo: filePreview.PreviewInfo = { uri: localFilePath, mimeType: mineType }; let canPreview = await filePreview.canPreview(context, localFilePath) if (canPreview) { fil...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L145-L161
673ad0543dfa689f95754d78aa15e3b6faf840b0
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentEncapsulation/entry/src/main/ets/pages/WatchCallPage.ets
arkts
ChildComponent
[Start watch]
@Component export struct ChildComponent { @State bgColor: ResourceColor = Color.White; @Link @Watch('switchColor') checkFlag: boolean; private switchColor() { if (this.checkFlag) { this.bgColor = Color.Red; } else { this.bgColor = Color.White; } } build() { Column() { Text(...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChildComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#t...
@Component export struct ChildComponent { @State bgColor: ResourceColor = Color.White; @Link @Watch('switchColor') checkFlag: boolean; private switchColor() { if (this.checkFlag) { this.bgColor = Color.Red; } else { this.bgColor = Color.White; } } build() { Column() { Text(...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentEncapsulation/entry/src/main/ets/pages/WatchCallPage.ets#L16-L35
7498da73bd7387bf7ba715a6d82662af5e119438
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/http/FileUtil.ets
arkts
TODO 文件操作相关工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class FileUtil { static readonly separator: string = '/'; /** * 获取文件目录下的文件夹路径或文件路径。 * @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 * @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 * @param blHap true:HAP级别文件路径、 false:App级别文件路径 * @returns */ static getFilesDir...
AST#export_declaration#Left export AST#class_declaration#Left class FileUtil AST#class_body#Left { AST#property_declaration#Left static readonly separator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/' AST#expression#Right ; AST#propert...
export class FileUtil { static readonly separator: string = '/'; static getFilesDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().filesDir : getContext().getApplicationContext().filesDir; if (StringUtils.isNotEmpty(dirPath)) { ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/FileUtil.ets#L26-L828
eb722197fe0632385b3cd811981a596641db740e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.utils.d.ets
arkts
notifyOne
Notify one waiting promise. @syscap SystemCapability.Utils.Lang @atomicservice @since 18
notifyOne(): void;
AST#method_declaration#Left notifyOne 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#method_declaration#Right
notifyOne(): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L699-L699
67e5d5647311dc5fa20a4d6d494cd5eeeee2b658
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets
arkts
TODO 加解密公用工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/07/01
export class CryptoUtil { /** * 加密,异步 * @param data 加密或者解密的数据。data不能为null。 * @param key 指定加密或解密的密钥。 * @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 * @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。 * @returns */ static async encrypt(data...
AST#export_declaration#Left export AST#class_declaration#Left class CryptoUtil AST#class_body#Left { /** * 加密,异步 * @param data 加密或者解密的数据。data不能为null。 * @param key 指定加密或解密的密钥。 * @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 * @param transformation 待生成Cipher的算法名...
export class CryptoUtil { static async encrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> { let cipher = cryptoFramework.createCipher(transformation); await cipher.init(cryptoFramework...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets#L26-L652
f91c7146ee8bc6b8c26c736f48a9ce2041130731
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/NavigationService.ets
arkts
返回到指定路由 @param {string} name - 目标路由名称 @param {boolean} inclusive - 是否移除目标自身(默认 false) @returns {void} 无返回值
export function popTo(name: string, inclusive: boolean = false): void { const stack: NavPathStack | undefined = getNavPathStack(); if (!stack) { return; } try { stack.popToName(name, inclusive); } catch (err) { hilog.error(DOMAIN, "NavSvc", "[NavigationService] popTo failed: %{public}s", JSON.stri...
AST#export_declaration#Left export AST#function_declaration#Left function popTo 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 inclusive : AST#type_annotation#Left AST#pri...
export function popTo(name: string, inclusive: boolean = false): void { const stack: NavPathStack | undefined = getNavPathStack(); if (!stack) { return; } try { stack.popToName(name, inclusive); } catch (err) { hilog.error(DOMAIN, "NavSvc", "[NavigationService] popTo failed: %{public}s", JSON.stri...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L120-L130
3bf4fc1a7dc1360ad70248c0dbef0608503771ec
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/componentstack/src/main/ets/model/IconModel.ets
arkts
商品的数据类
export class ProductDataModel { id: number; uri: ResourceStr; title: ResourceStr; price: ResourceStr; insurance: ResourceStr; constructor(id: number, uri: ResourceStr, title: ResourceStr, price: ResourceStr, insurance: ResourceStr) { this.id = id; this.uri = uri; this.title = title; this.pr...
AST#export_declaration#Left export AST#class_declaration#Left class ProductDataModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left uri : AST#ty...
export class ProductDataModel { id: number; uri: ResourceStr; title: ResourceStr; price: ResourceStr; insurance: ResourceStr; constructor(id: number, uri: ResourceStr, title: ResourceStr, price: ResourceStr, insurance: ResourceStr) { this.id = id; this.uri = uri; this.title = title; this.pr...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/model/IconModel.ets#L36-L54
d291fba022c9d24689d1ff6e6e00fae2ec87fc98
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/UserInfoRepository.ets
arkts
@file 用户信息仓库,封装用户信息相关请求 @author Joker.X
export class UserInfoRepository { /** * 用户信息网络数据源 */ private networkDataSource: UserInfoNetworkDataSource; /** * 构造函数 * @param {UserInfoNetworkDataSource} networkDataSource - 可选的用户信息数据源实例 */ constructor(networkDataSource?: UserInfoNetworkDataSource) { this.networkDataSource = networkDataSour...
AST#export_declaration#Left export AST#class_declaration#Left class UserInfoRepository AST#class_body#Left { /** * 用户信息网络数据源 */ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left UserInfoNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#...
export class UserInfoRepository { private networkDataSource: UserInfoNetworkDataSource; constructor(networkDataSource?: UserInfoNetworkDataSource) { this.networkDataSource = networkDataSource ?? new UserInfoNetworkDataSourceImpl(); } async updatePersonInfo(params: Record<string, Unknown>): Promis...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/UserInfoRepository.ets#L8-L65
1ae0bbf2cc9bc83692a8c5383bfe25a1e75edfcb
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/BoxType.ets
arkts
typeString
返回 distance 类型字符串:学习 或 复习 @param distance 天数 @returns 学习 或 复习
static typeString(distance: DistanceFromBase): string { return distance === BoxType.New ? getString($r("app.string.distance_new_string")) : getString($r("app.string.distance_review_string")); }
AST#method_declaration#Left static typeString AST#parameter_list#Left ( AST#parameter#Left distance : AST#type_annotation#Left AST#primary_type#Left DistanceFromBase AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AS...
static typeString(distance: DistanceFromBase): string { return distance === BoxType.New ? getString($r("app.string.distance_new_string")) : getString($r("app.string.distance_review_string")); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/BoxType.ets#L43-L45
07b852d416bde7826d7e436608540c71d7ceda14
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/Index.ets
arkts
registryDocumentViewPickerFn
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 { registryDocumentViewPickerFn, generateAbilityID, addUIContext, setTopAbilityID, removeUIContext } from './src/main/ets/wrapper/wrapper';
AST#export_declaration#Left export { registryDocumentViewPickerFn , generateAbilityID , addUIContext , setTopAbilityID , removeUIContext } from './src/main/ets/wrapper/wrapper' ; AST#export_declaration#Right
export { registryDocumentViewPickerFn, generateAbilityID, addUIContext, setTopAbilityID, removeUIContext } from './src/main/ets/wrapper/wrapper';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/Index.ets#L15-L21
1ff33857c42182cd751dafae1998c32f4dfa8662
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/mock/local/FileData.ets
arkts
文件价\文件结构
export class FileStructure { // 名字 public name: string = ""; // 时间 public time: string = ""; // 子文件数量 public childrenNum?: number // 数据类型 1:文件夹、2:文件 public type: number = 0; // 文件大小 public size?: string; // 处理日期格式 private dateFormat(time: Date): string { let date = time; let year = date....
AST#export_declaration#Left export AST#class_declaration#Left class FileStructure 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#expression#Left "" AST#expression#Right ; AST#property_de...
export class FileStructure { public name: string = ""; public time: string = ""; public childrenNum?: number public type: number = 0; public size?: string; private dateFormat(time: Date): string { let date = time; let year = date.getFullYear(); let month: string | number = date...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/mock/local/FileData.ets#L17-L57
b6084b94efe43b8bf27c676f970c23fa2dd05e35
gitee
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/bean/StockBasicInfoBean.ets
arkts
{"code":"000002","date":20240116,"time":121111,"snap":["万 科A",9.7100,9.6700,9.7000,9.5400,9.5500, -0.1600,-1.65,33986076,327706400,1200,17410183,16575893,[9.5400,98700,9.5300,246700,9.5200,154500,9.5100, 343100,9.5000,629400],[9.5500,10200,9.5600,92600,9.5700,53500,9.5800,198301,9.5900,49100]]} 股票的基础信息
export class StockBasicInfoBean { code: string date: number time: number = 0 snap: StockSnap }
AST#export_declaration#Left export AST#class_declaration#Left class StockBasicInfoBean AST#class_body#Left { AST#property_declaration#Left code AST#ERROR#Left : AST#ERROR#Left string date : number time : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Rig...
export class StockBasicInfoBean { code: string date: number time: number = 0 snap: StockSnap }
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/bean/StockBasicInfoBean.ets#L8-L13
b21239343324e9c59109be01d52fbb1908ab4ffd
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Alarm/AlarmManager.ets
arkts
saveReminderId
保存提醒ID
private async saveReminderId(reminderId: number): Promise<void> { if (!this.prefs) throw new Error('Preferences未初始化'); await this.prefs.put('reminderId', reminderId); await this.prefs.flush(); }
AST#method_declaration#Left private async saveReminderId AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge...
private async saveReminderId(reminderId: number): Promise<void> { if (!this.prefs) throw new Error('Preferences未初始化'); await this.prefs.put('reminderId', reminderId); await this.prefs.flush(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/AlarmManager.ets#L52-L56
1202b64519fbc3826815fd71b3953935c4779826
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets
arkts
getAddressInfo
获取地址详情 @param {number} id - 地址 ID @returns {Promise<NetworkResponse<Address>>} 地址详情
async getAddressInfo(id: number): Promise<NetworkResponse<Address>> { const resp: AxiosResponse<NetworkResponse<Address>> = await NetworkClient.http.get("user/address/info", { params: { id } }); return resp.data; }
AST#method_declaration#Left async getAddressInfo AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
async getAddressInfo(id: number): Promise<NetworkResponse<Address>> { const resp: AxiosResponse<NetworkResponse<Address>> = await NetworkClient.http.get("user/address/info", { params: { id } }); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets#L70-L74
613d741b1bacc57e3966fedaa4da0bcce6df5edd
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/MusicModel.ets
arkts
歌曲信息接口
export interface MusicInfo { title: string, cover: string, singer: string, duration: number, res: string, lrcRes: string, }
AST#export_declaration#Left export AST#interface_declaration#Left interface MusicInfo AST#object_type#Left { AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left cover : AST#type_annotation#Left A...
export interface MusicInfo { title: string, cover: string, singer: string, duration: number, res: string, lrcRes: string, }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/MusicModel.ets#L87-L94
3a9a70353ef1bc2147ba0c9326c1edb840d9f806
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/GlobalContext.ets
arkts
put
将数据存入缓存中
public put(key: string, value: Object): void { this._objects.set(key, value); }
AST#method_declaration#Left public put AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right A...
public put(key: string, value: Object): void { this._objects.set(key, value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/GlobalContext.ets#L45-L47
9567e88173fcee62c22f0f0d410620e10c29f2c3
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/Logger.ets
arkts
error
error级别日志【入参为两个字符串,第一个为提示消息,第二个为错误原因】 @param args 错误信息
static error(...args: string[]): void { hilog.error(Logger.domain, Logger.prefix, Logger.format, args); }
AST#method_declaration#Left static error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A...
static error(...args: string[]): void { hilog.error(Logger.domain, Logger.prefix, Logger.format, args); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Logger.ets#L147-L149
819602b617047d9a9f051e33c5c922b359ec2b05
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/GridSample/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * Top grid count. */ static readonly TOP_GRID_COUNT: number = 8; /** * Bottom grid count. */ static readonly BOTTOM_GRID_COUNT: number = 32; /** * Font weight of text in Grid. */ static readonly GRID_ITEM_FONT_WEIGHT: number = 400; /** * Font weig...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Top grid count. */ AST#property_declaration#Left static readonly TOP_GRID_COUNT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#...
export class CommonConstants { static readonly TOP_GRID_COUNT: number = 8; static readonly BOTTOM_GRID_COUNT: number = 32; static readonly GRID_ITEM_FONT_WEIGHT: number = 400; static readonly TEXT_FONT_WEIGHT: number = 500; static readonly TITLE_FONT_WEIGHT: number = 500; static reado...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/GridSample/entry/src/main/ets/common/constants/CommonConstants.ets#L4-L54
30bed51f175ef7b4292434d4398316ae7832ac66
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.DownloadFileButton.d.ets
arkts
Defines the download content options. @interface DownloadContentOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface DownloadContentOptions { /** * DownloadFileButton icon Style. * * @type { ?DownloadIconStyle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ icon?: DownloadIconStyle; /** * DownloadFileButton description. * * @type {...
AST#export_declaration#Left export AST#interface_declaration#Left interface DownloadContentOptions AST#object_type#Left { /** * DownloadFileButton icon Style. * * @type { ?DownloadIconStyle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_me...
export interface DownloadContentOptions { icon?: DownloadIconStyle; text?: DownloadDescription; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L185-L207
d489e27ce437a316e6f9783ac066a4ae39c737cc
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/ContactPage.ets
arkts
addFriend
添加好友
addFriend() { router.pushUrl({ url: 'pages/AddFriendPage' }); }
AST#method_declaration#Left addFriend 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 router AST#expression#Right . pushUrl AST#member_expre...
addFriend() { router.pushUrl({ url: 'pages/AddFriendPage' }); }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/ContactPage.ets#L195-L199
5efa27f50d8359728a887a09068a74e5df749fe3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteItemModel.ets
arkts
场地信息,包括场地图片、场地名称、场地地址、场地折扣、场地套餐
export class SiteItem { siteImage: ResourceStr; // 场地图片 siteName: string; // 场地名称 siteAddress: string; // 场地地址 siteDiscount: string; // 场地折扣 siteBale: Array<TimeList>; // 场地套餐 constructor(siteImage: ResourceStr, siteName: string, siteAddress: string, siteDiscount: string, siteBale: Array<TimeList>) { ...
AST#export_declaration#Left export AST#class_declaration#Left class SiteItem AST#class_body#Left { AST#property_declaration#Left siteImage : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 场地图片 AST#property_declaration#Left ...
export class SiteItem { siteImage: ResourceStr; siteName: string; siteAddress: string; siteDiscount: string; siteBale: Array<TimeList>; constructor(siteImage: ResourceStr, siteName: string, siteAddress: string, siteDiscount: string, siteBale: Array<TimeList>) { this.siteImage = siteImage; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteItemModel.ets#L29-L44
8e8a401c45c7b465d08ae95b23db5b266ece326a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
联系人基础信息接口
export interface ContactInfo { id: string; name: string; avatar?: string; phone?: string; email?: string; relation: RelationType; gender: Gender; tags: string[]; notes?: string; createdAt: string; updatedAt: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ContactInfo AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST...
export interface ContactInfo { id: string; name: string; avatar?: string; phone?: string; email?: string; relation: RelationType; gender: Gender; tags: string[]; notes?: string; createdAt: string; updatedAt: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L102-L114
8f6ec3c746463202c3eed036b642c8b2d25adad8
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bridges/PhotoView/PickHelper.ets
arkts
makeAssetModels
根据相机相册返回的uri生成 AssetModel @param uris 图片uri数组 @param toDir 要copy到的本地路径 @returns 返回 AssetModels
static async makeAssetModels(uris: Array<string>, toDir: string): Promise<Array<AssetModel>> { let access = await fs.access(toDir) if (access == false) { await fs.mkdir(toDir).catch((err: BusinessError) => { DMPLogger.e(`[PhotosUtil] mkdir error: ${JSON.stringify(err)}`) }) } let mo...
AST#method_declaration#Left static async makeAssetModels AST#parameter_list#Left ( AST#parameter#Left uris : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#t...
static async makeAssetModels(uris: Array<string>, toDir: string): Promise<Array<AssetModel>> { let access = await fs.access(toDir) if (access == false) { await fs.mkdir(toDir).catch((err: BusinessError) => { DMPLogger.e(`[PhotosUtil] mkdir error: ${JSON.stringify(err)}`) }) } let mo...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/PhotoView/PickHelper.ets#L15-L37
837a7fc8227d39429288b5623d47ec62ff2aa4cc
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets
arkts
removeData
删除数据函数 @param index
removeData(index: number): void { this.originDataArray = this.originDataArray.slice(index, 1); }
AST#method_declaration#Left removeData 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#Right A...
removeData(index: number): void { this.originDataArray = this.originDataArray.slice(index, 1); }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L65-L67
2476910ed48f5096c36273ba8db6895627633403
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets
arkts
date format
export const TODAY: string = new Date().toDateString();
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TODAY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#...
export const TODAY: string = new Date().toDateString();
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L53-L53
8931d677d2d798abe5f3f2ee2a4d294a6c93a486
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/axios/EfClientApi.ets
arkts
all
批量获取请求 @param requestList 需要传入的请求集合 @returns 返回的请求结果ArrayList集合组装
async all(requestList: Promise<AxiosResponse>[]): Promise<ArrayList<string> | EfAxiosError> { try { //返回结果 let result: ArrayList<string> = new ArrayList(); //发起请求 let responseList: AxiosResponse[] = await Promise.all(requestList); //返回response的数据 responseList.forEach((response: A...
AST#method_declaration#Left async all AST#parameter_list#Left ( AST#parameter#Left requestList : AST#ERROR#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AxiosResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments...
async all(requestList: Promise<AxiosResponse>[]): Promise<ArrayList<string> | EfAxiosError> { try { let result: ArrayList<string> = new ArrayList(); let responseList: AxiosResponse[] = await Promise.all(requestList); responseList.forEach((response: AxiosResponse) => { ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L302-L320
031d236467014fa4c97e7bf0ce297b4a8859da3e
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/model/WindowModel.ets
arkts
窗口管理模型 - 控制登录验证子窗口的生命周期 Window controller model for login verification sub-window. Source: 从 WindowManager 项目迁移并适配溪村园区项目
export default class WindowModel { private windowStage?: window.WindowStage; private subWindowClass?: window.Window; /** * 获取单例实例 * Get singleton. * * @return {WindowModel} WindowModel 单例 */ static getInstance(): WindowModel { let instance: WindowModel = GlobalContext.getContext().getObject(...
AST#export_declaration#Left export default AST#class_declaration#Left class WindowModel AST#class_body#Left { AST#property_declaration#Left private windowStage ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotat...
export default class WindowModel { private windowStage?: window.WindowStage; private subWindowClass?: window.Window; static getInstance(): WindowModel { let instance: WindowModel = GlobalContext.getContext().getObject('windowModel') as WindowModel; if (instance === undefined) { instance = new Wi...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/model/WindowModel.ets#L27-L165
8d93c8f57c037ed734c217ec574eb89525e5fcda
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpdfviewer/src/main/ets/view/RemotePPTViewer.ets
arkts
RemotePPTViewer
指定进度总长,进度条总长度为100
@Component export struct RemotePPTViewer { @State remoteProgressValue: number = 0; // 设置加载网络进度,进度条初始值为0 @State isHiddenRemoteProgress: Boolean = true; // 记录加载网络进度条显隐,进入页面默认加载 controller: webview.WebviewController = new webview.WebviewController(); build() { Column() { Stack() { if (this.isHid...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RemotePPTViewer AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right remoteProgressValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
@Component export struct RemotePPTViewer { @State remoteProgressValue: number = 0; @State isHiddenRemoteProgress: Boolean = true; controller: webview.WebviewController = new webview.WebviewController(); build() { Column() { Stack() { if (this.isHiddenRemoteProgress) { Progress({ v...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpdfviewer/src/main/ets/view/RemotePPTViewer.ets#L22-L61
abfbd223374c14e1b423c1d42c8ebcce067ab4ba
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LLMConfigPage.ets
arkts
clearConfig
清除配置
private clearConfig(): void { this.llmService.clearConfig(); this.apiKey = ''; this.baseUrl = ''; this.model = ''; this.testResult = '配置已清除'; this.testSuccess = false; }
AST#method_declaration#Left private clearConfig 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#expr...
private clearConfig(): void { this.llmService.clearConfig(); this.apiKey = ''; this.baseUrl = ''; this.model = ''; this.testResult = '配置已清除'; this.testSuccess = false; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L174-L181
4f8f7e53a6807795f885d5a3fb0e2b539040b286
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
showToast
显示奶油提示。 @param message 提示内容 @param duration 持续时间(单位:毫秒),默认1500
static showToast(message: string | Resource, duration: number = 1500) { promptAction.showToast({ message: message, duration: duration, // 软键盘弹出时,防止Toast上抬,详见: https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-keyboard-layout-adapt-V5#section381324419328 showMode: promptActi...
AST#method_declaration#Left static showToast AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ...
static showToast(message: string | Resource, duration: number = 1500) { promptAction.showToast({ message: message, duration: duration, showMode: promptAction.ToastShowMode.TOP_MOST, }); }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/ToolKits.ets#L118-L126
c59da5c9c4a4f4b6a8c7981bd6387d549db31f6b
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/update/UpdateManager.ets
arkts
cancelDownload
取消下载
cancelDownload(): void { if (this.downloadTask) { // 取消下载任务 this.downloadTask = null; this.onProgressCallback = null; Logger.info('UpdateManager', 'Download cancelled'); } }
AST#method_declaration#Left cancelDownload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_ex...
cancelDownload(): void { if (this.downloadTask) { this.downloadTask = null; this.onProgressCallback = null; Logger.info('UpdateManager', 'Download cancelled'); } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/update/UpdateManager.ets#L203-L210
1f6b976c3c0d1c03430670fdc043a64c415a6b68
github
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
getSyncAttrib
https://registry.khronos.org/EGL/sdk/docs/man/html/eglGetSyncAttrib.xhtml @param attribute EGL_SYNC_TYPE / EGL_SYNC_STATUS / EGL_SYNC_CONDITION
getSyncAttrib(sync: EGLSync, attribute: number): number | undefined;
AST#method_declaration#Left getSyncAttrib AST#parameter_list#Left ( AST#parameter#Left sync : AST#type_annotation#Left AST#primary_type#Left EGLSync AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attribute : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
getSyncAttrib(sync: EGLSync, attribute: number): number | undefined;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L219-L219
aec84b12978b09d8ad585cd4edadac6c36b757fb
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/udp/UdpEchoServer/entry/src/main/ets/pages/Index.ets
arkts
getCurrentTimeString
同步获取当前时间的字符串形式
async function getCurrentTimeString() { let time = "" await systemDateTime.getDate().then( (date) => { time = date.getHours().toString() + ":" + date.getMinutes().toString() + ":" + date.getSeconds().toString() } ) return "[" + time + "]" }
AST#function_declaration#Left async function getCurrentTimeString AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left time = AST#expression#Left "" AST#expression#Right AST#variable_declarator#Right AST#variab...
async function getCurrentTimeString() { let time = "" await systemDateTime.getDate().then( (date) => { time = date.getHours().toString() + ":" + date.getMinutes().toString() + ":" + date.getSeconds().toString() } ) return "[" + time + "]" }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/udp/UdpEchoServer/entry/src/main/ets/pages/Index.ets#L131-L140
19e5eeb41163d031807407d071df55c0c102c62d
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/CameraService.ets
arkts
摄像头信息接口(用于UI显示)
export interface CameraInfo { id: string; name: string; url: string; status: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CameraInfo AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST#...
export interface CameraInfo { id: string; name: string; url: string; status: string; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/CameraService.ets#L16-L21
f74befa6847199032817ffab475d862e9756adfe
github
de8gemaker/AccountApp.git
b5156cd90ac02239b39fd0f91d32851acad8ba42
entry/src/main/ets/service/account.ets
arkts
getRangeAccountByType
查询指定日期范围内收入/支出的账单数据
getRangeAccountByType(startTime: number, endTime: number, type: AccountType) { return AccountModel.queryRangeAndType(startTime, endTime, type); }
AST#method_declaration#Left getRangeAccountByType AST#parameter_list#Left ( AST#parameter#Left startTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endTime : AST#type_annotation#Left AST#primary_type#Left number AST#p...
getRangeAccountByType(startTime: number, endTime: number, type: AccountType) { return AccountModel.queryRangeAndType(startTime, endTime, type); }
https://github.com/de8gemaker/AccountApp.git/blob/b5156cd90ac02239b39fd0f91d32851acad8ba42/entry/src/main/ets/service/account.ets#L47-L49
b5435034cefd16f0b89557317be33b0bfd53fe4a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets
arkts
gridItem删除管理
export class GridItemDeletionCtrl<T> { private modifier: GridItemModifier[] = []; private gridData: T[] = []; private status: DeletionStatus = DeletionStatus.IDLE; constructor(data: T[]) { this.gridData = data; data.forEach(() => { this.modifier.push(new GridItemModifier()); }) } /** ...
AST#export_declaration#Left export AST#class_declaration#Left class GridItemDeletionCtrl AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { AST#property_declaration#Left private modifier : AST#type_annotation#Left AST#primary_type#Left AST#arr...
export class GridItemDeletionCtrl<T> { private modifier: GridItemModifier[] = []; private gridData: T[] = []; private status: DeletionStatus = DeletionStatus.IDLE; constructor(data: T[]) { this.gridData = data; data.forEach(() => { this.modifier.push(new GridItemModifier()); }) } getM...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets#L42-L109
bcb6d865eeb8ae501373fc4bb8c956b55831ff3e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/social/SearchPage.ets
arkts
buildEmptyResults
构建空结果
@Builder buildEmptyResults() { Column({ space: 16 }) { Image($r('app.media.ic_search_empty')) .width('80vp') .height('80vp') .fillColor($r('app.color.text_secondary')) .opacity(0.5) Text('未找到相关结果') .fontSize(16) .fontColor($r('app.color.text_secondary')...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyResults AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_p...
@Builder buildEmptyResults() { Column({ space: 16 }) { Image($r('app.media.ic_search_empty')) .width('80vp') .height('80vp') .fillColor($r('app.color.text_secondary')) .opacity(0.5) Text('未找到相关结果') .fontSize(16) .fontColor($r('app.color.text_secondary')...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/SearchPage.ets#L380-L412
21752ac516311d9ab4b91474683088b05d04f88e
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/util/Snowflake.ets
arkts
应用约束:61. 使用ES模块导出
export default SnowflakeUtil;
AST#export_declaration#Left export default AST#expression#Left SnowflakeUtil AST#expression#Right ; AST#export_declaration#Right
export default SnowflakeUtil;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/util/Snowflake.ets#L79-L79
d1496296fccce008403d4ff2b4c82389bc0ba015
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/GreetingsPage.ets
arkts
buildFilterOption
构建筛选选项
@Builder buildFilterOption(label: string, value: string, type: string) { const isSelected = type === 'style' ? (this.selectedStyle === value) : (this.selectedOccasion === value); Button(label) .type(ButtonType.Capsule) .fontSize(14) .fontColor(isSelected ? '#ffffff' : '#66...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilterOption AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#...
@Builder buildFilterOption(label: string, value: string, type: string) { const isSelected = type === 'style' ? (this.selectedStyle === value) : (this.selectedOccasion === value); Button(label) .type(ButtonType.Capsule) .fontSize(14) .fontColor(isSelected ? '#ffffff' : '#66...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L560-L575
72b5ccf7a165517d51a472241e5cf06ac37e2beb
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/MainView.ets
arkts
TabBuilder
设置tabBar样式的位置、未选中图片、选中图片及文字显示的参数
@Builder TabBuilder(text: Resource, index: number) { Column() { Text(text) .fontSize(this.currentTabIndex === index ? $r('app.integer.layout_size_24') : $r('app.integer.layout_size_18')) .fontWeight(this.currentTabIndex === index ? 700 : 500) .fontColor(this.currentTabIndex === index...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left A...
@Builder TabBuilder(text: Resource, index: number) { Column() { Text(text) .fontSize(this.currentTabIndex === index ? $r('app.integer.layout_size_24') : $r('app.integer.layout_size_18')) .fontWeight(this.currentTabIndex === index ? 700 : 500) .fontColor(this.currentTabIndex === index...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/MainView.ets#L31-L40
f82ed65095de9339f9597b46bb2a2ccb2586f397
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets
arkts
clearTempFolder
清空临时文件目录(temp_folder)
static clearTempFolder(): boolean { const tempDir = `${getContext().cacheDir}/CosDownloads`; return FileUtility.deleteDirectoryAt(tempDir); }
AST#method_declaration#Left static clearTempFolder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left...
static clearTempFolder(): boolean { const tempDir = `${getContext().cacheDir}/CosDownloads`; return FileUtility.deleteDirectoryAt(tempDir); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets#L187-L190
c8e85ccedea457859226ca93861990ef89e85768
github
weiwei0928/Eyepetizer-harmony.git
fd5947c6f616c22d42256f36ba752093b782a910
entry/src/main/ets/http/ApiResponse.ets
arkts
定义接口响应包装类
export interface ApiResponse<T = CommonType> { errorCode: number errorMsg: string data: T | CommonType; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ApiResponse AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left CommonType AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#L...
export interface ApiResponse<T = CommonType> { errorCode: number errorMsg: string data: T | CommonType; }
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/http/ApiResponse.ets#L6-L10
242c2587c7e679d7fe62dd7879db256432d95b06
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
getTime
Hour, minute, second
getTime(): string { const DATETIME = new Date(); return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds()); }
AST#method_declaration#Left getTime 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 DATETIME = AST#...
getTime(): string { const DATETIME = new Date(); return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds()); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets#L24-L27
4779dce9540c8f30184205f1963d825f24112dd6
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets
arkts
问题类型枚举
export enum QuestionTypeEnum { /** * 单选 */ RADIO, /** * 多选 */ CHECK_BOX, /** * 判断题 */ JUDGE }
AST#export_declaration#Left export AST#enum_declaration#Left enum QuestionTypeEnum AST#enum_body#Left { /** * 单选 */ AST#enum_member#Left RADIO AST#enum_member#Right , /** * 多选 */ AST#enum_member#Left CHECK_BOX AST#enum_member#Right , /** * 判断题 */ AST#enum_member#Left JUDGE AST#enum_member#Right } AST#...
export enum QuestionTypeEnum { RADIO, CHECK_BOX, JUDGE }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets#L4-L17
35f4599a09dd4d5b998918a2706a84bdd007dfb6
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Tab.ets
arkts
leftTabBuilder
自定义 leftTabBuilder @param index @param name
@Builder leftTabBuilder(index: number, item: ColorItem) { Column() { Text(item.name) .fontColor(this.leftCurrent === index ? item.color : this.fontColor) .fontSize(16) .fontWeight(this.leftCurrent === index ? FontWeight.Bold : FontWeight.Normal) .lineHeight(22) }.width('100...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right leftTabBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left...
@Builder leftTabBuilder(index: number, item: ColorItem) { Column() { Text(item.name) .fontColor(this.leftCurrent === index ? item.color : this.fontColor) .fontSize(16) .fontWeight(this.leftCurrent === index ? FontWeight.Bold : FontWeight.Normal) .lineHeight(22) }.width('100...
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Tab.ets#L106-L114
d31dece83a71076fb14082115033b8914cbc1931
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets
arkts
callFilePickerSaveFile
另存为
async callFilePickerSaveFile(fileName: string): Promise<void> { try { let DocumentSaveOptions = new picker.DocumentSaveOptions(); DocumentSaveOptions.newFileNames = [fileName]; let documentPicker = new picker.DocumentViewPicker(); documentPicker.save(DocumentSaveOptions).then((DocumentSaveRe...
AST#method_declaration#Left async callFilePickerSaveFile AST#parameter_list#Left ( AST#parameter#Left fileName : 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#gene...
async callFilePickerSaveFile(fileName: string): Promise<void> { try { let DocumentSaveOptions = new picker.DocumentSaveOptions(); DocumentSaveOptions.newFileNames = [fileName]; let documentPicker = new picker.DocumentViewPicker(); documentPicker.save(DocumentSaveOptions).then((DocumentSaveRe...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets#L167-L187
3d9dbce81967acc00d486ff5c28024bae5addc86
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/DataRenderer.ets
arkts
drawData
Draws the actual data in form of lines, bars, ... depending on Renderer subclass. @param c
public abstract drawData(c: CanvasRenderingContext2D): void;
AST#method_declaration#Left public abstract drawData AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v...
public abstract drawData(c: CanvasRenderingContext2D): void;
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/DataRenderer.ets#L147-L147
e730b0c5e203963e874d272a4a17c37b065417af
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
put
插入键值对
put(key: K, value: V): void { if (this.size / this.capacity >= this.LOAD_FACTOR) { this.resize(); } const index = this.hash(key); const newNode = new HashNode(key, value); if (!this.table[index]) { this.table[index] = newNode; } else { let current = this.table[index]; w...
AST#method_declaration#Left put AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left V AST#primary_type#Right AST#type_annotatio...
put(key: K, value: V): void { if (this.size / this.capacity >= this.LOAD_FACTOR) { this.resize(); } const index = this.hash(key); const newNode = new HashNode(key, value); if (!this.table[index]) { this.table[index] = newNode; } else { let current = this.table[index]; w...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L47-L72
502502ed242b2491183e11b7a176c10fd8c5bf54
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
getDayNumber
获取指定位置的日期数字
private getDayNumber(week: number, dayOfWeek: number): number { const firstDayWeekday: number = new Date(this.currentYear, this.currentMonth - 1, 1).getDay(); return week * 7 + dayOfWeek - firstDayWeekday + 1; }
AST#method_declaration#Left private getDayNumber AST#parameter_list#Left ( AST#parameter#Left week : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dayOfWeek : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
private getDayNumber(week: number, dayOfWeek: number): number { const firstDayWeekday: number = new Date(this.currentYear, this.currentMonth - 1, 1).getDay(); return week * 7 + dayOfWeek - firstDayWeekday + 1; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4194-L4197
ce71b340b7661cc5eb711ce1fda18ad0395a05bb
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
Preset search engines in a specified string format. @returns Baidu and Google. @example 'Bing\nhttps://www.cn.bing.com/search?q=%s'
export function preset_search_engines() { let result = [ "Baidu\nhttps://www.baidu.com/s?wd=%s", "Google\nhttps://www.google.com/search?q=%s", ]; return result.join("\n"); }
AST#export_declaration#Left export AST#function_declaration#Left function preset_search_engines 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#expression#Left AST#array_literal#Left [ AST#expr...
export function preset_search_engines() { let result = [ "Baidu\nhttps://www.baidu.com/s?wd=%s", "Google\nhttps://www.google.com/search?q=%s", ]; return result.join("\n"); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L103-L109
59d08613e18e878fdb37821ed139b2b34c181e58
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/view/play/CommentView.ets
arkts
textStyle
Text style. @param fontSize Font size. @param fonWeight Font weight.
@Extend(Text) function textStyle(fontSize: Resource, fonWeight: number) { .fontSize(fontSize) .fontWeight(fonWeight) .fontColor($r('app.color.start_window_background')) .textAlign(TextAlign.Center) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function textStyle AST#parameter_list#Left ( AST#parameter#Left fontSize : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AS...
@Extend(Text) function textStyle(fontSize: Resource, fonWeight: number) { .fontSize(fontSize) .fontWeight(fonWeight) .fontColor($r('app.color.start_window_background')) .textAlign(TextAlign.Center) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/play/CommentView.ets#L25-L31
636713bea7939608a37905db6f240f88c77a1eb9
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/icon/CommonIcon.ets
arkts
CommonIcon
@file 通用图标组件 @author Joker.X
@ComponentV2 export struct CommonIcon { /** * 图标资源 */ @Param icon: ResourceStr = ""; /** * 图标大小(单位:vp) */ @Param iconSize: number = 24; /** * 图标颜色(不传则不着色) */ @Param tintColor: ResourceColor | undefined = undefined; /** * 点击回调 */ @Param onTap: (() => void) | undefined = un...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CommonIcon AST#component_body#Left { /** * 图标资源 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_typ...
@ComponentV2 export struct CommonIcon { @Param icon: ResourceStr = ""; @Param iconSize: number = 24; @Param tintColor: ResourceColor | undefined = undefined; @Param onTap: (() => void) | undefined = undefined; build(): void { if (this.tintColor !== undefined) { if (this.onTap...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/icon/CommonIcon.ets#L5-L69
35b6f8ddd61365a3450866d22f4d0757ea1d65b4
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/basic_expression_operation/binary_expression_add_assignment_002_F.ets
arkts
Introduction 基础表达式运算-二元运算-加等
export function binary_expression_add_assignment_002_F(taint_src : string) { let _t = taint_src; let clean = "_"; clean += "_"; taint.Sink(clean); }
AST#export_declaration#Left export AST#function_declaration#Left function binary_expression_add_assignment_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
export function binary_expression_add_assignment_002_F(taint_src : string) { let _t = taint_src; let clean = "_"; clean += "_"; taint.Sink(clean); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/basic_expression_operation/binary_expression_add_assignment_002_F.ets#L6-L11
5cebc6ec4ea2152b1c7f17a4041deac6d19045da
github
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
onCameraInputChange
监听相机输入变化 @param cameraInput - 相机输入对象 @param cameraDevice - 相机设备对象 @returns 无返回值
onCameraInputChange(cameraInput: camera.CameraInput, cameraDevice: camera.CameraDevice): void { Logger.info(TAG, `onCameraInputChange is called`); try { cameraInput.on('error', cameraDevice, (cameraInputError: BusinessError): void => { Logger.info(TAG, `onCameraInputChange cameraInput error code: ...
AST#method_declaration#Left onCameraInputChange AST#parameter_list#Left ( AST#parameter#Left cameraInput : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraInput AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left camera...
onCameraInputChange(cameraInput: camera.CameraInput, cameraDevice: camera.CameraDevice): void { Logger.info(TAG, `onCameraInputChange is called`); try { cameraInput.on('error', cameraDevice, (cameraInputError: BusinessError): void => { Logger.info(TAG, `onCameraInputChange cameraInput error code: ...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L674-L683
c807f1b465ce25826acf295fab4c00c140a83b8b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
getPrivacySettings
获取隐私设置 @returns 隐私设置
async getPrivacySettings(): Promise<PrivacySettings> { const settings = await this.getSettings(); return settings.privacy; }
AST#method_declaration#Left async getPrivacySettings 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 PrivacySettings AST#primary_type#Right AST#type_annotation#Rig...
async getPrivacySettings(): Promise<PrivacySettings> { const settings = await this.getSettings(); return settings.privacy; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L229-L232
ddb6cb705400f9d23665bedd1836362ea024d9a6
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
createModuleContext
获取去模块Context @param moduleName @returns
static async createModuleContext(moduleName: string = 'entry'): Promise<Context> { const moduleContext = await application.createModuleContext(ArkWebHelper.getContext(), moduleName); return moduleContext; }
AST#method_declaration#Left static async createModuleContext AST#parameter_list#Left ( AST#parameter#Left moduleName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'entry' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right ...
static async createModuleContext(moduleName: string = 'entry'): Promise<Context> { const moduleContext = await application.createModuleContext(ArkWebHelper.getContext(), moduleName); return moduleContext; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L46-L49
566f4054c3fe90ccff985ce331e493f37eeb925b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarUtils.ets
arkts
getLunarYearInfo
获取农历年份的信息 @param year 农历年份 @returns 年份信息
private static getLunarYearInfo(year: number): LunarYearInfo { if (year < 1900 || year > 2050) { return { leapMonth: 0, monthDays: [], totalDays: 0 }; } const totalDays = LunarUtils.REAL_LUNAR_YEAR_DAYS.get(year) || 354; const leapMonth = LunarUtils.LEAP_MONTHS.get(year) || 0; // 构建月...
AST#method_declaration#Left private static getLunarYearInfo AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LunarYear...
private static getLunarYearInfo(year: number): LunarYearInfo { if (year < 1900 || year > 2050) { return { leapMonth: 0, monthDays: [], totalDays: 0 }; } const totalDays = LunarUtils.REAL_LUNAR_YEAR_DAYS.get(year) || 354; const leapMonth = LunarUtils.LEAP_MONTHS.get(year) || 0; c...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L141-L163
230cbb7be723aadc7d640348d4e4f007df5ba0dd
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets
arkts
Declare type OperateCheck @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare type OperateCheck @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export declare class OperateCheck { /** * Whether is checked on default. * @type { ?boolean }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Whether is checked on default. * @type { ?boolean }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomics...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class OperateCheck AST#class_body#Left { /** * Whether is checked on default. * @type { ?boolean }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Whether is checked on de...
export declare class OperateCheck { isCheck?: boolean; onChange?: (value: boolean) => void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L182-L211
f9adf6f8dd57416da95be8d3a23309b36abc663f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets
arkts
HSV颜色类型
export interface ColorHsv { // 色调 hue: number; // 饱和度 saturation: number; // 明度 value: number; // 透明度 alpha: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ColorHsv AST#object_type#Left { // 色调 AST#type_member#Left hue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 饱和度 AST#type_member#Left saturation : AST#type_an...
export interface ColorHsv { hue: number; saturation: number; value: number; alpha: number; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets#L36-L48
453244b3b6b9746bffe9b771a23ee1f4cc064c46
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
setTextSize
sets the size of the label text in density pixels min = 6f, max = 24f, default 10f @param size the text size, in DP
public setTextSize(size: number): void { if (size > 24) { size = 24; } if (size < 6) { size = 6; } this.mTextSize = size; }
AST#method_declaration#Left public setTextSize AST#parameter_list#Left ( AST#parameter#Left size : 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#...
public setTextSize(size: number): void { if (size > 24) { size = 24; } if (size < 6) { size = 6; } this.mTextSize = size; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L119-L128
2bc869fa26ade947bfe5f3d9458de07788d58e74
gitee
RicardoWesleyli/HarmonyNEXT_Examples.git
6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670
Chapter6/entry/src/main/ets/pages/Index.ets
arkts
changeAreaBtn
更改地区按钮组件代码块
@Builder changeAreaBtn(){ Button('更改时间', { type: ButtonType.Normal, stateEffect: true }) .fontSize(17) .fontColor(0x007BFF) .borderRadius(16) .backgroundColor(Color.White) .height(48) .width('80%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right changeAreaBtn AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#ERROR#Left AST#expression#Left '更改时间' AST#expre...
@Builder changeAreaBtn(){ Button('更改时间', { type: ButtonType.Normal, stateEffect: true }) .fontSize(17) .fontColor(0x007BFF) .borderRadius(16) .backgroundColor(Color.White) .height(48) .width('80%') }
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L34-L43
9e155c7ace7c802639a453564ced1a11ada5bd6b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/ContactsPage.ets
arkts
applyFilters
应用筛选条件
private applyFilters(): void { let filtered = [...this.contacts]; // 应用搜索关键词 if (this.searchKeyword.trim()) { const keyword = this.searchKeyword.trim().toLowerCase(); filtered = filtered.filter(contact => contact.name.toLowerCase().includes(keyword) || contact.phone?.toLowerCas...
AST#method_declaration#Left private applyFilters AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filter...
private applyFilters(): void { let filtered = [...this.contacts]; if (this.searchKeyword.trim()) { const keyword = this.searchKeyword.trim().toLowerCase(); filtered = filtered.filter(contact => contact.name.toLowerCase().includes(keyword) || contact.phone?.toLowerCase().includ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L60-L80
79f49f85a5f3b7170ff3e5a69a2bf6103884565f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/model/ColorType.ets
arkts
value
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export type ColorType = { value:Resource, color:Resource, };
AST#export_declaration#Left export AST#ERROR#Left type ColorType = AST#ERROR#Right { value AST#ERROR#Left : Resource , color AST#ERROR#Left : Resource AST#ERROR#Right , AST#ERROR#Right } ; AST#export_declaration#Right
export type ColorType = { value:Resource, color:Resource, };
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/model/ColorType.ets#L16-L19
ee78b7b6104aec041e9aeee4de26c1b7a33a8a6b
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/Viewmodel/HomeViewModel.ets
arkts
getAccountingListOfAll
获取所有的记账列表
public getAccountingListOfAll(): string { // 使用 reduce 将所有 accountingList 拼接成一个数组 this.customAccountingList = this.dateArr.reduce((accumulator, item) => { // 将 item.accountingList 拼接到累积器中 return accumulator.concat(item.accountingList); }, []); // 计算结余信息 this.customDayInfo = this.setSele...
AST#method_declaration#Left public getAccountingListOfAll 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#builder_function_body#Left { // 使用 reduce 将所有 accountingList 拼接成一个数组 AST#expression_statement#Left A...
public getAccountingListOfAll(): string { this.customAccountingList = this.dateArr.reduce((accumulator, item) => { return accumulator.concat(item.accountingList); }, []); this.customDayInfo = this.setSelectedDayBalance(this.customAccountingList, this.customDayInfo) return JSON.s...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L393-L405
ccb2040a63a535aceacca64af500f25004385071
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getAppInfoSync
获取应用程序的配置信息 @returns
static getAppInfoSync(): bundleManager.ApplicationInfo { return AppUtil.getBundleInfoSync().appInfo; }
AST#method_declaration#Left static getAppInfoSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . ApplicationInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#stateme...
static getAppInfoSync(): bundleManager.ApplicationInfo { return AppUtil.getBundleInfoSync().appInfo; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L482-L484
db6fdffe576cef52df8cf6dc02a131cab89579c5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
updateLoading
刷新加载弹框
static updateLoading(dialogId: string, content?: string, progress?: number) { if (DialogHelper.isShowing(dialogId)) { let cacheOptions = CacheHelper.get<LoadingProgressOptions>(`${CacheHelper.CACHE_LABEL}${dialogId}`); if (cacheOptions) { if (content && content.length >= 0) { cacheOpti...
AST#method_declaration#Left static updateLoading AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content ? : AST#type_annotation#Left AST#primary_type#Left string AST#p...
static updateLoading(dialogId: string, content?: string, progress?: number) { if (DialogHelper.isShowing(dialogId)) { let cacheOptions = CacheHelper.get<LoadingProgressOptions>(`${CacheHelper.CACHE_LABEL}${dialogId}`); if (cacheOptions) { if (content && content.length >= 0) { cacheOpti...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L343-L356
c67ba8ebac3626405729fb4ed2e62e27a424bfc8
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ToolBarV2.d.ets
arkts
Declare the options of ToolBarV2Item @interface ToolBarV2ItemOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export interface ToolBarV2ItemOptions { /** * Define text content. * * @type { ToolBarV2ItemText }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ content: ToolBarV2ItemText; /** * Define the action event. * * @type { ?ToolBarV2ItemAct...
AST#export_declaration#Left export AST#interface_declaration#Left interface ToolBarV2ItemOptions AST#object_type#Left { /** * Define text content. * * @type { ToolBarV2ItemText }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left co...
export interface ToolBarV2ItemOptions { content: ToolBarV2ItemText; action?: ToolBarV2ItemAction; icon?: ToolBarV2ItemIconType; state?: ToolBarV2ItemState; accessibilityText?: ResourceStr; accessibilityDescription?: ResourceStr; accessibilityLevel?: string; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L454-L526
61bc5b233c3b692bf1a5f73a3ae10fe91abb090c
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bridges/PhotoView/CameraPicker.ets
arkts
takePhoto
调用系统相机拍照(无权限) @param context 上下文 @param toDir 存放位置,会把照片copy过去 @param frontCamera 是否使用前置相机 @returns 返回AssetModel
public static async takePhoto(context: common.UIAbilityContext, localDir: string, cameraPos?: camera.CameraPosition): Promise<AssetModel | null> { let pickerProfile: picker.PickerProfile = { cameraPosition: (cameraPos != undefined ? cameraPos : camera.CameraPosition.CAMERA_POSITION_BACK) }; return pic...
AST#method_declaration#Left public static async takePhoto AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#...
public static async takePhoto(context: common.UIAbilityContext, localDir: string, cameraPos?: camera.CameraPosition): Promise<AssetModel | null> { let pickerProfile: picker.PickerProfile = { cameraPosition: (cameraPos != undefined ? cameraPos : camera.CameraPosition.CAMERA_POSITION_BACK) }; return pic...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/PhotoView/CameraPicker.ets#L18-L35
5e28ad6487dd84e0e426024babf273efe2d9c359
github
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
setFocusPoint
焦点
setFocusPoint(point: camera.Point): void { // 设置焦点 this.session?.setFocusPoint(point); Logger.info(TAG, `setFocusPoint success point: ${JSON.stringify(point)}`); // 获取当前的焦点 let nowPoint: camera.Point | undefined = undefined; nowPoint = this.session?.getFocusPoint(); Logger.info(TAG, `getFocu...
AST#method_declaration#Left setFocusPoint AST#parameter_list#Left ( AST#parameter#Left point : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . Point AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat...
setFocusPoint(point: camera.Point): void { this.session?.setFocusPoint(point); Logger.info(TAG, `setFocusPoint success point: ${JSON.stringify(point)}`); let nowPoint: camera.Point | undefined = undefined; nowPoint = this.session?.getFocusPoint(); Logger.info(TAG, `getFocusPoint success, n...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L804-L812
e5ad99c4a783080bb947c13dd4c1023ec648b1a9
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/const/CommonConst.ets
arkts
@Author csx @DateTime 2024/4/25 20:39:04 @TODO CommonConst 公共常量 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core
export class CommonConst { /** * 引号 */ static readonly quot: string = "\""; /** * 大于 */ static readonly gt: string = ">"; /** * 小于 */ static readonly lt: string = "<"; /** * 等于 */ static readonly eq: string = "="; /** * 冒号 */ static readonly mh: string = ":"; /** *...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConst AST#class_body#Left { /** * 引号 */ AST#property_declaration#Left static readonly quot : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "\"" AST#expression#Ri...
export class CommonConst { static readonly quot: string = "\""; static readonly gt: string = ">"; static readonly lt: string = "<"; static readonly eq: string = "="; static readonly mh: string = ":"; static readonly dh: string = ","; static readonly zkh: string = "{"; static read...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/const/CommonConst.ets#L23-L64
a6e6c9dc753b6890023f735c71e0314945efe509
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/VoiceServerUpdate.ets
arkts
应用约束60: 使用export default代替module.exports
export default VoiceServerUpdate;
AST#export_declaration#Left export default AST#expression#Left VoiceServerUpdate AST#expression#Right ; AST#export_declaration#Right
export default VoiceServerUpdate;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/VoiceServerUpdate.ets#L23-L23
e567b4f85fffd8b4407cdbf463ff2242bbaa640a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets
arkts
batchInsertData
批量插入数据库
public async batchInsertData(context: common.Context, array: Array<Contact>): Promise<number> { logger.info(TAG, 'batch insert begin'); if (!context) { logger.info(TAG, 'context is null or undefined'); } const predicates = new rdb.RdbPredicates(TABLE_NAME); if (predicates === null || predicat...
AST#method_declaration#Left public async batchInsertData AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left array...
public async batchInsertData(context: common.Context, array: Array<Contact>): Promise<number> { logger.info(TAG, 'batch insert begin'); if (!context) { logger.info(TAG, 'context is null or undefined'); } const predicates = new rdb.RdbPredicates(TABLE_NAME); if (predicates === null || predicat...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L130-L172
9f5e0abc092b601c93bbc04628cc534bde239110
gitee
BlingCc233/ArkTs_FlipClock.git
c67675869e289f7d472dd68fc2aea8c20f66790e
entry/build/default/generated/profile/default/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const BUNDLE_NAME = 'com.blingcc.flipclock';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUNDLE_NAME = AST#expression#Left 'com.blingcc.flipclock' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const BUNDLE_NAME = 'com.blingcc.flipclock';
https://github.com/BlingCc233/ArkTs_FlipClock.git/blob/c67675869e289f7d472dd68fc2aea8c20f66790e/entry/build/default/generated/profile/default/BuildProfile.ets#L4-L4
5bd05eef08080ee9ce8cc0b4b6c33c87986f2c14
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/TextEncoder.ets
arkts
TextEncoder 类用于将字符串编码为 UTF-8 字节数组
export class TextEncoder { /** * 将字符串编码为 UTF-8 字节数组 * @param text 要编码的字符串 * @returns UTF-8 编码的字节数组 */ public encode(text: string): Uint8Array { const bytes: number[] = []; for (let i: number = 0; i < text.length; i++) { const charCode: number = text.charCodeAt(i); if (charCode...
AST#export_declaration#Left export AST#class_declaration#Left class TextEncoder AST#class_body#Left { /** * 将字符串编码为 UTF-8 字节数组 * @param text 要编码的字符串 * @returns UTF-8 编码的字节数组 */ AST#method_declaration#Left public encode AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_...
export class TextEncoder { public encode(text: string): Uint8Array { const bytes: number[] = []; for (let i: number = 0; i < text.length; i++) { const charCode: number = text.charCodeAt(i); if (charCode < 0x80) { bytes.push(charCode); } else if (charCode < 0x800) {...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/TextEncoder.ets#L4-L52
a2a7925cc7845cea873dff9cce9e6c287b83cfc8
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
getAbsoluteAngles
returns the absolute angles of the different chart slices (where the slices end) @return
public getAbsoluteAngles(): number[] { return this.mAbsoluteAngles; }
AST#method_declaration#Left public getAbsoluteAngles AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_stateme...
public getAbsoluteAngles(): number[] { return this.mAbsoluteAngles; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L422-L424
5408f0ca39975359c44f8fe9524478b8d2c0efbd
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
common/src/main/ets/util/UpdateUtils.ets
arkts
启动Ability @param context 要启动Ability的context @param want 要启动Ability的want @param options 配置项
export function startAbility(context: any, want, options): void { if (!context || !want) { LogUtils.error(TAG, 'Failed to start ability with error: context or want is null.'); return; } context.startAbility(want, options).then((data) => { LogUtils.info(TAG, 'Succeed to start ability with d...
AST#export_declaration#Left export AST#function_declaration#Left function startAbility AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left want AST#parameter#Right , AST#parame...
export function startAbility(context: any, want, options): void { if (!context || !want) { LogUtils.error(TAG, 'Failed to start ability with error: context or want is null.'); return; } context.startAbility(want, options).then((data) => { LogUtils.info(TAG, 'Succeed to start ability with d...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/util/UpdateUtils.ets#L61-L71
eea20b0e2cebf316830eaac0adb15689031ee25b
gitee