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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/SegmentButton.ets | arkts | SegmentButton | MARK: - Segment 控件 | @ComponentV2
export struct SegmentButton {
// ========== 外部参数 ==========
@Param @Require items : SegmentItem[] // 段标题数组(每个 item 可控制是否可用)
@Param selectedIndex : number = 0 // 当前选中索引
@Event onSelect : (index: number) => void ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SegmentButton AST#component_body#Left { // ========== 外部参数 ========== AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right items : AST#type_an... | @ComponentV2
export struct SegmentButton {
@Param @Require items : SegmentItem[]
@Param selectedIndex : number = 0
@Event onSelect : (index: number) => void
@Param totalWidth : Length ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/SegmentButton.ets#L8-L103 | 9f494006d8be7f29f220b17433fb0062a4735ef1 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/common/component/AttributeUpdater.ets | arkts | @author open_9527
@date 2025/5/19
@desc 描述信息 | export class CustomLineAttributeUpdater extends AttributeUpdater<LineAttribute> {
private _width: Length = TitleBarConstants.FULL_PERCENT
private _height: Length = TitleBarConstants.DIVIDER_HEIGHT
private _backgroundColor: ResourceColor = TitleBarConstants.DIVIDER_COLOR
private _visibility: Visibility = Visibil... | AST#export_declaration#Left export AST#class_declaration#Left class CustomLineAttributeUpdater extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeUpdater AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left LineAttribute AST#primary_type#Right AST#type_annotation#R... | export class CustomLineAttributeUpdater extends AttributeUpdater<LineAttribute> {
private _width: Length = TitleBarConstants.FULL_PERCENT
private _height: Length = TitleBarConstants.DIVIDER_HEIGHT
private _backgroundColor: ResourceColor = TitleBarConstants.DIVIDER_COLOR
private _visibility: Visibility = Visibil... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/common/component/AttributeUpdater.ets#L11-L23 | 2caf0e0a3b1430750935c1b2037364ef81d59fbe | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | totalCount | 获取数组长度。
@returns {number} 返回数组长度。 | public totalCount(): double {
return 0;
} | AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left double AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#... | public totalCount(): double {
return 0;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L68-L70 | b817af4f35e218f61bbe85e4bf4350b6721c4d5a | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/ConfigService.ets | arkts | 配置管理服务类
提供系统配置的获取、更新和摄像头设备管理功能 | export class ConfigService {
/**
* 获取系统配置
* @returns 系统配置信息
*/
static async getConfig(): Promise<AgvConfig> {
try {
console.info('[ConfigService] 🔧 获取系统配置');
const response = await HttpUtil.get('/agv/config');
console.info('[ConfigService] ✅ 系统配置获取成功');
return response.data ... | AST#export_declaration#Left export AST#class_declaration#Left class ConfigService AST#class_body#Left { /**
* 获取系统配置
* @returns 系统配置信息
*/ AST#method_declaration#Left static async getConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | export class ConfigService {
static async getConfig(): Promise<AgvConfig> {
try {
console.info('[ConfigService] 🔧 获取系统配置');
const response = await HttpUtil.get('/agv/config');
console.info('[ConfigService] ✅ 系统配置获取成功');
return response.data as AgvConfig;
} catch (error) {
... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/ConfigService.ets#L56-L142 | 4d873e58691212222049e10a6425412ebf86e33b | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | TextureHypercompression/entry/src/main/ets/pages/OptimizeWebImagesUsingCDN.ets | arkts | OptimizeWebImagesUsingCDN | 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... | @Component
export struct OptimizeWebImagesUsingCDN {
// [Start OptimizeWebImagesUsingCDN]
// It needs to be replaced with the image resource address required by the developer.
private imgUrl = 'https://******.com/path/to/image.jpg?w=200&h=150&fit=cover&q=85&format=webp';
build() {
NavDestination() {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct OptimizeWebImagesUsingCDN AST#component_body#Left { // [Start OptimizeWebImagesUsingCDN] // It needs to be replaced with the image resource address required by the developer. AST#property_declaration#Left private imgU... | @Component
export struct OptimizeWebImagesUsingCDN {
private imgUrl = 'https://******.com/path/to/image.jpg?w=200&h=150&fit=cover&q=85&format=webp';
build() {
NavDestination() {
Column() {
Image(this.imgUrl)
.width(200)
.height(150)
.objectFit(ImageFit.Cover)
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TextureHypercompression/entry/src/main/ets/pages/OptimizeWebImagesUsingCDN.ets#L16-L36 | 097b18c1fd2a2bc33aa8ee44636b9638ab11c40f | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/BasicDataSource.ets | arkts | pushData | TODO:知识点:存储数据到懒加载数据源中 | pushData(data: FriendMoment): void {
this.comments.push(data);
// 在数组头部添加数据
this.notifyDataAdd(this.comments.length - 1);
} | AST#method_declaration#Left pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left FriendMoment 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#Righ... | pushData(data: FriendMoment): void {
this.comments.push(data);
this.notifyDataAdd(this.comments.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/BasicDataSource.ets#L114-L118 | fb9c8e96a395a3ba4f766558d58b4b9180c4722f | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/gbktranscoding/Index.ets | arkts | FriendsBookComponent | 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 { FriendsBookComponent } from './src/main/ets/pages/FriendsBook'; | AST#export_declaration#Left export { FriendsBookComponent } from './src/main/ets/pages/FriendsBook' ; AST#export_declaration#Right | export { FriendsBookComponent } from './src/main/ets/pages/FriendsBook'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gbktranscoding/Index.ets#L15-L15 | 7fd780e851a8d9733658a4dbb4640903198f7460 | gitee |
ccccjiemo/egl.git | d18849c3da975ccf9373fd09874aa5637ccbe6bd | Index.d.ets | arkts | queryString | eglQueryString | queryString(name: QueryStringNames): string | undefined; | AST#method_declaration#Left queryString AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left QueryStringNames AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left... | queryString(name: QueryStringNames): string | undefined; | https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L186-L186 | c87387c64f31af9c688957d70fd49843cf8d5592 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/common/FeedbackService.ets | arkts | showSuccess | 显示成功提示 | async showSuccess(message: string, duration: number = 2000): Promise<void> {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Success: ${message}`);
await promptAction.showToast({
message: `✅ ${message}`,
duration
});
} | AST#method_declaration#Left async showSuccess AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | async showSuccess(message: string, duration: number = 2000): Promise<void> {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Success: ${message}`);
await promptAction.showToast({
message: `✅ ${message}`,
duration
});
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/FeedbackService.ets#L59-L66 | 36337e5a7892bccfb0bff942a0f7167612f7caf4 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/ColorTemplate.ets | arkts | getHoloBlue | @return | public static getHoloBlue(): number {
return ChartColor.rgb(51, 181, 229)
} | AST#method_declaration#Left public static getHoloBlue AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_... | public static getHoloBlue(): number {
return ChartColor.rgb(51, 181, 229)
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L192-L194 | 5dce61d3a4c240fdbd86501705641e307fb03b9b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildQuickActions | 快捷操作 | @Builder
buildQuickActions() {
Column({ space: 16 }) {
Text('快捷操作')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.alignSelf(ItemAlign.Start)
// 操作按钮网格
Column({ space: 12 }) {
Row({ space: 12 }) {
Button('添加联系人... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildQuickActions 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
buildQuickActions() {
Column({ space: 16 }) {
Text('快捷操作')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.alignSelf(ItemAlign.Start)
Column({ space: 12 }) {
Row({ space: 12 }) {
Button('添加联系人')
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1676-L1752 | b540a2c3b1eaea622c6f0dae25bf860caa5e331b | github |
peng-boy/arkTs.git | 68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0 | entry/src/main/ets/viewmodel/DataModel.ets | arkts | getData | Get the data. | getData(): Array<Resource> {
return this.tasks;
} | AST#method_declaration#Left getData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Ri... | getData(): Array<Resource> {
return this.tasks;
} | https://github.com/peng-boy/arkTs.git/blob/68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0/entry/src/main/ets/viewmodel/DataModel.ets#L30-L32 | 39da939316b6638170e5d5c7ec81465df70de2d5 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/BindSheet/entry/src/main/ets/pages/bindContentCover/template7/Index.ets | arkts | MyBuilder | 第二步:定义模态展示界面 通过@Builder构建模态展示界面 | @Builder
MyBuilder() {
Column() {
Row() {
Text($r('app.string.MyContentCoverBuilder_text1'))
.fontSize(20)
.fontColor(Color.White)
.width('100%')
.textAlign(TextAlign.Center)
.padding({ top: 30, bottom: 15 })
}
.backgroundColor(0x007dfe)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_elemen... | @Builder
MyBuilder() {
Column() {
Row() {
Text($r('app.string.MyContentCoverBuilder_text1'))
.fontSize(20)
.fontColor(Color.White)
.width('100%')
.textAlign(TextAlign.Center)
.padding({ top: 30, bottom: 15 })
}
.backgroundColor(0x007dfe)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/BindSheet/entry/src/main/ets/pages/bindContentCover/template7/Index.ets#L37-L122 | d7fc62f8f598cf4361d0377c359129e12062ee9d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | restore | 从备份恢复数据库
@param backupData 备份数据 | async restore(backupData: Record<string, Record<string, relationalStore.ValueType>[]>): Promise<void> {
try {
await this.executeTransaction(async () => {
// 清空现有数据
const tables = Object.keys(backupData);
for (const table of tables) {
await this.delete(table);
}
... | AST#method_declaration#Left async restore AST#parameter_list#Left ( AST#parameter#Left backupData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#ERROR#Lef... | async restore(backupData: Record<string, Record<string, relationalStore.ValueType>[]>): Promise<void> {
try {
await this.executeTransaction(async () => {
const tables = Object.keys(backupData);
for (const table of tables) {
await this.delete(table);
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L587-L613 | ef1c7e3bec418b530508b27b4d9d53581a77b7d3 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/WebhookClient.ets | arkts | setTimeout | Sets a timeout that will be automatically cancelled if the client is destroyed.
@param fn - Function to execute
@param delay - Time to wait in milliseconds
@param args - Arguments for the function | setTimeout(fn: Function, delay: number, ...args: unknown[]): Timeout {
const timeout = setTimeout(() => {
fn(...args);
this._timeouts.delete(timeout);
}, delay);
this._timeouts.add(timeout);
return timeout;
} | AST#method_declaration#Left setTimeout AST#parameter_list#Left ( AST#parameter#Left fn : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left delay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right ... | setTimeout(fn: Function, delay: number, ...args: unknown[]): Timeout {
const timeout = setTimeout(() => {
fn(...args);
this._timeouts.delete(timeout);
}, delay);
this._timeouts.add(timeout);
return timeout;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/WebhookClient.ets#L39-L46 | 68cad7f9408cd23723e7dbadd37e7a86bebfd473 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringMapUtility.ets | arkts | map | / 按指定的分隔符split之后进行transform,如:去除重复项 / 返回的结果是按原来的seperator合并的 | public static map(
srcStr : string,
seperator : string,
transform : MapTransform
): string {
const array : Array<string> = srcStr.split(seperator);
const distList : Array<string> = [];
for (const str of array) {
const tranStr = transform.transform(str);
if (tranStr !== null... | AST#method_declaration#Left public static map AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | public static map(
srcStr : string,
seperator : string,
transform : MapTransform
): string {
const array : Array<string> = srcStr.split(seperator);
const distList : Array<string> = [];
for (const str of array) {
const tranStr = transform.transform(str);
if (tranStr !== null... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringMapUtility.ets#L31-L48 | 9e802c79636bd1487c2fd7265404233e59350afa | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocache/src/main/ets/view/VideoCacheView.ets | arkts | VideoCacheViewComponent | 动画总时长
功能描述: OhosVideoCache是一个支持边播放边缓存的库,只需要将音视频的url传递给OhosVideoCache处理之后再设置给播放器,
OhosVideoCache就可以一边下载音视频数据并保存在本地,一边读取本地缓存返回给播放器,使用者无需进行其他操作
推荐场景: 缓存播放视频
核心组件:
1. AvPlayManager
实现步骤:
1. XComponent组件绘制视频播放窗口
2. 通过HttpProxyCacheServer初始化代理服务器
3. media.createAVPlayer()创建播放管理类,用于管理和播放媒体资源
4. 边播放边缓存,MyCacheListener监听缓存进... | @Component
export struct VideoCacheViewComponent {
@State isPlaying: boolean = true; // 是否处于播放中状态
@State videoDuration: string = '00:00'; // 视频时长
@State windowWidth: number = 300; // 初始化窗口宽度
@State windowHeight: number = 300; // 初始化窗口高度
@State xComponentWidth: number | null = null; // 初始化XComponent的宽度
@Stat... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoCacheViewComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isPlaying : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right ... | @Component
export struct VideoCacheViewComponent {
@State isPlaying: boolean = true;
@State videoDuration: string = '00:00';
@State windowWidth: number = 300;
@State windowHeight: number = 300;
@State xComponentWidth: number | null = null;
@State xComponentHeight: number | null = null;
@State curren... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/view/VideoCacheView.ets#L49-L197 | 7bbd007bc2fe6410957911fb84a0bf2aefc18376 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/SetAppFontSize/entry/src/main/ets/view/ChatItemComponent.ets | arkts | ChatItemComponent | The chat list item component. | @Component
export default struct ChatItemComponent {
item: ChatData = new ChatData();
@Prop changeFontSize: number = 0;
build() {
Row() {
Image(this.item.itemDirection === ItemDirection.RIGHT ? $r('app.media.right_head') : $r('app.media.left_head'))
.width(StyleConstants.SET_CHAT_HEAD_SIZE_PERC... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct ChatItemComponent AST#component_body#Left { AST#property_declaration#Left item : AST#type_annotation#Left AST#primary_type#Left ChatData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left A... | @Component
export default struct ChatItemComponent {
item: ChatData = new ChatData();
@Prop changeFontSize: number = 0;
build() {
Row() {
Image(this.item.itemDirection === ItemDirection.RIGHT ? $r('app.media.right_head') : $r('app.media.left_head'))
.width(StyleConstants.SET_CHAT_HEAD_SIZE_PERC... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/view/ChatItemComponent.ets#L23-L47 | ef635a986a7eb8e063a1b7a910ae0430b777bc23 | gitee |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/pagedesktop/src/main/ets/default/common/components/AppItem.ets | arkts | cancelFormDialog | When click cancel dialog, this function will be called. | cancelFormDialog() {
Log.showInfo(TAG, 'cancel form dialog');
this.clearForm();
} | AST#method_declaration#Left cancelFormDialog 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 Log AST#expression#Right . showInfo AST#member_... | cancelFormDialog() {
Log.showInfo(TAG, 'cancel form dialog');
this.clearForm();
} | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/pagedesktop/src/main/ets/default/common/components/AppItem.ets#L129-L132 | 51fba6faaee192e49365ee36656698f79f7d2c7b | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/JSONUtil.ets | arkts | TODO JSON工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class JSONUtil {
/**
* JSON字符串转Class对象(嵌套类需要添加装饰器NestedClassV6)
* @param jsonStr JSON字符串
* @param cls 类名
* @returns
*/
static jsonToBean<T>(jsonStr: string, clazz?: Constructor<T>, reviver?: JSON.Transformer, options?: JSON.ParseOptions): T | undefined {
try {
if (StrUtil.isEmpty(j... | AST#export_declaration#Left export AST#class_declaration#Left class JSONUtil AST#class_body#Left { /**
* JSON字符串转Class对象(嵌套类需要添加装饰器NestedClassV6)
* @param jsonStr JSON字符串
* @param cls 类名
* @returns
*/ AST#method_declaration#Left static jsonToBean AST#type_parameters#Left < AST#type_parameter#Left T AST#t... | export class JSONUtil {
static jsonToBean<T>(jsonStr: string, clazz?: Constructor<T>, reviver?: JSON.Transformer, options?: JSON.ParseOptions): T | undefined {
try {
if (StrUtil.isEmpty(jsonStr)) {
return undefined;
}
if (!options) {
options = { bigIntMode: JSON.BigIntMode.P... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/JSONUtil.ets#L28-L147 | a1c4e7c899e0909f1e67e849106e6f10d0019287 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderListViewModel.ets | arkts | toGoodsDetailForRebuy | 跳转到指定商品详情页面(再次购买)
@param {number} goodsId - 商品 ID
@returns {void} 无返回值 | toGoodsDetailForRebuy(goodsId: number): void {
if (!goodsId) {
return;
}
GoodsNavigator.toDetail(goodsId);
this.hideRebuyModal();
} | AST#method_declaration#Left toGoodsDetailForRebuy AST#parameter_list#Left ( AST#parameter#Left goodsId : 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... | toGoodsDetailForRebuy(goodsId: number): void {
if (!goodsId) {
return;
}
GoodsNavigator.toDetail(goodsId);
this.hideRebuyModal();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderListViewModel.ets#L165-L171 | 91caec7bd7620faf635d94372283cb4e61c4ffd2 | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhAlert.ets | arkts | showSystemAlert | 系统中间弹框
@param options | public static showSystemAlert(options: JhAlertOptions) {
AlertDialog.show(
{
title: options.title,
message: options.message ?? '',
autoCancel: true,
buttons: [
{
value: options.leftText ?? _cancelText,
fontColor: Color.Black,
action... | AST#method_declaration#Left public static showSystemAlert AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left JhAlertOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_s... | public static showSystemAlert(options: JhAlertOptions) {
AlertDialog.show(
{
title: options.title,
message: options.message ?? '',
autoCancel: true,
buttons: [
{
value: options.leftText ?? _cancelText,
fontColor: Color.Black,
action... | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhAlert.ets#L71-L98 | 75d2fe67ec6bb9cc5257057ff1121f7ca11646d6 | github |
conrad_sheeran/TickAuth | 8ef852e12999d15cf70394cdab82d08ac5843143 | features/homepage/Index.ets | arkts | HomePage | Copyright (c) 2024 Yang He
TickAuth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be... | export { HomePage } from './src/main/ets/pages/HomePage' | AST#export_declaration#Left export { HomePage } from './src/main/ets/pages/HomePage' AST#export_declaration#Right | export { HomePage } from './src/main/ets/pages/HomePage' | https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/homepage/Index.ets#L18-L18 | cb3ac5ec332fa31081d3f78293641aec12683bc3 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | getCenterOffsetY | 获取添加自身后的偏移量
@returns { number } | getCenterOffsetY(): number {
// 获取自身的一半
let widthHalf = this.width / 2;
return this.offsetY + widthHalf
} | AST#method_declaration#Left getCenterOffsetY AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 获取自身的一半 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Le... | getCenterOffsetY(): number {
let widthHalf = this.width / 2;
return this.offsetY + widthHalf
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L230-L234 | 0ea3580b7161eda803d00c8da4d7eb78bc7fe269 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderDetailPage.ets | arkts | getPageTitle | 获取页面标题
@returns {ResourceStr} 标题文案 | private getPageTitle(): ResourceStr {
if (this.vm.uiState !== BaseNetWorkUiState.SUCCESS) {
return $r("app.string.order_detail");
}
switch (this.getOrderData().status) {
case 0:
return $r("app.string.order_status_pending_payment");
case 1:
return $r("app.string.order_status... | AST#method_declaration#Left private getPageTitle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expr... | private getPageTitle(): ResourceStr {
if (this.vm.uiState !== BaseNetWorkUiState.SUCCESS) {
return $r("app.string.order_detail");
}
switch (this.getOrderData().status) {
case 0:
return $r("app.string.order_status_pending_payment");
case 1:
return $r("app.string.order_status... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L496-L519 | b7bc0764e8d7ace8e6996b88f351315c04e76806 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LIstOptimizationBak/entry/src/main/ets/pages/LazyForEachListPage.ets | arkts | Header | DocsCode 1 | @Builder
function Header() {
Row() {
Text($r('app.string.lazy_foreach'))
.fontSize($r('app.float.header_font_size'))
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Start)
.width('100%')
.fontFamily('HarmonyHeiTi-Bold')
.padding({ left: $r('app.float.md_padding_margin') })
... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function Header 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 Row ( ) AST#container_content_body#Left { AST#... | @Builder
function Header() {
Row() {
Text($r('app.string.lazy_foreach'))
.fontSize($r('app.float.header_font_size'))
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Start)
.width('100%')
.fontFamily('HarmonyHeiTi-Bold')
.padding({ left: $r('app.float.md_padding_margin') })
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LIstOptimizationBak/entry/src/main/ets/pages/LazyForEachListPage.ets#L62-L75 | d2f5c7251ac1e039b24e6c478d530608b1f19061 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/PrefUtil.ets | arkts | getValueStr | 根据KEY获取value 字符串
@param key
@returns value | static getValueStr(key: string): string {
const defStore = PrefUtil.getStore()
return defStore?.getSync(key, '') as string
} | AST#method_declaration#Left static getValueStr AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static getValueStr(key: string): string {
const defStore = PrefUtil.getStore()
return defStore?.getSync(key, '') as string
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/PrefUtil.ets#L77-L80 | 93ba8ec49658d2982a6347b8af39f15ab01549f9 | gitee |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/model/KeyboardController.ets | arkts | insertText | 插入文本 | public insertText(text: string): void {
inputString += text;
let wordsArray = inputString.split(" ");
wordsArray = wordsArray.filter(token => token !== '');
wordsArray = wordsArray.filter(token => token !== ' ');
wordsArray = wordsArray.filter(token => token !== " ");
console.log("wordsArray", w... | AST#method_declaration#Left public insertText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | public insertText(text: string): void {
inputString += text;
let wordsArray = inputString.split(" ");
wordsArray = wordsArray.filter(token => token !== '');
wordsArray = wordsArray.filter(token => token !== ' ');
wordsArray = wordsArray.filter(token => token !== " ");
console.log("wordsArray", w... | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/model/KeyboardController.ets#L156-L181 | a4da14b72d6d8d08e7c2a1b6070157221f88b673 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_json/src/main/ets/json/JSONArray.ets | arkts | parseArray | json字符串转换为实体对象集合
@param jsonStr 实体对象集合字符串
@returns 实体对象集合Array<T> | public static parseArray<T>(jsonStr: string): Array<T> {
const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n'); | AST#method_declaration#Left public static parseArray AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left jsonStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST... | public static parseArray<T>(jsonStr: string): Array<T> {
const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n'); | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONArray.ets#L66-L67 | 94b4b6c19256054fff04fef9639eef38182b5ca2 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets | arkts | Thousandth | export const THOUSANDTH_80: string = '8%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_80 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '8%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarat... | export const THOUSANDTH_80: string = '8%'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L17-L17 | 585d5792c80f26d8845ad367d2e7d73663c39737 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/init_process.ets | arkts | ensure_continue_folder | Files
Checks and ensures there is a /continue directory in sandbox. | function ensure_continue_folder(context: common.UIAbilityContext) {
let filesDir = context.filesDir;
try {
if (!fileIo.accessSync(filesDir + '/continue')) {
fileIo.mkdirSync(filesDir + '/continue', true);
}
} catch (e) {
console.error('[init][ensure_continue_folder] Error: ' + e);
}
} | AST#function_declaration#Left function ensure_continue_folder AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parame... | function ensure_continue_folder(context: common.UIAbilityContext) {
let filesDir = context.filesDir;
try {
if (!fileIo.accessSync(filesDir + '/continue')) {
fileIo.mkdirSync(filesDir + '/continue', true);
}
} catch (e) {
console.error('[init][ensure_continue_folder] Error: ' + e);
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L86-L95 | 31952a9ef8945a5b459f644ab8001fed646aec6c | gitee |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/api/jellyfin/JellyfinFinApi.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2025/7/6 13:49
@Version V1.0
@Description jellyfin api | export class JellyfinFinApi implements FinVideoApi {
private readonly context: Context
private readonly appConfig: AppConfig
private readonly emptyArray = []
private activeInfo?: ActiveInfo
/**
* Jellyfin api tmp
*/
private jellyfin: Jellyfin
/**
* Jellyfin api tmp
*/
protected jellyfi... | AST#export_declaration#Left export AST#ERROR#Left class JellyfinFinApi AST#implements_clause#Left implements FinVideoApi AST#implements_clause#Right { AST#property_declaration#Left private readonly context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#pro... | export class JellyfinFinApi implements FinVideoApi {
private readonly context: Context
private readonly appConfig: AppConfig
private readonly emptyArray = []
private activeInfo?: ActiveInfo
private jellyfin: Jellyfin
protected jellyfinTmp: Jellyfin
constructor | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/api/jellyfin/JellyfinFinApi.ets#L30-L50 | 9d9c6b84877a03f9e3f82435e3caa1819a9f4e90 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/pageTransition/template2/Index.ets | arkts | pageTransition | 自定义方式2:使用系统提供的多种默认效果(平移、缩放、透明度等) | pageTransition() {
//设置入场动效
PageTransitionEnter({ duration: 200 })
.slide(SlideEffect.START)
//设置退场动效
PageTransitionExit({ delay: 100 })
.slide(SlideEffect.START) //Left
} | AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#e... | pageTransition() {
PageTransitionEnter({ duration: 200 })
.slide(SlideEffect.START)
PageTransitionExit({ delay: 100 })
.slide(SlideEffect.START)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/pageTransition/template2/Index.ets#L43-L50 | 8265d9b77a6d737a7f82462772de354d24aab68f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 收藏分析接口 | export interface FavoriteAnalytics {
totalFavorites: number;
greetingFavorites: number;
giftFavorites: number;
topTags: string[];
contactDistribution: Record<string, number>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface FavoriteAnalytics AST#object_type#Left { AST#type_member#Left totalFavorites : 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 greetingFavorites... | export interface FavoriteAnalytics {
totalFavorites: number;
greetingFavorites: number;
giftFavorites: number;
topTags: string[];
contactDistribution: Record<string, number>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L647-L653 | 08e4d041eaef719ad25c1c6b2e0c22bf75f60117 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/ECDSA.ets | arkts | verifySegmentSync | 对数据进行分段验签,同步
@param data 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(ECC256|SHA256、ECC256|SHA512、ECC384|SHA256、等)。
@param len 自定义的数据拆分长度,此处取64
@returns | static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
algName = 'ECC256|SHA256', len: number = 64): boolean {
return CryptoUtil.verifySegmentSync(data, signDataBlob, pubKey, algName, len);
} | AST#method_declaration#Left static verifySegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#q... | static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
algName = 'ECC256|SHA256', len: number = 64): boolean {
return CryptoUtil.verifySegmentSync(data, signDataBlob, pubKey, algName, len);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/ECDSA.ets#L130-L133 | 709b99b07ed0ed934f98dbaa27fde552c5f2d987 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/Transformer.ets | arkts | rectToPixelPhase | Transform a rectangle with all matrices with potential animation phases.
@param r
@param phaseY | public rectToPixelPhase(r: MyRect, phaseY: number) {
// multiply the height of the rect with the phase
r.top *= phaseY;
r.bottom *= phaseY;
this.mMatrixValueToPx.mapRect(r);
this.mViewPortHandler.getMatrixTouch().mapRect(r);
this.mMatrixOffset.mapRect(r);
} | AST#method_declaration#Left public rectToPixelPhase AST#parameter_list#Left ( AST#parameter#Left r : AST#type_annotation#Left AST#primary_type#Left MyRect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | public rectToPixelPhase(r: MyRect, phaseY: number) {
r.top *= phaseY;
r.bottom *= phaseY;
this.mMatrixValueToPx.mapRect(r);
this.mViewPortHandler.getMatrixTouch().mapRect(r);
this.mMatrixOffset.mapRect(r);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L302-L311 | 3327758a6b98d6993d0f1940e07e6f37affe919e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 历史更新数据接口 | export interface HistoryUpdateData {
status: string;
sent_at?: string;
metadata?: string;
updated_at: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface HistoryUpdateData AST#object_type#Left { AST#type_member#Left status : 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 sent_at ? : AST#type_anno... | export interface HistoryUpdateData {
status: string;
sent_at?: string;
metadata?: string;
updated_at: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L301-L306 | 810360791e255a6c2cacd88ca6c5b8646742b92a | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/Immersive/casesfeature/immersive/src/main/ets/view/FullScreenImmersive.ets | arkts | FullScreenImmersive | 窗口全屏布局方案示例
1、设置窗口强制全屏布局
2、获取状态栏和导航条的高度手动进行避让 | @Component
export struct FullScreenImmersive {
@State topHeight: number = 0;
@State bottomHeight: number = 0;
windowClass?: window.Window;
aboutToAppear(): void {
window.getLastWindow(getContext(), (err, windowClass) => {
this.windowClass = windowClass;
// 设置窗口强制全屏布局
windowClass.setWindow... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FullScreenImmersive AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right topHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#t... | @Component
export struct FullScreenImmersive {
@State topHeight: number = 0;
@State bottomHeight: number = 0;
windowClass?: window.Window;
aboutToAppear(): void {
window.getLastWindow(getContext(), (err, windowClass) => {
this.windowClass = windowClass;
windowClass.setWindowLayoutFullScr... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/Immersive/casesfeature/immersive/src/main/ets/view/FullScreenImmersive.ets#L24-L133 | 228c7378f0391749106313a2162d18a370a03e29 | gitee |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/common/AccountData.ets | arkts | init | 初始化存储 | static async init(context: Context): Promise<void> {
try {
AccountDataManager.preferencesStore = await preferences.getPreferences(context, 'accountData');
} catch (err) {
console.error('初始化账户存储失败:', err);
}
} | AST#method_declaration#Left static async init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le... | static async init(context: Context): Promise<void> {
try {
AccountDataManager.preferencesStore = await preferences.getPreferences(context, 'accountData');
} catch (err) {
console.error('初始化账户存储失败:', err);
}
} | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L30-L36 | 77462689a6593bc29c26864d4a861553c4734cde | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BubbleDataSet.ets | arkts | getHighlightCircleWidth | @Override | public getHighlightCircleWidth(): number {
return this.mHighlightCircleWidth;
} | AST#method_declaration#Left public getHighlightCircleWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#... | public getHighlightCircleWidth(): number {
return this.mHighlightCircleWidth;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BubbleDataSet.ets#L38-L40 | 8468d328f15b6cb18aa4a833c1e7cffbe40b81c5 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets | arkts | 验证签名
@param encryptedData 待验证的数据
@param singedData 签名信息
@param publicKey 公钥
@returns 签名验证是否通过 | export async function verify(encryptedData: string, singedData: string, publicKey: string): Promise<boolean> {
try {
let verifyer = cryptoFramework.createVerify('RSA1024|PKCS1|SHA256');
// 创建非对称密钥生成器实例
let rsaKeyGenerator: cryptoFramework.AsyKeyGenerator = cryptoFramework.createAsyKeyGenerator('RSA1024');... | AST#export_declaration#Left export AST#function_declaration#Left async function verify AST#parameter_list#Left ( AST#parameter#Left encryptedData : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left singedData : AST#type_annota... | export async function verify(encryptedData: string, singedData: string, publicKey: string): Promise<boolean> {
try {
let verifyer = cryptoFramework.createVerify('RSA1024|PKCS1|SHA256');
let rsaKeyGenerator: cryptoFramework.AsyKeyGenerator = cryptoFramework.createAsyKeyGenerator('RSA1024');
let p... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets#L125-L142 | ae6f40c47966c29d1c88015b8fe24585533c10b4 | gitee | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/OtaPage.ets | arkts | ota的ux显示数据
@since 2022-12-01 | export class OtaPage implements IPage {
/**
* 取新版本数据
*
* @param versionComponents 升级包
* @param componentDescriptions 更新日志
* @return Promise<VersionPageInfo> 具体的新版本数据
*/
public async getNewVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions?: Array<update.Co... | AST#export_declaration#Left export AST#class_declaration#Left class OtaPage AST#implements_clause#Left implements IPage AST#implements_clause#Right AST#class_body#Left { /**
* 取新版本数据
*
* @param versionComponents 升级包
* @param componentDescriptions 更新日志
* @return Promise<VersionPageInfo> 具体的新版本数据
*/ AST... | export class OtaPage implements IPage {
public async getNewVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions?: Array<update.ComponentDescription>): Promise<VersionPageInfo> {
let component: update.VersionComponent = versionComponents.filter((component: update.VersionC... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/OtaPage.ets#L28-L94 | 8a130c4d37d1720189172184ea4f5969271f3dfe | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets | arkts | loadPreference | 加载当前planId | private async loadPreference(): Promise<void> {
if (!this.prefs) return;
const value = await this.prefs.get(Prefs.kCurrentPlanId, null);
if (value != null) {
this.currentPlanId = value as number;
}
} | AST#method_declaration#Left private async loadPreference 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 > AS... | private async loadPreference(): Promise<void> {
if (!this.prefs) return;
const value = await this.prefs.get(Prefs.kCurrentPlanId, null);
if (value != null) {
this.currentPlanId = value as number;
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L116-L122 | 79a7eefe0834e19aa621cbb4d5e042061b18de73 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets | arkts | toModel | 将数据库实体转换为领域模型
@param {CartEntity} entity 数据库实体
@returns {Cart} 领域模型 | private toModel(entity: CartEntity): Cart {
const cart: Cart = new Cart();
cart.goodsId = entity.goodsId ?? 0;
cart.goodsName = entity.goodsName ?? "";
cart.goodsMainPic = entity.goodsMainPic ?? "";
cart.spec = this.parseSpecs(entity.specJson);
return cart;
} | AST#method_declaration#Left private toModel AST#parameter_list#Left ( AST#parameter#Left entity : AST#type_annotation#Left AST#primary_type#Left CartEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Cart AST#primary_ty... | private toModel(entity: CartEntity): Cart {
const cart: Cart = new Cart();
cart.goodsId = entity.goodsId ?? 0;
cart.goodsName = entity.goodsName ?? "";
cart.goodsMainPic = entity.goodsMainPic ?? "";
cart.spec = this.parseSpecs(entity.specJson);
return cart;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets#L180-L187 | c3fb8734ef737573112719d9278fe74a133a3ed8 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onActionEnd | The Rotation gesture is successfully recognized. When the finger is lifted, the callback is triggered.
@param { Callback<GestureEvent> } event
@returns { RotationGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onActionEnd(event: Callback<GestureEvent>): RotationGesture; | AST#method_declaration#Left onActionEnd AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | onActionEnd(event: Callback<GestureEvent>): RotationGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L701-L701 | dede3f3919e73549668e25ff85fe1af2a5f4ed26 | gitee |
MissTeven/ArkTS-demo.git | fd9f7695fa29889ad4a9ecf3330fda9991aca24c | entry/src/main/ets/viewmodel/LoginViewMode.ets | arkts | getContactListItems | Get contact information of CustomerServicePage.
@return {Array<ListItemData>} contactListItems. | getContactListItems(): Array<ListItemData> {
let contactListItems: Array<ListItemData> = [];
let serviceHotline = new ListItemData();
serviceHotline.title = $r('app.string.service_hotline');
serviceHotline.summary = $r('app.string.hotline_number');
contactListItems.push(serviceHotline);
let emai... | AST#method_declaration#Left getContactListItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ListItemData AST#primary_type#Right AST#type_annotation#Right > AST#t... | getContactListItems(): Array<ListItemData> {
let contactListItems: Array<ListItemData> = [];
let serviceHotline = new ListItemData();
serviceHotline.title = $r('app.string.service_hotline');
serviceHotline.summary = $r('app.string.hotline_number');
contactListItems.push(serviceHotline);
let emai... | https://github.com/MissTeven/ArkTS-demo.git/blob/fd9f7695fa29889ad4a9ecf3330fda9991aca24c/entry/src/main/ets/viewmodel/LoginViewMode.ets#L28-L39 | 82d9ecd3379e07c0fd13a42fe97e187c6768005e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | signSync | 对数据进行签名,同步
@param dataBlob 待签名数据
@param priKey 私钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
@returns | static signSync(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): cryptoFramework.DataBlob {
let signer = cryptoFramework.createSign(algName);
signer.initSync(priKey);
let signData = signer.signSync(dataBlob);
return signData;
} | AST#method_declaration#Left static signSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey ... | static signSync(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): cryptoFramework.DataBlob {
let signer = cryptoFramework.createSign(algName);
signer.initSync(priKey);
let signData = signer.signSync(dataBlob);
return signData;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L304-L309 | 0bee03c734604b3987999adc116f24ecde9d365c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/NotificationTypes.ets | arkts | 通知状态 | export enum NotificationStatus {
UNREAD = 'unread',
READ = 'read',
DISMISSED = 'dismissed',
ARCHIVED = 'archived'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum NotificationStatus AST#enum_body#Left { AST#enum_member#Left UNREAD = AST#expression#Left 'unread' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left READ = AST#expression#Left 'read' AST#expression#Right AST#enum_member#Right , AST#enum_m... | export enum NotificationStatus {
UNREAD = 'unread',
READ = 'read',
DISMISSED = 'dismissed',
ARCHIVED = 'archived'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/NotificationTypes.ets#L27-L32 | ec1e2099ec3ad04361d511b8ab47108c79e88644 | github | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.AlbumPickerComponent.d.ets | arkts | AlbumPickerComponent | AlbumPickerComponent: can select a certain album and display the images in that album through PhotoPickerComponent
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | @Component
export declare struct AlbumPickerComponent {
/**
* AlbumPickerOptions
*
* @type { ?AlbumPickerOptions }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
albumPickerOptions?: AlbumPickerOptions;
/**
* Callback ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AlbumPickerComponent AST#component_body#Left { /**
* AlbumPickerOptions
*
* @type { ?AlbumPickerOptions }
* @syscap SystemCapability.FileManagement.PhotoAcces... | @Component
export declare struct AlbumPickerComponent {
albumPickerOptions?: AlbumPickerOptions;
onAlbumClick?: (albumInfo: AlbumInfo) => boolean;
onEmptyAreaClick?: EmptyAreaClickCallback;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.AlbumPickerComponent.d.ets#L28-L57 | 853f88498a20ea453124f674bbe8b2aac0cc36ad | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets | arkts | getDrawY | Returns the y-position in pixels where this highlight object was last drawn.
@return | public getDrawY(): number {
return this.mDrawY;
} | AST#method_declaration#Left public getDrawY AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expressi... | public getDrawY(): number {
return this.mDrawY;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets#L202-L204 | dabdc1e24305141ebfd5de0b0e85b3ff6cbccf8b | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/MineView.ets | arkts | 后缀文本 | constructor(id: string, image: Resource, text: Resource, des: Resource) {
this.id = id;
this.image = image;
this.text = text;
this.des = des;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#... | constructor(id: string, image: Resource, text: Resource, des: Resource) {
this.id = id;
this.image = image;
this.text = text;
this.des = des;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/MineView.ets#L26-L31 | f0aca2546dc6343dc8e0b4b2e2fc7082802ff0e9 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets | arkts | GridExchangeComponent | 动画总时长200ms
功能描述: 本示例直接进行交换和删除元素会给用户带来不好的体验效果,因此需要在此过程中注入一些特色的动画来提升体验效果,本案例通过Grid组件、
attributeModifier、以及animateTo函数实现了拖拽动画,删除动画和添加时的位移动画。
推荐场景: 在进行交换和删除元素时注入一些特色的动画来提升体验效果
核心组件:
1. onAreaChange
2. onTouch
实现步骤:
1. 本示例主要通过attributeModifier、supportAnimation、animateTo等实现了删除动画,以及长按拖拽动画。
2. attributeModifier绑定自定义属性对象,控制... | @Component
export struct GridExchangeComponent {
@Provide isEdit: boolean = false;
@Provide @Watch('monitoringData') appInfoList: AppInfo[] = APP_LIST_DATA;
@Provide firstAppInfoList: AppInfo[] = FIRST_APP_LIST_DATA;
@Provide secondAppInfoList: AppInfo[] = SECOND_APP_LIST_DATA;
@State movedItem: AppInfo = new... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GridExchangeComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right isEdit : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST... | @Component
export struct GridExchangeComponent {
@Provide isEdit: boolean = false;
@Provide @Watch('monitoringData') appInfoList: AppInfo[] = APP_LIST_DATA;
@Provide firstAppInfoList: AppInfo[] = FIRST_APP_LIST_DATA;
@Provide secondAppInfoList: AppInfo[] = SECOND_APP_LIST_DATA;
@State movedItem: AppInfo = new... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L43-L398 | 3ae789c5aa3aa5c20db64b6cc6caa2ecf282995f | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuIsShown.ets | arkts | BindContextMenuIsShownBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function BindContextMenuIsShownBuilder(name: string, param: Object) {
BindContextMenuIsShownExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindContextMenuIsShownBuilder 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#parame... | @Builder
export function BindContextMenuIsShownBuilder(name: string, param: Object) {
BindContextMenuIsShownExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuIsShown.ets#L16-L19 | 4a52f92016726e70a6630b123a2cbe4c5b630af9 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | initializeAlgorithms | 私有方法
初始化算法 | private initializeAlgorithms(): void {
// 协同过滤算法
this.algorithms.set('collaborative_filtering', {
name: 'Collaborative Filtering',
version: '1.0',
type: AlgorithmType.COLLABORATIVE_FILTERING,
weight: 0.3,
parameters: {
similarityThreshold: 0.6,
maxNeighbors: 50,
... | AST#method_declaration#Left private initializeAlgorithms 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_expre... | private initializeAlgorithms(): void {
this.algorithms.set('collaborative_filtering', {
name: 'Collaborative Filtering',
version: '1.0',
type: AlgorithmType.COLLABORATIVE_FILTERING,
weight: 0.3,
parameters: {
similarityThreshold: 0.6,
maxNeighbors: 50,
minR... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L477-L538 | 79fc274a0ae829567e900f3524a8b41ebd62f606 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/OHMailETS/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onStartRemoteAbility | 拉起远端FA | function onStartRemoteAbility(deviceId, dataList: any[]) {
AuthDevice(deviceId);
let numDevices = remoteDeviceModel.deviceList.length;
if (numDevices === 0) {
prompt.showToast({
message: "onStartRemoteAbility no device found"
});
return;
}
var params = {
dataList: JSON.stringify(dataLis... | AST#function_declaration#Left function onStartRemoteAbility AST#parameter_list#Left ( AST#parameter#Left deviceId AST#parameter#Right , AST#parameter#Left dataList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left any [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#param... | function onStartRemoteAbility(deviceId, dataList: any[]) {
AuthDevice(deviceId);
let numDevices = remoteDeviceModel.deviceList.length;
if (numDevices === 0) {
prompt.showToast({
message: "onStartRemoteAbility no device found"
});
return;
}
var params = {
dataList: JSON.stringify(dataLis... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OHMailETS/entry/src/main/ets/MainAbility/pages/index.ets#L79-L107 | 490eaf900985ae73a0c8d66ae6b4b5d4531289d6 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets | arkts | isTitleItemEqual | ④全角逗号(,) / 判断两个 TitleItem 是否相等(只比较 pos) | static isTitleItemEqual(a: TitleItem, b: TitleItem): boolean {
if (a.pos === null && b.pos === null) {
return true;
}
if (a.pos !== null) {
return a.pos === b.pos;
}
return false;
} | AST#method_declaration#Left static isTitleItemEqual AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left TitleItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Left TitleItem AST#primary... | static isTitleItemEqual(a: TitleItem, b: TitleItem): boolean {
if (a.pos === null && b.pos === null) {
return true;
}
if (a.pos !== null) {
return a.pos === b.pos;
}
return false;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L28-L36 | 3247f38d577b6ea43c692d42de556960406c61a7 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/VideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets | arkts | padding | Zero padding, 2 bits.
@param num Number to be converted.
@return Result after zero padding. | padding(num: string): string {
let length = CommonConstants.PADDING_LENGTH;
for (let len = (num.toString()).length; len < length; len = num.length) {
num = `${CommonConstants.PADDING_STR}${num}`;
}
return num;
} | AST#method_declaration#Left padding AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#... | padding(num: string): string {
let length = CommonConstants.PADDING_LENGTH;
for (let len = (num.toString()).length; len < length; len = num.length) {
num = `${CommonConstants.PADDING_STR}${num}`;
}
return num;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets#L47-L53 | bae9013db0b8c282f5ca37447f2c0000b2cc0075 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | copyDir | 复制源文件夹至目标路径下,只能复制沙箱里的文件夹,使用Promise异步返回。
@param src 源文件夹的应用沙箱路径。
@param dest 目标文件夹的应用沙箱路径。
@param mode 复制模式:
mode为0,文件级别抛异常。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至目标文件夹下,目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中以Array<ConflictFiles>形式提供。
mode为1,文件级别强制覆盖。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则强制覆盖冲突文件夹下所有同名文件... | static copyDir(src: string, dest: string, mode: number = 1): Promise<void> {
return fs.copyDir(src, dest, mode);
} | AST#method_declaration#Left static copyDir AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dest : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | static copyDir(src: string, dest: string, mode: number = 1): Promise<void> {
return fs.copyDir(src, dest, mode);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L620-L622 | 69287573d61636cf1a4cdf3219bc85efd926b9e2 | gitee |
wenqi1/MallHomepage.git | a09765bee60b214f73b875570f8721a004d0bc3b | entry/src/main/ets/viewmodel/MainPageData.ets | arkts | 主页底部导航栏数据 | export const tabBarData: TabBarData[] = [
{
index: 0,
img: $r('app.media.main_page_tab_home'),
selectImg: $r("app.media.main_page_tab_select_home"),
title: $r('app.string.main_page_tab_home'),
},
{
index: 1,
img: $r("app.media.main_page_tab_product"),
selectImg: $r("app.media.main_page... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left tabBarData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TabBarData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expr... | export const tabBarData: TabBarData[] = [
{
index: 0,
img: $r('app.media.main_page_tab_home'),
selectImg: $r("app.media.main_page_tab_select_home"),
title: $r('app.string.main_page_tab_home'),
},
{
index: 1,
img: $r("app.media.main_page_tab_product"),
selectImg: $r("app.media.main_page... | https://github.com/wenqi1/MallHomepage.git/blob/a09765bee60b214f73b875570f8721a004d0bc3b/entry/src/main/ets/viewmodel/MainPageData.ets#L17-L46 | ecf1ec8cc93004d932ac7b0213922e47330880f4 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/AlipayPayParams.ets | arkts | @file 支付宝支付请求参数
@author Joker.X | export interface AlipayPayParams extends Record<string, number> {
/**
* 订单 ID
*/
orderId: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AlipayPayParams AST#extends_clause#Left extends AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary... | export interface AlipayPayParams extends Record<string, number> {
orderId: number;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/AlipayPayParams.ets#L5-L10 | 0585a3fa9a981a4f6701b0ad279d9581ded351f5 | github | |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/utils/EventBus.ets | arkts | 系统有内部实现的emitter作为事件总线,可不引用该类实现 | export default class EventBus {
private static instance: EventBus;
private listeners: Record<string, EventHandler<any>[]> = {};
private constructor() {
}
public static getInstance(): EventBus {
if (!EventBus.instance) {
EventBus.instance = new EventBus();
}
return EventBus.instance;
}
... | AST#export_declaration#Left export default AST#class_declaration#Left class EventBus AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left EventBus AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declar... | export default class EventBus {
private static instance: EventBus;
private listeners: Record<string, EventHandler<any>[]> = {};
private constructor() {
}
public static getInstance(): EventBus {
if (!EventBus.instance) {
EventBus.instance = new EventBus();
}
return EventBus.instance;
}
... | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/utils/EventBus.ets#L6-L31 | 736a4c4639ac9b03c5cf50f8e8b8702084bca822 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/FileUtility.ets | arkts | 文件操作工具类 | export class FileUtility {
// MARK: - 基础文件操作
/** 判断文件是否存在 */
static isFileExistAt(path: string | null): boolean {
if (!path) return false;
try {
return fs.accessSync(path); // 直接返回比较结果
} catch (e) {
return false;
}
}
/** 删除文件 */
static deleteFileAt(path: string | null): boolean... | AST#export_declaration#Left export AST#class_declaration#Left class FileUtility AST#class_body#Left { // MARK: - 基础文件操作 /** 判断文件是否存在 */ AST#method_declaration#Left static isFileExistAt AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#prima... | export class FileUtility {
static isFileExistAt(path: string | null): boolean {
if (!path) return false;
try {
return fs.accessSync(path);
} catch (e) {
return false;
}
}
static deleteFileAt(path: string | null): boolean {
if (!path) return false;
try {
if (fs... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L16-L265 | 8cee308d315f799f4036b2ebe0c768d9eb2d9396 | github | |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/viewmodel/PositionItem.ets | arkts | Geographical coordinates, longitude and latitude. | export class GeoCoordinates {
longitude: number = 0;
latitude: number = 0;
} | AST#export_declaration#Left export AST#class_declaration#Left class GeoCoordinates AST#class_body#Left { AST#property_declaration#Left longitude : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaratio... | export class GeoCoordinates {
longitude: number = 0;
latitude: number = 0;
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/PositionItem.ets#L37-L40 | 0ddfe4a38123ca9d45ea2ab5664fbaab9ee642aa | github | |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/configure/sqlite.ets | arkts | initAppDatabase | 创建/关闭/销毁 App Database | static async initAppDatabase(): Promise<void> {
if (!AppDatabaser.created) {
await Sqliter.openAppDatabase()
}
if (AppDatabaser.created) {
Sqliter.appUser = await AppDatabaser.recentUser()
}
if (store.logined) {
!Sqliter.appUser ? event.logout() : event.login()
}
} | AST#method_declaration#Left static async initAppDatabase 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 > AS... | static async initAppDatabase(): Promise<void> {
if (!AppDatabaser.created) {
await Sqliter.openAppDatabase()
}
if (AppDatabaser.created) {
Sqliter.appUser = await AppDatabaser.recentUser()
}
if (store.logined) {
!Sqliter.appUser ? event.logout() : event.login()
}
} | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/configure/sqlite.ets#L23-L35 | 5cdddbcc3de04e0ec867dc408aff74018df5b46d | github |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/commons/components/HcNavBar.ets | arkts | HcNavBar | 直接可在预览器预览组件 @Preview | @Component
export struct HcNavBar {
@StorageProp('topHeight')
topHeight: number = 0
// 标题文字
@Prop
title: string = '登录'
// 是否有下边框
@Prop
showBorder: boolean = false
// 左边图标
@Prop
leftIcon: ResourceStr = $r('app.media.ic_common_back')
// 右边图标
@Prop
rightIcon: ResourceStr = $r('sys.media.ohos_ic... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HcNavBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'topHeight' AST#expression#Right ) AST#decorator#Right topHeight : AST#type_annotation#Left AST#p... | @Component
export struct HcNavBar {
@StorageProp('topHeight')
topHeight: number = 0
@Prop
title: string = '登录'
@Prop
showBorder: boolean = false
@Prop
leftIcon: ResourceStr = $r('app.media.ic_common_back')
@Prop
rightIcon: ResourceStr = $r('sys.media.ohos_ic_public_more')
@Prop
sh... | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/components/HcNavBar.ets#L5-L62 | 3644ed34e40d158156856c2e32c7df5d42caa076 | github |
wuyukobe24/HMApp_ArkTS.git | 6d09d9b07a4fdc4713e5a13b61b85bc1e7893956 | entry/src/main/ets/common/networking/QQNetworkRequestNET.ets | arkts | requestString方法:获取请求返回的json字符串 post | export function postRequest(url:string, param:Object, success:(str:string)=>void, fail:(error:NetError)=>void) {
Net.post(url).setParams(param).setHeaders(header).requestString((data) => {
success(data.toString())
}, (error) => {
fail(error)
})
} | AST#export_declaration#Left export AST#function_declaration#Left function postRequest AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : AST#type_annotation#Left AST#pr... | export function postRequest(url:string, param:Object, success:(str:string)=>void, fail:(error:NetError)=>void) {
Net.post(url).setParams(param).setHeaders(header).requestString((data) => {
success(data.toString())
}, (error) => {
fail(error)
})
} | https://github.com/wuyukobe24/HMApp_ArkTS.git/blob/6d09d9b07a4fdc4713e5a13b61b85bc1e7893956/entry/src/main/ets/common/networking/QQNetworkRequestNET.ets#L23-L29 | 1c6db6a3cbfed21dd85debf850a88614c5d6b992 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Learn.ets | arkts | MARK: - Plan Learn | export class Learn {
planId : number | null;
bookId : number | null;
num : number | null;
distance : number | null;
pieceNo : number | null;
wordId : number | null;
learnDate : Date | null;
constructor(
planId : number | null = null,
bookId : number | null = null,
nu... | AST#export_declaration#Left export AST#class_declaration#Left class Learn AST#class_body#Left { AST#property_declaration#Left planId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annota... | export class Learn {
planId : number | null;
bookId : number | null;
num : number | null;
distance : number | null;
pieceNo : number | null;
wordId : number | null;
learnDate : Date | null;
constructor(
planId : number | null = null,
bookId : number | null = null,
nu... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Learn.ets#L5-L98 | ba38540a42c94b0a9285029483f79f7648966558 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/array/ArrayStringUtils.ets | arkts | 字符串扩展 | export class StringWords {
/**
* 中间有空格,分割为词语数组。无空格则分割为汉字数组
* 有空格: "中国 今天 大 家里 好的" -> [中国, 今天,大,家里,好的]
* 有一个空格: "中国 " -> [中国]
*
* 全部是单字: "中国人" -> [中,国,人]
* 无空格: "中国" -> [中, 国]
*/
static splitToWordsArray(str: string, separator: string = " "... | AST#export_declaration#Left export AST#class_declaration#Left class StringWords AST#class_body#Left { /**
* 中间有空格,分割为词语数组。无空格则分割为汉字数组
* 有空格: "中国 今天 大 家里 好的" -> [中国, 今天,大,家里,好的]
* 有一个空格: "中国 " -> [中国]
*
* 全部是单字: "中国人" -> [中,国,人]
* 无空格: "中国" -> [中,... | export class StringWords {
static splitToWordsArray(str: string, separator: string = " "): string[] {
if (str.includes(separator)) {
return str.split(separator).filter(item => item.length > 0);
} else {
return Array.from(str);
}
}
static containsWords(str: string): boolean {
ret... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayStringUtils.ets#L83-L108 | d94f54dbc38a6cabf38a2e9e02bbeecb42138843 | github | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | arg | 添加额外参数 | public arg(key: string, value?: string): FFmpegCommandBuilder {
this.extraArgs.push(key);
if (value !== undefined) {
this.extraArgs.push(value);
}
return this;
} | AST#method_declaration#Left public arg 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 string AST#primary_type#Right... | public arg(key: string, value?: string): FFmpegCommandBuilder {
this.extraArgs.push(key);
if (value !== undefined) {
this.extraArgs.push(value);
}
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L145-L151 | c9866fc2868f3fb41c4dcbf2b41e3f7853f35cf4 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets | arkts | isCSoundExistsInCache | 检查是否有发音缓存 | async isCSoundExistsInCache(text: string): Promise<boolean> {
if (!text) {
return false;
}
if (this.existedSoundCacheSet.has(text)) {
return true
}
let rtn = await CSoundDbAccessor.shared.getByLangAndText(lang_en_us, text) !== null
if (rtn) {
//缓存结果true
this.existedSound... | AST#method_declaration#Left async isCSoundExistsInCache AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | async isCSoundExistsInCache(text: string): Promise<boolean> {
if (!text) {
return false;
}
if (this.existedSoundCacheSet.has(text)) {
return true
}
let rtn = await CSoundDbAccessor.shared.getByLangAndText(lang_en_us, text) !== null
if (rtn) {
this.existedSoundCacheSet.a... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets#L41-L56 | 89afd541f31ef854a0dc00d8b127946841f348a6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationManager.ets | arkts | initializeManager | 初始化通知管理器 | private async initializeManager(): Promise<void> {
try {
// 创建通知渠道
await this.createNotificationChannels();
// 加载设置
this.settings = await this.settingsService.getSettings();
// 启动定时检查
this.startPeriodicCheck();
hilog.info(LogConstants.DOMAIN_APP, LogCon... | AST#method_declaration#Left private async initializeManager AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right >... | private async initializeManager(): Promise<void> {
try {
await this.createNotificationChannels();
this.settings = await this.settingsService.getSettings();
this.startPeriodicCheck();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L79-L94 | 6b00dfc44b2ca884700de7d92d927bdbf81df08e | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/navigation/NetworkDemoNav.ets | arkts | NetworkDemoNav | @file Network Demo 示例页导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function NetworkDemoNav(): void {
NetworkDemoPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function NetworkDemoNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom... | @Builder
export function NetworkDemoNav(): void {
NetworkDemoPage();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/navigation/NetworkDemoNav.ets#L8-L11 | 05e164251740a86535e08eeb0435dac890e3f858 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/HillCipher.ets | arkts | textToNumbers | 将文本转换为数字数组
@param text 要转换的文本
@returns 数字数组 | private static textToNumbers(text: string): number[] {
return text.toUpperCase().split('').map(char => {
const index = HillCipher.ALPHABET.indexOf(char);
return index === -1 ? 0 : index;
});
} | AST#method_declaration#Left private static textToNumbers AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_ty... | private static textToNumbers(text: string): number[] {
return text.toUpperCase().split('').map(char => {
const index = HillCipher.ALPHABET.indexOf(char);
return index === -1 ? 0 : index;
});
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/HillCipher.ets#L62-L67 | 1aa53cff96cfc216dcff2fae1e72ef99ea1ff5b8 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | TODO 定位工具类(WGS-84坐标系)
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class LocationUtil {
/**
* 判断位置服务是否已经使能(定位是否开启)。
* @returns
*/
static isLocationEnabled(): boolean {
return geoLocationManager.isLocationEnabled();
}
/**
* 申请定位权限
* @returns
*/
static async requestLocationPermissions(): Promise<boolean> {
let grant = await PermissionUtil.r... | AST#export_declaration#Left export AST#class_declaration#Left class LocationUtil AST#class_body#Left { /**
* 判断位置服务是否已经使能(定位是否开启)。
* @returns
*/ AST#method_declaration#Left static isLocationEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST... | export class LocationUtil {
static isLocationEnabled(): boolean {
return geoLocationManager.isLocationEnabled();
}
static async requestLocationPermissions(): Promise<boolean> {
let grant = await PermissionUtil.requestPermissions(['ohos.permission.LOCATION', 'ohos.permission.APPROXIMATELY_LOCATIO... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L29-L374 | 3387b9be16d10fdea1a0c8cefe2ad51f6e9fa5e9 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/model/Socket.ets | arkts | TCP TLS UDP 共同实现的接口 | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/model/Socket.ets#L28-L28 | 508100eadaa24584b39840da5aa18507c39e854b | gitee | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/DataSyncVerifier.ets | arkts | createTestData | 创建测试数据 - 模拟真实使用场景 | async createTestData(): Promise<VerificationResult> {
const verificationResults: string[] = [];
const taskIds: number[] = [];
try {
verificationResults.push('📋 开始创建测试数据...');
// 创建不同优先级的任务
const task1: TaskData = {
title: '完成产品需求分析',
description: '分析用户需求,编写PRD文档',
... | AST#method_declaration#Left async createTestData 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 VerificationResult AST#primary_type#Right AST#type_annotation#Righ... | async createTestData(): Promise<VerificationResult> {
const verificationResults: string[] = [];
const taskIds: number[] = [];
try {
verificationResults.push('📋 开始创建测试数据...');
const task1: TaskData = {
title: '完成产品需求分析',
description: '分析用户需求,编写PRD文档',
priority: '... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DataSyncVerifier.ets#L53-L106 | 2df86252e9a42eeb03709148381c25b0e43a362e | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets | arkts | onHeartRate | 心率变动事件 | onHeartRate() {
Log.showInfo(TAG, `onHeartRate: heartRate = ${this.heartRate}`);
// update heart rate arr
this.heartRateArr.push(this.heartRate);
if (this.heartRateArr.length > SIZE) {
this.heartRateArr.shift();
}
Log.showInfo(TAG, `onHeartRate: heartRateArr = ${JSON.stringify(this.heartR... | AST#method_declaration#Left onHeartRate 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 Log AST#expression#Right . showInfo AST#member_expre... | onHeartRate() {
Log.showInfo(TAG, `onHeartRate: heartRate = ${this.heartRate}`);
this.heartRateArr.push(this.heartRate);
if (this.heartRateArr.length > SIZE) {
this.heartRateArr.shift();
}
Log.showInfo(TAG, `onHeartRate: heartRateArr = ${JSON.stringify(this.heartRateArr)}`);
th... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets#L62-L80 | 20a2e0d6e2016e8f6a96683844be0f0ff8e41bf0 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onActionCancel | The LongPress gesture is successfully recognized and a callback is triggered when the touch cancel event
is received.
@param { Callback<void> } event
@returns { LongPressGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onActionCancel(event: Callback<void>): LongPressGesture; | AST#method_declaration#Left onActionCancel AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | onActionCancel(event: Callback<void>): LongPressGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L454-L454 | 32e1851c03fe5106ad3ffd87e5dbf230363be4c4 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets | arkts | updateCanvas | Update canvas. | updateCanvas(): void {
this.redraw();
} | AST#method_declaration#Left updateCanvas AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#... | updateCanvas(): void {
this.redraw();
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets#L73-L75 | 9788efbde886dd8ae6c68d8d41c03c48ac012efb | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/share/SharePage.ets | arkts | buildPlatformItem | 构建分享平台项 | @Builder
buildPlatformItem(platform: SharePlatform) {
Column({ space: UIConstants.SMALL_PADDING }) {
Image(this.getPlatformIcon(platform))
.width('40vp')
.height('40vp')
.fillColor($r('app.color.primary'))
Text(this.getPlatformName(platform))
.fontSize(UIConstants.FONT... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildPlatformItem AST#parameter_list#Left ( AST#parameter#Left platform : AST#type_annotation#Left AST#primary_type#Left SharePlatform AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_... | @Builder
buildPlatformItem(platform: SharePlatform) {
Column({ space: UIConstants.SMALL_PADDING }) {
Image(this.getPlatformIcon(platform))
.width('40vp')
.height('40vp')
.fillColor($r('app.color.primary'))
Text(this.getPlatformName(platform))
.fontSize(UIConstants.FONT... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/share/SharePage.ets#L401-L421 | 89e3868b355e8af57f49262038bb8b061c37af45 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/theme/AppColors.ets | arkts | 应用颜色主题配置 | export class AppColors {
// 主色
static readonly primary: string = '#1976D2';
static readonly primaryVariant: string = '#1565C0';
// 背景色
static readonly background: string = '#F5F5F5';
static readonly surface: string = '#FFFFFF';
static readonly surfaceVariant: string = '#F0F0F0';
// 文本色
static re... | AST#export_declaration#Left export AST#class_declaration#Left class AppColors AST#class_body#Left { // 主色 AST#property_declaration#Left static readonly primary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#1976D2' AST#expression#Right ; ... | export class AppColors {
static readonly primary: string = '#1976D2';
static readonly primaryVariant: string = '#1565C0';
static readonly background: string = '#F5F5F5';
static readonly surface: string = '#FFFFFF';
static readonly surfaceVariant: string = '#F0F0F0';
static readonly onPrimary:... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/theme/AppColors.ets#L4-L38 | 7014552e9c69cdada74ec4ba92103d910081202c | github | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | example/BasicUsage.ets | arkts | custom | ============================================================ 高级定制(Builder) ============================================================ 自定义命令 | custom(): void {
const cmd = new FFmpegCommandBuilder()
.input('/input.mp4')
.hwaccel()
.scale(1280, 720)
.fps(30)
.videoBitrate('2M')
.audioCodec('aac')
.audioBitrate('128k')
.output('/output.mp4')
.build();
console.info('命令: ' + cmd.join(' '));
this.r... | AST#method_declaration#Left custom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cmd = AST#expressi... | custom(): void {
const cmd = new FFmpegCommandBuilder()
.input('/input.mp4')
.hwaccel()
.scale(1280, 720)
.fps(30)
.videoBitrate('2M')
.audioCodec('aac')
.audioBitrate('128k')
.output('/output.mp4')
.build();
console.info('命令: ' + cmd.join(' '));
this.r... | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L87-L101 | 194fc6f54833f55d27a927c7b919ad48442e8445 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets | arkts | updateCartSpecCount | 更新购物车中商品的规格数量
@param {number} goodsId 商品ID
@param {number} specId 规格ID
@param {number} count 规格数量
@returns {Promise<void>} Promise<void> | async updateCartSpecCount(goodsId: number, specId: number, count: number): Promise<void> {
const entity: CartEntity | undefined = this.findEntityByGoodsId(goodsId);
if (!entity) {
return;
}
const specs: CartGoodsSpec[] = this.parseSpecs(entity.specJson);
const updatedSpecs: CartGoodsSpec[] = s... | AST#method_declaration#Left async updateCartSpecCount AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#... | async updateCartSpecCount(goodsId: number, specId: number, count: number): Promise<void> {
const entity: CartEntity | undefined = this.findEntityByGoodsId(goodsId);
if (!entity) {
return;
}
const specs: CartGoodsSpec[] = this.parseSpecs(entity.specJson);
const updatedSpecs: CartGoodsSpec[] = s... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets#L64-L85 | 79bdf7368a241f03f46bef6c8037dfde928e9b94 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/RegexUtil.ets | arkts | TODO 正则工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class RegexUtil {
/**
* 英文字母 、数字和下划线
*/
static readonly REG_GENERAL: string = "^\\w+$";
/**
* 数字
*/
static readonly REG_NUMBERS: string = "^\\d+$";
/**
* 字母
*/
static readonly REG_WORD: string = "^[a-zA-Z]+$";
/**
* 单个中文汉字
* 参照维基百科汉字Unicode范围(https://zh.wikipedia.org/wiki/%... | AST#export_declaration#Left export AST#class_declaration#Left class RegexUtil AST#class_body#Left { /**
* 英文字母 、数字和下划线
*/ AST#property_declaration#Left static readonly REG_GENERAL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^\\w+$... | export class RegexUtil {
static readonly REG_GENERAL: string = "^\\w+$";
static readonly REG_NUMBERS: string = "^\\d+$";
static readonly REG_WORD: string = "^[a-zA-Z]+$";
static readonly REG_CHINESE: string = "^[\u2E80-\u2EFF\u2F00-\u2FDF\u31C0-\u31EF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uD840\uD... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/RegexUtil.ets#L25-L278 | 872438b704e005076eeb9f01c7616f6258244e70 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/componentinstancesharedinpages/Index.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export * from './src/main/ets/generated/RouterBuilder'; | AST#export_declaration#Left export * from './src/main/ets/generated/RouterBuilder' ; AST#export_declaration#Right | export * from './src/main/ets/generated/RouterBuilder'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentinstancesharedinpages/Index.ets#L16-L16 | 58ad507768b0836ec6c830e23f733ea3b1615b9c | gitee | |
fengcreate/harmony-document | 798534b0f76399dc84e7940f5b14b3ae4e53c6a9 | BackupRestore/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.ets | arkts | MockSetup | 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, softw... | export { MockSetup, MockKit, when } from './src/main/mock/MockKit'; | AST#export_declaration#Left export { MockSetup , MockKit , when } from './src/main/mock/MockKit' ; AST#export_declaration#Right | export { MockSetup, MockKit, when } from './src/main/mock/MockKit'; | https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.ets#L16-L16 | ae40c4d805c18e38481c0729739006aecec5d487 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSASync.ets | arkts | decode2048PKCS1 | 2048位解密
@param decodeStr 待解密的字符串
@param priKey 2048位RSA私钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@param isPem 秘钥是否为pem格式 - 默认为false | static decode2048PKCS1(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string {
return CryptoSyncUtil.decodeAsym(str, priKey, 'RSA2048', 'RSA2048|PKCS1', 2048, keyCoding, dataCoding, isPem);
} | AST#method_declaration#Left static decode2048PKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static decode2048PKCS1(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string {
return CryptoSyncUtil.decodeAsym(str, priKey, 'RSA2048', 'RSA2048|PKCS1', 2048, keyCoding, dataCoding, isPem);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L137-L140 | 4af1080a5da080e8e07e9be0dbdacc998fb58b48 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowTabsHost.ets | arkts | uni_move_tab | Send a tab. | uni_move_tab() {
if (this.move_tab_gateway < 0) {
return;
}
let from_tab_index = this.move_tab_gateway;
let to_window = this.move_tab_gateway_target;
console.log(`[uni_move_tab][SEND][${this.my_window_id}] From Tab.${from_tab_index} to window #${to_window}!`);
if (this.bunch_of_tabs.Tabs[f... | AST#method_declaration#Left uni_move_tab AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . move_tab_ga... | uni_move_tab() {
if (this.move_tab_gateway < 0) {
return;
}
let from_tab_index = this.move_tab_gateway;
let to_window = this.move_tab_gateway_target;
console.log(`[uni_move_tab][SEND][${this.my_window_id}] From Tab.${from_tab_index} to window #${to_window}!`);
if (this.bunch_of_tabs.Tabs[f... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsHost.ets#L538-L558 | 5e1e798cf47718b9c6f12ef9e5c25403f448fb47 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/media/MediaManager.ets | arkts | printBluetooth | 蓝牙打印 | async printBluetooth(content: string): Promise<boolean> {
try {
Logger.info('MediaManager', 'Printing via Bluetooth');
// 实际实现需要使用 @ohos.bluetoothManager
return true;
} catch (error) {
Logger.error('MediaManager', `Failed to print: ${String(error)}`);
return false;
}
} | AST#method_declaration#Left async printBluetooth AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#... | async printBluetooth(content: string): Promise<boolean> {
try {
Logger.info('MediaManager', 'Printing via Bluetooth');
return true;
} catch (error) {
Logger.error('MediaManager', `Failed to print: ${String(error)}`);
return false;
}
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/media/MediaManager.ets#L90-L99 | 2a80ceaee18a5f027be5116cbea2935ceb7f268a | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LLMConfigPage.ets | arkts | buildActionButtons | 构建操作按钮区域 | @Builder
buildActionButtons() {
Column({ space: 12 }) {
// 保存按钮
Button('保存配置')
.type(ButtonType.Capsule)
.fontSize(16)
.backgroundColor('#4caf50')
.width('100%')
.height('48vp')
.enabled(this.apiKey.trim().length > 0)
.onClick(() => {
t... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildActionButtons 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_... | @Builder
buildActionButtons() {
Column({ space: 12 }) {
Button('保存配置')
.type(ButtonType.Capsule)
.fontSize(16)
.backgroundColor('#4caf50')
.width('100%')
.height('48vp')
.enabled(this.apiKey.trim().length > 0)
.onClick(() => {
this.sav... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L523-L551 | 912c81309e6db92c28b4ccd177a221aecbd4b3df | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Description.ets | arkts | setText | Sets the text to be shown as the description.
@param text | public setText(text: string): void {
this.text = text;
} | AST#method_declaration#Left public setText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | public setText(text: string): void {
this.text = text;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Description.ets#L47-L49 | 22bb870a386cfc0f368c84ce349d58e328622cfe | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 祝福语场合统计接口 | export interface GreetingOccasionStat {
occasion: string;
count: number;
percentage: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingOccasionStat AST#object_type#Left { AST#type_member#Left occasion : 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 count : AST#type_ann... | export interface GreetingOccasionStat {
occasion: string;
count: number;
percentage: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L62-L66 | 80b318438918f55d720ba09b791ed9ba7f941601 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/setting/AboutView.ets | arkts | itemDivider | /列表分隔线 | @Extend(ListItemGroup) function itemDivider(){
.divider({strokeWidth: 1, startMargin: 10, endMargin: 10, color: '#338aa5b2' })
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left ListItemGroup AST#expression#Right ) AST#decorator#Right function itemDivider AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . divider ( AST#expression#Left ... | @Extend(ListItemGroup) function itemDivider(){
.divider({strokeWidth: 1, startMargin: 10, endMargin: 10, color: '#338aa5b2' })
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/setting/AboutView.ets#L153-L155 | bdc23f6e50a2ea6f91d6d92ec57aef4e26991764 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Box.ets | arkts | get | MARK: - Getter 方法
获取距离 | get distance(): DistanceFromBase {
return this._distance;
} | AST#method_declaration#Left get AST#ERROR#Left distance AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DistanceFromBase AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return A... | get distance(): DistanceFromBase {
return this._distance;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L24-L26 | bdceb17e7069c9a3ebc59af4df5588a405decd07 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DbFileUtility.ets | arkts | 数据库文件操作回调接口
用于异步操作完成时的回调通知 | export interface DBFileCallback {
completion: () => void; // 操作完成时调用的方法
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DBFileCallback AST#object_type#Left { AST#type_member#Left completion : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type... | export interface DBFileCallback {
completion: () => void;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DbFileUtility.ets#L13-L15 | f37d7db9de0777478895a6e8e4f88f2fcb676f19 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/router/AppRouter.ets | arkts | getCurrentPath | 获取当前页面路径 | getCurrentPath(): string {
try {
const state = router.getState();
return state.path || '';
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to get current path: ${error}`);
return '';
}
} | AST#method_declaration#Left getCurrentPath 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left ... | getCurrentPath(): string {
try {
const state = router.getState();
return state.path || '';
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to get current path: ${error}`);
return '';
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L180-L189 | 91c67390c90e1e63e6514c1a8935e55d7ebb32e9 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets | arkts | TODO: 高性能知识点: 界面嵌套带来了渲染和计算的大量开销,造成性能的衰退。使用扁平化布局优化嵌套层级,建议采用相对布局RelativeContainer进行扁平化布局,有效减少容器的嵌套层级,减少组件的创建时间。
优化布局性能:https://gitee.com/harmonyos-cases/cases/blob/master/docs/performance/reduce-view-nesting-levels.md#%E4%BC%98%E5%8C%96%E5%B8%83%E5%B1%80%E6%80%A7%E8%83%BD | build() {
RelativeContainer() {
Image(this.head)
.width($r('app.integer.tabcontentoverflow_head_image_width'))
.height($r('app.integer.tabcontentoverflow_head_image_height'))
.borderRadius(CONFIGURATION.TABCONTENT_OVERFLOW_HEADIMAGE_BORDER_RADIUS)
.border({
width: $r(... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expre... | build() {
RelativeContainer() {
Image(this.head)
.width($r('app.integer.tabcontentoverflow_head_image_width'))
.height($r('app.integer.tabcontentoverflow_head_image_height'))
.borderRadius(CONFIGURATION.TABCONTENT_OVERFLOW_HEADIMAGE_BORDER_RADIUS)
.border({
width: $r(... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets#L59-L202 | a93152433e4d6cf182b1d9e863712fff23f70dba | gitee | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/common/util/ArrayUtil.ets | arkts | copy | 复制数组的每一个值,而不是得到数组的引用。
@param arr 被复制的数组。
@returns 复制得到的数组。 | static copy<value_type>(arr: Array<value_type>): Array<value_type> {
let result: Array<value_type> = [];
arr.forEach((value: value_type) => result.push(value));
return result;
} | AST#method_declaration#Left static copy AST#type_parameters#Left < AST#type_parameter#Left value_type AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_anno... | static copy<value_type>(arr: Array<value_type>): Array<value_type> {
let result: Array<value_type> = [];
arr.forEach((value: value_type) => result.push(value));
return result;
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/common/util/ArrayUtil.ets#L49-L53 | 0a94b26201929c6a6c44764e61826a8925e15e66 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getKindFrom | / get original kind | private static getKindFrom(srcText: string): string | null {
let str: string = AppUtility.getFirstPartFrom(srcText);
const strPoint: string = STR_POINT_HALF;
let kind: string | null = null;
const indexNoFound: number = -1;
str = AppUtility.replaceOmitAndPoint(str);
const index: number = str.las... | AST#method_declaration#Left private static getKindFrom AST#parameter_list#Left ( AST#parameter#Left srcText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_t... | private static getKindFrom(srcText: string): string | null {
let str: string = AppUtility.getFirstPartFrom(srcText);
const strPoint: string = STR_POINT_HALF;
let kind: string | null = null;
const indexNoFound: number = -1;
str = AppUtility.replaceOmitAndPoint(str);
const index: number = str.las... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L261-L273 | 040caad748bb30e289adc47e5557397b1e797e98 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/Goods.ets | arkts | @param {Partial<Goods>} init - 初始化数据
@returns {void} 无返回值 | constructor(init?: Partial<Goods>) {
if (!init) {
return;
}
this.id = init.id ?? this.id;
this.typeId = init.typeId ?? this.typeId;
this.title = init.title ?? this.title;
this.subTitle = init.subTitle ?? this.subTitle;
this.mainPic = init.mainPic ?? this.mainPic;
this.pics = init.p... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | constructor(init?: Partial<Goods>) {
if (!init) {
return;
}
this.id = init.id ?? this.id;
this.typeId = init.typeId ?? this.typeId;
this.title = init.title ?? this.title;
this.subTitle = init.subTitle ?? this.subTitle;
this.mainPic = init.mainPic ?? this.mainPic;
this.pics = init.p... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Goods.ets#L81-L102 | 619f153e02e44cecccd78ca078041b818a1fe0a5 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.