nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SettingsPage.ets | arkts | buildHeader | 构建页面头部 | @Builder
buildHeader() {
AppHeader({
title: '设置',
showBack: false,
showAction: false
})
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader 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 AppHeader ( AST#component_parameters#Left { AST#component_para... | @Builder
buildHeader() {
AppHeader({
title: '设置',
showBack: false,
showAction: false
})
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L374-L381 | 36b4973929df57284d32db835ba3656e7323c8d8 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets | arkts | loadListData | 加载列表数据
@returns {void} 无返回值 | protected loadListData(): void {
RequestHelper.repository<NetworkPageData<T>>(this.requestListData())
.toast(this.showErrorToast)
.execute()
.then((data: NetworkPageData<T>): void => this.handleSuccess(data))
.catch((err: Error): void => this.handleError(err))
.finally((): void => {
... | AST#method_declaration#Left protected loadListData 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#e... | protected loadListData(): void {
RequestHelper.repository<NetworkPageData<T>>(this.requestListData())
.toast(this.showErrorToast)
.execute()
.then((data: NetworkPageData<T>): void => this.handleSuccess(data))
.catch((err: Error): void => this.handleError(err))
.finally((): void => {
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L74-L83 | 7f2728ab30f1c5f8e4bfe7c570c2498559c73fd3 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/grid/ScrollableGrid.ets | arkts | ScrollableGrid | [Start build_scrollable_horizontally_grid_layouts] | @Entry
@Component
export struct ScrollableGrid {
@State services: Array<string> = ['Live Streaming', 'Imported', 'Categories', 'Recharge',
'Membership', 'Claim Coupon', 'Lottery', 'Favorites', 'Points', 'More'];
build() {
NavDestination() {
Column({ space: 12 }) {
ComponentCard({ title: $r('a... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ScrollableGrid AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right services : AST#type_annotation#Left AST#primary_type... | @Entry
@Component
export struct ScrollableGrid {
@State services: Array<string> = ['Live Streaming', 'Imported', 'Categories', 'Recharge',
'Membership', 'Claim Coupon', 'Lottery', 'Favorites', 'Points', 'More'];
build() {
NavDestination() {
Column({ space: 12 }) {
ComponentCard({ title: $r('a... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/grid/ScrollableGrid.ets#L19-L52 | e8f10743a12c01f2b1014929ae94dcd62e3eea6b | gitee |
Huarrrr/MiShop_HarmonyOS.git | a94d941f50550522c8324416afe4551ed4a2df93 | entry/src/main/ets/net/model/BannerBean.ets | arkts | "_id": "59f6ef443ce1fb0fb02c7a43",
"title": "米家智能空气炸烤箱",
"status": "1",
"pic": "public\\upload\\zon0TTXnXUs1z5meqZhP5aNF.png",
"url": "12",
"position": 1 | export class Banner {
_id: string
title: string
status: number
pic: string
url: string
position: number
} | AST#export_declaration#Left export AST#class_declaration#Left class Banner AST#class_body#Left { AST#property_declaration#Left _id : AST#ERROR#Left string title : string status : number pic : string url : string position : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#... | export class Banner {
_id: string
title: string
status: number
pic: string
url: string
position: number
} | https://github.com/Huarrrr/MiShop_HarmonyOS.git/blob/a94d941f50550522c8324416afe4551ed4a2df93/entry/src/main/ets/net/model/BannerBean.ets#L10-L17 | 6b07facd0335f203635db77dc938db6747ab49a7 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/ChatTools.ets | arkts | getTimeStringAutoShort2 | 仿照微信中的消息时间显示逻辑,将时间戳(单位:毫秒)转换为友好的显示格式.
1)7天之内的日期显示逻辑是:今天、昨天(-1d)、前天(-2d)、星期?(只显示总计7天之内的星期数,即<=-4d);
2)7天之外(即>7天)的逻辑:直接显示完整日期时间。
@param timestamp 时间戳(单位:毫秒),形如:1550789954260
@param mustIncludeTime true表示输出的格式里一定会包含“时间:分钟”
,否则不包含(参考微信,不包含时分的情况,用于首页“消息”中显示时)
@param timeWithSegmentStr 本参数仅在mustIncludeTime=true时有生效,表示在时间字符... | static getTimeStringAutoShort2(timestamp: number, mustIncludeTime: boolean, timeWithSegmentStr: boolean): string {
// 当前时间
let currentDate: Date = new Date();
// 目标判断时间
let srcDate: Date = new Date(timestamp);
let currentYear: number = currentDate.getFullYear();
let currentMonth: number = (curr... | AST#method_declaration#Left static getTimeStringAutoShort2 AST#parameter_list#Left ( AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mustIncludeTime : AST#type_annotation#Left AST#primary_type#... | static getTimeStringAutoShort2(timestamp: number, mustIncludeTime: boolean, timeWithSegmentStr: boolean): string {
let currentDate: Date = new Date();
let srcDate: Date = new Date(timestamp);
let currentYear: number = currentDate.getFullYear();
let currentMonth: number = (currentDate.getMonth... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L153-L245 | 5602a19752016d335c868c8e5cee765ac3f6d09a | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/eventbus/EventBus.ets | arkts | on | 订阅事件 | on(event: string, callback: EventCallback): void {
if (!this.events.has(event)) {
this.events.set(event, []);
}
const callbacks = this.events.get(event);
if (callbacks) {
callbacks.push(callback);
}
Logger.debug('EventBus', `Subscribed to event: ${event}`);
} | AST#method_declaration#Left on AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left EventCallback AST#primary_type#Rig... | on(event: string, callback: EventCallback): void {
if (!this.events.has(event)) {
this.events.set(event, []);
}
const callbacks = this.events.get(event);
if (callbacks) {
callbacks.push(callback);
}
Logger.debug('EventBus', `Subscribed to event: ${event}`);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/eventbus/EventBus.ets#L34-L43 | abf010a7388ec4e3c12cd1008ff17995d2e080f1 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/product/entry/src/main/ets/entryability/EntryAbility.ets | arkts | napi封装ets | export default class EntryAbility extends UIAbility {
// napi封装ets
abilityID: string = generateAbilityID();
private mWindow!: window.Window;
private selectPage: string = '';
private currentWindowStage: window.WindowStage | null = null;
private storage: LocalStorage = new LocalStorage();
onCreate(want: Wa... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // napi封装ets AST#property_declaration#Left abilityID : AST#type_annotation#Left AST#primary_typ... | export default class EntryAbility extends UIAbility {
abilityID: string = generateAbilityID();
private mWindow!: window.Window;
private selectPage: string = '';
private currentWindowStage: window.WindowStage | null = null;
private storage: LocalStorage = new LocalStorage();
onCreate(want: Want, launchPa... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/entryability/EntryAbility.ets#L53-L324 | 84a433788e38ee7a6e667abcf3450ef682b4a3be | gitee | |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | taoyao/src/main/ets/shijing/taoyao/picker/document/DocumentBuilder.ets | arkts | setFileSuffixFilters | 选择文件的后缀类型['后缀类型描述|后缀类型'](可选) 若选择项存在多个后缀名,则每一个后缀名之间用英文逗号进行分隔(可选),后缀类型名不能超过100,选择所有文件:'所有文件(*.*)|.*';
@param fileSuffixFilters 例如:['图片(.png, .jpg)|.png,.jpg', '文档|.txt', '视频|.mp4', '.pdf']
@returns | public setFileSuffixFilters(fileSuffixFilters: Array<string>): DocumentBuilder {
this._fileSuffixFilters = fileSuffixFilters
return this
} | AST#method_declaration#Left public setFileSuffixFilters AST#parameter_list#Left ( AST#parameter#Left fileSuffixFilters : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#R... | public setFileSuffixFilters(fileSuffixFilters: Array<string>): DocumentBuilder {
this._fileSuffixFilters = fileSuffixFilters
return this
} | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/picker/document/DocumentBuilder.ets#L29-L32 | 4400cd87c2098469cbf512059461fb7eb68b1d14 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/src/main/ets/NetworkClient.ets | arkts | getInstance | 获取 NetworkClient 单例 | public static getInstance(): NetworkClient {
if (!NetworkClient.instance) {
NetworkClient.instance = new NetworkClient();
}
return NetworkClient.instance;
} | AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NetworkClient AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expressio... | public static getInstance(): NetworkClient {
if (!NetworkClient.instance) {
NetworkClient.instance = new NetworkClient();
}
return NetworkClient.instance;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/NetworkClient.ets#L33-L38 | 0e71f9194abd1768b545e9783c70e3474c6f3e35 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_key_shortcuts.ets | arkts | get_shortcut | Gets the key_combination of shortcut of a specific action.
@param label A string, the label of the action. e.g. 'show_tabs'.
@returns A key_combination. | get_shortcut(label: string): key_combination | undefined {
let index = this.key_shortcut_labels.indexOf(label);
if (index > -1) {
return this.key_shortcut_combinations[index];
} else {
return undefined;
}
} | AST#method_declaration#Left get_shortcut AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left key_com... | get_shortcut(label: string): key_combination | undefined {
let index = this.key_shortcut_labels.indexOf(label);
if (index > -1) {
return this.key_shortcut_combinations[index];
} else {
return undefined;
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L71-L78 | 26c6c709ad34ad1f957047ef355ada6f43880b57 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/model/RenderNodeModel.ets | arkts | 画笔线宽 | constructor() {
super();
// 设置画笔颜色
const penColor: common2D.Color = {
alpha: 0xFF,
red: 0xFA,
green: 0x64,
blue: 0x00
};
this.pen.setColor(penColor);
// 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑
this.pen.setAntiAlias(true);
// 开启画笔的抖动绘制效果。抖动绘制可以使得绘制出的颜色更加真实。
this.pen.setDith... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST... | constructor() {
super();
const penColor: common2D.Color = {
alpha: 0xFF,
red: 0xFA,
green: 0x64,
blue: 0x00
};
this.pen.setColor(penColor);
this.pen.setAntiAlias(true);
this.pen.setDither(true);
this.pen.setJoinStyle(drawing.JoinStyle.ROUND_JOIN);
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/model/RenderNodeModel.ets#L29-L47 | 59d5e019d105c96e4cea914bf5d6df9675ebc689 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GlobalTypes.ets | arkts | 坐标接口 | export interface Position {
x: number;
y: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Position AST#object_type#Left { AST#type_member#Left x : 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 y : AST#type_annotation#Left AST#primar... | export interface Position {
x: number;
y: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L116-L119 | 3c067ebc21a8246234d789339ba20b33af08403c | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dealstridesolution/src/main/ets/utils/PermissionUtils.ets | arkts | checkPermission | 检查权限
@param context
@param permissions 需要检查的权限 | static async checkPermission(context: common.UIAbilityContext, permissions: Array<Permissions>): Promise<boolean> {
// 获取媒体权限
let permissionResult: PermissionResult =
await PermissionUtils.requestPermission(context, permissions)
switch (permissionResult) {
case PermissionResult.Agree:
//... | AST#method_declaration#Left static async checkPermission AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#L... | static async checkPermission(context: common.UIAbilityContext, permissions: Array<Permissions>): Promise<boolean> {
let permissionResult: PermissionResult =
await PermissionUtils.requestPermission(context, permissions)
switch (permissionResult) {
case PermissionResult.Agree:
re... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/utils/PermissionUtils.ets#L49-L68 | 4744d91379001b7017be96f0c42127538d9fe131 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | BaseItemInfo
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare class BaseItemInfo {
/**
* Uri. if the itemType is CAMERA, it will be null
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
uri?: string;
/**
* MimeType. if the itemType is CAMERA, it... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class BaseItemInfo AST#class_body#Left { /**
* Uri. if the itemType is CAMERA, it will be null
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicser... | export declare class BaseItemInfo {
uri?: string;
mimeType?: string;
width?: number;
height?: number;
size?: number;
duration?: number;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L361-L416 | dfdf44e827983b8221b09a0b9adcaf8c3ec4ec65 | github | |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | time_bar/src/main/ets/components/viewModel/RecordSegment.ets | arkts | set | Start time in ISO 8601. | public set beginTime(value: string) {
this._beginTime = value;
} | AST#method_declaration#Left public set AST#ERROR#Left beg in Time AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : 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#builder_function_body#Left { AS... | public set beginTime(value: string) {
this._beginTime = value;
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/viewModel/RecordSegment.ets#L23-L25 | 865e72c9f83c38eb37c2c854817651f470f7fe19 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/InteractiveGameService.ets | arkts | resumeGame | 恢复游戏 | resumeGame(sessionId: string): boolean {
try {
const session = this.activeSessions.get(sessionId);
if (!session || session.state !== GameState.PAUSED) {
return false;
}
session.state = GameState.PLAYING;
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_... | AST#method_declaration#Left resumeGame AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#... | resumeGame(sessionId: string): boolean {
try {
const session = this.activeSessions.get(sessionId);
if (!session || session.state !== GameState.PAUSED) {
return false;
}
session.state = GameState.PLAYING;
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L335-L349 | 46eb103cce37927801e19dba7d64faf02fde4ee0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecomment/src/main/ets/components/constants/Constants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class Constants {
static readonly ACTION_PICKER_CAMERA: string = "ohos.want.action.imageCapture";
static readonly KEY_RESULT_PICKER_CAMERA: string = "resourceUri";
} | AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly ACTION_PICKER_CAMERA : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "ohos.want.action.imageCap... | export class Constants {
static readonly ACTION_PICKER_CAMERA: string = "ohos.want.action.imageCapture";
static readonly KEY_RESULT_PICKER_CAMERA: string = "resourceUri";
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/constants/Constants.ets#L16-L19 | 722bbbbf49bda1b9e1f7fb7ae5f33a8041542c38 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloader.ets | arkts | getCFileMetaDataFromCos | MARK: - COS文件元数据获取方法 | private getCFileMetaDataFromCos(fname: string, finished: (metaInfo: CMetaInfo | null, error: string | null) => void): void {
// 生成文件名,将文本转为拼音并转换为.mp3格式
const fileName = StringPyHelper.convertUnicodeForPinyin(fname)
// // 存储桶名称,格式为 BucketName-APPID https://console.cloud.tencent.com/cos5/bucket
le... | AST#method_declaration#Left private getCFileMetaDataFromCos AST#parameter_list#Left ( AST#parameter#Left fname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left finished : AST#type_annotation#Left AST#function_type#Left AST#... | private getCFileMetaDataFromCos(fname: string, finished: (metaInfo: CMetaInfo | null, error: string | null) => void): void {
const fileName = StringPyHelper.convertUnicodeForPinyin(fname)
let bucket = CurrentBucket
let cosPath = `${this.filePrefix}${fileName}`
let ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloader.ets#L36-L59 | ff34144f5f2112bc4ca9882710ac0944d0fac77c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | getInstance | 获取单例实例 | static getInstance(): DatabaseService {
if (!DatabaseService.instance) {
DatabaseService.instance = new DatabaseService();
}
return DatabaseService.instance;
} | AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DatabaseService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Lef... | static getInstance(): DatabaseService {
if (!DatabaseService.instance) {
DatabaseService.instance = new DatabaseService();
}
return DatabaseService.instance;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L22-L27 | c48ceb9e9703a81c8e951383d0ec3d9394fa982e | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/DES.ets | arkts | encodeCBC | 加密-CBC模式
@param str 待加密的字符串
@param aesKey 3DES密钥
@param iv iv偏移量字符串
@returns | static async encodeCBC(str: string, desKey: string, iv: string): Promise<string> {
return CryptoUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192);
} | AST#method_declaration#Left static async encodeCBC 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 desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async encodeCBC(str: string, desKey: string, iv: string): Promise<string> {
return CryptoUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DES.ets#L53-L55 | c326e125903acb13d68c07efc5c1438fbd23744d | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/animation/AnimationShake.ets | arkts | 左右旋转式抖动 | export function shakeRotate(options: ShakeRotateOptions): void {
const times = options.times ?? 3
const duration = options.duration ?? 60
const angle = options.angle ?? 5
const setAngle = options.setAngle
let count = 0
let direction = 1
const shakeStep = () => {
if (count >= times * ... | AST#export_declaration#Left export AST#function_declaration#Left function shakeRotate AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ShakeRotateOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annota... | export function shakeRotate(options: ShakeRotateOptions): void {
const times = options.times ?? 3
const duration = options.duration ?? 60
const angle = options.angle ?? 5
const setAngle = options.setAngle
let count = 0
let direction = 1
const shakeStep = () => {
if (count >= times * ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/animation/AnimationShake.ets#L12-L38 | 03e4dedb0378bd99f806da18b88096e64e610c5a | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | toVolumeSetting | 跳转声音和振动设置页面 | static toVolumeSetting(): Promise<void> {
return WantUtil.toSetting(WantUtil.URI_VOLUME);
} | AST#method_declaration#Left static toVolumeSetting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type... | static toVolumeSetting(): Promise<void> {
return WantUtil.toSetting(WantUtil.URI_VOLUME);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L163-L165 | dff2d1c4b4820b042c31254e1a80566e35c9f703 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets | arkts | onVodCurrentDuration | @description 当前播放时长,单位为毫秒(ms),用于刷新进度条长度
@param currentDuration 当前播放时长,单位为毫秒(ms)。 | onVodCurrentDuration(current: number) {
this.currentTime = current;
//定时每秒同步播放进度。用于同步显示实时字幕
if (this.subtitleTimer == 0) {
this.subtitleTimer = setInterval(() => {
let msgData: EmitterMsgData;
msgData = {
type: MsgType.VOD_SUBTITLE_TIME,
data: this.currentTime
... | AST#method_declaration#Left onVodCurrentDuration AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST... | onVodCurrentDuration(current: number) {
this.currentTime = current;
if (this.subtitleTimer == 0) {
this.subtitleTimer = setInterval(() => {
let msgData: EmitterMsgData;
msgData = {
type: MsgType.VOD_SUBTITLE_TIME,
data: this.currentTime
} as EmitterMsgData;... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L399-L412 | 9905f9775101962b7dba283166ce29cf5aecd8e1 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/Rect.ets | arkts | centerY | @return the vertical center of the rectangle. If the computed value
is fractional, this method returns the largest integer that is
less than the computed value. | public centerY(): number {
return (this.top + this.bottom) >> 1;
} | AST#method_declaration#Left public centerY 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#binary_expressio... | public centerY(): number {
return (this.top + this.bottom) >> 1;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L120-L122 | a682b2597db7b1314a819e6242df5b5a0eb4b180 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildBanRemove.ets | arkts | 应用约束61:使用export default代替module.exports | export default GuildBanRemove; | AST#export_declaration#Left export default AST#expression#Left GuildBanRemove AST#expression#Right ; AST#export_declaration#Right | export default GuildBanRemove; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildBanRemove.ets#L21-L21 | d28003f6911b768b0cc7b0ed473c0724be31555f | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/game/GameCenterPage.ets | arkts | buildHeader | 构建头部 | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back();
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader 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#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back();
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/game/GameCenterPage.ets#L67-L103 | 92ebd06acaf95b1c1a6efa16c75c138793a0df48 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/usercontributor/UserContributorNetworkDataSourceImpl.ets | arkts | getUserContributorPage | 获取用户贡献者分页数据
@param {PageRequest} params - 分页参数
@returns {Promise<NetworkResponse<NetworkPageData<UserContributor>>>} 贡献者列表 | async getUserContributorPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<UserContributor>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<UserContributor>>> =
await NetworkClient.http.post("user/contributor/page", params);
return resp.data;
} | AST#method_declaration#Left async getUserContributorPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g... | async getUserContributorPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<UserContributor>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<UserContributor>>> =
await NetworkClient.http.post("user/contributor/page", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/usercontributor/UserContributorNetworkDataSourceImpl.ets#L16-L20 | b80d28e2699a07fab178ea67293b971d001ca8d6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/ContactTypes.ets | arkts | 年龄分布接口 | export interface AgeDistribution {
under18: number;
'18-30': number;
'31-50': number;
over50: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AgeDistribution AST#object_type#Left { AST#type_member#Left under18 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#ERROR#Left '18-30' : number ; '31-50' : num... | export interface AgeDistribution {
under18: number;
'18-30': number;
'31-50': number;
over50: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/ContactTypes.ets#L9-L14 | af7e3844bee910d3a728833eebdd6008e4eb4fb9 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationManagementUtil.ets | arkts | getAllNotifications | 获取当前所有消息及数量 | async getAllNotifications() {
let result: getAllNotificationsResultType = {
groupNotifications: this.typeNotifications,
countsByType: this.countsByType
};
return result;
} | AST#method_declaration#Left async getAllNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left getAllNotificationsResultType AST#primary_type#R... | async getAllNotifications() {
let result: getAllNotificationsResultType = {
groupNotifications: this.typeNotifications,
countsByType: this.countsByType
};
return result;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationManagementUtil.ets#L93-L99 | 84f8c7f536ad4c8efd13b9a95e4ab40888ebddc1 | gitee |
2763981847/Klotski.git | 35bfb313c07e25ea53d2f4e66df0c441dd51675b | entry/src/main/ets/common/util/ImageUtils.ets | arkts | 图片工具类 | export default class ImageUtils {
// 创建一个静态 OffscreenCanvasRenderingContext2D 实例,用于图像处理
private static offC2d = new OffscreenCanvasRenderingContext2D(1000, 1000, {
antialias: true
})
/**
* 等距切割图片
* @param img 原图
* @param rows 要切割的行数
* @param cols 要切割的列数
* @param withIndex 切割后图片是否标记编号
* @r... | AST#export_declaration#Left export default AST#class_declaration#Left class ImageUtils AST#class_body#Left { // 创建一个静态 OffscreenCanvasRenderingContext2D 实例,用于图像处理 AST#property_declaration#Left private static offC2d = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expres... | export default class ImageUtils {
private static offC2d = new OffscreenCanvasRenderingContext2D(1000, 1000, {
antialias: true
})
public static async cutImage(img: image.PixelMap, rows: number, cols: number, withIndex: boolean = true): Promise<CroppedImage[]> {
const imgInfo = await img.getImag... | https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/util/ImageUtils.ets#L7-L65 | cbeb19eb54d1ec95c50bd69c681602d144192b2c | github | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets | arkts | Add1stItem | 增加数据 | public Add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length);
this.notifyDataAdd(0);
} | AST#method_declaration#Left public Add1stItem 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#expres... | public Add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length);
this.notifyDataAdd(0);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets#L86-L89 | f0c7f97e1919811888e3d5ea998b90fee612ac5e | gitee |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/NotificationManager.ets | arkts | sendNotification | 发送通知 | public async sendNotification(event: EventModel): Promise<void> {
return this.sendImmediateNotification(event)
} | AST#method_declaration#Left public async sendNotification AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left EventModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge... | public async sendNotification(event: EventModel): Promise<void> {
return this.sendImmediateNotification(event)
} | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/NotificationManager.ets#L148-L150 | 855ba7685765d63e955f99e77f819e3572e704ae | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets | arkts | get | private db: DBAccessor | null = null; 获取单例 | public static get shared(): WordUserDbAccess {
if (!WordUserDbAccess.instance) {
WordUserDbAccess.instance = new WordUserDbAccess();
}
return WordUserDbAccess.instance;
} | AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WordUserDbAccess AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_... | public static get shared(): WordUserDbAccess {
if (!WordUserDbAccess.instance) {
WordUserDbAccess.instance = new WordUserDbAccess();
}
return WordUserDbAccess.instance;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L60-L65 | 4645db2d1e65316bee400b583208ea2db901f705 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Piece.ets | arkts | equals | MARK: - 等价比较(Equatable)
判断两个Piece对象是否相等
@param other - 另一个Piece对象 | equals(other: Piece): boolean {
return this.pieceNo === other.pieceNo;
} | AST#method_declaration#Left equals AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left Piece AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST... | equals(other: Piece): boolean {
return this.pieceNo === other.pieceNo;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Piece.ets#L75-L77 | acdf06d3d52b5a9d6546e74cabedea47d536de4b | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets | arkts | Generates fake history from a given year to another given year, inclusive.
@param from_year the starting year
@param to_year the ending year
@param quantity quantity of histories
@author Generated by DeepSeek on 17th May, 2025, modified by awa_Liny | export function fill_fake_history(from_year: number, to_year: number, quantity: number): void {
// 生成月份时间戳范围(明确标注返回类型)
const getMonthRanges = (): Array<[number, number]> => {
const ranges: Array<[number, number]> = [];
// 明确循环参数类型
for (let year: number = from_year; year <= to_year; year++) {
cons... | AST#export_declaration#Left export AST#function_declaration#Left function fill_fake_history AST#parameter_list#Left ( AST#parameter#Left from_year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to_year : AST#type_annotati... | export function fill_fake_history(from_year: number, to_year: number, quantity: number): void {
const getMonthRanges = (): Array<[number, number]> => {
const ranges: Array<[number, number]> = [];
for (let year: number = from_year; year <= to_year; year++) {
const maxMonth: number = (year === to... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets#L355-L408 | a6d42e1fbd2b0a58e28e7d0f9f89466d30950228 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | PreHttpRequestUseFiles/entry/src/main/ets/utils/NetRequest.ets | arkts | The image's network address suffix needs to be replaced by the real url. | export async function httpRequest() {
fs.access(fileUrl, fs.AccessModeType.READ).then((res) => { // Check whether files exist
if (!res) { // If the address does not exist in the sandbox, re-request the network image resource
http.createHttp()
// Please fill in a specific network image address here, ... | AST#export_declaration#Left export AST#function_declaration#Left async function httpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp... | export async function httpRequest() {
fs.access(fileUrl, fs.AccessModeType.READ).then((res) => {
if (!res) {
http.createHttp()
.request('https://example.com/xxx.png',
(error: BusinessError, data: http.HttpResponse) => {
if (error) {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PreHttpRequestUseFiles/entry/src/main/ets/utils/NetRequest.ets#L27-L49 | b117d0b7071d4190f4abe18fb0504ab7b868c59b | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | statSync | 获取文件详细属性信息,以同步方法。
@param file string|number 文件应用沙箱路径path或已打开的文件描述符fd。
@returns | static statSync(file: string | number): fs.Stat {
return fs.statSync(file);
} | AST#method_declaration#Left static statSync AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#... | static statSync(file: string | number): fs.Stat {
return fs.statSync(file);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L573-L575 | f5a0b4f60258b70816f79ce0d0a14ae113d74e53 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/UserConnection.ets | arkts | 应用约束60: 使用ES模块导出语法 | export default UserConnection; | AST#export_declaration#Left export default AST#expression#Left UserConnection AST#expression#Right ; AST#export_declaration#Right | export default UserConnection; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/UserConnection.ets#L40-L40 | 5a9802e5306fffb990abff8844422b153d754302 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | getParentUri | 通过URI或路径,获取对应文件父目录的URI。
@param uriOrPath URI或路径 | static getParentUri(uriOrPath: string): string {
return Helper.getFileUri(uriOrPath).getFullDirectoryUri();
} | AST#method_declaration#Left static getParentUri AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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#prima... | static getParentUri(uriOrPath: string): string {
return Helper.getFileUri(uriOrPath).getFullDirectoryUri();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L276-L278 | 9d9bac015b86b27332ec197ebdfbe710996ee41b | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/model/DailySummary.ets | arkts | DailySummary insert data | export interface DailySummaryData {
date: string;
summary: string;
key_topics: string;
tasks_created: number;
memos_created: number;
mood_trend: string;
timestamp: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DailySummaryData AST#object_type#Left { AST#type_member#Left date : 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 summary : AST#type_annotatio... | export interface DailySummaryData {
date: string;
summary: string;
key_topics: string;
tasks_created: number;
memos_created: number;
mood_trend: string;
timestamp: number;
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/DailySummary.ets#L25-L33 | b4cbeb947e4a733ee6efa3b3b56fbd9204c25fab | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets | arkts | 评论的数据结构 | export class NewsCommentModel {
// 评论id
public id: string;
// 评论头像
public url: ResourceStr;
// 评论昵称
public user: string;
// 回复id
public replyId: string;
// 回复用户昵称
public replyUser: string;
// 回复文本
public text: string;
// 回复时间
public commentTime: Date;
// 评论下的回复列表
public replyList: NewsCo... | AST#export_declaration#Left export AST#class_declaration#Left class NewsCommentModel AST#class_body#Left { // 评论id AST#property_declaration#Left public id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 评论头像 AST#property_declar... | export class NewsCommentModel {
public id: string;
public url: ResourceStr;
public user: string;
public replyId: string;
public replyUser: string;
public text: string;
public commentTime: Date;
public replyList: NewsCommentData;
constructor(id: string, url: ResourceStr, user: ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets#L19-L47 | 0d870789b48a67840c180e34a6d9ead32b8f4aae | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | 继承自BasicDataSource的子类,重写了方法。
@class
@extends {BasicDataSource} | export class MyDataSource extends BasicDataSource {
public dataArray: CustomDataType[] = Array<CustomDataType>();
/**
* 获取数组长度。
* @returns {number} 返回数组长度。
*/
public totalCount(): double {
return this.dataArray.length;
}
/**
* 获取指定索引数据。
* @param {number} index - 索引值。
* @returns {Custo... | AST#export_declaration#Left export AST#class_declaration#Left class MyDataSource extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left public dataArray : AST#type_annotation#Left AST#primary_type#Left A... | export class MyDataSource extends BasicDataSource {
public dataArray: CustomDataType[] = Array<CustomDataType>();
public totalCount(): double {
return this.dataArray.length;
}
public getData(index: double): CustomDataType {
return this.dataArray[index];
}
public addData(index: double, d... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L152-L194 | 1bd8d012a3eea754060c3f78fbc9d7a2ba4dfcec | gitee | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | getLogService | 获取日志服务实例 | getLogService(): LogService {
return this.logService;
} | AST#method_declaration#Left getLogService AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LogService AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres... | getLogService(): LogService {
return this.logService;
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L726-L728 | 0cd1d7be6e0dcb537619f27f94c4ea0571b06c7b | github |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | src/main/ets/model/TaskTimeRange.ets | arkts | updatePriority | 更新优先级 | updatePriority(newPriority: number): void {
this.priority = newPriority;
} | AST#method_declaration#Left updatePriority AST#parameter_list#Left ( AST#parameter#Left newPriority : 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_ty... | updatePriority(newPriority: number): void {
this.priority = newPriority;
} | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/model/TaskTimeRange.ets#L35-L37 | 130a0e7b4ea35467c8b51659311fde5cfd54da8a | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | buildCommonModifier | 构建通用属性修饰器
@returns {AttributeModifier<RowAttribute>} Row 属性修饰器 | private buildCommonModifier(): AttributeModifier<RowAttribute> {
const size = this.sizeValue;
const fillMaxSize = this.fillMaxSize;
const width = this.widthValue;
const height = this.heightValue;
const padding = this.paddingValue;
const margin = this.marginValue;
const backgroundColor = this... | AST#method_declaration#Left private buildCommonModifier AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#primary_type#Right AST#type_anno... | private buildCommonModifier(): AttributeModifier<RowAttribute> {
const size = this.sizeValue;
const fillMaxSize = this.fillMaxSize;
const width = this.widthValue;
const height = this.heightValue;
const padding = this.paddingValue;
const margin = this.marginValue;
const backgroundColor = this... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L95-L139 | 40c07b5aa1f3ca2c10c58bc0c31f53caebafbdc4 | github |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/model/ImageEditModel.ets | arkts | RGB颜色定义,因为实际使用没用到透明度分量,这里忽略掉透明度定义 | export interface RgbColor {
/** 红色分量,范围为 0-255 */
red: number;
/** 绿色分量,范围为 0-255 */
green: number;
/** 蓝色分量,范围为 0-255 */
blue: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RgbColor AST#object_type#Left { /** 红色分量,范围为 0-255 */ AST#type_member#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** 绿色分量,范围为 0-255 */ AST#type_membe... | export interface RgbColor {
red: number;
green: number;
blue: number;
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/model/ImageEditModel.ets#L158-L167 | 20e572229f8be3d8463781cefad5ed997045fbd4 | gitee | |
ikunbranch666-auto/SimpleCalculator.git | ea24568014d05285ad3def5b741380294308aef2 | entry/src/main/ets/model/ImageList.ets | arkts | 垂直方向的按钮(左侧数字和清除按钮 - 前3列) | export function obtainImgVertical(): ImageList[] {
return [
{
image: '',
value: '0' // 第1行第1列
},
{
image: '',
value: 'C' // 第1行第2列
},
{
image: '',
value: 'D' // 第1行第3列
},
{
image: '',
value: '1' // 第2行第1列
},
{
image: '',
... | AST#export_declaration#Left export AST#function_declaration#Left function obtainImgVertical AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ImageList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Le... | export function obtainImgVertical(): ImageList[] {
return [
{
image: '',
value: '0'
},
{
image: '',
value: 'C'
},
{
image: '',
value: 'D'
},
{
image: '',
value: '1'
},
{
image: '',
value: '2'
},
{
i... | https://github.com/ikunbranch666-auto/SimpleCalculator.git/blob/ea24568014d05285ad3def5b741380294308aef2/entry/src/main/ets/model/ImageList.ets#L62-L113 | 44d13d68e7040ac6019974c5f12a563b9e23b189 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets | arkts | topButtonLine | 画笔可选择的线宽列表 顶部撤销、恢复按钮模块 | @Builder
topButtonLine() {
Row() {
Image($r('app.media.eraser_undo'))
.fillColor(this.undoEnabled ? $r('app.color.eraser_top_button_enabled_color') :
$r('app.color.eraser_top_button_disabled_color'))
.width($r('app.integer.eraser_top_button_size'))
.height($r('app.integer.era... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right topButtonLine 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#arkts_ui_eleme... | @Builder
topButtonLine() {
Row() {
Image($r('app.media.eraser_undo'))
.fillColor(this.undoEnabled ? $r('app.color.eraser_top_button_enabled_color') :
$r('app.color.eraser_top_button_disabled_color'))
.width($r('app.integer.eraser_top_button_size'))
.height($r('app.integer.era... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets#L57-L90 | 548d3992ece253cb4f519bc8a72edc754938bc1e | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | releaseCamera | 释放会话及其相关参数 | async releaseCamera(): Promise<void> {
Logger.info(TAG, 'releaseCamera is called');
try {
await this.previewOutput?.release();
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `previewOutput release fail: error: ${JSON.stringify(err)}`);
} finally {
this.prev... | AST#method_declaration#Left async releaseCamera AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async releaseCamera(): Promise<void> {
Logger.info(TAG, 'releaseCamera is called');
try {
await this.previewOutput?.release();
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `previewOutput release fail: error: ${JSON.stringify(err)}`);
} finally {
this.prev... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L328-L381 | 42210375e09ad4f432dd0d1d88c74e573221eae0 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List_HDC/entry/src/main/ets/view/CustomDialogView.ets | arkts | CustomDialogView | 弹窗 | @Component
export struct CustomDialogView {
@State isShow: boolean = false;
@Provide achievementLevel: number = 3;
@Consume broadCast: BroadCast;
//目标设置
targetSettingDialog = new CustomDialogController({
builder: TargetSettingDialog(),
autoCancel: true,
alignment: DialogAlignment.Bottom,
offs... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomDialogView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_a... | @Component
export struct CustomDialogView {
@State isShow: boolean = false;
@Provide achievementLevel: number = 3;
@Consume broadCast: BroadCast;
targetSettingDialog = new CustomDialogController({
builder: TargetSettingDialog(),
autoCancel: true,
alignment: DialogAlignment.Bottom,
offset: { ... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/view/CustomDialogView.ets#L21-L74 | a92b412a94cc4f61a66ca4aacd3d6a63b5e94212 | gitee |
CongDuang/PlayHarmony.git | 674a0459e1b20db9de8c837dff6a8d1f06330e79 | entry/src/main/ets/widgets/ArticleListView.ets | arkts | getArticleListData | 获取项目列表数据
@param page | private async getArticleListData(page: number): Promise<boolean> {
let topArticleList: ArticleModel[] = [];
if (!this.category) {
if (page === 0) {
const topArticleResp = await HttpUtil.getInstance().get<ArticleModel[], undefined>('/article/top/json')
if (topArticleResp.errorCode === ErroC... | AST#method_declaration#Left private async getArticleListData AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene... | private async getArticleListData(page: number): Promise<boolean> {
let topArticleList: ArticleModel[] = [];
if (!this.category) {
if (page === 0) {
const topArticleResp = await HttpUtil.getInstance().get<ArticleModel[], undefined>('/article/top/json')
if (topArticleResp.errorCode === ErroC... | https://github.com/CongDuang/PlayHarmony.git/blob/674a0459e1b20db9de8c837dff6a8d1f06330e79/entry/src/main/ets/widgets/ArticleListView.ets#L27-L60 | d1bdf56279ca9f7bfe91ecab3df9ab9c806c3872 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | 常量数据 | export enum ComponentStyle {
ITEM_GUTTER = 12,
TAG_TEXT_HEIGHT= 75,
SUB_ITEM_GUTTER= 7,
SUB_ITEM_HEIGHT= 96,
SUB_ITEM_TEXT_WIDTH_TITLE= 56,
SUB_ITEM_TEXT_HEIGHT= 12,
SUB_ITEM_TEXT_WIDTH_BODY= 120,
BOTTOM_TOAST_TEXT_MAX_HEIGHT= 200
}; | AST#export_declaration#Left export AST#enum_declaration#Left enum ComponentStyle AST#enum_body#Left { AST#enum_member#Left ITEM_GUTTER = AST#expression#Left 12 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left TAG_TEXT_HEIGHT = AST#expression#Left 75 AST#expression#Right AST#enum_member#Right , AST#enum... | export enum ComponentStyle {
ITEM_GUTTER = 12,
TAG_TEXT_HEIGHT= 75,
SUB_ITEM_GUTTER= 7,
SUB_ITEM_HEIGHT= 96,
SUB_ITEM_TEXT_WIDTH_TITLE= 56,
SUB_ITEM_TEXT_HEIGHT= 12,
SUB_ITEM_TEXT_WIDTH_BODY= 120,
BOTTOM_TOAST_TEXT_MAX_HEIGHT= 200
}; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L197-L206 | 7700da92f1a287e642a43567e51dfc8563f2a39d | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/DatePickerDialogView.ets | arkts | initPickerData | 初始化选择器参数 | initPickerData() {
this.dateType = this.options.dateType;
this.selectDate = this.options.selected ?? new Date();
this.startDate = this.options.start ?? new Date('1900-01-01 00:00:00');
this.endDate = this.options.end ?? new Date('2199-12-31 23:59:59');
if (this.startDate.getTime() > this.endDate.get... | AST#method_declaration#Left initPickerData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dateType AST#member_expression#Righ... | initPickerData() {
this.dateType = this.options.dateType;
this.selectDate = this.options.selected ?? new Date();
this.startDate = this.options.start ?? new Date('1900-01-01 00:00:00');
this.endDate = this.options.end ?? new Date('2199-12-31 23:59:59');
if (this.startDate.getTime() > this.endDate.get... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/DatePickerDialogView.ets#L53-L85 | 6759c57922fa17e91e2ae2c5d18f51051d808b6e | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Wave/WaveView.ets | arkts | cancelAnimationFrame | 取消动画帧
@param id - 定时器ID | private cancelAnimationFrame(id: number) {
clearTimeout(id); // 清除定时器
} | AST#method_declaration#Left private cancelAnimationFrame AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statem... | private cancelAnimationFrame(id: number) {
clearTimeout(id);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Wave/WaveView.ets#L122-L124 | 4e6510b6e1489923558e3307b79d2290a89e3b56 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/DateUtil.ets | arkts | strDateDiff | 计算两个字符串日期的差单位为天
@param startDateStr 开始日期字符串
@param endDateStr 结束日期字符串
@returns | static strDateDiff(startDateStr: string, endDateStr: string): number {
let startDate = new Date(startDateStr);
let endDate = new Date(endDateStr);
const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
const difference = Math.floor((endDate.getTime() - startDate.getTime()) / oneDay); // 计算差值天数
return differe... | AST#method_declaration#Left static strDateDiff AST#parameter_list#Left ( AST#parameter#Left startDateStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endDateStr : AST#type_annotation#Left AST#primary_type#Left string AS... | static strDateDiff(startDateStr: string, endDateStr: string): number {
let startDate = new Date(startDateStr);
let endDate = new Date(endDateStr);
const oneDay = 24 * 60 * 60 * 1000;
const difference = Math.floor((endDate.getTime() - startDate.getTime()) / oneDay);
return difference;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/DateUtil.ets#L107-L113 | ffa0f7fe6bf6b196080583055a8f75b909659b8b | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/ChaptersDataSource.ets | arkts | reloadNewData | 重新加载 | public reloadNewData(data: chaptersItem[]): void {
this.dataArray = []
for (const d of data) {
this.dataArray.push(d);
this.notifyDataAdd(this.dataArray.length - 1);
}
this.notifyDataReload()
} | AST#method_declaration#Left public reloadNewData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left chaptersItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat... | public reloadNewData(data: chaptersItem[]): void {
this.dataArray = []
for (const d of data) {
this.dataArray.push(d);
this.notifyDataAdd(this.dataArray.length - 1);
}
this.notifyDataReload()
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/ChaptersDataSource.ets#L43-L50 | 7a91d4e8db2ccb4ca07d37d8773468a5a794e16c | github |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/utils/GestureUtils.ets | arkts | updateGestureState | 更新手势状态
@param state - 当前手势状态
@param currentX - 当前X坐标
@param currentY - 当前Y坐标
@returns 更新后的手势状态 | static updateGestureState(
state: GestureState,
currentX: number,
currentY: number
): GestureState {
return {
startX: state.startX,
startY: state.startY,
currentX: currentX,
currentY: currentY,
deltaX: currentX - state.startX,
deltaY: currentY - state.startY,
... | AST#method_declaration#Left static updateGestureState AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left GestureState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left currentX : AST#type_annotation#Left AST#primary_type#Left numbe... | static updateGestureState(
state: GestureState,
currentX: number,
currentY: number
): GestureState {
return {
startX: state.startX,
startY: state.startY,
currentX: currentX,
currentY: currentY,
deltaX: currentX - state.startX,
deltaY: currentY - state.startY,
... | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L48-L63 | 07e8f0ab60207a70a4693006b0f9a7f04bb6cb08 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | decryptGCMSegmentSync | 解密(GCM模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|GCM|PKCS7、AES192|GCM|PKCS7、AES128|GCM|PKCS7)。
@param len 自定义的数据拆分长度。
@returns | static decryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7',
len: number = 128): cryptoFramework.DataBlob {
let decoder = cryptoFramework.createCipher(transformation);
decoder.initS... | AST#method_declaration#Left static decryptGCMSegmentSync 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... | static decryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7',
len: number = 128): cryptoFramework.DataBlob {
let decoder = cryptoFramework.createCipher(transformation);
decoder.initS... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L358-L377 | 622123dfacafb0fdd789d5d07da8978b3c918493 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BubbleDataSet.ets | arkts | isNormalizeSizeEnabled | @Override | public isNormalizeSizeEnabled(): boolean {
return this.mNormalizeSize;
} | AST#method_declaration#Left public isNormalizeSizeEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#... | public isNormalizeSizeEnabled(): boolean {
return this.mNormalizeSize;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BubbleDataSet.ets#L76-L78 | 687f69e98f332aacd3c9579e562cac1d02dbac26 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeBanner.ets | arkts | 构建轮播图视图
@returns {void} 无返回值 | build(): void {
Column() {
if (this.bannerList && this.bannerList.length > 0) {
Swiper() {
ForEach(this.bannerList, (item: Banner) => {
Image(item.pic)
.width(P100)
.borderRadius($r("app.float.radius_medium"))
.objectFit(ImageFit.Contain)... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_... | build(): void {
Column() {
if (this.bannerList && this.bannerList.length > 0) {
Swiper() {
ForEach(this.bannerList, (item: Banner) => {
Image(item.pic)
.width(P100)
.borderRadius($r("app.float.radius_medium"))
.objectFit(ImageFit.Contain)... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeBanner.ets#L32-L59 | fa738e0a17ee2fbc23cefb1164e54b8bf0f7c70a | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets | arkts | verify2048PKCS1 | 2048位验签-PKCS1
@param signStr 已签名的字符串
@param verifyStr 需要验签的字符串
@param pubKey 2048位RSA公钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@param isPem 秘钥是否为pem格式 - 默认为false
@returns 验签结果OutDTO对象,其中Msg为验签结果 | static verify2048PKCS1(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> {
return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048, keyCoding,
... | AST#method_declaration#Left static verify2048PKCS1 AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#... | static verify2048PKCS1(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> {
return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048, keyCoding,
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L194-L198 | 5361c7f3b6f4dc3900a778f213d51454e41f73f1 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/OrderRepository.ets | arkts | confirmReceive | 确认收货
@param orderId 订单 ID
@returns 是否成功 | async confirmReceive(orderId: number): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.confirmReceive(orderId);
} | AST#method_declaration#Left async confirmReceive AST#parameter_list#Left ( AST#parameter#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#... | async confirmReceive(orderId: number): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.confirmReceive(orderId);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L118-L120 | 8ecdd46f5d7761ef3bcc09ae1b1129fb3b0e9a9c | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets | arkts | getCorrectCount | 获取全部正确数量
@returns | public getCorrectCount(): number {
return this.examDetails.filter(item => item.isCorrect === true).length;
} | AST#method_declaration#Left public getCorrectCount 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_e... | public getCorrectCount(): number {
return this.examDetails.filter(item => item.isCorrect === true).length;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L204-L206 | 9f3fcc9af64d361cf86506bbe5e1b64520e25c0d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagetheft/src/main/ets/view/ImageTheft.ets | arkts | sendRequest | 发送请求
@param url 图片url
@param ref 图片来源 | sendRequest(url: string, ref: string): void {
const imageKnife: ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife();
if (imageKnife !== undefined) {
imageKnife.removeAllMemoryCache() // 清理全部缓存
imageKnife.removeAllFileCache() // 清理全部缓存
// TODO: 知识点:自定义RequestOption来获取image图片... | AST#method_declaration#Left sendRequest 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 ref : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AS... | sendRequest(url: string, ref: string): void {
const imageKnife: ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife();
if (imageKnife !== undefined) {
imageKnife.removeAllMemoryCache()
imageKnife.removeAllFileCache()
const request: RequestOption = new RequestOption()... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagetheft/src/main/ets/view/ImageTheft.ets#L149-L194 | 09810a356e0b4425874a1e9cc1f3e50f67754e20 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets | arkts | pushData | 添加数据
@param {PanelDataType} data - 需要添加的数据 | public pushData(data: PanelDataType | PanelDataType[]): void {
if (Array.isArray(data)) {
this.dataArray.push(...data);
} else {
this.dataArray.push(data);
}
this.notifyDataAdd(this.dataArray.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PanelDataType AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left PanelDataType [ ] AST#array_type#Right AST#primary_type#Right AST#union_type... | public pushData(data: PanelDataType | PanelDataType[]): void {
if (Array.isArray(data)) {
this.dataArray.push(...data);
} else {
this.dataArray.push(data);
}
this.notifyDataAdd(this.dataArray.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L222-L229 | 9ec7339519562bfa2fb86f83230da708952ebc71 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/common/CommonNavigator.ets | arkts | toWeb | 跳转到 WebView 页面
@param {string} url - 页面 URL
@param {string} [title] - 页面标题
@returns {void} 无返回值 | static toWeb(url: string, title?: string): void {
const params: CommonWebParam = {
url: url,
title: title
};
navigateTo(CommonRoutes.Web, params);
} | AST#method_declaration#Left static toWeb 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 title ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | static toWeb(url: string, title?: string): void {
const params: CommonWebParam = {
url: url,
title: title
};
navigateTo(CommonRoutes.Web, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonNavigator.ets#L56-L62 | 3ed0b7e56def995f35e224190c4ba16417bbb0f4 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/resource_tools.ets | arkts | Analyses a ResourceStr and converts it to a string object.
@param resourceStr A Resource, indicating the identifier of the ResourceStr.
@returns A string, the string content retrieved.
@example resource_to_string($r('app.string.Whats_new_content_1')) | export function resource_to_string(resourceStr: Resource, context?: Context) {
try {
if (context) {
return context.resourceManager.getStringSync(resourceStr.id);
}
return meowContext().resourceManager.getStringSync(resourceStr.id);
// TODO: replace deprecated getStringSync when api20 is eventu... | AST#export_declaration#Left export AST#function_declaration#Left function resource_to_string AST#parameter_list#Left ( AST#parameter#Left resourceStr : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context ? : AST#type_a... | export function resource_to_string(resourceStr: Resource, context?: Context) {
try {
if (context) {
return context.resourceManager.getStringSync(resourceStr.id);
}
return meowContext().resourceManager.getStringSync(resourceStr.id);
} catch (error) {
console.error('[resource_to_string] '... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/resource_tools.ets#L9-L20 | 69ffd56e4e75120f3812f2ad010d9480c0bd14ce | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/CourseModel.ets | arkts | Course Model | 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/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/CourseModel.ets#L19-L19 | 3079c3869d5b85a7659f763401e5367eeca3d803 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/ApplicationModels/Launcher/recents/index.ets | arkts | RecentsLayout | Copyright (c) 2022 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 { RecentsLayout } from './src/main/ets/default/layout/RecentsLayout' | AST#export_declaration#Left export { RecentsLayout } from './src/main/ets/default/layout/RecentsLayout' AST#export_declaration#Right | export { RecentsLayout } from './src/main/ets/default/layout/RecentsLayout' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/recents/index.ets#L16-L16 | 73c154d4c5b319bcdd2667527ba3267492627a7b | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/QuizManager.ets | arkts | 自定义单词列表(用于自定义测验) | private constructor() {
} | AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right | private constructor() {
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/QuizManager.ets#L116-L117 | 1736a9bfe3291d2cd498e90dcc48647c3bc1e733 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets | arkts | sendData | 发送数据
@param data | async sendData(data: string): Promise<void> {
if (!this.tlsSocket) {
return;
}
Logger.info(`${TAG} tls sendData data ${JSON.stringify(data)}`);
try {
await this.tlsSocket.send(data);
} catch (e) {
Logger.error(`${TAG} tls sendData error ${JSON.stringify(e)}}`);
}
} | AST#method_declaration#Left async sendData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom... | async sendData(data: string): Promise<void> {
if (!this.tlsSocket) {
return;
}
Logger.info(`${TAG} tls sendData data ${JSON.stringify(data)}`);
try {
await this.tlsSocket.send(data);
} catch (e) {
Logger.error(`${TAG} tls sendData error ${JSON.stringify(e)}}`);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets#L183-L193 | 8dcd5b6d7e60686ef26d36eef6f45076c7d0cba7 | gitee |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/models/TaskModel.ets | arkts | loadData | 当前正在运行的计时器值 初始化数据(从持久化存储加载) | static async loadData(context: Context): Promise<void> {
await DataStorage.init(context);
AppState.tasks = await DataStorage.loadTasks();
AppState.completedTasks = await DataStorage.loadCompletedTasks();
} | AST#method_declaration#Left static async loadData 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_typ... | static async loadData(context: Context): Promise<void> {
await DataStorage.init(context);
AppState.tasks = await DataStorage.loadTasks();
AppState.completedTasks = await DataStorage.loadCompletedTasks();
} | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L130-L134 | 2545393276bb999be64fddb2eab214e62e048be2 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ImageUtil.ets | arkts | createIncrementalSource | 以增量的方式创建图片源实例
@param buf ArrayBuffer 增量数据
@param options SourceOptions 图片属性,包括图片像素密度、像素格式和图片尺寸。
sourceDensity number ImageSource的密度。
sourcePixelFormat PixelMapFormat 图片像素格式。
sourceSize Size 图像像素大小。
@returns | static createIncrementalSource(buf: ArrayBuffer, options?: image.SourceOptions): image.ImageSource {
if (options) {
return image.CreateIncrementalSource(buf, options);
} else {
return image.CreateIncrementalSource(buf);
}
} | AST#method_declaration#Left static createIncrementalSource AST#parameter_list#Left ( AST#parameter#Left buf : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AS... | static createIncrementalSource(buf: ArrayBuffer, options?: image.SourceOptions): image.ImageSource {
if (options) {
return image.CreateIncrementalSource(buf, options);
} else {
return image.CreateIncrementalSource(buf);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L165-L171 | 44088b62bca0c7f7146a0322f027d2018d01e220 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | getAllData | 获取全部数据函数 | public getAllData(): IChatMessage[] {
return this.originDataArray;
} | AST#method_declaration#Left public getAllData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IChatMessage [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statemen... | public getAllData(): IChatMessage[] {
return this.originDataArray;
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L58-L60 | a626e498b6a8b796e17c795483101a1fcae3ddd2 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/ContactService.ets | arkts | 联系人服务 - 管理所有联系人相关的业务逻辑 | export class ContactService {
private static instance: ContactService;
private contacts: Contact[] = [];
private databaseService = DatabaseService.getInstance();
private mappingService = LunarSolarMappingService.getInstance();
private constructor() {
this.initializeMockData();
// 生产模式:测试数据方法为空实现
... | AST#export_declaration#Left export AST#class_declaration#Left class ContactService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left ContactService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_de... | export class ContactService {
private static instance: ContactService;
private contacts: Contact[] = [];
private databaseService = DatabaseService.getInstance();
private mappingService = LunarSolarMappingService.getInstance();
private constructor() {
this.initializeMockData();
this.addTestContac... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService.ets#L70-L430 | e71fe5e1f4558211eae196bf4d7d57b241e02eb6 | github | |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/DataManager.ets | arkts | 数据存储管理类 | export class DataManager {
private static instance: DataManager
private preferences: preferences.Preferences | null = null
private readonly STORE_NAME = 'CalendarData'
private readonly EVENTS_KEY = 'events'
private constructor() {}
static getInstance(): DataManager {
if (!DataManager.instance) {
... | AST#export_declaration#Left export AST#class_declaration#Left class DataManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left DataManager AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declarati... | export class DataManager {
private static instance: DataManager
private preferences: preferences.Preferences | null = null
private readonly STORE_NAME = 'CalendarData'
private readonly EVENTS_KEY = 'events'
private constructor() {}
static getInstance(): DataManager {
if (!DataManager.instance) {
... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/DataManager.ets#L5-L143 | c70b91e26b4b673ad77e73f117304f2e36481184 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/PlayerSettingBuilder.ets | arkts | 操作项信息 | export interface ActionItem {
id: string;
title: string | Resource;
subTitle: string | Resource;
switchType : boolean;
enable : boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ActionItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST... | export interface ActionItem {
id: string;
title: string | Resource;
subTitle: string | Resource;
switchType : boolean;
enable : boolean;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/PlayerSettingBuilder.ets#L16-L22 | 3954d929b2845feda8ddebd7f95f1a4168b7f08b | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets | arkts | setLabelRotationAngle | sets the angle for drawing the X axis labels (in degrees)
@param angle the angle in degrees | public setLabelRotationAngle(angle: XAxisPosition): void {
this.mLabelRotationAngle = angle;
} | AST#method_declaration#Left public setLabelRotationAngle AST#parameter_list#Left ( AST#parameter#Left angle : AST#type_annotation#Left AST#primary_type#Left XAxisPosition AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void... | public setLabelRotationAngle(angle: XAxisPosition): void {
this.mLabelRotationAngle = angle;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L102-L104 | e05eb3537291607b111fa0be677dde51f25cfc12 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/doc/VHDocPageComponent.ets | arkts | onDocAdd | @description 添加文档或创建文档成功
@param id 文档id
@param type 文档类型 | onDocAdd(id: string, type: VHDocType,createData: string) {
if(this.webinars.webinar?.type == 5){
let add:boolean = true;
for (let index = 0; index < this.documentViews.length; index++) {
const element = this.documentViews[index]
//回放与直播逻辑存在差异。当同一个文档已经存在不需重复加入载入docview。
if (elemen... | AST#method_declaration#Left onDocAdd 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 type : AST#type_annotation#Left AST#primary_type#Left VHDocType AST#primary_type#Right AS... | onDocAdd(id: string, type: VHDocType,createData: string) {
if(this.webinars.webinar?.type == 5){
let add:boolean = true;
for (let index = 0; index < this.documentViews.length; index++) {
const element = this.documentViews[index]
if (element == id) {
add = false;
... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/doc/VHDocPageComponent.ets#L44-L72 | 5016b948eed6963552600a2bf13f319a813bca34 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/eventbus/EventBus.ets | arkts | clear | 清空所有事件 | clear(): void {
this.events.clear();
} | AST#method_declaration#Left clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AS... | clear(): void {
this.events.clear();
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/eventbus/EventBus.ets#L98-L100 | d6dea4cdeac7ab5d4978a64e4339af19e697d247 | github |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/pages/LoginPage.ets | arkts | blueTextStyle | 为 Text 组件扩展蓝色文本样式。
定义了字体颜色、大小和粗细。 | @Extend(Text)
function blueTextStyle() {
.fontColor($r('app.color.login_blue_text_color')) // 设置字体颜色为蓝色
.fontSize($r('app.float.small_text_size')) // 设置字体大小
.fontWeight(FontWeight.Medium) // 设置字体粗细为中等
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function blueTextStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#r... | @Extend(Text)
function blueTextStyle() {
.fontColor($r('app.color.login_blue_text_color'))
.fontSize($r('app.float.small_text_size'))
.fontWeight(FontWeight.Medium)
} | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/pages/LoginPage.ets#L203-L208 | e5be8ab33a1af6742fe0c2911719863135b7ca55 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeComponent.ets | arkts | AddressExchangeComponent | 功能描述:
1. 点击中间的交换图标,左右两侧的地址可以交换,图标也会进行旋转,伴随着动画效果
实现原理:
1. 点击交换图标,通过animateTo修改偏移量的值和图标的旋转角度,完成动画效果
@param { () => void } exchangeIconBuilderParam - 交换图标模块
@param { () => void } leftAddressBuilderParam - 左侧地址模块
@param { () => void } rightAddressBuilderParam - 右侧地址模块
@param { AnimateParam } translateAnimationParam - 地址交... | @Component
export struct AddressExchangeComponent {
// -------------------对外暴露变量-----------------------
// 交换图标模块
@BuilderParam exchangeIconBuilderParam: () => void = this.exchangeIconBuilder;
// 左侧地址模块
@BuilderParam leftAddressBuilderParam: () => void = this.leftAddressBuilder;
// 右侧地址模块
@BuilderParam ri... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AddressExchangeComponent AST#component_body#Left { // -------------------对外暴露变量----------------------- // 交换图标模块 AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right exchangeIconBuilderP... | @Component
export struct AddressExchangeComponent {
@BuilderParam exchangeIconBuilderParam: () => void = this.exchangeIconBuilder;
@BuilderParam leftAddressBuilderParam: () => void = this.leftAddressBuilder;
@BuilderParam rightAddressBuilderParam: () => void = this.rightAddressBuilder;
@State tra... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeComponent.ets#L33-L108 | c5947e47f41ad891796ed2bb9d91a8d6699e395a | gitee |
mhtcgr/ToDoList_For_Harmony.git | 356d4c9a507205f02870e970203022a380c8a2a1 | entry/src/main/ets/model/model.ets | arkts | initializePreferences | 初始化获取 Preferences 实例 | async initializePreferences() {
try {
preference = await preferences.getPreferences(context, 'todo_data');
await this.loadTodos(); // 初始化时加载所有待办事项
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to initialize preferences, Cause: ${err}`);
}
} | AST#method_declaration#Left async initializePreferences AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left preference ... | async initializePreferences() {
try {
preference = await preferences.getPreferences(context, 'todo_data');
await this.loadTodos();
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to initialize preferences, Cause: ${err}`);
}
} | https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/model.ets#L19-L26 | 87a445e8d8af446aa60600686da5c16906195b0b | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets | arkts | 使用 @ObservedV2 和 @Trace 装饰器进行状态管理[6,7](@ref) | export class VersionChecker {
// 单例实例
private static instance: VersionChecker = new VersionChecker();
// UserDefaults 键名
private versionListKey: string = "VersionHistory";
private maxRecordCount: number = 5;
private defaultVersion: string = "0.0.0";
// 当前版本信息[4](@ref)
private _oldVersion: string = thi... | AST#export_declaration#Left export AST#class_declaration#Left class VersionChecker AST#class_body#Left { // 单例实例 AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left VersionChecker AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expressio... | export class VersionChecker {
private static instance: VersionChecker = new VersionChecker();
private versionListKey: string = "VersionHistory";
private maxRecordCount: number = 5;
private defaultVersion: string = "0.0.0";
private _oldVersion: string = this.defaultVersion;
private _newVersion: st... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets#L9-L130 | c3c062018c8e581bf70acde233ad28127410bff0 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | setWindowGrayScale | 设置窗口灰阶,使用Promise异步回调。该接口需要在调用loadContent()或setUIContent()使窗口加载页面内容后调用。
@param grayScale 窗口灰阶。该参数为浮点数,取值范围为[0.0, 1.0]。0.0表示窗口图像无变化,1.0表示窗口图像完全转为灰度图像,0.0至1.0之间时效果呈线性变化。
@param windowClass 不传该值,默认主窗口。
@returns | static async setWindowGrayScale(grayScale: number,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setWindowGrayScale(grayScale);
} | AST#method_declaration#Left static async setWindowGrayScale AST#parameter_list#Left ( AST#parameter#Left grayScale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Lef... | static async setWindowGrayScale(grayScale: number,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setWindowGrayScale(grayScale);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L158-L161 | 99216012375f77b4b7714ae23865f528ad682b06 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.EditableTitleBar.d.ets | arkts | Indicates the options of the editable title bar.
@interface EditableTitleBarOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export declare interface EditableTitleBarOptions {
/**
* Background color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
backgroundColor?: ResourceColor;
/**
* Background blur style.
*
* @type { ?BlurStyl... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface EditableTitleBarOptions AST#object_type#Left { /**
* Background color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @sin... | export declare interface EditableTitleBarOptions {
backgroundColor?: ResourceColor;
backgroundBlurStyle?: BlurStyle;
safeAreaTypes?: Array<SafeAreaType>;
safeAreaEdges?: Array<SafeAreaEdge>;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.EditableTitleBar.d.ets#L198-L242 | d7f986549c30d35939ef2044c3fd05fa083d3882 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets | arkts | Customize to get the NodeController interface. | export const getNWeb = (url: string): MyNodeController | undefined => {
// When loading a new Url, it is recommended to reuse pre-created Web components.
if (!NodeMap.get(url) && NodeMap.get('about://blank')) {
// Get pre-created Web components
let webNode: MyNodeController = NodeMap.get('about://blank') as... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left getNWeb = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#paramete... | export const getNWeb = (url: string): MyNodeController | undefined => {
if (!NodeMap.get(url) && NodeMap.get('about://blank')) {
let webNode: MyNodeController = NodeMap.get('about://blank') as MyNodeController;
webNode.loadUrl(url);
return webNode;
}
return NodeMap.get(url);
}; | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L122-L132 | aefb873a2acbcb24b9e20a1374a5c9fb22a6e4b9 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | getFoldStatus | 获取可折叠设备的当前折叠状态。
FoldStatus:
FOLD_STATUS_UNKNOWN 0 表示设备当前折叠状态未知。
FOLD_STATUS_EXPANDED 1 表示设备当前折叠状态为完全展开。
FOLD_STATUS_FOLDED 2 表示设备当前折叠状态为折叠。
FOLD_STATUS_HALF_FOLDED 3 表示设备当前折叠状态为半折叠。半折叠指完全展开和折叠之间的状态。
@returns
@returns | static getFoldStatus(): display.FoldStatus {
return display.getFoldStatus();
} | AST#method_declaration#Left static getFoldStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#... | static getFoldStatus(): display.FoldStatus {
return display.getFoldStatus();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L148-L150 | f3c7f44a36f27f2d41c4bc2768905635ceb2b28c | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM3.ets | arkts | hmac | 消息认证码计算
@param str 计算字符串
@returns | static async hmac(str: string): Promise<string> {
return DynamicUtil.hmac(str, 'SM3');
} | AST#method_declaration#Left static async hmac 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr... | static async hmac(str: string): Promise<string> {
return DynamicUtil.hmac(str, 'SM3');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM3.ets#L43-L45 | 02cac05696d35c3476cc1ba0447088cc550a222c | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | getData | 获取指定索引数据。
@param {number} index - 索引值。
@returns {CustomDataType} 返回指定索引数据。 | public getData(index: double): CustomDataType {
return this.dataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left double AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primar... | public getData(index: double): CustomDataType {
return this.dataArray[index];
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L168-L170 | 16ddcc4a75057a8c4ea3933403c8b9671d8efb1b | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/PullToRefresh/pulltorefresh/src/main/ets/pages/PullToRefreshNews.ets | arkts | customRefresh | 下拉刷新提示 | @Builder
private customRefresh() {
Row() {
// 下滑加载图片
Image($r('app.media.pull_icon_load'))
.width($r('app.string.pull_refresh_load_width'))
.height($r('app.string.pull_refresh_load_height'))
.objectFit(ImageFit.Contain)
.rotate({
z: 1,
angle: this.an... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private customRefresh 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 { // 下滑加载图片 ... | @Builder
private customRefresh() {
Row() {
Image($r('app.media.pull_icon_load'))
.width($r('app.string.pull_refresh_load_width'))
.height($r('app.string.pull_refresh_load_height'))
.objectFit(ImageFit.Contain)
.rotate({
z: 1,
angle: this.angle2 !== ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/PullToRefresh/pulltorefresh/src/main/ets/pages/PullToRefreshNews.ets#L262-L296 | 96ff48c2203e8f694fbc88d2f7b4e2e4547a4e5b | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/StateManagement/entry/src/main/ets/utils/ResourceUtils.ets | arkts | getResourceString将Resource类型的数据转换成string类型的数据
@param context
@param ResourceData | export function getResourceString(context: common.UIAbilityContext, resourceData: Resource): string {
let stringData: string = context.resourceManager.getStringSync(resourceData.id);
return stringData;
} | AST#export_declaration#Left export AST#function_declaration#Left function getResourceString 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 AS... | export function getResourceString(context: common.UIAbilityContext, resourceData: Resource): string {
let stringData: string = context.resourceManager.getStringSync(resourceData.id);
return stringData;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/StateManagement/entry/src/main/ets/utils/ResourceUtils.ets#L23-L26 | 4d204885dc4881e9eaff8903b3db0ac7fa4e8c71 | gitee | |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/controller/MapController.ets | arkts | mapMultiples | Obtains the map magnification.
@returns Map magnification. | mapMultiples(): number {
return Math.pow(Const.MAP_ZOOM_RATIO, this.pinchCount);
} | AST#method_declaration#Left mapMultiples 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_expression#Le... | mapMultiples(): number {
return Math.pow(Const.MAP_ZOOM_RATIO, this.pinchCount);
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/controller/MapController.ets#L136-L138 | f1c336dc56c03177ed386a5332346864b5f0a842 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customanimationtab/src/main/ets/view/CustomAnimationTabView.ets | arkts | tabBar | tabBar样式 | @Builder
function tabBar($$: TabBarItemInterface) {
Column() {
Image($r("app.media.return_home_fill"))
.height(20)
.width(20)
.objectFit(ImageFit.Contain)
Text($$.title)
.fontSize($$.curIndex === $$.index ? $r("app.float.custom_animation_tab_list_select_font_size") : $r("app.float.cust... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function tabBar AST#parameter_list#Left ( AST#parameter#Left $$ : AST#type_annotation#Left AST#primary_type#Left TabBarItemInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AS... | @Builder
function tabBar($$: TabBarItemInterface) {
Column() {
Image($r("app.media.return_home_fill"))
.height(20)
.width(20)
.objectFit(ImageFit.Contain)
Text($$.title)
.fontSize($$.curIndex === $$.index ? $r("app.float.custom_animation_tab_list_select_font_size") : $r("app.float.cust... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/view/CustomAnimationTabView.ets#L186-L199 | 45affd7742a1d44d44d4450b900afcb2a1028902 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/AboutSample/entry/src/main/ets/view/DetailListComponent.ets | arkts | DetailListComponent | This is the general detail page component that can add multiple items to the list. | @Component
export struct DetailListComponent {
private detailList: Array<ListItemData>;
build() {
Column() {
List() {
ForEach(this.detailList, (listItemData: ListItemData) => {
ListItem() {
Row() {
Text(listItemData.title)
.fontSize($r('app.floa... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DetailListComponent AST#component_body#Left { AST#property_declaration#Left private detailList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation... | @Component
export struct DetailListComponent {
private detailList: Array<ListItemData>;
build() {
Column() {
List() {
ForEach(this.detailList, (listItemData: ListItemData) => {
ListItem() {
Row() {
Text(listItemData.title)
.fontSize($r('app.floa... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/AboutSample/entry/src/main/ets/view/DetailListComponent.ets#L7-L46 | 857ec4f81636171165f6eb1b333f208f64451472 | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils.ets | arkts | generateUUID | / 生成UUID | public static generateUUID() {
let uuid = util.generateRandomUUID(true)
console.log("RFC 4122 Version 4 UUID:" + uuid.toString())
return uuid
} | AST#method_declaration#Left public static generateUUID AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uuid = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#... | public static generateUUID() {
let uuid = util.generateRandomUUID(true)
console.log("RFC 4122 Version 4 UUID:" + uuid.toString())
return uuid
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils.ets#L11-L15 | ac597d11808585c6de7f19209c37bc6cf0f2ca6c | github |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/types/SwipeCardTypes.ets | arkts | InternalCardInfo | 导出内部类型供组件使用 | export type { InternalCardInfo }; | AST#export_declaration#Left export AST#ERROR#Left type AST#ERROR#Right { InternalCardInfo } ; AST#export_declaration#Right | export type { InternalCardInfo }; | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L192-L192 | c2b9857af0e48a6e6f4ce7abdf22c5d1c06c4a27 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | wrapError | 统一封装业务异常,附加上下文提示
@param {unknown} error 捕获的异常
@param {string} message 补充说明
@returns {Error} 包装后的异常 | private wrapError(error: Unknown, message: string): Error {
if (error instanceof Error) {
error.message = `${message}:${error.message}`;
return error;
}
return new Error(message);
} | AST#method_declaration#Left private wrapError AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left Unknown AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | private wrapError(error: Unknown, message: string): Error {
if (error instanceof Error) {
error.message = `${message}:${error.message}`;
return error;
}
return new Error(message);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L119-L125 | 2cf0a5672073115b820b80ac225300d74a5d05ae | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/utils/Utils.ets | arkts | 比较点击的日期和当期日期是否为同一天 | export function sameDate(firstDate: Date, timestamp: number) {
let secondDate = new Date(timestamp);
if (firstDate.getFullYear() != secondDate.getFullYear()) {
return false;
}
if (firstDate.getMonth() != secondDate.getMonth()) {
return false;
}
if (firstDate.getDate() != secondDate.getDate()) {
... | AST#export_declaration#Left export AST#function_declaration#Left function sameDate AST#parameter_list#Left ( AST#parameter#Left firstDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timestamp : AST#type_annotation#Left A... | export function sameDate(firstDate: Date, timestamp: number) {
let secondDate = new Date(timestamp);
if (firstDate.getFullYear() != secondDate.getFullYear()) {
return false;
}
if (firstDate.getMonth() != secondDate.getMonth()) {
return false;
}
if (firstDate.getDate() != secondDate.getDate()) {
... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/utils/Utils.ets#L43-L59 | 82bb981ffe6580756ec109b34e3cc7c6fc88d0e5 | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/NetConnectionUtils.ets | arkts | hasNetWiFi | 判断当前网络是否是Wi-Fi,否则是移动流量热点网络。 | static async hasNetWiFi(): Promise<boolean> {
let net = await connection.getDefaultNet();
let netCapabilities = await connection.getNetCapabilities(net);
let networkCap = netCapabilities.networkCap;
if (networkCap) { //判断是否具有NET_CAPABILITY_NOT_METERED属性,如果具有NET_CAPABILITY_NOT_METERED,说明是普通Wi-Fi,否则是移动流量热... | AST#method_declaration#Left static async hasNetWiFi AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#... | static async hasNetWiFi(): Promise<boolean> {
let net = await connection.getDefaultNet();
let netCapabilities = await connection.getNetCapabilities(net);
let networkCap = netCapabilities.networkCap;
if (networkCap) {
return networkCap.indexOf(connection.NetCap.NET_CAPABILITY_NOT_METERED) >= 0
... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/NetConnectionUtils.ets#L35-L43 | 53cd47f30bf34408098249dbeb662e281aaafdab | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.