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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | BaseItemInfo
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare class BaseItemInfo {
/**
* Uri. if the itemType is CAMERA, it will be null
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
uri?: string;
/**
* MimeType. if the itemType is CAMERA, it will be null
*
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class BaseItemInfo AST#class_body#Left { /**
* Uri. if the itemType is CAMERA, it will be null
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* ... | export declare class BaseItemInfo {
uri?: string;
mimeType?: string;
width?: number;
height?: number;
size?: number;
duration?: number;
photoSubType?: photoAccessHelper.PhotoSubtype;
dynamicRangeType?: photoAccessHelper.DynamicRangeType;
orientation?: number;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L557-L648 | e34128c14ff93d01c47c41f2ec02695e86ccdc56 | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/lottie/LottieView.ets | arkts | removeEventListener | 删除侦听事件
@param name 事件名称, 有效范围见AnimationEventName声明
@param AnimationEventCallback 用户自定义回调函数; 缺省为空时, 删除此事件的所有回调函数。
@since 8
@design | removeEventListener<T extends AnimationEventName>(name: T,
callback?: AnimationEventCallback<AnimationEventsIndexed<T>>) {
this.animationItem?.removeEventListener(name, callback)
} | AST#method_declaration#Left removeEventListener AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AnimationEventName AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Lef... | removeEventListener<T extends AnimationEventName>(name: T,
callback?: AnimationEventCallback<AnimationEventsIndexed<T>>) {
this.animationItem?.removeEventListener(name, callback)
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L324-L327 | 0faee6a117ce94bd6e238bbb5abc33b2e6867a78 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/empty/EmptyError.ets | arkts | 构建错误缺省页视图
@returns {void} 无返回值 | build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_page"),
actionText: this.actionText,
onAction: this.onAction
});
} | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Empty ( AST#component_parameters#Left { AST#component_parameter#Left description : AST#expression#Left AST#member_expression... | build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_page"),
actionText: this.actionText,
onAction: this.onAction
});
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/EmptyError.ets#L31-L38 | d8a9261a97616420a56a003498cbf6278088acce | github | |
weiwei0928/Eyepetizer-harmony.git | fd5947c6f616c22d42256f36ba752093b782a910 | entry/src/main/ets/common/utils/DialogUtil.ets | arkts | 展示loading
@param tips | export function showLoadingDialog(tips: string = "") {
emitter.emit(loadingEvent, LoadingDialogEvent(true, tips))
} | AST#export_declaration#Left export AST#function_declaration#Left function showLoadingDialog AST#parameter_list#Left ( AST#parameter#Left tips : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right ) AST#p... | export function showLoadingDialog(tips: string = "") {
emitter.emit(loadingEvent, LoadingDialogEvent(true, tips))
} | https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/utils/DialogUtil.ets#L9-L11 | 1a2afa17f55225716d391afb3be960bb9db2e102 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chatwithexpression/Index.ets | arkts | ChatWithExpressionComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { ChatWithExpressionComponent } from './src/main/ets/view/ChatWithExpression'; | AST#export_declaration#Left export { ChatWithExpressionComponent } from './src/main/ets/view/ChatWithExpression' ; AST#export_declaration#Right | export { ChatWithExpressionComponent } from './src/main/ets/view/ChatWithExpression'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chatwithexpression/Index.ets#L15-L15 | 980861f991e0f98868a9b2593552f2f266fee8a2 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BubbleChartModel.ets | arkts | init | @Override | protected init(): void {
super.init();
if (this.mAnimator) {
this.mRenderer = new BubbleChartRenderer(this, this.mAnimator, this.mViewPortHandler);
}
} | AST#method_declaration#Left protected init AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | protected init(): void {
super.init();
if (this.mAnimator) {
this.mRenderer = new BubbleChartRenderer(this, this.mAnimator, this.mViewPortHandler);
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BubbleChartModel.ets#L53-L59 | a0e896b59017a4b73b251843b78c826524b69a22 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/main/sub/report/RadarView.ets | arkts | ChartPart | ChartPart.ets - 数据模型定义 | @ObservedV2
export class ChartPart {
@Trace partName: string = '';
@Trace allCount: number = 0;
@Trace curCount: number = 0;
@Trace color: string = '#994CAF50';
constructor(partName?: string, allCount?: number, curCount?: number, color?: string) {
if (partName) this.partName = partName;
if (allCount ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class ChartPart AST#class_body#Left { AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right partName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#... | @ObservedV2
export class ChartPart {
@Trace partName: string = '';
@Trace allCount: number = 0;
@Trace curCount: number = 0;
@Trace color: string = '#994CAF50';
constructor(partName?: string, allCount?: number, curCount?: number, color?: string) {
if (partName) this.partName = partName;
if (allCount ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L378-L401 | 1daa76964e1be58c9c9eb3a8baa90bc85e1c523e | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/FuncUtils.ets | arkts | 给函数的执行加上动画
@param fn:要在动画内执行的回调函数,通常fn里面会改变状态变量
@param duration:动画持续时长
@param curve:动画区线 | export function runWithAnimation(
fn: Function,
duration: number = ImageViewerConstants.ANIMATE_DURATION,
curve: Curve = Curve.Smooth): void {
animateTo({ duration: duration, curve: curve }, () => {
fn();
})
} | AST#export_declaration#Left export AST#function_declaration#Left function runWithAnimation AST#parameter_list#Left ( AST#parameter#Left fn : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left duration : AST#type_annotation#Le... | export function runWithAnimation(
fn: Function,
duration: number = ImageViewerConstants.ANIMATE_DURATION,
curve: Curve = Curve.Smooth): void {
animateTo({ duration: duration, curve: curve }, () => {
fn();
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/FuncUtils.ets#L24-L31 | 2e0d09d78d60b45c82d17232240cb20de3e09149 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogBuilder.ets | arkts | TextAreaDialogBuilder | TextAreaDialog
@param options | @Builder
export function TextAreaDialogBuilder(options: TextAreaOptions) {
TextAreaDialogView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TextAreaDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TextAreaOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#pa... | @Builder
export function TextAreaDialogBuilder(options: TextAreaOptions) {
TextAreaDialogView({ options: options });
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L147-L150 | 1db0f3f0728627af3d2ddf978f44db83eb3e91a4 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | buildSearchTag | 构建搜索标签 | @Builder
buildSearchTag(text: string, onTap: () => void, backgroundColor: string = '#f0f0f0') {
Text(text)
.fontSize(14)
.fontColor('#666666')
.padding({ left: 12, right: 12, top: 6, bottom: 6 })
.backgroundColor(backgroundColor)
.borderRadius(16)
.onClick(onTap)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchTag 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#Left onTap : AST#type_annotation#Left... | @Builder
buildSearchTag(text: string, onTap: () => void, backgroundColor: string = '#f0f0f0') {
Text(text)
.fontSize(14)
.fontColor('#666666')
.padding({ left: 12, right: 12, top: 6, bottom: 6 })
.backgroundColor(backgroundColor)
.borderRadius(16)
.onClick(onTap)
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L393-L402 | feb03bf17f203c4ae25bd164afa2a8da35f3df9d | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/live/LiveManager.ets | arkts | leaveRoom | 离开直播间 | async leaveRoom(): Promise<void> {
try {
Logger.info('LiveManager', 'Leaving room');
this.currentRoom = null;
this.liveStatus.isPlaying = false;
this.danmakuList = [];
EventBus.emit('LIVE_ROOM_LEFT');
} catch (error) {
Logger.error('LiveManager', `Failed to leave room: ${Stri... | AST#method_declaration#Left async leaveRoom 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_argume... | async leaveRoom(): Promise<void> {
try {
Logger.info('LiveManager', 'Leaving room');
this.currentRoom = null;
this.liveStatus.isPlaying = false;
this.danmakuList = [];
EventBus.emit('LIVE_ROOM_LEFT');
} catch (error) {
Logger.error('LiveManager', `Failed to leave room: ${Stri... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/live/LiveManager.ets#L90-L100 | b290ea71c7e59d5d720fddcd9ecd1553848f4370 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets | arkts | 将数据绑定到组件并提供接口。 | export class WindowViewModel {
/**
* 获取验证项目映射。
*
* @return {Map<number, VerifyItem>} verifyMap.
*/
getVerifyMap(): Map<number, VerifyItem> {
let verifyMap: Map<number, VerifyItem> = new Map();
verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK'));
verifyMap.set(1, n... | AST#export_declaration#Left export AST#class_declaration#Left class WindowViewModel AST#class_body#Left { /**
* 获取验证项目映射。
*
* @return {Map<number, VerifyItem>} verifyMap.
*/ AST#method_declaration#Left getVerifyMap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t... | export class WindowViewModel {
getVerifyMap(): Map<number, VerifyItem> {
let verifyMap: Map<number, VerifyItem> = new Map();
verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK'));
verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR'));
return verify... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets#L8-L85 | f337cdd38ddfc2a9385d2fbb1a7ce4ae192ec4a8 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets | arkts | pictures of newest. | export const PICTURE_LATEST: PictureItem[] = [
{ id: '1', name: '潮·设计大会', description: '国际设计大师分...', image: $r('app.media.ic_movie1') },
{ id: '2', name: '食客', description: '味蕾爆炸', image: $r('app.media.ic_movie2') },
{ id: '3', name: '绿野仙踪', description: '热带雨林的故事', image: $r('app.media.ic_movie3') },
{ id: '4',... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PICTURE_LATEST : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PictureItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST... | export const PICTURE_LATEST: PictureItem[] = [
{ id: '1', name: '潮·设计大会', description: '国际设计大师分...', image: $r('app.media.ic_movie1') },
{ id: '2', name: '食客', description: '味蕾爆炸', image: $r('app.media.ic_movie2') },
{ id: '3', name: '绿野仙踪', description: '热带雨林的故事', image: $r('app.media.ic_movie3') },
{ id: '4',... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets#L50-L60 | 775d8c320630c8f85867f42442f2733851aaa493 | gitee | |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/CropComponent.ets | arkts | 裁剪控制器 | export interface CropController {
/**
* 裁剪按钮点击
* @param cropChangedData 变化数据
* @returns 裁剪操作数据
*/
onCropButtonClick: (cropChangedData: CropChangedData) => CropData
/**
* 旋转按钮操作
* @param angle 旋转角度
* @returns 裁剪操作数据
*/
onRotate: (angle: number) => CropData
/**
* 退出裁剪功能
* @returns ... | AST#export_declaration#Left export AST#interface_declaration#Left interface CropController AST#object_type#Left { /**
* 裁剪按钮点击
* @param cropChangedData 变化数据
* @returns 裁剪操作数据
*/ AST#type_member#Left onCropButtonClick : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#L... | export interface CropController {
onCropButtonClick: (cropChangedData: CropChangedData) => CropData
onRotate: (angle: number) => CropData
onExitCropFunction: () => MatrixRecord
onEnterCropFunction: () => MatrixRecord
onUndoCrop: (cropData: CropData) => Array<MatrixRecord>
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/CropComponent.ets#L50-L79 | d554b0c37d8c4b81e5e88f1b18765b6d8dcf28ea | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/utils.ets | arkts | 获取粘贴类型 | export const getPasteDataSync = () => {
try {
const data = pasteboard.getSystemPasteboard().getUnifiedDataSync()
let records = data.getRecords();
let record = records[0] as unifiedDataChannel.PlainText;
return record.textContent
} catch (e) {
console.error(`获取失败:${e}`);
return undefined
}
... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left getPasteDataSync = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { A... | export const getPasteDataSync = () => {
try {
const data = pasteboard.getSystemPasteboard().getUnifiedDataSync()
let records = data.getRecords();
let record = records[0] as unifiedDataChannel.PlainText;
return record.textContent
} catch (e) {
console.error(`获取失败:${e}`);
return undefined
}
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/utils.ets#L5-L17 | 81b2a6090841a93a9e7824287e04896aa712a3a9 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/TaskManagement/WorkScheduler/entry/src/main/ets/feature/WorkSchedulerSystem.ets | arkts | Register the delayed task and pass the parameters.
@param url Url of the application package.
@permission ohos.permission.INTERNET | export async function getNewHap(url: string): Promise<http.HttpResponse> {
try {
return await http.createHttp().request(
url,
{
expectDataType: http.HttpDataType.ARRAY_BUFFER
});
} catch (err) {
Logger.error(`get result failed, code is ${err.code}, message is ${err.... | AST#export_declaration#Left export AST#function_declaration#Left async function getNewHap AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AS... | export async function getNewHap(url: string): Promise<http.HttpResponse> {
try {
return await http.createHttp().request(
url,
{
expectDataType: http.HttpDataType.ARRAY_BUFFER
});
} catch (err) {
Logger.error(`get result failed, code is ${err.code}, message is ${err.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/TaskManagement/WorkScheduler/entry/src/main/ets/feature/WorkSchedulerSystem.ets#L142-L152 | 0bf263cdeaaceb97fca783f00dafd8085a1bb0a2 | gitee | |
Neptune-EX/OS_System_Design.git | c728a82d48079ae0c52d50c4a2e2586b69f4ce55 | entry/src/main/ets/common/utils/FileManager.ets | arkts | searchFilesWithInfo | // 8. 获取文件信息 async getFileInfo(filename: string): Promise<FileInfoType> { try { const filePath = this.getFilesDir() + '/' + filename; const stat = await fs.stat(filePath); return { filename: filename, size: stat.size, mtime: stat.mtime, ctime: stat.ctime }; } catch (error) { Logger.error(`getFileInfo failed: ${JSON.st... | async searchFilesWithInfo(keyword: string): Promise<FileInfo[]> {
try {
const allFiles = await this.getAllFilesWithInfo();
if (!keyword || keyword.trim() === '') {
return allFiles;
}
const searchTerm = keyword.toLowerCase();
return allFiles.filter(fileInfo =>
fileInfo.f... | AST#method_declaration#Left async searchFilesWithInfo AST#parameter_list#Left ( AST#parameter#Left keyword : 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_... | async searchFilesWithInfo(keyword: string): Promise<FileInfo[]> {
try {
const allFiles = await this.getAllFilesWithInfo();
if (!keyword || keyword.trim() === '') {
return allFiles;
}
const searchTerm = keyword.toLowerCase();
return allFiles.filter(fileInfo =>
fileInfo.f... | https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/FileManager.ets#L103-L119 | a611bb305b4033ce8d5bdfdb22a3f548e84e303b | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/KvUtil.ets | arkts | putBatch | 批量插入键值对到SingleKVStore数据库中
@param entries 表示要批量插入的键值对。一个entries对象中允许的最大数据量为512M。
@returns | static async putBatch(entries: distributedKVStore.Entry[]): Promise<void> {
let kvStore = await KvUtil.getKvStore();
return kvStore.putBatch(entries);
} | AST#method_declaration#Left static async putBatch AST#parameter_list#Left ( AST#parameter#Left entries : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left distributedKVStore . Entry AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left [ ] AST#... | static async putBatch(entries: distributedKVStore.Entry[]): Promise<void> {
let kvStore = await KvUtil.getKvStore();
return kvStore.putBatch(entries);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L134-L137 | 35abfee9316d0aa3d97a5a7c824b67d9e25a9268 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/AudioManagerPage.ets | arkts | start | 开始录音 | async start() {
if (this.audioCapturer !== undefined) {
let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]
if (stateGroup.indexOf((this.audioCapturer as audio.AudioCapturer).state.valueOf()) === -1) { // 当且仅当状态为STATE_PREPARED、STATE_PAUSED和ST... | AST#method_declaration#Left async start AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . audioCapture... | async start() {
if (this.audioCapturer !== undefined) {
let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]
if (stateGroup.indexOf((this.audioCapturer as audio.AudioCapturer).state.valueOf()) === -1) {
console.error(`: start failed`)... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/AudioManagerPage.ets#L49-L86 | 087f4593faf770c1326b03e79a2c54b07ad375ce | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | get_contents_in_html | Encode this folder into HTML style text.
@param number_of_spaces The number of spaces in the front the line (forming an indent).
@returns The encoded HTML style text of this folder, containing its sub folders. | get_contents_in_html(number_of_spaces: number) {
let spaces: number = number_of_spaces;
let type: string = "";
let item: bookmark;
let result: string[] = [];
result.push(" ".repeat(spaces) +
"<DT><H3 ADD_DATE=\"" + this.add_date.toString() +
"\" LAST_MODIFIED=\"" + this.last_modified.toS... | AST#method_declaration#Left get_contents_in_html AST#parameter_list#Left ( AST#parameter#Left number_of_spaces : 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#variabl... | get_contents_in_html(number_of_spaces: number) {
let spaces: number = number_of_spaces;
let type: string = "";
let item: bookmark;
let result: string[] = [];
result.push(" ".repeat(spaces) +
"<DT><H3 ADD_DATE=\"" + this.add_date.toString() +
"\" LAST_MODIFIED=\"" + this.last_modified.toS... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L784-L813 | e3fe25adb1869b0be6ba0b7dbeb0582173a8ef15 | gitee |
robotzzh/AgricultureApp.git | 7b12c588dd1d07cc07a8b25577d785d30bd838f6 | entry/src/main/ets/common/History_Info.ets | arkts | to_arraylist | --------------------数据库操作部分(finished)------------------// --------------------数组装配部分 -------------------------// | static to_arraylist(message):ArrayList<number>{
let array = new ArrayList<number>();
if(!Object.keys(message)) return array;
for(let index of Object.keys(message)){
array.add(message[index]);
}
//console.info("begin= "+array[0].toString()+"length = "+array.length)
return array;
} | AST#method_declaration#Left static to_arraylist AST#parameter_list#Left ( AST#parameter#Left message AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary... | static to_arraylist(message):ArrayList<number>{
let array = new ArrayList<number>();
if(!Object.keys(message)) return array;
for(let index of Object.keys(message)){
array.add(message[index]);
}
return array;
} | https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/common/History_Info.ets#L189-L197 | 8675067349160204dfc30728e4160dd730f952e2 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getMapFromJson | ================== JSON处理方法 ================== | static getMapFromJson(json: string): Record<string, string> {
try {
return JSON.parse(json) as Record<string, string>;
} catch (error) {
console.error("JSON解析错误:", error);
return {};
}
} | AST#method_declaration#Left static getMapFromJson AST#parameter_list#Left ( AST#parameter#Left json : 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#Le... | static getMapFromJson(json: string): Record<string, string> {
try {
return JSON.parse(json) as Record<string, string>;
} catch (error) {
console.error("JSON解析错误:", error);
return {};
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L428-L435 | 41c9c38d0cfae47e9888b3e573a9d47a77905d33 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | delete | 删除缓存值
@param key
@param preferenceName
@returns | static async delete(key: string, preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<void> {
let preferences = await PreferencesUtil.getPreferences(preferenceName); //获取实例
await preferences.delete(key);
return preferences.flush() //此处一定要flush,要不然不能永久序列化到本地
} | AST#method_declaration#Left static async delete AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | static async delete(key: string, preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<void> {
let preferences = await PreferencesUtil.getPreferences(preferenceName);
await preferences.delete(key);
return preferences.flush()
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L228-L232 | 534acdea96056a396767a09178a307a7b89fa765 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/viewmodel/NavigationResultViewModel.ets | arkts | submitResult | 组装结果并返回上一页
@returns {void} 无返回值 | submitResult(): void {
const result: DemoResult = {
title: this.titleInput.trim(),
description: this.descInput.trim()
};
navigateBackWithResult(result);
} | AST#method_declaration#Left submitResult AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST... | submitResult(): void {
const result: DemoResult = {
title: this.titleInput.trim(),
description: this.descInput.trim()
};
navigateBackWithResult(result);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/NavigationResultViewModel.ets#L43-L49 | 84136c26ba90178d4208c10fed2b1add1ab63597 | github |
openharmony/bundlemanager_bundle_framework | 89882654172b6bfba2a4a1ebfacdd6c9296f6f21 | interfaces/kits/ani/resource_manager/ets/bundleManager/BundleResourceInfo.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface BundleResourceInfo {
readonly bundleName: string;
readonly icon: string;
readonly label: string;
readonly appIndex: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BundleResourceInfo AST#object_type#Left { AST#type_member#Left readonly AST#ERROR#Left bundleName AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; A... | export interface BundleResourceInfo {
readonly bundleName: string;
readonly icon: string;
readonly label: string;
readonly appIndex: number;
} | https://github.com/openharmony/bundlemanager_bundle_framework/blob/89882654172b6bfba2a4a1ebfacdd6c9296f6f21/interfaces/kits/ani/resource_manager/ets/bundleManager/BundleResourceInfo.ets#L16-L21 | acd4ef6f6e5fb34547ee58a5124f366ddf9c5090 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkJsObject.ets | arkts | runJavaScript | 异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScript需要在loadUrl完成后,比如onPageEnd中调用。
@param script JavaScript脚本
@returns | async runJavaScript(script: string): Promise<string> {
if (this.controller) {
return ArkWebHelper.runJavaScript(this.controller, script);
}
return '';
} | AST#method_declaration#Left async runJavaScript AST#parameter_list#Left ( AST#parameter#Left script : 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#Le... | async runJavaScript(script: string): Promise<string> {
if (this.controller) {
return ArkWebHelper.runJavaScript(this.controller, script);
}
return '';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L42-L47 | 675b68ad98c1eef0fce48ba6528943a658991e74 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets | arkts | 构建屏幕适配示例页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.demo_screen_adapt_title"),
viewModel: this.vm
}) {
this.ScreenAdaptContent();
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_scr... | build() {
AppNavDestination({
title: $r("app.string.demo_screen_adapt_title"),
viewModel: this.vm
}) {
this.ScreenAdaptContent();
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L42-L49 | 669d51e3cdc4f3b26b01f8fbc1a38fb96e0e6023 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/mapthumbtack/src/main/ets/components/ThumbTackComponent.ets | arkts | ThumbTackComponent | 定位大头针组件
@param thumbTackState 用于设置大头针状态:
ThumbTackState.EMPTY(无动画)、
ThumbTackState.LOADING(展示波纹动画)、
ThumbTackState.SHOWING(展示弹跳动画)。
@param thumbTackWidth 用于设置大头针的宽度。
@param animationFinishCallback 大头针动画结束时回调。 | @Component
export struct ThumbTackComponent {
@Prop thumbTackState: ThumbTackState = ThumbTackState.EMPTY;
// 20, 大头针宽度未设置时,默认20
public thumbTackWidth: number = 20;
public animationFinishCallback: () => void = () => {
};
@State private greenTackHatBrimWidth: number = 0;
@State private greenTackHatWidth: n... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ThumbTackComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right thumbTackState : AST#type_annotation#Left AST#primary_type#Left ThumbTackState AST#primary_type#... | @Component
export struct ThumbTackComponent {
@Prop thumbTackState: ThumbTackState = ThumbTackState.EMPTY;
public thumbTackWidth: number = 20;
public animationFinishCallback: () => void = () => {
};
@State private greenTackHatBrimWidth: number = 0;
@State private greenTackHatWidth: number = 0;
@State p... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mapthumbtack/src/main/ets/components/ThumbTackComponent.ets#L28-L228 | 0115e0e74a82d2d1279a70eea878790b17332883 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Vibrator/Vibrator.ets | arkts | get | 获取单例对象
@returns AppVibrator实例 | public static get shared(): Vibrator {
if (!Vibrator.sharedInstance) {
Vibrator.sharedInstance = new Vibrator();
}
return Vibrator.sharedInstance;
} | AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Vibrator AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statemen... | public static get shared(): Vibrator {
if (!Vibrator.sharedInstance) {
Vibrator.sharedInstance = new Vibrator();
}
return Vibrator.sharedInstance;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Vibrator/Vibrator.ets#L17-L22 | 0201d064d1be0bae2975ab1850b8c06bb10cafda | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/CommonModel.ets | arkts | Contact information. | export class ContactInfo {
imgName: string;
name: Resource;
constructor(imgName: string, name: Resource) {
this.imgName = imgName;
this.name = name;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ContactInfo AST#class_body#Left { AST#property_declaration#Left imgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left name : AST#t... | export class ContactInfo {
imgName: string;
name: Resource;
constructor(imgName: string, name: Resource) {
this.imgName = imgName;
this.name = name;
}
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/CommonModel.ets#L58-L66 | 195535f6dcd27b1c7da0c950a52261f1fd9ef46a | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets | arkts | @memo | export function hookCheckBoxContentModifier(
receiver: ArkCheckboxComponent, value?: ContentModifier<CheckBoxConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const checkboxBuilder = (parentNode: KPointer, config: CheckBoxConfiguration): KPointer ... | AST#export_declaration#Left export AST#function_declaration#Left function hookCheckBoxContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkCheckboxComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left valu... | export function hookCheckBoxContentModifier(
receiver: ArkCheckboxComponent, value?: ContentModifier<CheckBoxConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const checkboxBuilder = (parentNode: KPointer, config: CheckBoxConfiguration): KPointer ... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L82-L95 | 2b4e9c31242f65e7541774b14aba1fe389097b2b | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/DiskStatus.ets | arkts | isDiskSpaceEnoughSync | 快捷方法:检查空间是否足够(同步) | static isDiskSpaceEnoughSync(context: common.Context, needMegas: number): boolean {
const availableBytes = DiskStatus.getAvailableBytesForDataDirectorySync(context);
const needBytes = needMegas * 1024 * 1024;
console.info(`可用空间: ${availableBytes}字节,需要空间: ${needBytes}字节`);
return availableBytes > needByt... | AST#method_declaration#Left static isDiskSpaceEnoughSync AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left needM... | static isDiskSpaceEnoughSync(context: common.Context, needMegas: number): boolean {
const availableBytes = DiskStatus.getAvailableBytesForDataDirectorySync(context);
const needBytes = needMegas * 1024 * 1024;
console.info(`可用空间: ${availableBytes}字节,需要空间: ${needBytes}字节`);
return availableBytes > needByt... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/DiskStatus.ets#L20-L25 | 7df66e86b255a6b65ca01a7b1e74035b4e13bbd1 | github |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/router/AppRouter.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2026/1/18 22:50
@Version V1.0
@Description | export class AppRouter {
/**
* 跳转到播放页
* @param context
* @param args
*/
public static goToPlayer(context: UIContext, args: PlayerArgs) {
context.getRouter().pushUrl({url: "pages/player/PlayerPage", params: args})
}
} | AST#export_declaration#Left export AST#class_declaration#Left class AppRouter AST#class_body#Left { /**
* 跳转到播放页
* @param context
* @param args
*/ AST#method_declaration#Left public static goToPlayer AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UICont... | export class AppRouter {
public static goToPlayer(context: UIContext, args: PlayerArgs) {
context.getRouter().pushUrl({url: "pages/player/PlayerPage", params: args})
}
} | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/router/AppRouter.ets#L10-L21 | 42536db1e176540139d1a7dacf956303a81db953 | github | |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/DataManager.ets | arkts | updateEvent | 更新事件 | async updateEvent(event: EventModel): Promise<boolean> {
const events = await this.loadEvents()
const index = events.findIndex(e => e.id === event.id)
if (index !== -1) {
events[index] = event
return await this.saveEvents(events)
}
return false
}
// 删除事件
async deleteEvent(eventId:... | AST#method_declaration#Left async updateEvent AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left EventModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | async updateEvent(event: EventModel): Promise<boolean> {
const events = await this.loadEvents()
const index = events.findIndex(e => e.id === event.id)
if (index !== -1) {
events[index] = event
return await this.saveEvents(events)
}
return false
}
async deleteEvent(eventId: string... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/DataManager.ets#L76-L91 | 4ede88a2cf34cb3ef925ba2ebeb39efb5a1c52c1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarUtils.ets | arkts | getLunarLeapMonth | 获取农历闰月
@param year 农历年份
@returns 闰月月份,0表示无闰月 | static getLunarLeapMonth(year: number): number {
const yearInfo = LunarUtils.getLunarYearInfo(year);
return yearInfo.leapMonth;
} | AST#method_declaration#Left static getLunarLeapMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#prima... | static getLunarLeapMonth(year: number): number {
const yearInfo = LunarUtils.getLunarYearInfo(year);
return yearInfo.leapMonth;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L443-L446 | 2b68134cc450eeb25514c997eb094c77b79aa5ad | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/action/ToastUtil.ets | arkts | initToastDefault | 初始化DialogOptions参数 | private static initToastDefault(options: ToastOptions = new ToastOptions(), type: number): ToastOptions {
if (type == 1) {
options.duration = options.duration ?? ToastUtil.defaultConfig.duration_short;
} else if (type == 2) {
options.duration = options.duration ?? ToastUtil.defaultConfig.duration_lo... | AST#method_declaration#Left private static initToastDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ToastOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new A... | private static initToastDefault(options: ToastOptions = new ToastOptions(), type: number): ToastOptions {
if (type == 1) {
options.duration = options.duration ?? ToastUtil.defaultConfig.duration_short;
} else if (type == 2) {
options.duration = options.duration ?? ToastUtil.defaultConfig.duration_lo... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/action/ToastUtil.ets#L89-L109 | 2970aeb61f9bc4b34bd6cc1cc2cfb878bbb674bf | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | handleOrderComment | 处理订单评价逻辑
@returns {void} 无返回值 | handleOrderComment(): void {
if (this.cartList.length > 1) {
this.showCommentModal();
return;
}
const orderId: number = this.data?.id ?? 0;
const goodsId: number = this.getFirstCartGoodsId();
if (!orderId || !goodsId) {
return;
}
OrderNavigator.toComment(orderId, goodsId);
... | AST#method_declaration#Left handleOrderComment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Le... | handleOrderComment(): void {
if (this.cartList.length > 1) {
this.showCommentModal();
return;
}
const orderId: number = this.data?.id ?? 0;
const goodsId: number = this.getFirstCartGoodsId();
if (!orderId || !goodsId) {
return;
}
OrderNavigator.toComment(orderId, goodsId);
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L161-L172 | cd731ad2f0db9f8b656b7e7c8d6701c1b1cd7d7b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | loadUserGameData | 私有方法
加载用户游戏数据 | private async loadUserGameData(): Promise<void> {
try {
const savedData = await this.preferences?.get(StorageKeys.USER_GAME_DATA, null);
if (savedData) {
this.userGameData = JSON.parse(savedData as string);
// 转换Map数据
if (this.userGameData?.streaks) {
this.userGa... | AST#method_declaration#Left private async loadUserGameData 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 loadUserGameData(): Promise<void> {
try {
const savedData = await this.preferences?.get(StorageKeys.USER_GAME_DATA, null);
if (savedData) {
this.userGameData = JSON.parse(savedData as string);
if (this.userGameData?.streaks) {
this.userGameData.str... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L519-L543 | 51c02e0ab08b3745ba11199b660f95b8c0eaf4ba | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/pages/InterThreadCommunication4.ets | arkts | init | Some configuration properties and methods | init() {
// Initialization-related logic
freezeObj(this) // Freeze the current object after initialization is completed.
} | AST#method_declaration#Left init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // Initialization-related logic AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left freezeObj ( AST#expression#Left this AST#expression#Right ) AST#ui_component#Right AST... | init() {
freezeObj(this)
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/InterThreadCommunication4.ets#L31-L34 | 99b0c0156823f806bbf0b1c0d307834f191f2de0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets | arkts | notifyDataDelete | 通知LazyForEach组件需要在index对应索引处删除该子组件
@param {number} index - 索引值。 | notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
} | AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L96-L100 | a6655cd66a1f4d90177192b87999edfe55c892b5 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/SubscribeManager.ets | arkts | saveNewItemIfNeeds | ------------------------- 条件保存新订阅项 ------------------------- | saveNewItemIfNeeds(newItem: SubscribeItem): void {
if (!newItem.expiresDateMs) return;
const currentItem = this.currentItem;
if (!currentItem || !currentItem.expiresDateMs) {
// 本地为空时直接保存
SubscribeManager.shared.saveCurrentItem(newItem);
return;
}
// 更新本地为最新,只更新时间
if (current... | AST#method_declaration#Left saveNewItemIfNeeds AST#parameter_list#Left ( AST#parameter#Left newItem : AST#type_annotation#Left AST#primary_type#Left SubscribeItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pri... | saveNewItemIfNeeds(newItem: SubscribeItem): void {
if (!newItem.expiresDateMs) return;
const currentItem = this.currentItem;
if (!currentItem || !currentItem.expiresDateMs) {
SubscribeManager.shared.saveCurrentItem(newItem);
return;
}
if (currentItem.expiresDateMs <= newIte... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/SubscribeManager.ets#L114-L131 | ba646a4c1b797cf688b73d3590ef3937d8ff3dd6 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/control_flow/conditional_stmt/conditional_if_002_F.ets | arkts | Introduction 条件语句-if | export function conditional_if_002_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
if (true) {
taint.Sink(clean)
} else {}
} | AST#export_declaration#Left export AST#function_declaration#Left function conditional_if_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function conditional_if_002_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
if (true) {
taint.Sink(clean)
} else {}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/conditional_stmt/conditional_if_002_F.ets#L6-L12 | df3f3ce68ed1ec310db88685e5732c9d531a1b0a | github | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/NavigationView.ets | arkts | NavigationView | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct NavigationView {
private arr: number[] = [0, 1, 2, 3]
@State isActive: boolean = false
@State dex: number = 0
@Link _position: Position;
private componentKey: string;
build() {
Navigation() {
List({ space: 12, initialIndex: 0 }) {
ForEach(this.arr, (item: number, ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavigationView AST#component_body#Left { AST#property_declaration#Left private arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_a... | @Component
export struct NavigationView {
private arr: number[] = [0, 1, 2, 3]
@State isActive: boolean = false
@State dex: number = 0
@Link _position: Position;
private componentKey: string;
build() {
Navigation() {
List({ space: 12, initialIndex: 0 }) {
ForEach(this.arr, (item: number, ... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/NavigationView.ets#L16-L69 | 82b68a778fb6c0ce5844ce9b6abd8815848af19e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/LunarTypes.ets | arkts | API响应格式 | export interface LunarApiResponse {
code: number;
msg: string;
data: LunarApiData;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LunarApiResponse AST#object_type#Left { AST#type_member#Left code : 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 msg : AST#type_annotation#Le... | export interface LunarApiResponse {
code: number;
msg: string;
data: LunarApiData;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/LunarTypes.ets#L154-L158 | ebbaa9b57faf2a6b26b025e7e88825a72974d6a3 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | getNotificationRequest | 构建NotificationRequest对象
@param notificationId 通知ID
@param options 描述通知的请求参数
@param content 通知内容
@param template 模板
@returns | private static getNotificationRequest(notificationId: number, options: NotificationOptions,
content: notificationManager.NotificationContent, template?: notificationManager.NotificationTemplate): notificationManager.NotificationRequest {
const request: notificationManager.NotificationRequest = { content: conten... | AST#method_declaration#Left private static getNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_t... | private static getNotificationRequest(notificationId: number, options: NotificationOptions,
content: notificationManager.NotificationContent, template?: notificationManager.NotificationTemplate): notificationManager.NotificationRequest {
const request: notificationManager.NotificationRequest = { content: conten... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L484-L547 | 08be533f4f8e9137b5289105616e5fcb5b552b0f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/greeting/GreetingService.ets | arkts | updateGreeting | 更新祝福语
@param params 更新参数
@returns 更新后的祝福语 | async updateGreeting(params: UpdateGreetingParams): Promise<Greeting> {
try {
// 获取原有祝福语数据
const existingGreeting: Greeting | null = await this.getGreetingById(params.id);
if (!existingGreeting) {
throw new Error('祝福语不存在');
}
// 更新祝福语对象
const updatedGreeting: Greeting = ... | AST#method_declaration#Left async updateGreeting AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left UpdateGreetingParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#... | async updateGreeting(params: UpdateGreetingParams): Promise<Greeting> {
try {
const existingGreeting: Greeting | null = await this.getGreetingById(params.id);
if (!existingGreeting) {
throw new Error('祝福语不存在');
}
const updatedGreeting: Greeting = {
id: existing... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/greeting/GreetingService.ets#L155-L209 | 4a2a0c04547c5c7d67560984e67ffb27122f8123 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ImageEditTaskPool/entry/src/main/ets/viewModel/IconListViewModel.ets | arkts | Icon status. | export class IconStatus {
normal: Resource;
chosen: Resource;
constructor(normal: Resource, chosen: Resource) {
this.normal = normal;
this.chosen = chosen;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class IconStatus AST#class_body#Left { AST#property_declaration#Left normal : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left chosen : AST... | export class IconStatus {
normal: Resource;
chosen: Resource;
constructor(normal: Resource, chosen: Resource) {
this.normal = normal;
this.chosen = chosen;
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/viewModel/IconListViewModel.ets#L19-L27 | 89b27d176dab427655de6b8ce550c994b64d4896 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/KeyboardAvoid/casesfeature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets | arkts | KeyboardAvoid | 功能描述: 本示例介绍使用TextInput组件和LazyForEach实现组件随软键盘弹出避让场景
推荐场景: 需要用户手动输入文字的场景
核心组件:
1. KeyboardAvoid.liftUpComponents
2. KeyboardAvoid.scalingComponents
实现步骤:
1. 在输入按钮的点击事件中调用focusControl.requestFocus API,即可实现给TextInput组件申请焦点功能
2. 通过监听键盘高度,可以感知到键盘的拉起收起状态,实现缩放组件尺寸的调整,配合KeyboardAvoidMode.RESIZE避让模式,实现组件上抬压缩效果 | @Component
export struct KeyboardAvoid {
@State keyboardHeight: number = 0; // 软键盘高度
@State contentData: string[] =
['第一条数据', '第二条数据', '第三条数据', '第四条数据', '第五条数据', '第六条数据', '第七条数据', '第八条数据',
'第九条数据', '第十条数据', '第十一条数据', '第十二条数据'];
@State isLiftUpShow: boolean = true;
@State isScalingShow: boolean = false... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct KeyboardAvoid AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right keyboardHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#ty... | @Component
export struct KeyboardAvoid {
@State keyboardHeight: number = 0;
@State contentData: string[] =
['第一条数据', '第二条数据', '第三条数据', '第四条数据', '第五条数据', '第六条数据', '第七条数据', '第八条数据',
'第九条数据', '第十条数据', '第十一条数据', '第十二条数据'];
@State isLiftUpShow: boolean = true;
@State isScalingShow: boolean = false;
@Sto... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/KeyboardAvoid/casesfeature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets#L33-L237 | f85473a886eaf422c724f4ed188a47b16a0ac387 | gitee |
0dot618/my_PCB_detection_harmony_app.git | 58217366ac936b5f4c246191701b333f4d3c5513 | MyApplication2/entry/src/main/ets/pages/Upload.ets | arkts | UploadBuilder | second.ets | @Builder
export function UploadBuilder(name: string, param: Object) {
Upload()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function UploadBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param :... | @Builder
export function UploadBuilder(name: string, param: Object) {
Upload()
} | https://github.com/0dot618/my_PCB_detection_harmony_app.git/blob/58217366ac936b5f4c246191701b333f4d3c5513/MyApplication2/entry/src/main/ets/pages/Upload.ets#L30-L33 | 2913eb00a285e1223afbbe021f40508e49d586af | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/http/HttpsRequestDemo/entry/src/main/ets/pages/Index.ets | arkts | selectCA | 选择CA证书文件 | selectCA() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
this.caFileUri = result[0]
this.msgHistory += "select file: " + this.caFileUri + "\r\n";
this.isCopyCaFile = false
}
}).catch((e: Busines... | AST#method_declaration#Left selectCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi... | selectCA() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
this.caFileUri = result[0]
this.msgHistory += "select file: " + this.caFileUri + "\r\n";
this.isCopyCaFile = false
}
}).catch((e: Busines... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpsRequestDemo/entry/src/main/ets/pages/Index.ets#L176-L187 | 47f6eb6ffa012c10aa1f1794bbddb13e285ed86e | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | removeAllLimitLines | Removes all LimitLines from the axis. | public removeAllLimitLines(): void {
this.mLimitLines.clear();
} | AST#method_declaration#Left public removeAllLimitLines AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left A... | public removeAllLimitLines(): void {
this.mLimitLines.clear();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L476-L478 | 50f2944083b3b832c53cb1305c0f41ea9453452f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/FavoritesService.ets | arkts | exportData | 导出数据 | async exportData(): Promise<string> {
const analytics = this.getAnalyticsData();
const exportDate = new Date().toISOString();
// 构建导出数据结构
const exportDataParts: string[] = [];
exportDataParts.push(`"favorites":${JSON.stringify(this.favorites)}`);
exportDataParts.push(`"generationHistory":${JSON... | AST#method_declaration#Left async exportData 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | async exportData(): Promise<string> {
const analytics = this.getAnalyticsData();
const exportDate = new Date().toISOString();
const exportDataParts: string[] = [];
exportDataParts.push(`"favorites":${JSON.stringify(this.favorites)}`);
exportDataParts.push(`"generationHistory":${JSON.stringify(... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L436-L449 | c50d27a28d4c26d093c5918edfd27f41a17e06ab | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIAssistantService.ets | arkts | 建议动作接口 | export interface SuggestedAction {
id: string;
type: ActionType;
title: string;
description: string;
priority: number;
parameters?: Record<string, string | number | boolean>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SuggestedAction 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 type : AST#type_annotation#Left... | export interface SuggestedAction {
id: string;
type: ActionType;
title: string;
description: string;
priority: number;
parameters?: Record<string, string | number | boolean>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L192-L199 | 7c9a307d8d23f8643c9ece926905bd6812442638 | github | |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/utils/DateUtil.ets | arkts | 日期工具类 | export class DateUtil {
// 格式化日期为 YYYY-MM-DD
static formatDate(date: Date): string {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
// 格式化时间为 HH:mm
static formatT... | AST#export_declaration#Left export AST#class_declaration#Left class DateUtil AST#class_body#Left { // 格式化日期为 YYYY-MM-DD AST#method_declaration#Left static formatDate 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 A... | export class DateUtil {
static formatDate(date: Date): string {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
static formatTime(date: Date): string {
const... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L9-L133 | 06dd9462be88b692f774b7958e9a20cc0fdc19cc | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets | arkts | updateCurrentImageUrls | 更新当前显示的图片列表 | updateCurrentImageUrls() {
// 获取保留的原始图片
const remainingOriginalImages: string[] = [];
for (let i = 0; i < this.originalImageUrls.length; i++) {
const url = this.originalImageUrls[i];
if (!this.removedImageUrls.includes(url)) {
remainingOriginalImages.push(url);
}
}
// ... | AST#method_declaration#Left updateCurrentImageUrls AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取保留的原始图片 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left remainingOriginalImages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left... | updateCurrentImageUrls() {
const remainingOriginalImages: string[] = [];
for (let i = 0; i < this.originalImageUrls.length; i++) {
const url = this.originalImageUrls[i];
if (!this.removedImageUrls.includes(url)) {
remainingOriginalImages.push(url);
}
}
const merg... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets#L339-L367 | 1715f60632a7b6ace3475d135cc57e31ae995be6 | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/models/TaskModel.ets | arkts | init | 初始化 Preferences | static async init(context: Context): Promise<void> {
try {
DataStorage.prefsInstance = await preferences.getPreferences(context, DataStorage.PREFS_NAME);
console.info('DataStorage initialized successfully');
} catch (err) {
console.error('Failed to init DataStorage: ' + JSON.stringify(err));
... | AST#method_declaration#Left static async init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le... | static async init(context: Context): Promise<void> {
try {
DataStorage.prefsInstance = await preferences.getPreferences(context, DataStorage.PREFS_NAME);
console.info('DataStorage initialized successfully');
} catch (err) {
console.error('Failed to init DataStorage: ' + JSON.stringify(err));
... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L28-L35 | be1de2d83a527b394520871ebe7e6c78b5d2adb5 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/OrderCount.ets | arkts | pickNumber | 读取数字字段(优先英文,回退中文)
@param {Object} source - 原始对象
@param {string} key - 英文字段
@param {string} cnKey - 中文字段
@param {number} fallback - 回退值
@returns {number} 解析后的数值 | private static pickNumber(source: Object, key: string, cnKey: string, fallback: number): number {
const englishValue: number | null = OrderCount.readNumber(source, key);
if (englishValue !== null) {
return englishValue;
}
const chineseValue: number | null = OrderCount.readNumber(source, cnKey);
... | AST#method_declaration#Left private static pickNumber AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | private static pickNumber(source: Object, key: string, cnKey: string, fallback: number): number {
const englishValue: number | null = OrderCount.readNumber(source, key);
if (englishValue !== null) {
return englishValue;
}
const chineseValue: number | null = OrderCount.readNumber(source, cnKey);
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/OrderCount.ets#L71-L81 | aecce83a891c26e8ce50f7aa2424a2653c1b3b78 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | getUpdateTime | 获取应用包更新时间。
@returns | static getUpdateTime(): number {
return AppUtil.getBundleInfoSync().updateTime;
} | AST#method_declaration#Left static getUpdateTime 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_exp... | static getUpdateTime(): number {
return AppUtil.getBundleInfoSync().updateTime;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L544-L546 | db4ba4bfdf925b5b0952d0771c5e376add539a9a | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBarV2.d.ets | arkts | Defines the action callback of ToolBarV2Item.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export type ToolBarV2ItemAction = (index: number) => void; | AST#export_declaration#Left export AST#type_declaration#Left type ToolBarV2ItemAction = AST#type_annotation#Left AST#function_type#Left 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#pa... | export type ToolBarV2ItemAction = (index: number) => void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L536-L536 | e62e4b82af3ce3218d101ebf413758dc0751bfd7 | gitee | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/path_sensitive/explicit_jump_control/continue_002_F.ets | arkts | Introduction 显式跳转控制-continue | export function continue_002_F(taint_src : string) {
let res = ''
for (let i = 0; i < 10; i++) {
if (i === 3) {
res = taint_src
continue
taint.Sink(res)
}
}
} | AST#export_declaration#Left export AST#function_declaration#Left function continue_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left... | export function continue_002_F(taint_src : string) {
let res = ''
for (let i = 0; i < 10; i++) {
if (i === 3) {
res = taint_src
continue
taint.Sink(res)
}
}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/explicit_jump_control/continue_002_F.ets#L6-L15 | 7e877f23f15e48a698977da0c1bb21a802f7370d | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogBuilder.ets | arkts | TextInputDialogBuilder | 文本输入弹窗view (内部使用系统自定义内容弹窗)
@param options | @Builder
export function TextInputDialogBuilder(options: ITextInputOptions) {
TextInputDialogView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TextInputDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ITextInputOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST... | @Builder
export function TextInputDialogBuilder(options: ITextInputOptions) {
TextInputDialogView({ options: options });
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L224-L227 | 66cb02659eda2bf73577e88240284fbf8619fa6a | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildAISuggestions | 构建AI建议 | @Builder
buildAISuggestions() {
Column({ space: 12 }) {
Row() {
Text('AI生成建议')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
if (this.aiGenerating) {
Row({ space: 4 }) {
LoadingProgre... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAISuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_... | @Builder
buildAISuggestions() {
Column({ space: 12 }) {
Row() {
Text('AI生成建议')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
if (this.aiGenerating) {
Row({ space: 4 }) {
LoadingProgre... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L402-L488 | 8a1cbe49dad21899188182533a9323490d8f31ea | github |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/Shoucang.ets | arkts | getImageByKey | 存储从数据库获取的收藏数据 获取购物车商品图片 | getImageByKey(imageKey: string): Resource {
return imageMap[imageKey] ?? $r('app.media.img_16'); // 默认图片
} | AST#method_declaration#Left getImageByKey AST#parameter_list#Left ( AST#parameter#Left imageKey : 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 Resource AST#primary_ty... | getImageByKey(imageKey: string): Resource {
return imageMap[imageKey] ?? $r('app.media.img_16');
} | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Shoucang.ets#L85-L87 | 9af3010ba88aea47f99fee847c5fe09b292ddc2b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | onSearchInput | 搜索输入处理 | private onSearchInput(value: string): void {
this.searchKeyword = value;
// 防抖搜索
if (this.searchTimer !== -1) {
clearTimeout(this.searchTimer);
}
if (value.trim()) {
this.searchTimer = setTimeout(() => {
this.performSearch(value.trim());
}, 500);
} else {
... | AST#method_declaration#Left private onSearchInput AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | private onSearchInput(value: string): void {
this.searchKeyword = value;
if (this.searchTimer !== -1) {
clearTimeout(this.searchTimer);
}
if (value.trim()) {
this.searchTimer = setTimeout(() => {
this.performSearch(value.trim());
}, 500);
} else {
this.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L88-L103 | 1cc332f2621f855be79abab4a87cb427c4fbe66e | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
ColumnCenter() { Text("Hi"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVa... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expressio... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVa... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L204-L219 | 741111d7fc832b35f3505b693b66aebde67b848c | github | |
xsdkhlgz/ATSOBJECT_OF_FIRST.git | 8c14e875d7ec3f418bb7cdaae123a8fea87a7e76 | entry/src/main/ets/view/record/NutrientStat.ets | arkts | Stack | 进度条 | Stack(){
//进度条所需数据
Progress({
value:$$.value,
total:$$.total,
type:ProgressType.Ring,
})
.width(95)
.style({strokeWidth:CommonConstants.DEFAULT_8})
//进度条颜色
.color($$.color)
//2.2.传入各类数据
this.StatsBuilder($$.con... | AST#method_declaration#Left Stack 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 Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#mem... | Stack(){
Progress({
value:$$.value,
total:$$.total,
type:ProgressType.Ring,
})
.width(95)
.style({strokeWidth:CommonConstants.DEFAULT_8})
.color($$.color)
this.StatsBuilder($$.content,$$.value,$$.total)
... | https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/view/record/NutrientStat.ets#L36-L49 | 25b993abbd8bafd93bd18025837d141f0f57b434 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/pages/VideoPage.ets | arkts | VideoPage | 实现步骤:
1. 通过@kit.NetworkKit接口监听网络状态
2. 添加Video组件,播放在线视频
3. 添加自动播放设置toggle,可以在网络状态变化时修改视频播放状态 | @Component
export struct VideoPage {
@Provide("navPathStack") navPathStack: NavPathStack = new NavPathStack();
// 视频控制器
controller: VideoController = new VideoController();
// WI-FI自动播放
@StorageLink("wifi_auto_play") wifiAutoPlay: boolean = false;
// 3G/4G/5G自动播放
@StorageLink("cellular_auto_play") cellula... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Provide ( AST#expression#Left "navPathStack" AST#expression#Right ) AST#decorator#Right navPathStack : AST#type_annotation#Left AS... | @Component
export struct VideoPage {
@Provide("navPathStack") navPathStack: NavPathStack = new NavPathStack();
controller: VideoController = new VideoController();
@StorageLink("wifi_auto_play") wifiAutoPlay: boolean = false;
@StorageLink("cellular_auto_play") cellularAutoPlay: boolean = false;
pr... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/pages/VideoPage.ets#L38-L77 | c77b5940b8f75fab88da4fb175da6aa62872e06f | gitee |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/TargetInfoApi.type.ets | arkts | 修改目标 | export interface TargetInfoEditParam {
/**
* 目标内容
*/
content: string
/**
* 目标内容id
*/
id: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TargetInfoEditParam AST#object_type#Left { /**
* 目标内容
*/ AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 目标内容id
*/ AST... | export interface TargetInfoEditParam {
content: string
id: number
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/TargetInfoApi.type.ets#L33-L43 | f35e506a7f1a75e3c2041249434b66c08aae70b1 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Paint.ets | arkts | 用于绘制Legend的属性类 | export class RectPaint extends Paint {
public startPoint: number[] = [0, 0];
public linearGradientColors: Array<ColorStop>;
constructor(paint?: RectPaint) {
super(paint);
if (paint != null && paint != undefined) {
this.startPoint = paint.startPoint;
}
}
setStartPoint(value: number[]) {
... | AST#export_declaration#Left export AST#class_declaration#Left class RectPaint extends AST#type_annotation#Left AST#primary_type#Left Paint AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left public startPoint : AST#type_annotation#Left AST#primary_type#Left AST#array_typ... | export class RectPaint extends Paint {
public startPoint: number[] = [0, 0];
public linearGradientColors: Array<ColorStop>;
constructor(paint?: RectPaint) {
super(paint);
if (paint != null && paint != undefined) {
this.startPoint = paint.startPoint;
}
}
setStartPoint(value: number[]) {
... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Paint.ets#L534-L558 | a9ed78fba956f587327a98524138cdaed049d746 | gitee | |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/pages/user/settings.ets | arkts | saveVibrationEnabled | 保存震感反馈设置 | private async saveVibrationEnabled(enabled: boolean) {
try {
await setVibrationEnabled(enabled);
this.vibrationON = enabled;
} catch (error) {
console.error("保存震感反馈设置失败:", error);
}
} | AST#method_declaration#Left private async saveVibrationEnabled 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#block_statement#Left { AST#statement#Left AST#t... | private async saveVibrationEnabled(enabled: boolean) {
try {
await setVibrationEnabled(enabled);
this.vibrationON = enabled;
} catch (error) {
console.error("保存震感反馈设置失败:", error);
}
} | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/user/settings.ets#L148-L155 | 6104f58c28c3a8224af2641e94fea9b8dd44ee58 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/PhotoHelper.ets | arkts | getPhotoAsset | 获取对应uri的PhotoAsset对象,用于读取文件信息。
@param uri 文件uri
PhotoAsset - photoAccessHelper.PhotoKeys:
URI 'uri' 文件uri。
PHOTO_TYPE 'media_type' 媒体文件类型。
DISPLAY_NAME 'display_name' 显示名字。
SIZE 'size' 文件大小。
DURATION 'duration' 持续时间(单位:毫秒)。
WIDTH 'width' 图片宽度(单位:像素)。
HEIGHT 'height' 图片高度(单位:像素)。
DATE_TAKEN 'date_taken' ... | static async getPhotoAsset(uri: string): Promise<photoAccessHelper.PhotoAsset> {
const photoHelper = photoAccessHelper.getPhotoAccessHelper(getContext());
const predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
//配置查询条件,使用PhotoViewPicker选择图片返回的uri进行查询
p... | AST#method_declaration#Left static async getPhotoAsset AST#parameter_list#Left ( AST#parameter#Left 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#type_annotation#Left AST#primary_type#Left AST#generic_typ... | static async getPhotoAsset(uri: string): Promise<photoAccessHelper.PhotoAsset> {
const photoHelper = photoAccessHelper.getPhotoAccessHelper(getContext());
const predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo('uri', uri);
let f... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PhotoHelper.ets#L189-L204 | a5a66dde4084f35cad86c299895be61a40c27523 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets | arkts | getRecordSound | MARK: - 查询操作
根据文本获取录音数据
@param text - 查询的文本
@returns RecordSound 对象或 null | async getRecordSound(text: string): Promise<RecordSound | null> {
if (!this.db) return null;
const sql = `SELECT * FROM ${Tables.Record.name}
WHERE SUBSTR(${Tables.Record.Col.text}, ${DB.salt} + 1,
LENGTH(${Tables.Record.Col.text}) - ${DB.salt}) = ?`;
const textEncoded = StringEnco... | AST#method_declaration#Left async getRecordSound 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#Lef... | async getRecordSound(text: string): Promise<RecordSound | null> {
if (!this.db) return null;
const sql = `SELECT * FROM ${Tables.Record.name}
WHERE SUBSTR(${Tables.Record.Col.text}, ${DB.salt} + 1,
LENGTH(${Tables.Record.Col.text}) - ${DB.salt}) = ?`;
const textEncoded = StringEnco... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L125-L136 | 4344d9f931b68004956cb90a99899b895de8dc63 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/media/VoiceService.ets | arkts | 语音命令接口 | export interface VoiceCommand {
command: string;
action: string;
params?: any;
confidence: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface VoiceCommand AST#object_type#Left { AST#type_member#Left command : 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 action : AST#type_annotation#... | export interface VoiceCommand {
command: string;
action: string;
params?: any;
confidence: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L50-L55 | 3e896483e6953f78b002119bc35421c916243363 | github | |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | src/main/ets/model/TaskTimeRange.ets | arkts | TaskTimeRange | TaskTimeRange数据模型定义 | @Observed
export class TaskTimeRange {
id: string;
taskName: string;
startTime: Date;
endTime: Date;
isCompleted: boolean = false;
priority: number = 1; // 1-低, 2-中, 3-高
constructor(id: string, taskName: string, startTime: Date, endTime: Date) {
this.id = id;
this.taskName = taskName;
this.st... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class TaskTimeRange AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property... | @Observed
export class TaskTimeRange {
id: string;
taskName: string;
startTime: Date;
endTime: Date;
isCompleted: boolean = false;
priority: number = 1;
constructor(id: string, taskName: string, startTime: Date, endTime: Date) {
this.id = id;
this.taskName = taskName;
this.startTime = startT... | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/model/TaskTimeRange.ets#L2-L48 | 769d808b648943e0a375cb6ac95e662f0a3f402e | github |
hi-dhl/HarmonyPractice.git | 0ebaac278d286ab99c4d0d06eb68c95148e89901 | Basic/entry/src/main/ets/syntax/Static2.ets | arkts | <pre>
author: 程序员DHL
date : 2024/1/21
公众号 : ByteCode
desc :
文件名以 ts 的结尾表示 TypeScript
文件名以 ets 的结尾表示 ArkTS
基于 ArkTS 语法
</pre> | export class Person {
static {
let name = "dhl"
let age = 10; | AST#export_declaration#Left export AST#ERROR#Left class Person { static { let AST#variable_declarator#Left name = AST#expression#Left "dhl" AST#expression#Right AST#variable_declarator#Right AST#ERROR#Right AST#variable_declaration#Left let AST#variable_declarator#Left age = AST#expression#Left 10 AST#expression#Right ... | export class Person {
static {
let name = "dhl"
let age = 10; | https://github.com/hi-dhl/HarmonyPractice.git/blob/0ebaac278d286ab99c4d0d06eb68c95148e89901/Basic/entry/src/main/ets/syntax/Static2.ets#L13-L16 | 9d103aaf047980920e32b223aaa510ae01e7f532 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ExceptionPrompt.d.ets | arkts | Configuration parameter of ExceptionPrompt.
@interface PromptOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Configuration parameter of ExceptionPrompt.
@interface PromptOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface PromptOptions {
/**
* Icon of PromptOptions.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Icon of PromptOptions.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @a... | AST#export_declaration#Left export AST#interface_declaration#Left interface PromptOptions AST#object_type#Left { /**
* Icon of PromptOptions.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Icon of PromptOptions.
* @type { ?ResourceStr }... | export interface PromptOptions {
icon?: ResourceStr;
symbolStyle?: SymbolGlyphModifier;
tip?: ResourceStr;
marginType: MarginType;
actionText?: ResourceStr;
marginTop: Dimension
isShown?: boolean
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets#L83-L194 | d0c443b50e261e7fe02cda39c21ea6ceb705fb01 | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/ArkCustomComponent.ets | arkts | This is basically the CustomComponent, which doesn't extend CommonAttribute | export interface ArkCustomComponent { | AST#export_declaration#Left export AST#interface_declaration#Left interface ArkCustomComponent AST#object_type#Left { AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface ArkCustomComponent { | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/ArkCustomComponent.ets#L34-L34 | 02d40fa491a441de7ecc0515ec6fedd8d072dcb6 | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Prop | Called when a property is set.
@since 7
@deprecated since 10 | static Prop<T>(propName: string): SubscribedAbstractProperty<T> | undefined {
return AppStorage.prop<T>(propName)
} | AST#method_declaration#Left static Prop AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#R... | static Prop<T>(propName: string): SubscribedAbstractProperty<T> | undefined {
return AppStorage.prop<T>(propName)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L85-L87 | d112b23cda63605b1102da4141f245e9a5db9fa2 | gitee |
texiwustion/chinese-herbal-shopping--arkts.git | 3f71338f3c6d88bc74342e0322867f3a0c2c17d1 | entry/src/main/ets/constants/ColorConstants.ets | arkts | Constants for color | export class ColorConstants {
/**
color for placeholder
*/
static readonly PLACEHOLDER: number = 0x999999;
/**
* color green
*/
static readonly GREEN_MINT: number = 0xDAFFED;
static readonly GREEN_LIGHT: number = 0xADFC92;
static readonly GREEN_DEEP: number = 0x7A8450;
/*... | AST#export_declaration#Left export AST#class_declaration#Left class ColorConstants AST#class_body#Left { /**
color for placeholder
*/ AST#property_declaration#Left static readonly PLACEHOLDER : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#express... | export class ColorConstants {
static readonly PLACEHOLDER: number = 0x999999;
static readonly GREEN_MINT: number = 0xDAFFED;
static readonly GREEN_LIGHT: number = 0xADFC92;
static readonly GREEN_DEEP: number = 0x7A8450;
static readonly GREY_DEEP: number = 0xC1CAD6;
static readonly... | https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/constants/ColorConstants.ets#L4-L24 | a33a1d09415630dfda27b69d8c49d0c2a8f0076f | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index_backup.ets | arkts | generateMinuteRange | 生成分钟范围数组 | private generateMinuteRange(): string[] {
const minutes: string[] = [];
for (let i = 0; i < 60; i++) {
minutes.push(i.toString().padStart(2, '0'));
}
return minutes;
} | AST#method_declaration#Left private generateMinuteRange AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_de... | private generateMinuteRange(): string[] {
const minutes: string[] = [];
for (let i = 0; i < 60; i++) {
minutes.push(i.toString().padStart(2, '0'));
}
return minutes;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1447-L1453 | 1ec25e11ce1c1ea6cc8db7e605e1c008eb0cdca9 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/utils/Utils.ets | arkts | showSheetText | 文本展示Sheet
@param content | static showSheetText(content: string) {
let options: TISheetOptions = {
title: {
title: "结果展示",
},
content: content,
detents: [SheetSize.FIT_CONTENT, SheetSize.MEDIUM, SheetSize.FIT_CONTENT],
borderWidth: 0,
mode: SheetMode.EMBEDDED,
preferType: SheetType.BOTTOM,
... | AST#method_declaration#Left static showSheetText AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declara... | static showSheetText(content: string) {
let options: TISheetOptions = {
title: {
title: "结果展示",
},
content: content,
detents: [SheetSize.FIT_CONTENT, SheetSize.MEDIUM, SheetSize.FIT_CONTENT],
borderWidth: 0,
mode: SheetMode.EMBEDDED,
preferType: SheetType.BOTTOM,
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/utils/Utils.ets#L15-L27 | d9ceac8322d7b9918ce5b888f1a670d708a83b37 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/user/src/main/ets/view/ProfilePage.ets | arkts | ProfilePage | @file 个人中心视图
@author Joker.X | @ComponentV2
export struct ProfilePage {
/**
* 个人中心 ViewModel
*/
@Local
private vm: ProfileViewModel = new ProfileViewModel();
/**
* 构建个人中心页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: $r("app.string.user_profile_title"),
viewModel: this.vm
}) {
th... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ProfilePage AST#component_body#Left { /**
* 个人中心 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left ProfileVie... | @ComponentV2
export struct ProfilePage {
@Local
private vm: ProfileViewModel = new ProfileViewModel();
build() {
AppNavDestination({
title: $r("app.string.user_profile_title"),
viewModel: this.vm
}) {
this.ProfileContent();
}
}
@Builder
private ProfileContent() {
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/user/src/main/ets/view/ProfilePage.ets#L10-L72 | 2c20d310a290a909bed0748dac1e88bd58100d71 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | LunarCalendar_Fixed.ets | arkts | 农历计算工具类 - 修复版本
支持1900-2100年公历农历相互转换
基于真实天文数据的精确算法
🔧 修复内容:
1. 使用准确的农历月份天数数据
2. 修正闰月处理逻辑
3. 确保数据一致性
公历日期接口 | export interface SolarDate {
year: number;
month: number;
day: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SolarDate AST#object_type#Left { AST#type_member#Left year : 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 month : AST#type_annotation#Left AS... | export interface SolarDate {
year: number;
month: number;
day: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L15-L19 | e0bab619b9372f23a9cad00ae67890562dfa16a5 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/PathUtility.ets | arkts | getExtension | 获取文件扩展名
@param fileName 文件名
@returns 扩展名(不含点),如无扩展名返回原字符串 | static getExtension(fileName: string | null): string | null {
if (!fileName) return null;
const point = fileName.lastIndexOf('.');
return point !== -1 ? fileName.substring(point + 1) : fileName;
} | AST#method_declaration#Left static getExtension AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ... | static getExtension(fileName: string | null): string | null {
if (!fileName) return null;
const point = fileName.lastIndexOf('.');
return point !== -1 ? fileName.substring(point + 1) : fileName;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L118-L123 | 48433733950ebcda0f4712bf6c02552c50be739c | github |
cljhwt/Gemini3_to_ArkTS.git | 11507c45be72ecccef2f757eaf024c2b8617ad34 | ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/common/utils/Utils.ets | arkts | Save the pixel map into image file.
@param pixelMap - pixel map
@param path - file path
@returns Promise<void> | export async function pixelMap2File(pixelMap: image.PixelMap | undefined, path: string): Promise<void> {
try {
const imagePacker = image.createImagePacker();
let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 98 }... | AST#export_declaration#Left export AST#function_declaration#Left async function pixelMap2File AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_... | export async function pixelMap2File(pixelMap: image.PixelMap | undefined, path: string): Promise<void> {
try {
const imagePacker = image.createImagePacker();
let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 98 }... | https://github.com/cljhwt/Gemini3_to_ArkTS.git/blob/11507c45be72ecccef2f757eaf024c2b8617ad34/ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/common/utils/Utils.ets#L49-L64 | 9a35d3cecd92092451a4e769495b4b280be0faee | github | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/MyDay.ets | arkts | MusicHeader | 音乐自习室所在的 ListItemGroup 的标题组件。 | @Builder
private MusicHeader(): void {
Row() {
Text('音乐自习室')
.fontWeight(FontWeight.Medium)
.fontSize(14)
.fontColor($r('app.color.font_black'));
}
.padding('1%')
.size({ width: '96%', height: '4%' })
.border({
radius: 12,
style: BorderStyle.Solid,
c... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private MusicHeader 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_e... | @Builder
private MusicHeader(): void {
Row() {
Text('音乐自习室')
.fontWeight(FontWeight.Medium)
.fontSize(14)
.fontColor($r('app.color.font_black'));
}
.padding('1%')
.size({ width: '96%', height: '4%' })
.border({
radius: 12,
style: BorderStyle.Solid,
c... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L496-L514 | a6edb8168882e1afcdc10df29b9e34c03705caf7 | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets | arkts | Indicates the options of Navigation's Titlebar.
@typedef TitleOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export interface TitleOptions {
/**
* Background color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
backgroundColor?: ResourceColor;
/**
* Whether to enable the blur effect.
*
* @type { ?boolean }.... | AST#export_declaration#Left export AST#interface_declaration#Left interface TitleOptions AST#object_type#Left { /**
* Background color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left backgroundColor ? : AST... | export interface TitleOptions {
backgroundColor?: ResourceColor;
isBlurEnabled?: boolean;
barStyle?: BarStyle;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets#L160-L190 | 60c7f5cfde7b1b5c9e03946c7b708e8e5183402b | github | |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/utils/FileUtil.ets | arkts | isExist | 判断文件是否存在 | static isExist(fileName: string, fileSuffix: string) {
// 判断文件是否存在,存在就删除
let path = filesDir + '/' + fileName + '.' + fileSuffix;
if (fs.accessSync(path)) {
fs.unlinkSync(path);
}
} | AST#method_declaration#Left static isExist AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileSuffix : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static isExist(fileName: string, fileSuffix: string) {
let path = filesDir + '/' + fileName + '.' + fileSuffix;
if (fs.accessSync(path)) {
fs.unlinkSync(path);
}
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/utils/FileUtil.ets#L17-L23 | 3eea3d52e3c99f161170711215b013c12f946fad | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | removeThemeEventListener | 移除主题事件监听器 | removeThemeEventListener(listener: (event: ThemeEvent) => void): void {
const index = this.themeEventListeners.indexOf(listener);
if (index > -1) {
this.themeEventListeners.splice(index, 1);
}
} | AST#method_declaration#Left removeThemeEventListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ThemeEvent AST#primary_type#Right AST#type_annotation#Right AST... | removeThemeEventListener(listener: (event: ThemeEvent) => void): void {
const index = this.themeEventListeners.indexOf(listener);
if (index > -1) {
this.themeEventListeners.splice(index, 1);
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L486-L491 | d7d823af35fd18ab08cdc229cc3c7169852ef00e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/action/DialogUtil.ets | arkts | initSheetOptions | 选择类弹出框,参数
@param options | private static initSheetOptions(options: ActionSheetOptions) {
if (options.sheets && options.sheets.length > 0) {
let sheetInfos = new Array<SheetInfo>()
for (let index = 0; index < options.sheets.length; index++) {
let sheetItem = options.sheets[index];
if (TypeUtil.isResourceStr(sheetI... | AST#method_declaration#Left private static initSheetOptions AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ActionSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Le... | private static initSheetOptions(options: ActionSheetOptions) {
if (options.sheets && options.sheets.length > 0) {
let sheetInfos = new Array<SheetInfo>()
for (let index = 0; index < options.sheets.length; index++) {
let sheetItem = options.sheets[index];
if (TypeUtil.isResourceStr(sheetI... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L403-L460 | 0598218593546f5c4e625a4518d5245494a02ebc | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.InterstitialDialogAction.d.ets | arkts | IconStyle enumeration description.
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare enum IconStyle {
/**
* Sets the button icon to dark.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
DARK = 0,
/**
* Sets the button icon to light.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum IconStyle AST#enum_body#Left { /**
* Sets the button icon to dark.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#enum_member#Left DARK = AST#expressi... | export declare enum IconStyle {
DARK = 0,
LIGHT = 1
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.InterstitialDialogAction.d.ets#L30-L47 | da2568b1e13666b00b099ccf6e40b8f0c8057837 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM4.ets | arkts | decryptECBSync | 解密(ECB模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|ECB|PKCS7、SM4_128|ECB|PKCS5、等)。
@returns | static decryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = 'SM4_128|ECB|PKCS7'): cryptoFramework.DataBlob {
return SM4.decryptSync(data, symKey, null, transformation);
} | AST#method_declaration#Left static decryptECBSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe... | static decryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = 'SM4_128|ECB|PKCS7'): cryptoFramework.DataBlob {
return SM4.decryptSync(data, symKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L200-L203 | 545626dc08be8a9c45abbf0fd8a696ca24a755ba | gitee |
supermanaaaa/HarmonyOS-Next-Knowledge-Base.git | a818e59f200ebf4cae00bc634a6c04b9486b8a8f | HarmonyOSNextKnowledgeLearning/DevEco Studio/Design and Implementation of Active Image Caching Based on HarmonyOS 5 Ability Image Component/ImageReloadComponent.ets | arkts | _doDownload | 将下载图片的具体实现封装为内部方法 | protected abstract _doDownload(
urlLink: string,
onStartDownload: () => void,
onEndDownload: () => void
): Promise<string>; | AST#method_declaration#Left protected abstract _doDownload AST#parameter_list#Left ( AST#parameter#Left urlLink : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onStartDownload : AST#type_annotation#Left AST#function_type#L... | protected abstract _doDownload(
urlLink: string,
onStartDownload: () => void,
onEndDownload: () => void
): Promise<string>; | https://github.com/supermanaaaa/HarmonyOS-Next-Knowledge-Base.git/blob/a818e59f200ebf4cae00bc634a6c04b9486b8a8f/HarmonyOSNextKnowledgeLearning/DevEco Studio/Design and Implementation of Active Image Caching Based on HarmonyOS 5 Ability Image Component/ImageReloadComponent.ets#L112-L116 | c3040558602ed92ea0f00326147b17aa6418d3d7 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isProxy | 检查是否为Proxy类型。
@param value
@returns | static isProxy(value: Object): boolean {
return new util.types().isProxy(value);
} | AST#method_declaration#Left static isProxy AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#... | static isProxy(value: Object): boolean {
return new util.types().isProxy(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L259-L261 | 091936e8fd399169786d7a0e7f173f6496e13068 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildUpdate.ets | arkts | 应用约束61:使用ES模块导出语法 | export default GuildUpdateHandler; | AST#export_declaration#Left export default AST#expression#Left GuildUpdateHandler AST#expression#Right ; AST#export_declaration#Right | export default GuildUpdateHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildUpdate.ets#L16-L16 | d681b5e3974521ce3e111886e8cf05ed100d3c33 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets | arkts | 按钮点击缩放 | export const IMAGE_THEFT_BUTTON_CLICK_SCALE: number = 0.8; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left IMAGE_THEFT_BUTTON_CLICK_SCALE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.8 AST#expression#Right AST#variable_declarator#Right ; AST#v... | export const IMAGE_THEFT_BUTTON_CLICK_SCALE: number = 0.8; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets#L32-L32 | bf1cbcc391fd8b73b7da4ad877b19aa8cb9d5dc0 | gitee | |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | setFocusMode | 对焦模式 | setFocusMode(focusMode: camera.FocusMode): void {
// 检测对焦模式是否支持
Logger.info(TAG, `setFocusMode is called`);
let isSupported = this.session?.isFocusModeSupported(focusMode);
Logger.info(TAG, `setFocusMode isSupported: ${isSupported}`);
// 设置对焦模式
if (!isSupported) {
return;
}
this.se... | AST#method_declaration#Left setFocusMode AST#parameter_list#Left ( AST#parameter#Left focusMode : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . FocusMode AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_... | setFocusMode(focusMode: camera.FocusMode): void {
Logger.info(TAG, `setFocusMode is called`);
let isSupported = this.session?.isFocusModeSupported(focusMode);
Logger.info(TAG, `setFocusMode isSupported: ${isSupported}`);
if (!isSupported) {
return;
}
this.session?.setFocusMode(fo... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L844-L854 | 81619ae5f42b5ed601275a64140500ad9fd0c7fe | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildMemberRemove.ets | arkts | 应用约束60:使用ES模块导出代替module.exports | export default GuildMemberRemoveHandler; | AST#export_declaration#Left export default AST#expression#Left GuildMemberRemoveHandler AST#expression#Right ; AST#export_declaration#Right | export default GuildMemberRemoveHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildMemberRemove.ets#L14-L14 | 2d308d338c04f2cef66faae46236d0c55033fe0e | github | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/DimensionUtils.ets | arkts | getFp | 获取屏幕水平适配 fp 值。
@param value 资源值
@return 适配后的 fp 值 | static getFp(value: Resource): number {
let beforeFp = context.resourceManager.getNumber(value.id);
return px2fp(DimensionUtil.adaptDimension(beforeFp));
} | AST#method_declaration#Left static getFp AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | static getFp(value: Resource): number {
let beforeFp = context.resourceManager.getNumber(value.id);
return px2fp(DimensionUtil.adaptDimension(beforeFp));
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/DimensionUtils.ets#L63-L66 | e46a899600d23b27e94c049372dabad32d415c01 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/component/DemoLayout.ets | arkts | DemoLayout | Demo | @Preview
@ComponentV2
export struct DemoLayout {
build() {
Column() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(100)
.backgroundColor('#a3cf62')
.alignRules({
top: { anchor: "__container__", alig... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct DemoLayout 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_compone... | @Preview
@ComponentV2
export struct DemoLayout {
build() {
Column() {
RelativeContainer() {
Row() {
Text('row1')
}
.justifyContent(FlexAlign.Center)
.width(100)
.backgroundColor('#a3cf62')
.alignRules({
top: { anchor: "__container__", alig... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/DemoLayout.ets#L4-L47 | b47082a01f3e432401656c0cd81cddd62f85f7e2 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.