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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/utils/HttpUtil.ets | arkts | put | @description: put请求函数
@param {string} url 请求地址
@param {Object} data 请求参数
@param {RequestConfig} OtherConfig request其他配置
@return {*} | public put<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> {
return this.request<T>(url, { method: http.RequestMethod.PUT, extraData: data })
} | AST#method_declaration#Left public put AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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 ,... | public put<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> {
return this.request<T>(url, { method: http.RequestMethod.PUT, extraData: data })
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/HttpUtil.ets#L139-L141 | 0d97ee5a1667986e16b356d13d729f023442aa1d | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ChatbotEngine.ets | arkts | initializeEngine | 初始化聊天机器人引擎 | private async initializeEngine(): Promise<void> {
try {
await this.loadResponseTemplates();
await this.loadConversationFlows();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ChatbotEngine initialized');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstan... | AST#method_declaration#Left private async initializeEngine AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > ... | private async initializeEngine(): Promise<void> {
try {
await this.loadResponseTemplates();
await this.loadConversationFlows();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ChatbotEngine initialized');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstan... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L154-L163 | cdd9505da4ae1082b3add5c6756fc4f1f2dfec3d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets | arkts | CompressFileComponent | 功能描述:
1. 点击压缩按钮,指定目录下的文件会被压缩,压缩成功后,会显示压缩包名字
实现原理:
1. 通过initCompressFile函数将rawfile下指定目录的待压缩文件写入到应用沙箱路径中
2. 在Button的onClick回调中向worker子线程发送应用沙箱路径和待压缩文件所在目录
@param { string } compressBundleName - 压缩成功后压缩包的名字
@param { string } compressZipPath - 压缩成功后压缩包路径
@param { string } beCompressFileDir - 待压缩文件所在目录名 | @Component
export struct CompressFileComponent {
// -------------------对外暴露变量-----------------------
// 压缩成功后压缩包的名字
@Link compressBundleName: string;
// 压缩成功后压缩包路径
compressZipPath: string = '';
// 待压缩文件所在目录名
beCompressFileDir: string = '';
// --------------------私有属性----------------------------
privat... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CompressFileComponent AST#component_body#Left { // -------------------对外暴露变量----------------------- // 压缩成功后压缩包的名字 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right compressBundleName : AST#t... | @Component
export struct CompressFileComponent {
@Link compressBundleName: string;
compressZipPath: string = '';
beCompressFileDir: string = '';
private rawfilePath: string = '';
private context: Context = getContext(this);
@State pathDir: string = '';
@State outFileDir: string = '';
@... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets#L36-L152 | 58edb1318733d0d313e7cda8fc49af658a087b84 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/ByteCodeCache.ets | arkts | [End about_to_appear] | build() {
Column() {
// [Start byte_code_cache_web]
Web({
src: $rawfile('index.html'),
controller: this.webController
})
.fileAccess(true)
.javaScriptAccess(true)
.width('100%')
.height('100%')
.onConsole((event) => {
console.log('e... | AST#build_method#Left build ( ) 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 { // [Start byte_code_cache_web] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Web ( AST#component_para... | build() {
Column() {
Web({
src: $rawfile('index.html'),
controller: this.webController
})
.fileAccess(true)
.javaScriptAccess(true)
.width('100%')
.height('100%')
.onConsole((event) => {
console.log('ets onConsole:' + event?.messag... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/ByteCodeCache.ets#L24-L78 | 497e91138e3b009450ba4b0ea0cdda2551439390 | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/storage/StorageManager.ets | arkts | clearByPrefix | 按前缀删除缓存 | static async clearByPrefix(prefix: string): Promise<void> {
try {
const keys = await StorageManager.getAllKeys();
for (const key of keys) {
if (key.startsWith(prefix)) {
await StorageManager.remove(key);
}
}
Logger.info('StorageManager', `Cleared cache with prefix: ... | AST#method_declaration#Left static async clearByPrefix AST#parameter_list#Left ( AST#parameter#Left prefix : 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_... | static async clearByPrefix(prefix: string): Promise<void> {
try {
const keys = await StorageManager.getAllKeys();
for (const key of keys) {
if (key.startsWith(prefix)) {
await StorageManager.remove(key);
}
}
Logger.info('StorageManager', `Cleared cache with prefix: ... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L228-L240 | 7be6439ef7059182c6b7188b0254d3ad7da392ce | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/im/IMManager.ets | arkts | markAsRead | 标记消息为已读 | async markAsRead(conversationId: string): Promise<void> {
try {
const conversation = this.conversations.find(c => c.id === conversationId);
if (conversation) {
conversation.unreadCount = 0;
await this.saveConversations();
EventBus.emit('IM_MESSAGES_READ', { conversationId });
... | AST#method_declaration#Left async markAsRead AST#parameter_list#Left ( AST#parameter#Left conversationId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty... | async markAsRead(conversationId: string): Promise<void> {
try {
const conversation = this.conversations.find(c => c.id === conversationId);
if (conversation) {
conversation.unreadCount = 0;
await this.saveConversations();
EventBus.emit('IM_MESSAGES_READ', { conversationId });
... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L163-L174 | 25825afe2b8b64980fc97a805204b7a7fd532669 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | moveDir | 移动源文件夹至目标路径下,使用Promise异步返回。
@param src 源文件夹的应用沙箱路径
@param dest 目标文件夹的应用沙箱路径
@param mode 移动模式:
mode为0,文件夹级别抛异常。若目标文件夹下存在与源文件夹名冲突的非空文件夹,则抛出异常。
mode为1,文件级别抛异常。目标文件夹下存在与源文件夹名冲突的文件夹,若冲突文件夹下存在同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至目标文件夹下,目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中以Array<ConflictFiles>形式提供。
mode为2,文件级别强制覆盖。目标文件夹下存在与源文件夹名冲突的文件... | static moveDir(src: string, dest: string, mode: number = 3): Promise<void> {
return fs.moveDir(src, dest, mode);
} | AST#method_declaration#Left static moveDir AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dest : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | static moveDir(src: string, dest: string, mode: number = 3): Promise<void> {
return fs.moveDir(src, dest, mode);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L671-L673 | 6c395c9efa20519821473b5e3b4e45ca5c2b4362 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | getKeyboardAvoidMode | 获取虚拟键盘抬起时的页面避让模式(OFFSET-上抬模式、RESIZE-压缩模式)。 | static getKeyboardAvoidMode(): KeyboardAvoidMode {
let mode = AppUtil.getUIContext().getKeyboardAvoidMode();
if (typeof mode === 'string') {
if ('KeyBoardAvoidMode.RESIZE' === mode) {
return KeyboardAvoidMode.RESIZE;
} else {
return KeyboardAvoidMode.OFFSET;
}
}
return ... | AST#method_declaration#Left static getKeyboardAvoidMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left KeyboardAvoidMode AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_de... | static getKeyboardAvoidMode(): KeyboardAvoidMode {
let mode = AppUtil.getUIContext().getKeyboardAvoidMode();
if (typeof mode === 'string') {
if ('KeyBoardAvoidMode.RESIZE' === mode) {
return KeyboardAvoidMode.RESIZE;
} else {
return KeyboardAvoidMode.OFFSET;
}
}
return ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L320-L330 | 8dc65942918483608b90900dc98a5bfd9fb649f9 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets | arkts | setAvoidFirstLastClipping | if set to true, the chart will avoid that the first and last label entry
in the chart "clip" off the edge of the chart or the screen
@param enabled | public setAvoidFirstLastClipping(enabled: boolean): void {
this.mAvoidFirstLastClipping = enabled;
} | AST#method_declaration#Left public setAvoidFirstLastClipping AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void... | public setAvoidFirstLastClipping(enabled: boolean): void {
this.mAvoidFirstLastClipping = enabled;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L112-L114 | 8da47f87b5445c6354b2e96f349dcd3a766ca634 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/ComponentBase.ets | arkts | This class encapsulates everything both Axis, Legend and LimitLines have in common. | export default abstract class ComponentBase {
/**
* flag that indicates if this axis / legend is enabled or not
*/
protected mEnabled: boolean = true;
/**
* the offset in pixels this component has on the x-axis
*/
protected mXOffset: number = 5;
/**
* the offset in pixels this component has on ... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class ComponentBase AST#class_body#Left { /**
* flag that indicates if this axis / legend is enabled or not
*/ AST#property_declaration#Left protected mEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R... | export default abstract class ComponentBase {
protected mEnabled: boolean = true;
protected mXOffset: number = 5;
protected mYOffset: number = 5;
protected mTypeface: FontFamily
= '';
protected mTextSize: number = 10;
protected mTextColor: string | number | CanvasGradient | CanvasPatt... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L23-L182 | c68afa8a168c7f53f35d55b0a39be25d7603b379 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Point.ets | arkts | set | Set value.
@param x
@param y | set(x: number, y: number): void {
this.x = x;
this.y = y;
} | AST#method_declaration#Left set AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annot... | set(x: number, y: number): void {
this.x = x;
this.y = y;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Point.ets#L42-L45 | 26915639668b9bf1349498ab1edf6bbed8417411 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/ets/model/AppInfo.ets | arkts | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | export class AppInfo {
bundleName: string
name: string
icon: Resource
constructor | AST#export_declaration#Left export AST#ERROR#Left class AppInfo { bundleName : string name : string icon : Resource AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right | export class AppInfo {
bundleName: string
name: string
icon: Resource
constructor | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/ets/model/AppInfo.ets#L16-L21 | 0091d2452286b876053e56b1b4c86b1abe2691cf | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets | arkts | connectSocket | 空实现
@param address
@param port | async connectSocket(address: string, port: number): Promise<boolean> {
return false;
} | AST#method_declaration#Left async connectSocket AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left port : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | async connectSocket(address: string, port: number): Promise<boolean> {
return false;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets#L111-L113 | d86e7bf413f5ede3c7bb6b9c82abd0fbfbeffbde | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/WorksListsType.ets | arkts | @author 2008
@datetime 2024/8/1 11:02
@className: WorkListsType | export interface WorksListsTypeSearchParams {
// 搜索关键词
searchKey?: string,
// 源类型 0 小说;1 漫画;2 有声书;
type?: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface WorksListsTypeSearchParams AST#object_type#Left { // 搜索关键词 AST#type_member#Left searchKey ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , // 源类型 0 小说;1 漫画;2 有声书;... | export interface WorksListsTypeSearchParams {
searchKey?: string,
type?: number
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/WorksListsType.ets#L6-L11 | 7af1bbc86516ef49814a94c7e70e5d68949401ac | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets | arkts | 将十六进制颜色值转换为 HSL 颜色格式。
@param {string} hex - 输入的十六进制颜色字符串,可以是格式如 #RRGGBB 或 #RGB。
@returns { HslType | null} - 返回一个包含 HSL 值的数组,或者在输入无效时返回 null。 | export function hexToHsl(hex: string): HslType | null {
// 将 HEX 类型颜色转为 RGB 类型
let rgb = hexToRgb(hex);
if (rgb === null) {
return null;
}
// 将 RGB 类型颜色转为 HSL 类型
return rgbToHsl(rgb.red, rgb.green, rgb.blue);
} | AST#export_declaration#Left export AST#function_declaration#Left function hexToHsl AST#parameter_list#Left ( AST#parameter#Left hex : 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... | export function hexToHsl(hex: string): HslType | null {
let rgb = hexToRgb(hex);
if (rgb === null) {
return null;
}
return rgbToHsl(rgb.red, rgb.green, rgb.blue);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets#L113-L121 | 5a9f259e704b15a2848fe645951d90610589685f | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/model/DataObject.ets | arkts | getRemoteDeviceId | 获取可信组网中的设备 | function getRemoteDeviceId() {
let deviceId = '';
try {
let deviceManager = distributedDeviceManager.createDeviceManager('com.samples.distributedfilemanager');
let devices = deviceManager.getAvailableDeviceListSync();
for (let device of devices) {
if (device.networkId) {
deviceId = device.... | AST#function_declaration#Left function getRemoteDeviceId AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left deviceId = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_d... | function getRemoteDeviceId() {
let deviceId = '';
try {
let deviceManager = distributedDeviceManager.createDeviceManager('com.samples.distributedfilemanager');
let devices = deviceManager.getAvailableDeviceListSync();
for (let device of devices) {
if (device.networkId) {
deviceId = device.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/model/DataObject.ets#L133-L148 | ce43ac566befd729483267ca82aec369e4d3f216 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getWordsByPartId | 根据分类ID获取单词 | getWordsByPartId(partId: number): WordUser[] {
if (partId === SearchConstants.PART_ID_ALL) {
return this.getAliveWords();
}
const part = this.getPartById(partId);
return part ? part.aliveWords : [];
} | AST#method_declaration#Left getWordsByPartId AST#parameter_list#Left ( AST#parameter#Left partId : 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#array_type#Left Wo... | getWordsByPartId(partId: number): WordUser[] {
if (partId === SearchConstants.PART_ID_ALL) {
return this.getAliveWords();
}
const part = this.getPartById(partId);
return part ? part.aliveWords : [];
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L411-L418 | 47c8d7a2ef201910ca08ce24f74017df565735ed | github |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | getSupportedCamerasFn | 获取支持指定的相机设备对象 | getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> {
let supportedCameras: Array<camera.CameraDevice> = [];
try {
supportedCameras = cameraManager.getSupportedCameras();
Logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.length... | AST#method_declaration#Left getSupportedCamerasFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#... | getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> {
let supportedCameras: Array<camera.CameraDevice> = [];
try {
supportedCameras = cameraManager.getSupportedCameras();
Logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.length... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L404-L414 | 845b4830fa3fcf908c904e8743a73d0a30896f30 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/StorageUtils.ets | arkts | has | 检查键是否存在
@param key 存储键
@returns 是否存在 | static async has(key: string): Promise<boolean> {
const dataPreferences = StorageUtils.dataPreferences;
if (!dataPreferences) {
console.error('Preferences not initialized');
return false;
}
try {
return await dataPreferences.has(key);
} catch (error) {
console.error(`Failed ... | AST#method_declaration#Left static async has AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pro... | static async has(key: string): Promise<boolean> {
const dataPreferences = StorageUtils.dataPreferences;
if (!dataPreferences) {
console.error('Preferences not initialized');
return false;
}
try {
return await dataPreferences.has(key);
} catch (error) {
console.error(`Failed ... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L220-L233 | 3af678506c0ba69781a8e0fac8281314501bc3e3 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/UniversalKeystoreKit/KeyDeletion/entry/src/main/ets/pages/KeyDeletion.ets | arkts | publicDeleteKeyFunc | 3.删除密钥 | async function publicDeleteKeyFunc(keyAlias: string, huksOptions: huks.HuksOptions): Promise<string> {
console.info(`enter promise deleteKeyItem`);
let throwObject: ThrowObject = { isThrow: false };
try {
console.log('start genKey...')
await testGenKey();
console.log('end genKey...')
await deleteK... | AST#function_declaration#Left async function publicDeleteKeyFunc AST#parameter_list#Left ( AST#parameter#Left keyAlias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type... | async function publicDeleteKeyFunc(keyAlias: string, huksOptions: huks.HuksOptions): Promise<string> {
console.info(`enter promise deleteKeyItem`);
let throwObject: ThrowObject = { isThrow: false };
try {
console.log('start genKey...')
await testGenKey();
console.log('end genKey...')
await deleteK... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyDeletion/entry/src/main/ets/pages/KeyDeletion.ets#L113-L136 | 90fc9634e1cf1b68bdc54b73a9215257e5235cc2 | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/default/pages/searchDisSchedule.ets | arkts | initScheduleData | 获取日程列表 | async initScheduleData() {
if (this.userId != '' && this.strSearch != '') {
await DistScheduleService.searchSchedule(this.userId, this.strSearch)
.then((scheduleResult) => {
for (let ScheduleModel of scheduleResult) {
this.scheduleList.push(ScheduleModel)
}
... | AST#method_declaration#Left async initScheduleData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_exp... | async initScheduleData() {
if (this.userId != '' && this.strSearch != '') {
await DistScheduleService.searchSchedule(this.userId, this.strSearch)
.then((scheduleResult) => {
for (let ScheduleModel of scheduleResult) {
this.scheduleList.push(ScheduleModel)
}
... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/pages/searchDisSchedule.ets#L113-L128 | be1c7ee2733db230f6d264dc9bacb66a42cd6ac8 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/DistributedFilemanager/Library/src/main/ets/filemanager/fileio/FileIoManager.ets | arkts | getFileSize | 获取文件大小 | getFileSize(filePath: string): string {
try {
let fileSize = fileio.statSync(filePath).size;
if (fileSize / GB_MAGNITUDE > 1) {
return `${(fileSize / GB_MAGNITUDE).toFixed(2)}${GB_SYMBOL}`;
} else if (fileSize / MB_MAGNITUDE > 1) {
return `${(fileSize / MB_MAGNITUDE).toFixed(2)}${M... | AST#method_declaration#Left getFileSize AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | getFileSize(filePath: string): string {
try {
let fileSize = fileio.statSync(filePath).size;
if (fileSize / GB_MAGNITUDE > 1) {
return `${(fileSize / GB_MAGNITUDE).toFixed(2)}${GB_SYMBOL}`;
} else if (fileSize / MB_MAGNITUDE > 1) {
return `${(fileSize / MB_MAGNITUDE).toFixed(2)}${M... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/Library/src/main/ets/filemanager/fileio/FileIoManager.ets#L31-L47 | df1152300e24230b42432b4747d3a58039dda3ec | gitee |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/entryability/EntryAbility.ets | arkts | class Student extends Person { } | export default class EntryAbility extends UIAbility {
// 最早的创建窗口的钩子
// 提前将后续使用的上下文context放到appstorage 共享给整个应用
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
// hilog.info(DOMAIN,... | 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 { // 最早的创建窗口的钩子 // 提前将后续使用的上下文context放到appstorage 共享给整个应用 AST#method_declaration#Left onCreate A... | export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
logger.info('生命周期', 'Ability onCreate')
AppStorage.setOrCreat... | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/entryability/EntryAbility.ets#L43-L98 | 4eb3987274a10661f7e4a67265d57951f4148074 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/WebSocket/entry/src/main/ets/common/TopBar.ets | arkts | TopBar | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | @Component
export default struct TopBar {
@Link isConnect: boolean
private connect: () => void
build() {
Row() {
Text($r('app.string.server'))
.fontSize(20)
.margin({ left: '40%' })
.textAlign(TextAlign.Center)
Button() {
Text($r('app.string.connect'))
.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct TopBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isConnect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_a... | @Component
export default struct TopBar {
@Link isConnect: boolean
private connect: () => void
build() {
Row() {
Text($r('app.string.server'))
.fontSize(20)
.margin({ left: '40%' })
.textAlign(TextAlign.Center)
Button() {
Text($r('app.string.connect'))
.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/WebSocket/entry/src/main/ets/common/TopBar.ets#L16-L48 | 216453dc8603ef2bcb760e69fc23e0eb95e4660e | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | onCameraStatusChange | Monitors camera status changes
@param cameraManager - Camera Manager object
@returns No return value | onCameraStatusChange(cameraManager: camera.CameraManager): void {
Logger.info(TAG, 'onCameraStatusChange is called');
try {
cameraManager.on('cameraStatus', this.registerCameraStatusChange);
} catch (error) {
Logger.error(TAG, 'onCameraStatusChange error');
}
} | AST#method_declaration#Left onCameraStatusChange AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#R... | onCameraStatusChange(cameraManager: camera.CameraManager): void {
Logger.info(TAG, 'onCameraStatusChange is called');
try {
cameraManager.on('cameraStatus', this.registerCameraStatusChange);
} catch (error) {
Logger.error(TAG, 'onCameraStatusChange error');
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L593-L600 | 01d710bf6490a0c3516b74bcc23576290b9d034e | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | resetAxisMaximum | By calling this method, any custom maximum value that has been previously set is reset,
and the calculation is
done automatically. | public resetAxisMaximum(): void {
this.mCustomAxisMax = false;
} | AST#method_declaration#Left public resetAxisMaximum AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Lef... | public resetAxisMaximum(): void {
this.mCustomAxisMax = false;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L693-L695 | 6ce1986c6e161d164e0e2dd361016bd00b11449c | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets | arkts | startDeviceDiscovery | Discovering Devices. | startDeviceDiscovery() {
this.subscribeId = Math.floor(Math.random() * CommonConstants.RANDOM_ONE + CommonConstants.RANDOM_TWO);
let subscribeInfo: SubscribeInfoInterface = {
subscribeId: this.subscribeId,
mode: CommonConstants.MODE,
medium: 0,
freq: CommonConstants.FREQ,
isSameAcc... | AST#method_declaration#Left startDeviceDiscovery AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subscribeId AST#... | startDeviceDiscovery() {
this.subscribeId = Math.floor(Math.random() * CommonConstants.RANDOM_ONE + CommonConstants.RANDOM_TWO);
let subscribeInfo: SubscribeInfoInterface = {
subscribeId: this.subscribeId,
mode: CommonConstants.MODE,
medium: 0,
freq: CommonConstants.FREQ,
isSameAcc... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets#L53-L71 | 6bcfde5862df4aa2a61f65943e83fed694b68b1c | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | resizeAsync | 改变当前窗口大小,使用Promise异步回调。调用生效后返回,回调中可使用getWindowProperties()(见示例)立即获取最终生效结果。
@param width 目标窗口的宽度,单位为px,该参数仅支持整数输入,浮点数输入将向下取整,负值为非法参数。
@param height 目标窗口的高度,单位为px,该参数仅支持整数输入,浮点数输入将向下取整,负值为非法参数。
@param windowClass 不传该值,默认主窗口。
@returns | static async resizeAsync(width: number, height: number,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.resizeAsync(width, height);
} | AST#method_declaration#Left static async resizeAsync AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | static async resizeAsync(width: number, height: number,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.resizeAsync(width, height);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L461-L464 | fd198df6d3795f6fb6f1ae5d215ca21dc126d73a | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/PickerUtil.ets | arkts | cameraEasy | 调用系统相机,拍照、录视频
@param options
@returns | static async cameraEasy(options: CameraOptions = new CameraOptions()): Promise<string> {
let pickerResult = await PickerUtil.camera(options);
return pickerResult.resultUri;
} | AST#method_declaration#Left static async cameraEasy AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left CameraOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expr... | static async cameraEasy(options: CameraOptions = new CameraOptions()): Promise<string> {
let pickerResult = await PickerUtil.camera(options);
return pickerResult.resultUri;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L36-L39 | db2385b2a5728b0bb61e2270156a0cc440cdf8a2 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/constants/Constant.ets | arkts | 环境安全级别 | export const StatusArray: string[] = ["安全", "警告", "危险", "未知"]; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left StatusArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#express... | export const StatusArray: string[] = ["安全", "警告", "危险", "未知"]; | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/constants/Constant.ets#L2-L2 | c82886458d8f1542179961c31fdc5a501ed152cd | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ResourceUtils.ets | arkts | resourceColorToString | 将ResourceColor类型转换为#RRGGBB或#AARRGGBB格式的字符串
支持Color枚举、number(HEX)、string(rgb/argb)或Resource对象[6](@ref)
@param color 颜色资源,ResourceColor类型
@param context 上下文对象(主要用于处理Resource对象的情况)[2,5](@ref)
@returns 颜色字符串,例如'#ff0000'或'#ffff0000' | static resourceColorToString(color: ResourceColor): string {
// 1. 处理string类型:直接返回(可能是'#rgb'、'#argb'、'rgb()'、'rgba()'格式)
if (typeof color === 'string') {
return color;
}
///注意:无法处理 enum Color的情况,如: Color.Red, Color.Green...
// 3. 处理Resource对象:需要通过resourceManager获取其十进制颜色值[2,5](@ref)
// 使... | AST#method_declaration#Left static resourceColorToString AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left stri... | static resourceColorToString(color: ResourceColor): string {
if (typeof color === 'string') {
return color;
}
if (color !== null && typeof color === 'object' && typeof (color as Resource).id === 'number') {
try {
const colorValue: number = getContext(Resou... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ResourceUtils.ets#L23-L47 | dde30a2f2c2bdfdc6ce6127f4fd397d10e4e9104 | github |
jianguo888/nut-recipes | 262304b5d2bee2d5f1df4e29c094c9ddd58f9d51 | entry/src/main/ets/MainAbility/data/get_cook_data.ets | arkts | Copyright (c) 2021 JianGuo 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, sof... | export function getCookTest() {
return {
"id": "8",
"classid": "2",
"name": "醋溜白菜",
"peoplenum": "1-2人",
"preparetime": "10-20分钟",
"cookingtime": "10-20分钟",
"content": "醋溜白菜,是北方人经常吃的一道菜,尤其是在多年前的冬天。那时,没有大棚菜,冬天,家家每天佐餐的基本上都是冬储大白菜,聪明的家庭主妇总是想方设法将这单调的菜变成多种菜式,于是,醋溜白菜被频繁的端上餐桌。" +
" 美食不分贵贱,用最平... | AST#export_declaration#Left export AST#function_declaration#Left function getCookTest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "id"... | export function getCookTest() {
return {
"id": "8",
"classid": "2",
"name": "醋溜白菜",
"peoplenum": "1-2人",
"preparetime": "10-20分钟",
"cookingtime": "10-20分钟",
"content": "醋溜白菜,是北方人经常吃的一道菜,尤其是在多年前的冬天。那时,没有大棚菜,冬天,家家每天佐餐的基本上都是冬储大白菜,聪明的家庭主妇总是想方设法将这单调的菜变成多种菜式,于是,醋溜白菜被频繁的端上餐桌。" +
" 美食不分贵贱,用最平... | https://github.com/jianguo888/nut-recipes/blob/262304b5d2bee2d5f1df4e29c094c9ddd58f9d51/entry/src/main/ets/MainAbility/data/get_cook_data.ets#L16-L132 | 313c362d35ac07bdadbd50ab114ec8efa71f16b6 | gitee | |
Leeson-Wong/ark-layer.git | 9efa3553414a6b1eee890e3858c8cdcb308535d7 | core/DefaultPhases.ets | arkts | 默认阶段配置
提供常用的阶段配置,方便业务使用
优先级说明:
- 数字越小越先加载
- GLOBAL (10): 全局核心服务,必须最先完成
- BUSINESS (20): 业务核心服务,需要等待完成
- FEATURE (30): 功能服务,可并行加载
- LAZY (40): 延迟加载服务,最后加载
全局核心阶段
优先级: 10 (最高)
策略: 串行等待(必须完成)
用途: 基础设施、核心配置等必须最先完成的服务 | export const GLOBAL_PHASE = new Phase({
name: 'GLOBAL',
priority: 10,
waitForComplete: true,
description: '全局核心服务,必须最先完成加载'
})
/**
* 业务核心阶段
* 优先级: 20
* 策略: 串行等待(必须完成)
* 用途: 业务核心功能,需要等待完成后才能进入功能阶段
*/ | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GLOBAL_PHASE = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Phase AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#L... | export const GLOBAL_PHASE = new Phase({
name: 'GLOBAL',
priority: 10,
waitForComplete: true,
description: '全局核心服务,必须最先完成加载'
}) | https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/DefaultPhases.ets#L21-L33 | f4f6f5f1ea4556cdeb517474d5bfeaa92857ee03 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/permission/PermissionUtils.ets | arkts | handlePermissionResult | 处理权限申请结果的公共方法
统一处理权限申请成功/失败的逻辑和用户提示
@param {string} permissionName 权限名称(用于错误提示)
@param {(granted: boolean) => void} callback 权限申请结果回调
@param {Array<Permissions>} permissions 申请的权限 | private async handlePermissionResult(permissionName: string, callback: (granted: boolean) => void, permissions: Array<Permissions>): Promise<void> {
// 先检查是否已经获得所有权限
let allGranted = true;
for (const permission of permissions) {
if (!(await this.checkPermissionGrant(permission))) {
allGranted ... | AST#method_declaration#Left private async handlePermissionResult AST#parameter_list#Left ( AST#parameter#Left permissionName : 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#function_... | private async handlePermissionResult(permissionName: string, callback: (granted: boolean) => void, permissions: Array<Permissions>): Promise<void> {
let allGranted = true;
for (const permission of permissions) {
if (!(await this.checkPermissionGrant(permission))) {
allGranted = false;
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/permission/PermissionUtils.ets#L133-L165 | 69ec4118597fff506024ce510d3ea4b4634bca82 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/InputItem.ets | arkts | InputItem | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct InputItem {
@Link value: number;
private textValue: Resource = $r('app.string.short_sleep');
private placeHolder: Resource = $r('app.string.enter_sleep_time');
build() {
Row() {
Text(this.textValue)
.layoutWeight(1)
.fontSize(20)
TextInput({ placeholder:... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InputItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#... | @Component
export struct InputItem {
@Link value: number;
private textValue: Resource = $r('app.string.short_sleep');
private placeHolder: Resource = $r('app.string.enter_sleep_time');
build() {
Row() {
Text(this.textValue)
.layoutWeight(1)
.fontSize(20)
TextInput({ placeholder:... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/components/utilcomponents/scopehelper/InputItem.ets#L16-L42 | 99b7fb4bdc1c5f720513fa7b1c762ad4cdbb4b0f | gitee |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/SubscriptionManager.ets | arkts | 网络订阅信息 | export interface SubscriptionInfo {
id: string
name: string
url: string
lastUpdate: number
enabled: boolean
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SubscriptionInfo AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left name : AST#type_annotation#Left ... | export interface SubscriptionInfo {
id: string
name: string
url: string
lastUpdate: number
enabled: boolean
} | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L11-L17 | baf81a24aaeaf38c07cad7bf5d94deeb3bb3e97a | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/Legend.ets | arkts | Class representing the legend of the chart. The legend will contain one entry
per color and DataSet. Multiple colors in one DataSet are grouped together.
The legend object is NOT available before setting data to the chart. | export default class Legend extends ComponentBase {
/**
* The legend entries array
*/
private mEntries: LegendEntry[] = [];
/**
* Entries that will be appended to the end of the auto calculated entries after calculating the legend.
* (if the legend has already been calculated, you will need to call no... | AST#export_declaration#Left export AST#ERROR#Left default class Legend extends AST#type_annotation#Left AST#primary_type#Left ComponentBase AST#primary_type#Right AST#type_annotation#Right { /**
* The legend entries array
*/ AST#property_declaration#Left private mEntries : AST#type_annotation#Left AST#primary_typ... | export default class Legend extends ComponentBase {
private mEntries: LegendEntry[] = [];
private mExtraEntries: LegendEntry[] | null = null;
private mIsLegendCustom: boolean = false;
private mHorizontalAlignment: LegendHorizontalAlignment = LegendHorizontalAlignment.LEFT;
private mVerticalAlignment:... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/Legend.ets#L50-L118 | fcbb22f3edd72ff84621997a37f224b1605326f5 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets | arkts | AuthDevice | 设备认证 | function AuthDevice(deviceId) {
if (remoteDeviceModel.deviceList.length >= 1 && remoteDeviceModel.discoverList.length == 0) {
return;
}
if (remoteDeviceModel.discoverList.length > 0) {
remoteDeviceModel.authDevice(deviceId, () => {
prompt.showToast({
message: "AuthDevice device authenticate... | AST#function_declaration#Left function AuthDevice AST#parameter_list#Left ( AST#parameter#Left deviceId AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AS... | function AuthDevice(deviceId) {
if (remoteDeviceModel.deviceList.length >= 1 && remoteDeviceModel.discoverList.length == 0) {
return;
}
if (remoteDeviceModel.discoverList.length > 0) {
remoteDeviceModel.authDevice(deviceId, () => {
prompt.showToast({
message: "AuthDevice device authenticate... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L60-L76 | c55645183e666d93d9343df80e989d1517b73e29 | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/ConfigService.ets | arkts | 摄像头设备列表响应接口 | export interface CameraDeviceResponse {
total: number;
rows: CameraDevice[];
code: number;
msg: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CameraDeviceResponse AST#object_type#Left { AST#type_member#Left total : 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 rows : AST#type_annotat... | export interface CameraDeviceResponse {
total: number;
rows: CameraDevice[];
code: number;
msg: string;
} | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/ConfigService.ets#L39-L44 | 7b32f1573030fbe7ec96f6145069af7785597e2f | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the device manufacturer represented by a string.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get manufacture(): string; | AST#method_declaration#Left static get AST#ERROR#Left manufacture AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get manufacture(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L54-L54 | 3c65c4e46255c4e599e8f0296959366f4550349b | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | get | MARK: - endDate & Utils for Date / 结束日期(通过开始日期计算出) | get endDate(): Date | null {
if (this.startDate !== null) {
const lastDay: number | null = this.dayOfs.length > 0
? this.dayOfs[this.dayOfs.length - 1].num
: null;
if (lastDay !== null) {
return this.addDays(this.startDate, lastDay);
}
}
return null;
} | AST#method_declaration#Left get AST#ERROR#Left endDate AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ... | get endDate(): Date | null {
if (this.startDate !== null) {
const lastDay: number | null = this.dayOfs.length > 0
? this.dayOfs[this.dayOfs.length - 1].num
: null;
if (lastDay !== null) {
return this.addDays(this.startDate, lastDay);
}
}
return null;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L97-L107 | 6d4fcdd106918b7ccc211ffac3f939b68d81645b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolinkagelist/src/main/ets/pages/VideoLinkageList.ets | arkts | onIsHideVideoChange | TODO:知识点:根据视频显隐状态修改边距,使用边距代替video占位,使Scroll容器内容高度不变,可以向下滚动显示视频,并且避免滚动混乱 | onIsHideVideoChange() {
if (!this.isHideVideo) {
// 视频显示,视频卡片上边距减去视频高度
this.videoMarginTop -= Constants.VIDEO_HEIGHT;
} else {
// 视频隐藏,视频卡片上边距加上视频高度
this.videoMarginTop += Constants.VIDEO_HEIGHT;
}
} | AST#method_declaration#Left onIsHideVideoChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#express... | onIsHideVideoChange() {
if (!this.isHideVideo) {
this.videoMarginTop -= Constants.VIDEO_HEIGHT;
} else {
this.videoMarginTop += Constants.VIDEO_HEIGHT;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/pages/VideoLinkageList.ets#L66-L74 | d64f4617fd070112b935a0ef49fd34bb8f86f697 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/ActionParameter.ets | arkts | initButtons | 自定义弹框,按钮,初始化参数 | static initButtons(options: CustomContentOptions | BaseInputOptions, blInput: boolean) {
if (!options.buttons) {
options.buttons = [ActionParameter.config.primaryButton, ActionParameter.config.secondaryButton]
}
if (options.buttons && options.buttons.length > 0) {
let buttons = new Array<ButtonO... | AST#method_declaration#Left static initButtons AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CustomContentOptions AST#primary_type#Right | AST#primary_type#Left BaseInputOptions AST#primary_type#Right AST#union_type#Right AST#type_annotation#Ri... | static initButtons(options: CustomContentOptions | BaseInputOptions, blInput: boolean) {
if (!options.buttons) {
options.buttons = [ActionParameter.config.primaryButton, ActionParameter.config.secondaryButton]
}
if (options.buttons && options.buttons.length > 0) {
let buttons = new Array<ButtonO... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L287-L336 | d7465f683a19aca86c56e66209b986e9ac6ae18e | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | encodeAsymSegment | 非对称分段加密
@param encodeStr 待加密的字符串
@param pubKey 给定秘钥规格公钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格 | static async encodeAsymSegment(str: string, pubKey: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
//将公钥转换
let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName);
//生成加密器
let encoder = crypto.createCipher(symEncryptName);
//初始化加密... | AST#method_declaration#Left static async encodeAsymSegment 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 pubKey : AST#type_annotation#Left AST#primary_type#Left string AST... | static async encodeAsymSegment(str: string, pubKey: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName);
let encoder = crypto.createCipher(symEncryptName);
await encoder.in... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L243-L273 | f4ba1070bfaae43fbbb53dd6e77dfe2a3fb2d874 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets | arkts | querySqlForList | 查询数据
@param predicates 条件
@param columns
@returns | querySqlForList<T> (sql: string, columns: ColumnInfo[]): Promise<T[]> {
return new Promise((resolve, reject) => {
this.rdbStore?.querySql(sql, (err, result) => {
if (err) {
Logger.error(`[${CommonConstants.RDB_TAG}]`,'查询失败!',JSON.stringify(err));
reject(err);
} else {
... | AST#method_declaration#Left querySqlForList AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri... | querySqlForList<T> (sql: string, columns: ColumnInfo[]): Promise<T[]> {
return new Promise((resolve, reject) => {
this.rdbStore?.querySql(sql, (err, result) => {
if (err) {
Logger.error(`[${CommonConstants.RDB_TAG}]`,'查询失败!',JSON.stringify(err));
reject(err);
} else {
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L168-L181 | a0e3f7467fbb92f6d95c883a34dac18aa17d16e3 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Player/CAudioPlayer.ets | arkts | loadSound | MARK: - 私有方法
加载音频资源
@param text 音频资源URI | private async loadSound(text: string): Promise<void> {
try {
// 1. 使用AudioTool创建播放器实例
const audioData = await this.generateAudioData(text);
if (audioData !== null) {
// 加入队列
this.queue.push(audioData);
// 尝试播放
this.tryPlayIfNeeds();
}
} catch (err) {
... | AST#method_declaration#Left private async loadSound AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#... | private async loadSound(text: string): Promise<void> {
try {
const audioData = await this.generateAudioData(text);
if (audioData !== null) {
this.queue.push(audioData);
this.tryPlayIfNeeds();
}
} catch (err) {
console.error(`加载音频失败: ${JSON.st... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/CAudioPlayer.ets#L79-L97 | f57bce26a1af930eba01a4fc989abe4c69ae1e65 | github |
Zairgs/ArKTSMovie.git | 1586c977f12722333eee7d74a71f006ba0606ade | ets/pages/TicketReservation.ets | arkts | getSaleTimeText | 获取开抢时间文本 | private getSaleTimeText(saleTime: number): string {
const saleDate = new Date(saleTime)
const now = new Date(this.currentTime)
// 判断是否是今天、明天或后天
if (saleDate.getDate() === now.getDate() && saleDate.getMonth() === now.getMonth() &&
saleDate.getFullYear() === now.getFullYear()) {
return `今天${t... | AST#method_declaration#Left private getSaleTimeText AST#parameter_list#Left ( AST#parameter#Left saleTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | private getSaleTimeText(saleTime: number): string {
const saleDate = new Date(saleTime)
const now = new Date(this.currentTime)
if (saleDate.getDate() === now.getDate() && saleDate.getMonth() === now.getMonth() &&
saleDate.getFullYear() === now.getFullYear()) {
return `今天${this.padZero(sale... | https://github.com/Zairgs/ArKTSMovie.git/blob/1586c977f12722333eee7d74a71f006ba0606ade/ets/pages/TicketReservation.ets#L156-L182 | 045698ce759759d5458ab846180fd1a22c3e4f30 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/pages/InterThreadCommunication3.ets | arkts | InterThreadCommunication3 | [End initsingleton] | @Component
export struct InterThreadCommunication3 {
@Styles
buttonStyles() {
.width('100%')
.height(40)
}
build() {
NavDestination() {
Column() {
Button($r('app.string.singleton_solution_two_title'))
.buttonStyles()
.margin({
bottom: 16
})
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InterThreadCommunication3 AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right buttonStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_bod... | @Component
export struct InterThreadCommunication3 {
@Styles
buttonStyles() {
.width('100%')
.height(40)
}
build() {
NavDestination() {
Column() {
Button($r('app.string.singleton_solution_two_title'))
.buttonStyles()
.margin({
bottom: 16
})
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/InterThreadCommunication3.ets#L47-L79 | bede795d00594d431b413e0eaa6a138cdcd60b12 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarService.ets | arkts | getSolarTerm | 获取节气信息 | private async getSolarTerm(date: Date): Promise<SolarTerm | undefined> {
// 这里可以调用节气API或使用本地计算
// 简化实现:只在特定日期返回节气
const month = date.getMonth() + 1;
const day = date.getDate();
// 大致的节气日期(实际应该更精确)
const solarTermDates: Record<string, string> = {
'01-05': '小寒',
'01-20': '大寒',
'... | AST#method_declaration#Left private async getSolarTerm AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date 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... | private async getSolarTerm(date: Date): Promise<SolarTerm | undefined> {
const month = date.getMonth() + 1;
const day = date.getDate();
const solarTermDates: Record<string, string> = {
'01-05': '小寒',
'01-20': '大寒',
'02-04': '立春',
'02-19': '雨水',
'03-05': '惊蛰',
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarService.ets#L315-L361 | 6654c6863307d5297f2d24442b298d16571abaf2 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/huawei/HwSubscriber.ets | arkts | showManagedSubscriptions | /打开华为订阅管理页面(订阅列表 + 详情) | async showManagedSubscriptions() {
try {
let context = getAppContext()
// 跳转到用户已购订阅管理列表页
await iap.showManagedSubscriptions(context, {windowScreenMode: iap.WindowScreenMode.DIALOG_BOX});//是否全屏
// 或者,跳转到某个特定订阅的详情页(需要传入订阅的PurchaseToken)
//iap.showManagedSubscriptions(context, {windowS... | AST#method_declaration#Left async showManagedSubscriptions 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#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#L... | async showManagedSubscriptions() {
try {
let context = getAppContext()
await iap.showManagedSubscriptions(context, {windowScreenMode: iap.WindowScreenMode.DIALOG_BOX});
} catch (err) {
const e = err as BusinessError;
Toast.showMessage(`Failed to open subscription... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/HwSubscriber.ets#L218-L232 | d298f2fc642868cecc684a04413246472232a3ee | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/ObjectPool.ets | arkts | getPoolId | Returns the id of the given pool instance.
@return an integer ID belonging to this pool instance. | public getPoolId(): number {
return this.poolId;
} | AST#method_declaration#Left public getPoolId 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_express... | public getPoolId(): number {
return this.poolId;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ObjectPool.ets#L45-L47 | fee53efaa4f9aa88345baaa6a2771b0e770efb82 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/demo/DemoNavigator.ets | arkts | toSafeAreaDemo | 跳转到安全区示例页
@returns {void} 无返回值 | static toSafeAreaDemo(): void {
navigateTo(DemoRoutes.SafeAreaDemo);
} | AST#method_declaration#Left static toSafeAreaDemo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#membe... | static toSafeAreaDemo(): void {
navigateTo(DemoRoutes.SafeAreaDemo);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L82-L84 | 1d7c4285d29e4b91c4b0cf5705800e547b6b4dee | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/TextReaderHelper.ets | arkts | resume | 继续播放。 | static resume(): boolean {
try {
TextReader.resume();
return true;
} catch (e) {
console.error(`TextReader failed to resume. Code: ${e.code}, message: ${e.message}`);
return false;
}
} | AST#method_declaration#Left static resume AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left ... | static resume(): boolean {
try {
TextReader.resume();
return true;
} catch (e) {
console.error(`TextReader failed to resume. Code: ${e.code}, message: ${e.message}`);
return false;
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L107-L115 | 26fa8428bdc92c797bb4a63af27c40efe1d38755 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets | arkts | Preset split ratio.
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export enum PresetSplitRatio {
/**
* 1:1
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
LAYOUT_1V1 = 1 / 1,
/**
* 2:3
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
LAYOUT_2... | AST#export_declaration#Left export AST#enum_declaration#Left enum PresetSplitRatio AST#enum_body#Left { /**
* 1:1
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#enum_member#Left LAYOUT_1V1 = AST#expression#Left AST#binary_expression#Left AST#expre... | export enum PresetSplitRatio {
LAYOUT_1V1 = 1 / 1,
LAYOUT_2V3 = 2 / 3,
LAYOUT_3V2 = 3 / 2,
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets#L196-L226 | 4271f34d415e79928bda26e1e260c79350ff38a8 | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets | arkts | SelectDialog | Declare CustomDialog SelectDialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare CustomDialog SelectDialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @CustomDialog
export declare struct SelectDialog {
/**
* Sets the SelectDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the SelectDialog Controller.
* @type { CustomDialogController }.
* @syscap ... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SelectDialog AST#component_body#Left { /**
* Sets the SelectDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | @CustomDialog
export declare struct SelectDialog {
controller: CustomDialogController;
title: ResourceStr;
content?: ResourceStr;
selectedIndex?: number;
confirm?: ButtonOptions;
radioContent: Array<SheetInfo>;
theme?: Theme | ... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets#L318-L424 | b1405ed06ab0dd24afb31ff1b38743e2dd2c91fc | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/MultiDeviceAppDev/MultiNavBar/entry/src/main/ets/common/CommonMainTabs.ets | arkts | CommonMainTabs | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | @Component
export struct CommonMainTabs {
@LocalStorageProp("currentBreakpoint") currentBreakpoint: string = 'md';
@Link currentMainIndex: number;
@Link currentSubIndex: number;
mainTabsController: TabsController = new TabsController();
subTabsController: TabsController = new TabsController();
mainTabsConte... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonMainTabs AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ LocalStorageProp ( AST#expression#Left "currentBreakpoint" AST#expression#Right ) AST#decorator#Right currentBreakpoint : AST... | @Component
export struct CommonMainTabs {
@LocalStorageProp("currentBreakpoint") currentBreakpoint: string = 'md';
@Link currentMainIndex: number;
@Link currentSubIndex: number;
mainTabsController: TabsController = new TabsController();
subTabsController: TabsController = new TabsController();
mainTabsConte... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/MultiNavBar/entry/src/main/ets/common/CommonMainTabs.ets#L20-L51 | 7e2a447db6f41372a8d8402405d01bc667db9b77 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderLogisticsPage.ets | arkts | getStepStatusColor | 获取步骤条状态颜色
@param {number} index - 当前索引
@returns {ResourceColor} 状态颜色 | private getStepStatusColor(index: number): ResourceColor {
return index === 0 ? $r("app.color.text_primary") : $r("app.color.text_secondary");
} | AST#method_declaration#Left private getStepStatusColor AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceColor... | private getStepStatusColor(index: number): ResourceColor {
return index === 0 ? $r("app.color.text_primary") : $r("app.color.text_secondary");
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L320-L322 | 0f5f55138e6635ea0b7ca8acb06b7fa2a5787d7c | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBar.d.ets | arkts | stateEffect | Sets whether or not to display the press status effect.
@param { boolean } stateEffect - press status effect.
@returns { ToolBarModifier } returns the instance of the ToolBarModifier.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 13
Sets whether or not to display the press status effect.
@param { ... | stateEffect(stateEffect: boolean): ToolBarModifier; | AST#method_declaration#Left stateEffect AST#parameter_list#Left ( AST#parameter#Left stateEffect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier AST#p... | stateEffect(stateEffect: boolean): ToolBarModifier; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBar.d.ets#L496-L496 | 20d6329f2184799d9fb671a3930e6183c7945dea | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecomment/src/main/ets/components/model/CommentModel.ets | arkts | totalCount | TODO:知识点:获取懒加载数据源的数据长度 | totalCount(): number {
return this.comments.length;
} | AST#method_declaration#Left totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Le... | totalCount(): number {
return this.comments.length;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/model/CommentModel.ets#L107-L109 | b31dfb98e9b98fd5d4f59486120fe0632f23379a | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/pages/TaskReviewView.ets | arkts | openFlawDetail | 打开故障详情 | async openFlawDetail(flaw: FlawInfo) {
try {
console.log('[TaskReviewView] 🔍 开始获取故障详情,ID:', flaw.id, '故障名称:', flaw.flawName);
// 调用接口获取完整的故障详情
const httpRequest = http.createHttp();
const response = await httpRequest.request(
`${AppConstants.API_BASE_URL}/agv/flaw/${flaw.id}`... | AST#method_declaration#Left async openFlawDetail AST#parameter_list#Left ( AST#parameter#Left flaw : AST#type_annotation#Left AST#primary_type#Left FlawInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Lef... | async openFlawDetail(flaw: FlawInfo) {
try {
console.log('[TaskReviewView] 🔍 开始获取故障详情,ID:', flaw.id, '故障名称:', flaw.flawName);
const httpRequest = http.createHttp();
const response = await httpRequest.request(
`${AppConstants.API_BASE_URL}/agv/flaw/${flaw.id}`,
{
... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L186-L267 | dd71310e8b0979b13cb9ccfae10655ea8fafebfa | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/ContactsPage.ets | arkts | enterSelectionMode | 进入选择模式 | private enterSelectionMode(): void {
this.isSelectionMode = true;
this.selectedContacts.clear();
} | AST#method_declaration#Left private enterSelectionMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#... | private enterSelectionMode(): void {
this.isSelectionMode = true;
this.selectedContacts.clear();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L102-L105 | a3afc4151710d425f785593e34363e2a3f1fd697 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets | arkts | getData | 获取指定索引数据 | public getData(index: number): string {
return this.tabContent[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | public getData(index: number): string {
return this.tabContent[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L69-L71 | 677e0626e5d4d1095a6f19ded25d4a634c759f1d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/analytics/AdvancedAnalyticsService.ets | arkts | 数据点接口 | export interface DataPoint {
timestamp: string;
value: number;
label?: string;
metadata?: Record<string, any>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DataPoint AST#object_type#Left { AST#type_member#Left timestamp : 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 value : AST#type_annotation#Le... | export interface DataPoint {
timestamp: string;
value: number;
label?: string;
metadata?: Record<string, any>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L39-L44 | 6120d8bab66a931fd215ad17a1b3acabae0e9ddb | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindMenuBackgroundEffect.ets | arkts | BindMenuBackgroundEffectBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function BindMenuBackgroundEffectBuilder(name: string, param: Object) {
BindMenuBackgroundEffectExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindMenuBackgroundEffectBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#para... | @Builder
export function BindMenuBackgroundEffectBuilder(name: string, param: Object) {
BindMenuBackgroundEffectExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindMenuBackgroundEffect.ets#L16-L19 | cd2c54822f2080e1bd725c2e51f6def72e9ac564 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | callUnload | Calls a tab to unload it if possible.
@param target The target index.
@returns True if success. | callUnload(target: number) {
let t0 = Date.now();
console.log(`[callUnload] Call of Unload! target: ${target}, this.Tabs[target].pre_restoration_stage: ${this.Tabs[target]?.pre_restoration_stage}`);
if (target >= 0 && !this.Tabs[target].pre_restoration_stage && target != this.main_tab_idx && target != this.... | AST#method_declaration#Left callUnload AST#parameter_list#Left ( AST#parameter#Left target : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left l... | callUnload(target: number) {
let t0 = Date.now();
console.log(`[callUnload] Call of Unload! target: ${target}, this.Tabs[target].pre_restoration_stage: ${this.Tabs[target]?.pre_restoration_stage}`);
if (target >= 0 && !this.Tabs[target].pre_restoration_stage && target != this.main_tab_idx && target != this.... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L308-L330 | 423d0c168dfb97a67995cf4a382ec53c141eb1c1 | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/DiskStorage.ets | arkts | destroy | 销毁资源 | async destroy(): Promise<void> {
if (this._preference) {
try {
// 注意:在某些上下文中可能无法删除preferences
if (this._context && this._context["removePreferencesFromCache"]) {
this._context["removePreferencesFromCache"](this.preference_name);
}
... | AST#method_declaration#Left async destroy 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_argument... | async destroy(): Promise<void> {
if (this._preference) {
try {
if (this._context && this._context["removePreferencesFromCache"]) {
this._context["removePreferencesFromCache"](this.preference_name);
}
} catch (error) {
... | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/DiskStorage.ets#L200-L218 | 86f19d75c15fdeebf19923febc392eac6b831570 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets | arkts | MyThemeConfigComp | 个性主题组件模块 | @Component
export struct MyThemeConfigComp {
@StorageProp(ThemeStorageKey.THEMEINDEX)
activeIndex: number = 0 // 被选中的主题
@State longPressGestureIndex: number = 0 // 长按选中主题
@StorageProp(ThemeStorageKey.THEMELIST)
themeList: ThemeItem[] = []
// 主题颜色
@StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {}... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyThemeConfigComp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left AST#member_expression#Left AST#expression#Left ThemeStorageKey AST#expression#Right . TH... | @Component
export struct MyThemeConfigComp {
@StorageProp(ThemeStorageKey.THEMEINDEX)
activeIndex: number = 0
@State longPressGestureIndex: number = 0
@StorageProp(ThemeStorageKey.THEMELIST)
themeList: ThemeItem[] = []
@StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem
dialog: ... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets#L8-L166 | 5042c66cb1cd3a859adc17d382d6c5c3d8dbcd01 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/entity/ToastOptions.ets | arkts | TODO Toast基本参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export class ToastOptions {
duration?: number; //显示时长(1500ms-10000ms)
alignment?: Alignment; //对齐方式。默认值:undefined,默认底部偏上位置。
bottom?: string | number; //设置弹窗底部边框距离导航条的高度,ToastShowMode.TOP_MOST模式下,软键盘拉起时,如果bottom值过小,toast要被软键盘遮挡时,会自动避让至距离软键盘80vp处。ToastShowMode.DEFAULT模式下,软键盘拉起时,会上移软键盘的高度。默认值:80vp。说明:当底部没有导航条时,botto... | AST#export_declaration#Left export AST#class_declaration#Left class ToastOptions AST#class_body#Left { AST#property_declaration#Left duration ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //显示时长(1500ms-10000ms) AST#property_de... | export class ToastOptions {
duration?: number;
alignment?: Alignment;
bottom?: string | number;
offset?: Offset
textColor?: ResourceColor;
backgroundColor?: ResourceColor;
backgroundBlurStyle?: BlurStyle;
shadow?: ShadowOptions | ShadowStyle;
showMode?: promptAction.ToastShowMode;
enableHov... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/entity/ToastOptions.ets#L24-L37 | a59c54b3fed6061f1d84b921a8b3b542ec88d554 | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/Base64Utils.ets | arkts | encode | 编码,通过输入参数编码后输出Uint8Array对象。
@param array
@returns | static encode(array: Uint8Array): Promise<Uint8Array> {
let base64 = new util.Base64Helper();
return base64.encode(array);
} | AST#method_declaration#Left static encode AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | static encode(array: Uint8Array): Promise<Uint8Array> {
let base64 = new util.Base64Helper();
return base64.encode(array);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/Base64Utils.ets#L51-L54 | 554a56925ad5cd2eb4b8a205e7fed6fb97b097c2 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showIcon | 显示带图标的 Toast
@param {string | ResourceStr} message - 提示内容
@param {Resource | string} icon - 图标资源或网络地址
@returns {void} 无返回值 | static showIcon(message: string | ResourceStr, icon: Resource | string): void {
IBestToast.show({
icon: icon,
iconWidth: 50,
message: message
});
} | AST#method_declaration#Left static showIcon AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Righ... | static showIcon(message: string | ResourceStr, icon: Resource | string): void {
IBestToast.show({
icon: icon,
iconWidth: 50,
message: message
});
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L80-L86 | 10bc081b1b63d366e8e25c6510fe1f46e7fa1e4f | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/MultiDeviceMusic/common/src/main/ets/constants/BreakpointConstants.ets | arkts | Constants for breakpoint. | export class BreakpointConstants {
/**
* Breakpoints that represent small device types.
*/
static readonly BREAKPOINT_SM: string = 'sm';
/**
* Breakpoints that represent middle device types.
*/
static readonly BREAKPOINT_MD: string = 'md';
/**
* Breakpoints that represent large device types.
... | AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /**
* Breakpoints that represent small device types.
*/ AST#property_declaration#Left static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_... | export class BreakpointConstants {
static readonly BREAKPOINT_SM: string = 'sm';
static readonly BREAKPOINT_MD: string = 'md';
static readonly BREAKPOINT_LG: string = 'lg';
static readonly CURRENT_BREAKPOINT: string = 'currentBreakpoint';
static readonly FONT_SIZE: string = 'fontSize';
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/MultiDeviceMusic/common/src/main/ets/constants/BreakpointConstants.ets#L19-L94 | e14014a0144647ce05e744775642125f52488658 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Read a text file from file uri.
If you have a context filesDir already, you can pass it to me.
@returns A string, of the requested file's content. | export function uri_read_text_sync(file_uri: string) {
console.log('[storage_tools][uri_read_text_sync] ' + file_uri);
let path = uri_2_path(file_uri);
if (!(fs.accessSync(path))) {
// file doesn't exist
console.log('[storage_tools][uri_read_text_sync][' + path + '] Doesn\'t exist!');
return "undefine... | AST#export_declaration#Left export AST#function_declaration#Left function uri_read_text_sync AST#parameter_list#Left ( AST#parameter#Left file_uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#L... | export function uri_read_text_sync(file_uri: string) {
console.log('[storage_tools][uri_read_text_sync] ' + file_uri);
let path = uri_2_path(file_uri);
if (!(fs.accessSync(path))) {
console.log('[storage_tools][uri_read_text_sync][' + path + '] Doesn\'t exist!');
return "undefined";
}
let file = ... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L453-L470 | da78bfa0f93c39e6db7b90be22b765fc4f825e4f | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/CategorySample/entry/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | getTabItems | Get tab item data.
@return {Array<TabItem>} tabItems | getTabItems() {
let tabItems: Array<TabItem> = [];
for (let index = 0; index < CommonConstants.TAB_BAR_SIZE; index++) {
let tabItem = new TabItem();
tabItem.index = index;
tabItem.title = $r('app.string.tab_text');
tabItem.imageOriginal = $r("app.media.ic_tab_normal");
tabItem.imag... | AST#method_declaration#Left getTabItems AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tabItems : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#ty... | getTabItems() {
let tabItems: Array<TabItem> = [];
for (let index = 0; index < CommonConstants.TAB_BAR_SIZE; index++) {
let tabItem = new TabItem();
tabItem.index = index;
tabItem.title = $r('app.string.tab_text');
tabItem.imageOriginal = $r("app.media.ic_tab_normal");
tabItem.imag... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategorySample/entry/src/main/ets/viewmodel/CategoryViewModel.ets#L31-L42 | d0d60a07be64bcbd1aba93c79c0631fa2ce1b901 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/view/ProfilePage.ets | arkts | LogoutCard | 退出登录卡片
@returns {void} 无返回值 | @Builder
private LogoutCard(): void {
Card({
onTap: (): void => this.vm.onLogoutClick()
}) {
ColumnCenter({
widthValue: P100,
paddingValue: $r("app.float.space_padding_large")
}) {
Text($r("app.string.logout"))
.fontSize($r("app.float.body_large"))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private LogoutCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_el... | @Builder
private LogoutCard(): void {
Card({
onTap: (): void => this.vm.onLogoutClick()
}) {
ColumnCenter({
widthValue: P100,
paddingValue: $r("app.float.space_padding_large")
}) {
Text($r("app.string.logout"))
.fontSize($r("app.float.body_large"))
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L220-L234 | 9106d75817f8e0f78be918a2c866fbb71e7c8ff0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/product/entry/src/main/ets/view/HelperView.ets | arkts | buildReadMeSheet | 帮助功能:半模态弹窗显示对应案例README | @Builder
buildReadMeSheet(): void {
Column() {
Row() {
Row() {
Text(this.currentSceneModuleInfo?.name)
.textOverflow({ overflow: TextOverflow.MARQUEE })
.fontColor(Color.White)
.fontWeight(700)
.fontSize($r('app.integer.nav_destination_title_... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildReadMeSheet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_elem... | @Builder
buildReadMeSheet(): void {
Column() {
Row() {
Row() {
Text(this.currentSceneModuleInfo?.name)
.textOverflow({ overflow: TextOverflow.MARQUEE })
.fontColor(Color.White)
.fontWeight(700)
.fontSize($r('app.integer.nav_destination_title_... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/view/HelperView.ets#L188-L256 | 07bd6af9b3a4d35caa7b6f2d56603ee0bee9d2ea | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/ChangeTimeDialog.ets | arkts | ChangeTimeDialog | 用户改变文件(夹)时间的弹窗 | @CustomDialog
export struct ChangeTimeDialog {
controller?: CustomDialogController
textController: TextInputController = new TextInputController()
confirm: () => void = () => {}
time: string = ''
aboutToAppear() {
if (this.time) {
AppStorage.setOrCreate('time', this.time);
}
}
build() {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct ChangeTimeDialog AST#component_body#Left { AST#property_declaration#Left controller ? : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST#ERR... | @CustomDialog
export struct ChangeTimeDialog {
controller?: CustomDialogController
textController: TextInputController = new TextInputController()
confirm: () => void = () => {}
time: string = ''
aboutToAppear() {
if (this.time) {
AppStorage.setOrCreate('time', this.time);
}
}
build() {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/ChangeTimeDialog.ets#L17-L90 | 6887f2946620af46d9ff01d68bfb21c608131a57 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/EntryOhos.ets | arkts | copy | returns an exact copy of the entry
@return | public copy(): EntryOhos {
var e: EntryOhos = new EntryOhos(this.x, this.getY(), null, this.getData());
return e;
} | AST#method_declaration#Left public copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left e : AST#ty... | public copy(): EntryOhos {
var e: EntryOhos = new EntryOhos(this.x, this.getY(), null, this.getData());
return e;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/EntryOhos.ets#L56-L59 | 9486c0743215d80f3618f2b9b50316257584ae90 | gitee |
lemoye622/vmall.git | eac911317a088cc92ca07c58f29c50e18c0a5286 | entry/src/main/ets/config/constants.ets | arkts | 获取屏幕高度 | export const SCREEN_HEIGHT = display.getDefaultDisplaySync().height; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SCREEN_HEIGHT = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getDefaultDisp... | export const SCREEN_HEIGHT = display.getDefaultDisplaySync().height; | https://github.com/lemoye622/vmall.git/blob/eac911317a088cc92ca07c58f29c50e18c0a5286/entry/src/main/ets/config/constants.ets#L5-L5 | 9e768e7f650a51062529292aa9f497530201fb3d | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/base/ChildComponent.ets | arkts | ChildComponent | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct ChildComponent {
@Link title: string
func: () => void = () => {
}
build() {
Button(this.title)
.onClick(this.func)
.key('button_1')
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChildComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right title : AST#ERROR#Left string func : AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left... | @Component
export struct ChildComponent {
@Link title: string
func: () => void = () => {
}
build() {
Button(this.title)
.onClick(this.func)
.key('button_1')
}
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/base/ChildComponent.ets#L16-L27 | ceb440c250ad38734239b6a15e3e28e1c2422a9b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnShowList.ets | arkts | ColumnShowList | Show List in Column | @Component
export struct ColumnShowList {
@Consume currentColumnJustifyContent: FlexAlign;
@Consume currentColumnAlignItems: HorizontalAlign;
build() {
Column() {
Column() {
ForEach(LIST, (item: number) => {
CommonItem({ item: item })
}, (item: number) => JSON.stringify(item))... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ColumnShowList AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right currentColumnJustifyContent : AST#type_annotation#Left AST#primary_type#Left FlexAlign AST#primar... | @Component
export struct ColumnShowList {
@Consume currentColumnJustifyContent: FlexAlign;
@Consume currentColumnAlignItems: HorizontalAlign;
build() {
Column() {
Column() {
ForEach(LIST, (item: number) => {
CommonItem({ item: item })
}, (item: number) => JSON.stringify(item))... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnShowList.ets#L29-L60 | 6e7e86d25ca528b3e7adb932165c1dad23466721 | gitee |
huaweicloud/huaweicloud-iot-device-sdk-arkts.git | 72954bea19e7e7f93567487b036c0664457bdaf3 | huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets | arkts | set | 设置消息监听器,用于接收平台下发的消息
此监听器只能接收平台到直连设备的请求,子设备的请求由AbstractGateway处理
@param rawDeviceMessageListener 消息监听器 | public set rawDeviceMessageListener(value: RawDeviceMessageListener | null) {
this._rawDeviceMessageListener = value;
} | AST#method_declaration#Left public set AST#ERROR#Left rawDeviceMessage List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RawDeviceMessageListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST... | public set rawDeviceMessageListener(value: RawDeviceMessageListener | null) {
this._rawDeviceMessageListener = value;
} | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets#L124-L126 | a284da0c08974a567f45e8fb557b4a946744eab5 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets | arkts | obtainingEnrolledCredentialInformation | obtain-enrolled-state-capabilities.md
以查询用户人脸注册凭据的状态为例
[Start obtain_enrolled_capabilities] | obtainingEnrolledCredentialInformation() {
try {
let enrolledState = userAuth.getEnrolledState(userAuth.UserAuthType.PIN);
Logger.info(`get current enrolled state success, enrolledState: ${JSON.stringify(enrolledState)}`);
return enrolledState.credentialDigest;
} catch (error) {
const er... | AST#method_declaration#Left obtainingEnrolledCredentialInformation 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#variable_declaration#Left let AST#variable_declarator#Left enrolledState = AS... | obtainingEnrolledCredentialInformation() {
try {
let enrolledState = userAuth.getEnrolledState(userAuth.UserAuthType.PIN);
Logger.info(`get current enrolled state success, enrolledState: ${JSON.stringify(enrolledState)}`);
return enrolledState.credentialDigest;
} catch (error) {
const er... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L483-L493 | e826a75b5e36e626c9fedfb4ac3e8cf7c34b25e0 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/GoodsRepository.ets | arkts | submitGoodsComment | 提交商品评论
@param params 评论提交请求参数
@returns 提交结果 | async submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.submitGoodsComment(params);
} | AST#method_declaration#Left async submitGoodsComment AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsCommentSubmitRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#... | async submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.submitGoodsComment(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/GoodsRepository.ets#L82-L84 | fec6f6113e508f8e14c9ff5d8dda4dbb789304b8 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SimpleCalculator/entry/src/main/ets/viewmodel/PresskeysViewModel.ets | arkts | getPressKeys | Key array data. | getPressKeys(): Array<Array<PressKeysItem>>{
return [
[
new PressKeysItem(0, '32vp', '32vp', 'clean', $r('app.media.ic_clean')),
new PressKeysItem(1, '19vp', '43vp', '7'),
new PressKeysItem(1, '19vp', '43vp', '4'),
new PressKeysItem(1, '19vp', '43vp', '1'),
new PressKey... | AST#method_declaration#Left getPressKeys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Le... | getPressKeys(): Array<Array<PressKeysItem>>{
return [
[
new PressKeysItem(0, '32vp', '32vp', 'clean', $r('app.media.ic_clean')),
new PressKeysItem(1, '19vp', '43vp', '7'),
new PressKeysItem(1, '19vp', '43vp', '4'),
new PressKeysItem(1, '19vp', '43vp', '1'),
new PressKey... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SimpleCalculator/entry/src/main/ets/viewmodel/PresskeysViewModel.ets#L23-L174 | 6c243758c51f33d356d118fb6608d38b039faf4e | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | cancelGroup | 取消本应用指定组下的通知
@param groupName 通知组名称,此名称需要在发布通知时通过NotificationRequest对象指定。
@returns | static async cancelGroup(groupName: string): Promise<void> {
return notificationManager.cancelGroup(groupName);
} | AST#method_declaration#Left static async cancelGroup AST#parameter_list#Left ( AST#parameter#Left groupName : 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... | static async cancelGroup(groupName: string): Promise<void> {
return notificationManager.cancelGroup(groupName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L305-L307 | 753db3b9e5c174678c4eab71488178527be2504c | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/OrderGoods.ets | arkts | @file 订单商品
@author Joker.X | export class OrderGoods {
/**
* ID
*/
id: number = 0;
/**
* 订单ID
*/
orderId: number = 0;
/**
* 商品ID
*/
goodsId: number = 0;
/**
* 价格
*/
price: number = 0;
/**
* 优惠金额
*/
discountPrice: number = 0;
/**
* 数量
*/
count: number = 0;
/**
* 其他信息
*/
remark?: ... | AST#export_declaration#Left export AST#class_declaration#Left class OrderGoods AST#class_body#Left { /**
* ID
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_dec... | export class OrderGoods {
id: number = 0;
orderId: number = 0;
goodsId: number = 0;
price: number = 0;
discountPrice: number = 0;
count: number = 0;
remark?: string | null = null;
goodsInfo?: Goods | null = null;
spec?: GoodsSpec | null = null;
isComment: number = 0;
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/OrderGoods.ets#L8-L73 | 5733ea4fb444cd965f8771d958ec23469660f30e | github | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/BusinessSample/entry/src/main/ets/view/CardContentComponent.ets | arkts | CardContentComponent | Card content contains the information list. | @Component
export struct CardContentComponent {
build() {
Scroll() {
Stack({ alignContent: Alignment.Top }) {
Rect()
.width(CommonConstants.RECT_WIDTH_PERCENT)
.height($r('app.float.card_rect_height'))
.margin({ top: $r('app.float.card_margin_top') })
.fill($r... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CardContentComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_... | @Component
export struct CardContentComponent {
build() {
Scroll() {
Stack({ alignContent: Alignment.Top }) {
Rect()
.width(CommonConstants.RECT_WIDTH_PERCENT)
.height($r('app.float.card_rect_height'))
.margin({ top: $r('app.float.card_margin_top') })
.fill($r... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BusinessSample/entry/src/main/ets/view/CardContentComponent.ets#L11-L69 | c32126d475b48a8908e80f75ee92a76584ed8668 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/main/sub/report/RadarView.ets | arkts | get | 计算当前比率 (0~1) | get ratio(): number {
return this.allCount > 0 ? Math.min(this.curCount / this.allCount, 1) : 0;
} | AST#method_declaration#Left get AST#ERROR#Left ratio AST#ERROR#Right 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... | get ratio(): number {
return this.allCount > 0 ? Math.min(this.curCount / this.allCount, 1) : 0;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L393-L395 | b0aa6f51d6f78c781c1fea1fb773cf84f57d013d | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SHASync.ets | arkts | digestSHA224 | SHA224摘要
@param str 带摘要的字符串
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns 摘要后的字符串 | static digestSHA224(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SHA224', resultCoding);
} | AST#method_declaration#Left static digestSHA224 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t... | static digestSHA224(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SHA224', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHASync.ets#L45-L47 | 4a1ff58fb9ecca7064dec6c6c42666f1dfd979e5 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getAllFavorites | /获取所有收藏级别(去重并排序) | public getAllFavorites(): number[] {
let favorites: number[] = [];
for (let word of this.getAliveWords()) {
if (word.favoriteLevel > 0 && !word.isDeleted()) { // 未删除
if (!favorites.includes(word.favoriteLevel)) { // 去重
favorites.push(word.favoriteLevel);
}
}
}
... | AST#method_declaration#Left public getAllFavorites AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declara... | public getAllFavorites(): number[] {
let favorites: number[] = [];
for (let word of this.getAliveWords()) {
if (word.favoriteLevel > 0 && !word.isDeleted()) {
if (!favorites.includes(word.favoriteLevel)) {
favorites.push(word.favoriteLevel);
}
}
}
favori... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L541-L558 | 27711776518ee8590c21e7550a5bf159f5641af0 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageReactionRemoveAll.ets | arkts | Emitted whenever all reactions are removed from a cached message.
@event Client#messageReactionRemoveAll
@param {Message} message The message the reactions were removed from
应用ArkTS约束:使用export default代替module.exports(约束60) | export default MessageReactionRemoveAll; | AST#export_declaration#Left export default AST#expression#Left MessageReactionRemoveAll AST#expression#Right ; AST#export_declaration#Right | export default MessageReactionRemoveAll; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageReactionRemoveAll.ets#L31-L31 | 638ea9601d4351de2cffdc7cc4f686e4937d9be0 | github | |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/UserService.ets | arkts | saveUserInfo | 保存用户信息
@param userInfo 用户信息 | async saveUserInfo(userInfo: UserInfo): Promise<boolean> {
try {
const cloudObject = userInfo.toCloudObject();
return await this.cloudDBService.saveUserInfo(cloudObject);
} catch (error) {
console.error('保存用户信息失败:', error);
return false;
}
} | AST#method_declaration#Left async saveUserInfo AST#parameter_list#Left ( AST#parameter#Left userInfo : AST#type_annotation#Left AST#primary_type#Left UserInfo 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 saveUserInfo(userInfo: UserInfo): Promise<boolean> {
try {
const cloudObject = userInfo.toCloudObject();
return await this.cloudDBService.saveUserInfo(cloudObject);
} catch (error) {
console.error('保存用户信息失败:', error);
return false;
}
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L192-L200 | 259dc31de88406993f284615ef17fb33efd03f4c | github |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/crypto/authUtils.ets | arkts | Reference: https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/errorcode-useriam-V5 | export enum AUTH_ERROR_CODE {
AUTH_SUCCESS = 12500000,
AUTH_FAILED = 12500001,
GENERAL_OPERATION_ERROR = 12500002,
AUTH_CANCELED = 12500003,
AUTH_TIMEOUT = 12500004,
AUTH_TYPE_NOT_SUPPORT = 12500005,
AUTH_LEVEL_NOT_SUPPORT = 12500006,
AUTH_SERVICE_BUSY = 12500007,
AUTH_LOCKED_OUT = 1... | AST#export_declaration#Left export AST#enum_declaration#Left enum AUTH_ERROR_CODE AST#enum_body#Left { AST#enum_member#Left AUTH_SUCCESS = AST#expression#Left 12500000 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left AUTH_FAILED = AST#expression#Left 12500001 AST#expression#Right AST#enum_member#Right ... | export enum AUTH_ERROR_CODE {
AUTH_SUCCESS = 12500000,
AUTH_FAILED = 12500001,
GENERAL_OPERATION_ERROR = 12500002,
AUTH_CANCELED = 12500003,
AUTH_TIMEOUT = 12500004,
AUTH_TYPE_NOT_SUPPORT = 12500005,
AUTH_LEVEL_NOT_SUPPORT = 12500006,
AUTH_SERVICE_BUSY = 12500007,
AUTH_LOCKED_OUT = 1... | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/crypto/authUtils.ets#L16-L30 | 218894f6df26736387bbf49e24cd904e9f410d9d | github | |
Delsin-Yu/JustPDF.git | d53f566e02820dac46e1752151750144acbed50a | entry/src/main/ets/components/PageInfo.ets | arkts | movePageToGroupEnd | Moves a page to the end of a specific group.
This method explicitly targets a group, making it suitable for cross-group moves
including moves to empty groups.
@param srcGlobalIndex The global index of the page to move
@param targetGroup The group to append the page to | public movePageToGroupEnd(srcGlobalIndex: number, targetGroup: PageGroup): void {
const totalPages = this.totalPageCount();
if (srcGlobalIndex < 0 || srcGlobalIndex >= totalPages) {
throw new Error(`Source index ${srcGlobalIndex} out of bounds`);
}
const targetGroupIndex = this.pageGroups.indexOf... | AST#method_declaration#Left public movePageToGroupEnd AST#parameter_list#Left ( AST#parameter#Left srcGlobalIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetGroup : AST#type_annotation#Left AST#primary_type#Left... | public movePageToGroupEnd(srcGlobalIndex: number, targetGroup: PageGroup): void {
const totalPages = this.totalPageCount();
if (srcGlobalIndex < 0 || srcGlobalIndex >= totalPages) {
throw new Error(`Source index ${srcGlobalIndex} out of bounds`);
}
const targetGroupIndex = this.pageGroups.indexOf... | https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L810-L859 | 0f5983177c355472abe96f310143cc1e0cfb3ed0 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onActionEnd | The LongPress gesture is successfully recognized. When the finger is lifted, the callback is triggered.
@param { Callback<GestureEvent> } event
@returns { LongPressGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onActionEnd(event: Callback<GestureEvent>): LongPressGesture; | AST#method_declaration#Left onActionEnd AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | onActionEnd(event: Callback<GestureEvent>): LongPressGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L441-L441 | a1497f22992dfca9fcb64003110559b694f3cf42 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | getUIContext | 获取UIContext
@returns | static getUIContext(): UIContext {
return AppUtil.getMainWindow().getUIContext();
} | AST#method_declaration#Left static getUIContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UIContext 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_exp... | static getUIContext(): UIContext {
return AppUtil.getMainWindow().getUIContext();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L90-L92 | c2a01c09805e2615cb75f4dac1ea7289cb074589 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/social/SearchPage.ets | arkts | buildSearchBar | 构建搜索栏 | @Builder
buildSearchBar() {
Row({ space: 12 }) {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
rou... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchBar 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#component_parameters#Left { AST#component_paramet... | @Builder
buildSearchBar() {
Row({ space: 12 }) {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
rou... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/SearchPage.ets#L93-L163 | 039091601ed62bbe446758d3445ace10f9282030 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/MD5.ets | arkts | digest | MD5摘要
@param str 带摘要的字符串
@param resultCoding 返回结果编码方式(hex/base64)-不传默认为base64
@returns 摘要后的字符串 | static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.digest(str, 'MD5', resultCoding);
} | AST#method_declaration#Left static digest 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Le... | static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.digest(str, 'MD5', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/MD5.ets#L37-L39 | 48c2d73c19f99801e9d440b2f6faaf508696d590 | gitee |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/utils/HttpUtil.ets | arkts | searchCitiesByName | ===================== 业务方法:根据城市名搜索城市 ===================== | static async searchCitiesByName(cityName: string): Promise<CityInfo[]> {
// 1. 空名称直接返回空数组
if (!cityName.trim()) {
return [];
}
// 2. 构建URL并修复&符号转义
const requestUrl = `${WEATHER_CONFIG.CITY_URL}?location=${encodeURIComponent(cityName)}&key=${WEATHER_CONFIG.API_KEY}`;
// 3. 发起GET请求(使用正确的泛型... | AST#method_declaration#Left static async searchCitiesByName AST#parameter_list#Left ( AST#parameter#Left cityName : 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#g... | static async searchCitiesByName(cityName: string): Promise<CityInfo[]> {
if (!cityName.trim()) {
return [];
}
const requestUrl = `${WEATHER_CONFIG.CITY_URL}?location=${encodeURIComponent(cityName)}&key=${WEATHER_CONFIG.API_KEY}`;
const response = await HttpUtil.get<CityResponse>(r... | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/HttpUtil.ets#L84-L109 | d71a3f5851fa753be9c3f64b6a93b92017510fbc | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets | arkts | setTag | 设置日志标识(该方法建议在Ability里调用)
@param tag | static setTag(tag: string = LOGGER_TAG) {
LogUtil.tag = tag
} | AST#method_declaration#Left static setTag AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left LOGGER_TAG AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bo... | static setTag(tag: string = LOGGER_TAG) {
LogUtil.tag = tag
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets#L38-L40 | 59e0d787d83ea2e1109597926be7f85dcf7e2f92 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.