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-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | setAxisMaxLabels | The maximum number of labels on the axis | public setAxisMaxLabels(labels: number): void {
if (labels > 0)
this.mAxisMaxLabels = labels;
} | AST#method_declaration#Left public setAxisMaxLabels AST#parameter_list#Left ( AST#parameter#Left labels : 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#primar... | public setAxisMaxLabels(labels: number): void {
if (labels > 0)
this.mAxisMaxLabels = labels;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L172-L175 | 8f580a33a220f9a3363cf76cb8226cc8792acd5c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/SettingsTypes.ets | arkts | 数据设置接口(为DataSettings别名) | export interface DataSettings extends DataConfig {
// 继承DataConfig的所有属性
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DataSettings AST#extends_clause#Left extends DataConfig AST#extends_clause#Right AST#object_type#Left { // 继承DataConfig的所有属性 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface DataSettings extends DataConfig {
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L182-L184 | 78178a0565b6ac9e5e363052f658c9d32908fe20 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | createVideoOutputFn | [End create_photo_outputFn]
Creating a videoOutPut Output Object | createVideoOutputFn(cameraManager: camera.CameraManager, videoProfileObj: camera.VideoProfile,
surfaceId: string): camera.VideoOutput | undefined {
let videoOutput: camera.VideoOutput;
try {
videoOutput = cameraManager.createVideoOutput(videoProfileObj, surfaceId);
Logger.info(TAG, `createVideoO... | AST#method_declaration#Left createVideoOutputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left vi... | createVideoOutputFn(cameraManager: camera.CameraManager, videoProfileObj: camera.VideoProfile,
surfaceId: string): camera.VideoOutput | undefined {
let videoOutput: camera.VideoOutput;
try {
videoOutput = cameraManager.createVideoOutput(videoProfileObj, surfaceId);
Logger.info(TAG, `createVideoO... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L385-L397 | c4236dae084d96a4edf944d8c5fa3424a09138ab | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | getErrorMessage | 修改错误信息提取函数 | function getErrorMessage(error: Object | string | null | undefined): string {
let errorMessage = '未知错误';
if (error === null || error === undefined) {
return errorMessage;
}
if (typeof error === 'string') {
return error;
}
if (typeof error === 'object') {
// 检查是否有message属性,不使用in操作符
cons... | AST#function_declaration#Left function getErrorMessage AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#pri... | function getErrorMessage(error: Object | string | null | undefined): string {
let errorMessage = '未知错误';
if (error === null || error === undefined) {
return errorMessage;
}
if (typeof error === 'string') {
return error;
}
if (typeof error === 'object') {
const errorObj = error as Reco... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L243-L262 | 0fc51039604c664d9b2ab4888f4827b5171c9e71 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/main.ets | arkts | maybeNotCalledAtAllOptimize | [End import_change_global_var] | function maybeNotCalledAtAllOptimize() {
console.log(dataOptimize1);
console.log(dataOptimize2);
} | AST#function_declaration#Left function maybeNotCalledAtAllOptimize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#... | function maybeNotCalledAtAllOptimize() {
console.log(dataOptimize1);
console.log(dataOptimize2);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/main.ets#L30-L33 | 0fdbb0c49d07862aad838d2234c0f2dc89b2793f | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets | arkts | getHigh | Returns the upper shadows highest value.
@return | public getHigh(): number {
return this.mShadowHigh;
} | AST#method_declaration#Left public getHigh 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_expressio... | public getHigh(): number {
return this.mShadowHigh;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets#L95-L97 | 857d0de3cd95d82ead64398d80dc5d9629a2d07a | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/lazyForEach.d.ets | arkts | Developers need to implement this interface to provide data to LazyForEach component.
@interface IDataSource
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface IDataSource<T> {
/**
* Total data count.
*
* @returns { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
totalCount(): number;
/**
* Return the data of index.
*
* @param { number } in... | AST#export_declaration#Left export AST#interface_declaration#Left interface IDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { /**
* Total data count.
*
* @returns { number }
* @syscap SystemCapability.ArkUI.Ar... | export interface IDataSource<T> {
totalCount(): number;
getData(index: number): T;
registerDataChangeListener(listener: DataChangeListener): void;
unregisterDataChangeListener(listener: DataChangeListener): void;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L570-L612 | ab0525b05c004efb9fbb256e4254782b29c2712e | gitee | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | sendChatRequest | 使用配置发送聊天请求 | async sendChatRequest(message: string, config?: LLMConfig, enableStream: boolean = false): Promise<string> {
const targetConfig = config || this.getDefaultConfig();
if (!targetConfig) {
throw new Error('⚠️ 未找到可用的大模型配置\n\n请点击右上角⚙️按钮配置您的AI模型:\n• 选择服务商(OpenAI、DeepSeek等)\n• 填入API密钥\n• 测试连接后保存\n\n配置完成后即可开始智能对... | AST#method_declaration#Left async sendChatRequest AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left LLMConfig AST... | async sendChatRequest(message: string, config?: LLMConfig, enableStream: boolean = false): Promise<string> {
const targetConfig = config || this.getDefaultConfig();
if (!targetConfig) {
throw new Error('⚠️ 未找到可用的大模型配置\n\n请点击右上角⚙️按钮配置您的AI模型:\n• 选择服务商(OpenAI、DeepSeek等)\n• 填入API密钥\n• 测试连接后保存\n\n配置完成后即可开始智能对... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L324-L544 | f3b58de3e45acd3e8dbd8cc958a9335398a32ca0 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@[email protected]/oh_modules/@pura/spinkit/src/main/ets/components/SpinA.ets | arkts | SpinA | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinA {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local x: number = 0;
@Local y: number = 0;
@Local angle: number = 0;
build() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.backgroundColor(this.spinColor)
.... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinA AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinA {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local x: number = 0;
@Local y: number = 0;
@Local angle: number = 0;
build() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.backgroundColor(this.spinColor)
.... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@[email protected]/oh_modules/@pura/spinkit/src/main/ets/components/SpinA.ets#L26-L72 | dcb054cb766da207c52c1207af9edca547a3d739 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidance3DES/entry/src/main/ets/pages/3des_ecb_encryption_decryption_synchronous.ets | arkts | decryptMessage | 解密消息 | function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('3DES192|ECB|PKCS7');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null);
let decryptData = decoder.doFinalSync(cipherText);
return decryptData;
} | AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left c... | function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('3DES192|ECB|PKCS7');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null);
let decryptData = decoder.doFinalSync(cipherText);
return decryptData;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidance3DES/entry/src/main/ets/pages/3des_ecb_encryption_decryption_synchronous.ets#L29-L34 | 87510abac97e2a741ed1f3993fda0764a076578b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | limitRectInRotated | Rotating, limit in rect.
@param rect
@param outerLines | static limitRectInRotated(rect: RectF, outerLines: Array<LineSegment>): void {
let copy = new RectF();
copy.set(rect.left, rect.top, rect.right, rect.bottom);
let diagonal1 = new LineSegment(new Point(copy.left, copy.top), new Point(copy.right, copy.bottom));
for (let line of outerLines) {
MathUti... | AST#method_declaration#Left static limitRectInRotated AST#parameter_list#Left ( AST#parameter#Left rect : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outerLines : AST#type_annotation#Left AST#primary_type#Left AST#generic... | static limitRectInRotated(rect: RectF, outerLines: Array<LineSegment>): void {
let copy = new RectF();
copy.set(rect.left, rect.top, rect.right, rect.bottom);
let diagonal1 = new LineSegment(new Point(copy.left, copy.top), new Point(copy.right, copy.bottom));
for (let line of outerLines) {
MathUti... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L299-L312 | 732e9b947cee61f97083ee599b31ae17e4db46d5 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/sorting/MergeSort.ets | arkts | 归并排序实现 | export class MergeSort {
/**
* 归并排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/
public static sort(arr: number[]): number[] {
const result = [...arr];
MergeSort.mergeSort(result, 0, result.length - 1);
return result;
}
/**
* 归并排序的递归实现
* @param arr 需要排序的数组
* @param left 左边界
*... | AST#export_declaration#Left export AST#class_declaration#Left class MergeSort AST#class_body#Left { /**
* 归并排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/ AST#method_declaration#Left public static sort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#arra... | export class MergeSort {
public static sort(arr: number[]): number[] {
const result = [...arr];
MergeSort.mergeSort(result, 0, result.length - 1);
return result;
}
private static mergeSort(arr: number[], left: number, right: number): void {
if (left < right) {
const mid = Math.floor((... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/MergeSort.ets#L4-L61 | baaee2df55f2ad1c522743f9d9960338cf8ccde8 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/InteractiveGameService.ets | arkts | 游戏状态枚举 | export enum GameState {
NOT_STARTED = 'not_started',
PLAYING = 'playing',
PAUSED = 'paused',
COMPLETED = 'completed',
FAILED = 'failed'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum GameState AST#enum_body#Left { AST#enum_member#Left NOT_STARTED = AST#expression#Left 'not_started' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left PLAYING = AST#expression#Left 'playing' AST#expression#Right AST#enum_member#Right , AST... | export enum GameState {
NOT_STARTED = 'not_started',
PLAYING = 'playing',
PAUSED = 'paused',
COMPLETED = 'completed',
FAILED = 'failed'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L40-L46 | f098053c9405158484d2e9389bd9533f66c86fbd | github | |
RicardoWesleyli/HarmonyNEXT_Examples.git | 6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670 | Chapter6/entry/src/main/ets/pages/Index.ets | arkts | bgColorView | 背景颜色代码块 | @Builder
bgColorView(){
Column()
.width('100%')
.height('100%')
.linearGradient({
colors: [[0x007BFF, 0.0], [Color.White, 1.0]]
})
.expandSafeArea([SafeAreaType.SYSTEM])
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bgColorView 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#ui_component#Right AST#modifier_chain_expressio... | @Builder
bgColorView(){
Column()
.width('100%')
.height('100%')
.linearGradient({
colors: [[0x007BFF, 0.0], [Color.White, 1.0]]
})
.expandSafeArea([SafeAreaType.SYSTEM])
} | https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L102-L111 | cfa0fb24bb053121827bce996f7d66438fdd9c2a | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SHA1.ets | arkts | rol | Bitwise rotate a 32-bit number to the left.
32位二进制数循环左移 | rol(num: number, cnt: number) {
return (num << cnt) | (num >> (32 - cnt));
} | AST#method_declaration#Left rol AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cnt : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_a... | rol(num: number, cnt: number) {
return (num << cnt) | (num >> (32 - cnt));
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA1.ets#L185-L189 | 54494a4d5b730b8ec61fdaa78fdcf7ff495ac0e8 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets | arkts | push | 跳转到指定路由栈的指定路由页面 | public static push(info: NavRouterInfo, animated?: boolean) {
try {
if (info.onPop) {
RouterModule._stack.pushPathByName(info.url, info.param, info.onPop, animated);
} else {
RouterModule._stack.pushPathByName(info.url, info.param, animated);
}
} catch (err) {
Logger.erro... | AST#method_declaration#Left public static push AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left NavRouterInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AS... | public static push(info: NavRouterInfo, animated?: boolean) {
try {
if (info.onPop) {
RouterModule._stack.pushPathByName(info.url, info.param, info.onPop, animated);
} else {
RouterModule._stack.pushPathByName(info.url, info.param, animated);
}
} catch (err) {
Logger.erro... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets#L14-L24 | 86d93359c0ef210d9281a15bce8c9de10e6e7f49 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/GridSegmentedPicker.ets | arkts | generateColumnsTemplate | 生成网格列模板字符串
@returns 列模板字符串,如 "1fr 1fr 1fr" | private generateColumnsTemplate(): string {
// 如果尚未计算出列数或列数无效,返回默认一列模板
if (this.calculatedCols <= 0) {
return '1fr';
}
// 使用 repeat() 函数生成列模板,例如 repeat(3, 1fr) 表示三等分
return `repeat(${this.calculatedCols}, 1fr)`;
} | AST#method_declaration#Left private generateColumnsTemplate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 如果尚未计算出列数或列数无效,返回默认一列模板 AST#statement#Left AST#if_statement#Left if ( AS... | private generateColumnsTemplate(): string {
if (this.calculatedCols <= 0) {
return '1fr';
}
return `repeat(${this.calculatedCols}, 1fr)`;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/GridSegmentedPicker.ets#L127-L134 | d8c931cb5edc17c5b478bb2b820134f289629889 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBar.d.ets | arkts | Declare ToolBarModifier use in ToolBar
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 13
Declare ToolBarModifier use in ToolBar
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export declare class ToolBarModifier {
/**
* Sets the height of the toolBar.
*
* @param { LengthMetrics } height - toolBar's height.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
/**
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ToolBarModifier AST#class_body#Left { /**
* Sets the height of the toolBar.
*
* @param { LengthMetrics } height - toolBar's height.
* @returns { ToolBarModifier } returns the instance of the ToolBarMod... | export declare class ToolBarModifier {
height(height: LengthMetrics): ToolBarModifier;
backgroundColor(backgroundColor: ResourceColor): ToolBarModifier;
padding(padding: LengthMetrics): ToolBarModifier;
stateEffect(stateEffect: boolean): ToolBarModifier;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBar.d.ets#L416-L497 | 842f57b0832fe12a956f8a8c6009947e06efd58a | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets | arkts | replace | 将指定路由栈的栈顶页面退出,将info指定的NavDestination页面信息入栈 | public static replace(info: NavRouterInfo) {
try {
RouterModule._stack.replacePathByName(info.url, info.param);
} catch (err) {
Logger.error(
TAG,
'navigation stack replace failed::' + JSON.stringify(err),
);
}
} | AST#method_declaration#Left public static replace AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left NavRouterInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_stateme... | public static replace(info: NavRouterInfo) {
try {
RouterModule._stack.replacePathByName(info.url, info.param);
} catch (err) {
Logger.error(
TAG,
'navigation stack replace failed::' + JSON.stringify(err),
);
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets#L28-L37 | 3247edaed2de5a2fb66083d7a158a075cd7075fe | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets | arkts | getPause | 暂停视频 | getPause() {
if (this.isCreate) {
this.avPlayer.pause();
}
} | AST#method_declaration#Left getPause AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCreate AST#member_expression#Right AST#expres... | getPause() {
if (this.isCreate) {
this.avPlayer.pause();
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets#L93-L97 | b3389249851033f8a20af1a1a79c81de5b82eb85 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/opencustomdialog/openCustomDialog.ets | arkts | aboutToAppear | [End create_component_content] | aboutToAppear(): void {
PromptActionClass.setContext(this.ctx);
PromptActionClass.setContentNode(this.contentNode);
PromptActionClass.setOptions({ alignment: DialogAlignment.Top, offset: { dx: 0, dy: 50 } });
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
PromptActionClass.setContext(this.ctx);
PromptActionClass.setContentNode(this.contentNode);
PromptActionClass.setOptions({ alignment: DialogAlignment.Top, offset: { dx: 0, dy: 50 } });
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/opencustomdialog/openCustomDialog.ets#L98-L102 | 3d251b50610d8afa91f35a02ea3136025c52cefe | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets | arkts | getLengthOfStringWithoutKind | / 查找去除kind之后的字符串长度 | static getLengthOfStringWithoutKind(str: string): number {
const strPoint = BaseWordUtility.STR_POINT_HALF;
const indexNoFound = -1;
let strLength = 0;
if (str != null) {
strLength = str.length;
const index = str.indexOf(strPoint);
if (index !== indexNoFound) {
strLength = str... | AST#method_declaration#Left static getLengthOfStringWithoutKind AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number... | static getLengthOfStringWithoutKind(str: string): number {
const strPoint = BaseWordUtility.STR_POINT_HALF;
const indexNoFound = -1;
let strLength = 0;
if (str != null) {
strLength = str.length;
const index = str.indexOf(strPoint);
if (index !== indexNoFound) {
strLength = str... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L116-L129 | 57abb2fdb40b0f6ea6f52ed5427c818ec9f01c27 | github |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/ui_effect/ets/@ohos.graphics.uiEffect.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 BrightnessBlenderParam {
cubicRate: number;
quadraticRate: number;
linearRate: number;
degree: number;
saturation: number;
positiveCoefficient: [number, number, number];
negativeCoefficient: [number, number, number];
fraction: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BrightnessBlenderParam AST#object_type#Left { AST#type_member#Left cubicRate : 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 quadraticRate : A... | export interface BrightnessBlenderParam {
cubicRate: number;
quadraticRate: number;
linearRate: number;
degree: number;
saturation: number;
positiveCoefficient: [number, number, number];
negativeCoefficient: [number, number, number];
fraction: number;
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/ui_effect/ets/@ohos.graphics.uiEffect.ets#L16-L25 | 1922d6d864ba64e6901e25aaf37169122d7fdb28 | gitee | |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/utils/PreferenceModel.ets | arkts | getPreferencesFromStorage | 初始化Preferences首选项 | async getPreferencesFromStorage() {
try {
preference = await dataPreferences.getPreferences(context, 'mystore')
} catch (err) {
console.error(err)
}
} | AST#method_declaration#Left async getPreferencesFromStorage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left prefere... | async getPreferencesFromStorage() {
try {
preference = await dataPreferences.getPreferences(context, 'mystore')
} catch (err) {
console.error(err)
}
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L8-L14 | 09427513d1af8d86afa33923f25e0d94f9afc961 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | Page end event at the end of web page loading.
@typedef OnPageEndEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare interface OnPageEndEvent {
/**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
url: string;
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnPageEndEvent AST#object_type#Left { /**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left url :... | export declare interface OnPageEndEvent {
url: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L284-L294 | ab751d28b8e5a0d8ab72bdf3dc4a249ccd1a7813 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | selectAISuggestion | 选择AI建议 | private selectAISuggestion(suggestion: string): void {
this.customContent = suggestion;
} | AST#method_declaration#Left private selectAISuggestion AST#parameter_list#Left ( AST#parameter#Left suggestion : 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... | private selectAISuggestion(suggestion: string): void {
this.customContent = suggestion;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L170-L172 | a782bb0d4750912597ebcec51c21ffbbed6aa696 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets | arkts | The percentage of 50. | export const PERCENTAGE_50 = '50%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PERCENTAGE_50 = AST#expression#Left '50%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const PERCENTAGE_50 = '50%'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets#L50-L50 | 3eb246cc1e98a5b9d10bc78cabc2d91640447e83 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/component/TextInputDialogView.ets | arkts | TextInputDialogBuilder | TextInputDialog
@param options | @Builder
export function TextInputDialogBuilder(options: InputOptions) {
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 InputOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para... | @Builder
export function TextInputDialogBuilder(options: InputOptions) {
TextInputDialogView({ options: options });
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/component/TextInputDialogView.ets#L31-L34 | 9b1f130232fc9fa8b1dc18d04ff2fed092a55b4c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/ContactsPage.ets | arkts | exitSelectionMode | 退出选择模式 | private exitSelectionMode(): void {
this.isSelectionMode = false;
this.selectedContacts.clear();
} | AST#method_declaration#Left private exitSelectionMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#L... | private exitSelectionMode(): void {
this.isSelectionMode = false;
this.selectedContacts.clear();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L110-L113 | cbe4a5559b39a8f446762133d90099866801a2e1 | github |
texiwustion/chinese-herbal-shopping--arkts.git | 3f71338f3c6d88bc74342e0322867f3a0c2c17d1 | entry/src/main/ets/views/CartPage.ets | arkts | calculateTotalPrice | 计算订单总价的方法 | calculateTotalPrice() {
return this.orders.reduce((sum, order) => {
console.info('订单: 状态 ', order.status === 'added')
return sum + (order.status === 'added' ? (order.herbal.price * order.quantity) : 0);
}, 0);
} | AST#method_declaration#Left calculateTotalPrice AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left A... | calculateTotalPrice() {
return this.orders.reduce((sum, order) => {
console.info('订单: 状态 ', order.status === 'added')
return sum + (order.status === 'added' ? (order.herbal.price * order.quantity) : 0);
}, 0);
} | https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/views/CartPage.ets#L16-L21 | 45d806cbf491367026e0094b6548baf458922fbb | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/markAnchor/ListItemGroupView.ets | arkts | ListItemGroupView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct ListItemGroupView {
@Link _markAnchor: Position;
private componentKey: string;
private parentWidth: number;
private parentHeight: number;
private subassemblyWidth: number;
private subassemblyHeight: number;
private projects: string[] = ['Chinese', 'mathematics', 'English']
@Bui... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemGroupView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _markAnchor : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#... | @Component
export struct ListItemGroupView {
@Link _markAnchor: Position;
private componentKey: string;
private parentWidth: number;
private parentHeight: number;
private subassemblyWidth: number;
private subassemblyHeight: number;
private projects: string[] = ['Chinese', 'mathematics', 'English']
@Bui... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/markAnchor/ListItemGroupView.ets#L16-L84 | e4eebcf7ebd66ee0cfebaaf0eda9835bccb1cacd | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | searchGreetings | 搜索祝福语 | private async searchGreetings(keyword: string): Promise<Greeting[]> {
if (this.activeTab === 'contacts') return [];
return await this.greetingService.searchGreetings({
keyword,
pageSize: 50
} as GreetingSearchParams);
} | AST#method_declaration#Left private async searchGreetings 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#gene... | private async searchGreetings(keyword: string): Promise<Greeting[]> {
if (this.activeTab === 'contacts') return [];
return await this.greetingService.searchGreetings({
keyword,
pageSize: 50
} as GreetingSearchParams);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L151-L158 | e99cea889685e64523b2492b558441968f30c5ed | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/TabsSample/entry/src/main/ets/model/functionalScenes/SceneModuleInfo.ets | arkts | 首页瀑布流列表信息 | export class SceneModuleInfo {
// 首页列表图片
public imageSrc: ResourceStr;
// 首页列表名称
public name: string;
// 路由信息,自动生成路由时,在自定义装饰器中AppRouter中配置的参数,使用新版本自动路由时需要添加此参数,用于动态路由的跳转。
// 使用规则:模块名/需要加载的自定义组件名,如addressexchange/AddressExchangeView
public appUri: string;
// 路由传参数据
public param: string;
// 难度星级
pub... | AST#export_declaration#Left export AST#class_declaration#Left class SceneModuleInfo AST#class_body#Left { // 首页列表图片 AST#property_declaration#Left public imageSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 首页列表名称 AST#p... | export class SceneModuleInfo {
public imageSrc: ResourceStr;
public name: string;
public appUri: string;
public param: string;
public ratingNumber: number;
public category: string;
public serialNumber: number;
public swiperImage: ResourceStr;
public helperUrl: string;
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/model/functionalScenes/SceneModuleInfo.ets#L19-L52 | 9379a55a51e215f84660217efdd70f3710329ed5 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/Transformer.ets | arkts | pointValuesToPixel | Transform an array of points with all matrices. VERY IMPORTANT: Keep
matrix order "value-touch-offset" when transforming.
@param pts | public pointValuesToPixel(pts: number[]) {
this.mMatrixValueToPx.mapPoints(pts);
this.mViewPortHandler.getMatrixTouch().mapPoints(pts);
this.mMatrixOffset.mapPoints(pts);
} | AST#method_declaration#Left public pointValuesToPixel AST#parameter_list#Left ( AST#parameter#Left pts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function... | public pointValuesToPixel(pts: number[]) {
this.mMatrixValueToPx.mapPoints(pts);
this.mViewPortHandler.getMatrixTouch().mapPoints(pts);
this.mMatrixOffset.mapPoints(pts);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L278-L282 | ca49bdb57d6f6d99351e52f3c6c7357eda698e4d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/action/ToastUtil.ets | arkts | setDefaultConfig | 默认样式
设置默认统一样式
@param configs | static setDefaultConfig(configs: (config: ToastConfig) => void): void {
configs(ToastUtil.defaultConfig);
} | AST#method_declaration#Left static setDefaultConfig AST#parameter_list#Left ( AST#parameter#Left configs : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left ToastConfig AST#primary_type#Right AST#type_annotation#Right AST... | static setDefaultConfig(configs: (config: ToastConfig) => void): void {
configs(ToastUtil.defaultConfig);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/ToastUtil.ets#L36-L38 | 36cfb496221f95c5adfee0f2b7beab79b93995b6 | gitee |
Leeson-Wong/ark-layer.git | 9efa3553414a6b1eee890e3858c8cdcb308535d7 | core/Service.ets | arkts | Service
构造函数中不能使用上下文
init中可安全获取上下文
loginCallback登录时会被触发
logoutCallback登出时会被触发 | export abstract class Service implements AppPropagation {
private lifecycle: ServiceLifeCycle = ServiceLifeCycle.NONE
context: Context | undefined
depServices: AppPropagation[] = []
tag: string = this.constructor.name
constructor | AST#export_declaration#Left export AST#ERROR#Left abstract class Service AST#implements_clause#Left implements AppPropagation AST#implements_clause#Right { private lifecycle : AST#type_annotation#Left AST#primary_type#Left ServiceLifeCycle AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binar... | export abstract class Service implements AppPropagation {
private lifecycle: ServiceLifeCycle = ServiceLifeCycle.NONE
context: Context | undefined
depServices: AppPropagation[] = []
tag: string = this.constructor.name
constructor | https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/Service.ets#L12-L18 | d0f227edd598d00775a4a097b92721e1c61c38c7 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | Privacy/privacy/src/main/ets/pages/UrlListCheck.ets | arkts | checkUrl | Check Function | function checkUrl(surl: string): boolean {
let tmpUrl = url.URL.parseURL(surl);
hilog.info(0x0000, 'privacy', 'res.scheme:' + tmpUrl.protocol); // scheme
hilog.info(0x0000, 'privacy', 'res.host:' + tmpUrl.host); // host
hilog.info(0x0000, 'privacy', 'res.port:' + tmpUrl.port); // port
hilog.info(0x0000, 'priv... | AST#function_declaration#Left function checkUrl AST#parameter_list#Left ( AST#parameter#Left surl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_t... | function checkUrl(surl: string): boolean {
let tmpUrl = url.URL.parseURL(surl);
hilog.info(0x0000, 'privacy', 'res.scheme:' + tmpUrl.protocol);
hilog.info(0x0000, 'privacy', 'res.host:' + tmpUrl.host);
hilog.info(0x0000, 'privacy', 'res.port:' + tmpUrl.port);
hilog.info(0x0000, 'privacy', 'res.path:' + tmp... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Privacy/privacy/src/main/ets/pages/UrlListCheck.ets#L28-L41 | a3d38daf7dcdac175c1d9772e1518e66aac1290d | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets | arkts | closeSocket | 关闭Socket | async closeSocket(): Promise<void> {
if (!this.tlsSocket) {
return;
}
await this.tlsSocket.close();
this.tlsSocket.off('connect');
this.tlsSocket.off('message');
this.tlsSocket = undefined;
} | AST#method_declaration#Left async closeSocket 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_argu... | async closeSocket(): Promise<void> {
if (!this.tlsSocket) {
return;
}
await this.tlsSocket.close();
this.tlsSocket.off('connect');
this.tlsSocket.off('message');
this.tlsSocket = undefined;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets#L169-L177 | 5656633f12058164018060ac33413d3e54da1c33 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/model/WorkItemModel.ets | arkts | 视频信息,包括标题、视频地址、首帧图片、视频详情 | export class WorkItem {
public date: string; // 日期
public time: string; // 详细记录时间
public author: string; // 作者
public videoSrc: string; // 视频地址
public trimmerSrc: string; // 裁剪过后的视频地址
public firstImage: ResourceStr | PixelMap; // 首帧图片
public labels: ResourceStr; // 标签
public address: string; // 所在位置
p... | AST#export_declaration#Left export AST#class_declaration#Left class WorkItem AST#class_body#Left { AST#property_declaration#Left public date : 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 publi... | export class WorkItem {
public date: string;
public time: string;
public author: string;
public videoSrc: string;
public trimmerSrc: string;
public firstImage: ResourceStr | PixelMap;
public labels: ResourceStr;
public address: string;
public isDayTop: boolean = false;
public index: number ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/model/WorkItemModel.ets#L19-L45 | 32389a3af25fc9e9a6330b557b862052fc031898 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Learn.ets | arkts | asDBLearn | MARK: - DBLearn 相关 / 转换为 DBLearn | asDBLearn(): DBLearn {
let dbLearn = new DBLearn();
dbLearn.planId = this.planId;
dbLearn.bookId = this.bookId;
dbLearn.num = this.num;
dbLearn.distance = this.distance;
dbLearn.pieceNo = this.pieceNo;
dbLearn.wordId = this.wordId;
dbLearn.learnDate = this... | AST#method_declaration#Left asDBLearn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DBLearn AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dbLearn = AST#... | asDBLearn(): DBLearn {
let dbLearn = new DBLearn();
dbLearn.planId = this.planId;
dbLearn.bookId = this.bookId;
dbLearn.num = this.num;
dbLearn.distance = this.distance;
dbLearn.pieceNo = this.pieceNo;
dbLearn.wordId = this.wordId;
dbLearn.learnDate = this... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Learn.ets#L81-L91 | 8fde49c0433814e4bf765d9bd117a67943e062c7 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageresizable/src/main/ets/model/ProductModel.ets | arkts | 商品数据类,基于LazyForEach | export class ProductsDataSource implements IDataSource{
private productArr: Array<Product> = [];
constructor() {
this.productArr = getProductInfoMock();
}
totalCount(): number {
return this.productArr.length;
}
getData(index: number): Product {
return this.productArr[index];
}
registerDa... | AST#export_declaration#Left export AST#class_declaration#Left class ProductsDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private productArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#typ... | export class ProductsDataSource implements IDataSource{
private productArr: Array<Product> = [];
constructor() {
this.productArr = getProductInfoMock();
}
totalCount(): number {
return this.productArr.length;
}
getData(index: number): Product {
return this.productArr[index];
}
registerDa... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageresizable/src/main/ets/model/ProductModel.ets#L35-L55 | 42c0b26a36761a3dc66a694e4a9c485522f24972 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | isPrivacyMode | 窗口是否隐私模式,默认为false。true表示模式开启;false表示模式关闭。
@param windowClass 不传该值,默认主窗口。
@returns | static isPrivacyMode(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return WindowUtil.getWindowProperties(windowClass).isPrivacyMode;
} | AST#method_declaration#Left static isPrivacyMode AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#... | static isPrivacyMode(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return WindowUtil.getWindowProperties(windowClass).isPrivacyMode;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L79-L81 | 9bf381064c463b669dd9d74009e1fb239acd7bf8 | gitee |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/pages/EnvironmentMonitoringPage.ets | arkts | handleTempThresholdChange | 处理温度阈值调节 | private handleTempThresholdChange(increase: boolean) {
this.environmentData.tempThreshold = adjustTempThreshold(
this.environmentData.tempThreshold,
increase
)
this.updateEnvironmentStatus()
} | AST#method_declaration#Left private handleTempThresholdChange AST#parameter_list#Left ( AST#parameter#Left increase : 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#builder_function_body#Left { AST#expression_sta... | private handleTempThresholdChange(increase: boolean) {
this.environmentData.tempThreshold = adjustTempThreshold(
this.environmentData.tempThreshold,
increase
)
this.updateEnvironmentStatus()
} | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/EnvironmentMonitoringPage.ets#L183-L189 | fb7d8ba0d72a551001ffeb137552cac6a87153f1 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bundle/Model/DMPBundleLoadInfo.ets | arkts | 包管理加载信息 | export class DMPBundleLoadInfo {
//小程序id
appId: string = '';
appIndex: number = 0;
//客户端版本信息
appVersionName: string | null = null;
appVersionCode: number | null = null;
cacheVersionName: string | null = null;
cacheVersionCode: number | null = null;
//JSApp信息
localJSAppBundleConfig: DMJSAppBundleConf... | AST#export_declaration#Left export AST#class_declaration#Left class DMPBundleLoadInfo AST#class_body#Left { //小程序id AST#property_declaration#Left appId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_de... | export class DMPBundleLoadInfo {
appId: string = '';
appIndex: number = 0;
appVersionName: string | null = null;
appVersionCode: number | null = null;
cacheVersionName: string | null = null;
cacheVersionCode: number | null = null;
localJSAppBundleConfig: DMJSAppBundleConfig | null = null;
cache... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Model/DMPBundleLoadInfo.ets#L6-L38 | 03adb5b13b986bb0613ac2e5a394ac45c33b77ed | github | |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/home/HomeTabContent.ets | arkts | handleRefresh | 下拉刷新处理 | private async handleRefresh() {
if (this.isRefreshing) {
return;
}
try {
hilog.info(DOMAIN, TAG, 'Refreshing data');
this.isRefreshing = true;
// 清除缓存,强制重新从 API 获取数据
MockDataManager.getInstance().clearCache();
// 重置页码和分类
this.selectedCategory = ''... | AST#method_declaration#Left private async handleRefresh AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRefreshing AST#member_expression#Right AS... | private async handleRefresh() {
if (this.isRefreshing) {
return;
}
try {
hilog.info(DOMAIN, TAG, 'Refreshing data');
this.isRefreshing = true;
MockDataManager.getInstance().clearCache();
this.selectedCategory = '';
this.banne... | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/home/HomeTabContent.ets#L136-L170 | 4f3d5c52bc07064cea832cc9887603fb9f43b8d9 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets | arkts | Exec color transform.
@param bufferArray.
@param last.
@param cur.
@param hsvIndex.
@return arrayBuffer. | export function execColorInfo(bufferArray: ArrayBuffer, last: number, cur: number): ArrayBuffer {
if (!bufferArray) {
return new ArrayBuffer(0);
}
const newBufferArr = bufferArray;
let colorInfo: Uint8Array = new Uint8Array(newBufferArr);
for (let i: number = 0; i < colorInfo?.length; i += CommonConstants... | AST#export_declaration#Left export AST#function_declaration#Left function execColorInfo AST#parameter_list#Left ( AST#parameter#Left bufferArray : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left last : AST#type_annotati... | export function execColorInfo(bufferArray: ArrayBuffer, last: number, cur: number): ArrayBuffer {
if (!bufferArray) {
return new ArrayBuffer(0);
}
const newBufferArr = bufferArray;
let colorInfo: Uint8Array = new Uint8Array(newBufferArr);
for (let i: number = 0; i < colorInfo?.length; i += CommonConstants... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets#L26-L42 | c2fccc2cf3ea3b50994144c4958a08ac2cfafc64 | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/observe/LoadingProgressObserved.ets | arkts | LoadingProgressObserved | 加载进度弹窗Observed数据(可实时变更 进度 文本)
可无需再次弹窗时,变更加载中的文本 | @ObservedV2
export class LoadingProgressObserved extends CommonObservedData {
/**
* 加载动画的进度(赋值后可实时变更)
*/
@Trace
progress: number = 0;
/**
* 加载动画的提示文字(赋值后可实时变更)
*/
@Trace
content?: ResourceStr;
} | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class LoadingProgressObserved extends AST#type_annotation#Left AST#primary_type#Left CommonObservedData AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 加载动画的进度(赋值后可实时变更)
*/ AST#property_de... | @ObservedV2
export class LoadingProgressObserved extends CommonObservedData {
@Trace
progress: number = 0;
@Trace
content?: ResourceStr;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/observe/LoadingProgressObserved.ets#L7-L19 | 703b3161526f7a2b654b1a09f5e679641f452b71 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/common/ErrorHandler.ets | arkts | createValidationError | 创建验证错误 | static createValidationError(field: string, value: string | number | boolean, rule: string): ErrorInfo {
const contextData: ErrorContext = { field: field, value: value.toString(), rule: rule };
const errorInfo: ErrorInfo = {
type: ErrorType.VALIDATION,
message: `Validation failed for field ${field}:... | AST#method_declaration#Left static createValidationError AST#parameter_list#Left ( AST#parameter#Left field : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_t... | static createValidationError(field: string, value: string | number | boolean, rule: string): ErrorInfo {
const contextData: ErrorContext = { field: field, value: value.toString(), rule: rule };
const errorInfo: ErrorInfo = {
type: ErrorType.VALIDATION,
message: `Validation failed for field ${field}:... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/ErrorHandler.ets#L267-L281 | cdbabb8e9af9960979c48c14922f86c203a802d3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | copy | 拷贝文件或者目录,支持拷贝进度监听,使用Promise异步返回。
@param srcUri 待复制文件或目录的uri。
@param destUri 目标文件或目录的uri。
@param options options中提供拷贝进度回调:
ProgressListener 拷贝进度监听。
@returns | static copy(srcUri: string, destUri: string, options?: fs.CopyOptions): Promise<void> {
return fs.copy(srcUri, destUri, options);
} | AST#method_declaration#Left static copy AST#parameter_list#Left ( AST#parameter#Left srcUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left destUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | static copy(srcUri: string, destUri: string, options?: fs.CopyOptions): Promise<void> {
return fs.copy(srcUri, destUri, options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L586-L588 | 74e3fe89c6c5673031fe423d5a7e5d5e117509e7 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | generateKeyPairSync | 生成非对称密钥KeyPair,同步
@param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)。
@returns | static generateKeyPairSync(algName: string): cryptoFramework.KeyPair {
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); //非对称密钥生成器的对象。
let keyPair = asyKeyGenerator.generateKeyPairSync() //获取该非对称密钥生成器随机生成的密钥
return keyPair;
} | AST#method_declaration#Left static generateKeyPairSync AST#parameter_list#Left ( AST#parameter#Left algName : 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#qualifi... | static generateKeyPairSync(algName: string): cryptoFramework.KeyPair {
let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName);
let keyPair = asyKeyGenerator.generateKeyPairSync()
return keyPair;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L167-L171 | 213d9fc6fdc66d1cc115d766eb2caf360ec22379 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | 社区帖子接口 | export interface CommunityPost {
id: string;
authorId: string;
author: UserProfile;
type: PostType;
title?: string;
content: string;
images?: string[];
videos?: string[];
tags: string[];
location?: string;
status: PostStatus;
createdAt: string;
updatedAt: string;
likes: number;
comments: n... | AST#export_declaration#Left export AST#interface_declaration#Left interface CommunityPost 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 authorId : AST#type_annotation#Le... | export interface CommunityPost {
id: string;
authorId: string;
author: UserProfile;
type: PostType;
title?: string;
content: string;
images?: string[];
videos?: string[];
tags: string[];
location?: string;
status: PostStatus;
createdAt: string;
updatedAt: string;
likes: number;
comments: n... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L87-L109 | 916322e378e93ef76cc0435962262cd228883fa3 | github | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageUpdate.ets | arkts | Emitted whenever a message is updated - e.g. embed or content change.
@event Client#messageUpdate
@param {Message} oldMessage The message before the update
@param {Message} newMessage The message after the update
应用规则60: 使用export default代替module.exports | export default MessageUpdateAction; | AST#export_declaration#Left export default AST#expression#Left MessageUpdateAction AST#expression#Right ; AST#export_declaration#Right | export default MessageUpdateAction; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageUpdate.ets#L45-L45 | ac0b17cef9a0a8842782e5252e191ea1fade4a95 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/UserFile/UserFileURI/entry/src/main/ets/pages/Index.ets | arkts | getFileAccessAbilityInfo | [StartExclude import_get_uri_assets] | async function getFileAccessAbilityInfo() {
let wantInfos: Want[] = [];
try {
wantInfos = await fileAccess.getFileAccessAbilityInfo();
Logger.info('getFileAccessAbilityInfo data ' + JSON.stringify(wantInfos));
} catch (err) {
let error: BusinessError = err as BusinessError;
Logger.error('getFileAc... | AST#function_declaration#Left async function getFileAccessAbilityInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left wantInfos : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Want [ ] ... | async function getFileAccessAbilityInfo() {
let wantInfos: Want[] = [];
try {
wantInfos = await fileAccess.getFileAccessAbilityInfo();
Logger.info('getFileAccessAbilityInfo data ' + JSON.stringify(wantInfos));
} catch (err) {
let error: BusinessError = err as BusinessError;
Logger.error('getFileAc... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/UserFileURI/entry/src/main/ets/pages/Index.ets#L34-L43 | a7b3ab7bbc5b85fbe543a1e06d05ec5389961eb0 | gitee |
hackeris/HiSH | 6485c7b24ee47727fe464dc3a69484f44689e85b | entry/src/main/ets/lib/QemuAgentManager.ets | arkts | createConnection | 创建新连接 | private async createConnection(userId: string): Promise<QemuAgent | null> {
// 如果已有连接且可用,直接复用
if (this.agent && this.agent.isAlive()) {
hilog.info(DOMAIN, 'AgentManager', '复用现有空闲连接: %{public}s', userId)
this.currentUser = userId
return this.agent
}
const appTempDir = AppStorage.get(ap... | AST#method_declaration#Left private async createConnection AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene... | private async createConnection(userId: string): Promise<QemuAgent | null> {
if (this.agent && this.agent.isAlive()) {
hilog.info(DOMAIN, 'AgentManager', '复用现有空闲连接: %{public}s', userId)
this.currentUser = userId
return this.agent
}
const appTempDir = AppStorage.get(appOption.appTempDi... | https://github.com/hackeris/HiSH/blob/6485c7b24ee47727fe464dc3a69484f44689e85b/entry/src/main/ets/lib/QemuAgentManager.ets#L191-L211 | d9e3c807c599434ab52ece555b842198eabb3781 | gitee |
GikkiAres/todolist.git | 3a7571832fd2985ffc1a4eb4673b370ef715fe8e | entry/src/main/ets/components/ToDoItem.ets | arkts | labelIcon | private content: string = ""; @State isComplete: boolean = false; | @Builder labelIcon(icon:ResourceStr) {
Image(icon)
.objectFit(ImageFit.Contain)
.width($r('app.float.checkbox_width'))
.height($r('app.float.checkbox_width'))
.margin($r('app.float.checkbox_margin'))
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right labelIcon AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#... | @Builder labelIcon(icon:ResourceStr) {
Image(icon)
.objectFit(ImageFit.Contain)
.width($r('app.float.checkbox_width'))
.height($r('app.float.checkbox_width'))
.margin($r('app.float.checkbox_margin'))
} | https://github.com/GikkiAres/todolist.git/blob/3a7571832fd2985ffc1a4eb4673b370ef715fe8e/entry/src/main/ets/components/ToDoItem.ets#L25-L31 | a425194644f268ccbf46ad73efe72580b949e341 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets | arkts | onSelectedChange | 当选择"下载列表"时,显示下载列表相应内容,选择其他选项时,不显示内容,仅用于ux展示 | onSelectedChange(): void {
// 显示下载列表内容
if (this.tabSelectedIndexes[0] === 1) {
this.downloadPageOpacity = 1;
this.isDownloadPageEnabled = true;
this.downloadPageVisibility = Visibility.Visible;
this.historyPageVisibility = Visibility.None;
} else if (this.tabSelectedIndexes[0] === 2)... | AST#method_declaration#Left onSelectedChange AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 显示下载列表内容 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left... | onSelectedChange(): void {
if (this.tabSelectedIndexes[0] === 1) {
this.downloadPageOpacity = 1;
this.isDownloadPageEnabled = true;
this.downloadPageVisibility = Visibility.Visible;
this.historyPageVisibility = Visibility.None;
} else if (this.tabSelectedIndexes[0] === 2) {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets#L90-L114 | 3a9729e163c9e0371234590fdeee0d135a1ff089 | gitee |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/viewmodel/AccountList.ets | arkts | 定义图像列表,用于关联支出/收入类型与图标资源 | export const ImageList: Record<string, Resource> = {
'吃饭': $rawfile('foods.png'),
'零食': $rawfile('snacks.png'),
'汽车加油': $rawfile('fuel.png'),
'旅游': $rawfile('travel.png'),
'娱乐': $rawfile('games.png'),
'宠物': $rawfile('pets.png'),
'工作收入': $rawfile('income.png'),
'投资': $rawfile('invest.png')
}; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ImageList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , A... | export const ImageList: Record<string, Resource> = {
'吃饭': $rawfile('foods.png'),
'零食': $rawfile('snacks.png'),
'汽车加油': $rawfile('fuel.png'),
'旅游': $rawfile('travel.png'),
'娱乐': $rawfile('games.png'),
'宠物': $rawfile('pets.png'),
'工作收入': $rawfile('income.png'),
'投资': $rawfile('invest.png')
}; | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/viewmodel/AccountList.ets#L63-L72 | cb96432453643242ec038be59b8b0decf2e587b0 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/common/Route.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface Route {
title: string ;
name: string;
items?: Route[];
description?: ResourceStr;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Route AST#object_type#Left { AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST#pr... | export interface Route {
title: string ;
name: string;
items?: Route[];
description?: ResourceStr;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/common/Route.ets#L16-L21 | ca67d4200784fd0eb73e038150a1d9f067436d7f | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Adds a unit to a size in bytes.
@param size_in_bytes A number or bigint, the size in bytes.
@returns A string, the connected result of a number of size and its unit. | export function add_units_to_size(size_in_bytes: number | bigint) {
if (size_in_bytes == undefined || size_in_bytes == null) {
return 'No Bytes!';
}
let units = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
let result = BigInt(size_in_bytes);
let unit = 0;
while (result > 1024 * 1024... | AST#export_declaration#Left export AST#function_declaration#Left function add_units_to_size AST#parameter_list#Left ( AST#parameter#Left size_in_bytes : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left bigint AST#primary_type#Right AST#union_type#R... | export function add_units_to_size(size_in_bytes: number | bigint) {
if (size_in_bytes == undefined || size_in_bytes == null) {
return 'No Bytes!';
}
let units = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
let result = BigInt(size_in_bytes);
let unit = 0;
while (result > 1024 * 1024... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L663-L679 | 36b3c99211e83f680e8ce7c6c92afc76265a308f | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/RecordingView.ets | arkts | handleRecordingChange | 波纹基准高度
监听说话状态变化 | @Monitor('isTalking')
private handleRecordingChange() {
if (this.isTalking) {
this.waveSpeed = 0.25; // 说话时加速波纹
this.waveAmplitude = 15; // 增大波纹幅度
} else {
this.waveSpeed = 0.08; // 恢复正常速度
this.waveAmplitude = 10; // 恢复默认幅度
}
} | AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'isTalking' AST#expression#Right ) AST#decorator#Right private handleRecordingChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#... | @Monitor('isTalking')
private handleRecordingChange() {
if (this.isTalking) {
this.waveSpeed = 0.25;
this.waveAmplitude = 15;
} else {
this.waveSpeed = 0.08;
this.waveAmplitude = 10;
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/RecordingView.ets#L23-L32 | 68597646c3d30f579115d22cd96df88b4490752c | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/AccessControl/entry/src/main/ets/pages/UserIdentityAuthentication.ets | arkts | publicInitFunc | 初始化HUKS中的会话,获取挑战值 | async function publicInitFunc(keyAlias: string, huksOptions: huks.HuksOptions) {
console.info(`enter promise doInit`);
let throwObject: ThrowObject = { isThrow: true };
try {
await initSession(keyAlias, huksOptions, throwObject)
.then((data) => {
console.info(`promise: doInit success, data = ${J... | AST#function_declaration#Left async function publicInitFunc AST#parameter_list#Left ( AST#parameter#Left keyAlias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left... | async function publicInitFunc(keyAlias: string, huksOptions: huks.HuksOptions) {
console.info(`enter promise doInit`);
let throwObject: ThrowObject = { isThrow: true };
try {
await initSession(keyAlias, huksOptions, throwObject)
.then((data) => {
console.info(`promise: doInit success, data = ${J... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/AccessControl/entry/src/main/ets/pages/UserIdentityAuthentication.ets#L173-L194 | 6f91ea3613650c6334e15e1345bcca53496f9177 | gitee |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/login/LoginApproach.ets | arkts | buildItem | @Link switchLoginApproach:boolean; | @Builder
buildItem(itemModel: ItemModel){
Row(){
Image(itemModel.imagePath).width(30).margin({right:5})
Text(itemModel.text).fontSize(22).fontWeight(FontWeight.Bold)
}.width('100%').margin(20).border({ width: { bottom: 1 }, color: Color.Gray }).justifyContent(FlexAlign.Center)
.onClick(()=>{
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildItem AST#parameter_list#Left ( AST#parameter#Left itemModel : AST#type_annotation#Left AST#primary_type#Left ItemModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bo... | @Builder
buildItem(itemModel: ItemModel){
Row(){
Image(itemModel.imagePath).width(30).margin({right:5})
Text(itemModel.text).fontSize(22).fontWeight(FontWeight.Bold)
}.width('100%').margin(20).border({ width: { bottom: 1 }, color: Color.Gray }).justifyContent(FlexAlign.Center)
.onClick(()=>{
... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/login/LoginApproach.ets#L46-L57 | ba6fe669dda38b24b02529f241da872a3399c890 | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/Utils.ets | arkts | Save the pixel map into image file.
@param pixelMap - pixel map
@param path - file path
@returns Promise<void> | export function pixelMap2File(pixelMap: image.PixelMap | undefined, path: string): Promise<void> {
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 };
return imagePac... | AST#export_declaration#Left export AST#function_declaration#Left 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_type#L... | export function pixelMap2File(pixelMap: image.PixelMap | undefined, path: string): Promise<void> {
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 };
return imagePac... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/Utils.ets#L31-L42 | c987f31be9c2e72c094aeae71dc2291f6080daed | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets | arkts | aboutToResize | 当布局大小发生变化时进行回调 | aboutToResize(size: Size) {
console.info('aboutToResize width : ' + size.width + ' height : ' + size.height );
} | AST#method_declaration#Left aboutToResize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#... | aboutToResize(size: Size) {
console.info('aboutToResize width : ' + size.width + ' height : ' + size.height );
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets#L69-L71 | a261b2c6a959e3ff4c0a2919d298846e43dd78f8 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/StringUtils.ets | arkts | isEmpty | 字符串是否为空(undefined、null、字符串长度为0)
@param str 被检测的字符串
@return 是否为空 | static isEmpty(str: string | undefined | null): boolean {
return str == undefined || str == null || str.length == 0;
} | AST#method_declaration#Left static isEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right... | static isEmpty(str: string | undefined | null): boolean {
return str == undefined || str == null || str.length == 0;
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L39-L41 | a72e7996790915869f97c29a6471f3bfc77845d1 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/device/DeviceManager.ets | arkts | getAppInfo | 获取应用信息 | async getAppInfo(): Promise<AppInfo> {
try {
if (!this.context) {
throw new Error('Context not set');
}
const bundleInfo = await bundleManager.getBundleInfoForSelf(
bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT
);
return {
name: bundleInfo.name ... | AST#method_declaration#Left async getAppInfo 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 AppInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async getAppInfo(): Promise<AppInfo> {
try {
if (!this.context) {
throw new Error('Context not set');
}
const bundleInfo = await bundleManager.getBundleInfoForSelf(
bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT
);
return {
name: bundleInfo.name ... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/device/DeviceManager.ets#L105-L134 | 65b0eff4f046169c6f5c603d26be1caf3a3621a6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/GreetingsPage.ets | arkts | deleteSelectedGreetings | 删除选中的祝福语 | private async deleteSelectedGreetings(): Promise<void> {
try {
const selectedIds = Array.from(this.selectedGreetings);
if (selectedIds.length === 0) return;
for (const id of selectedIds) {
await this.greetingService.deleteGreeting(id);
}
// 刷新列表
await this.loadGre... | AST#method_declaration#Left private async deleteSelectedGreetings 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#R... | private async deleteSelectedGreetings(): Promise<void> {
try {
const selectedIds = Array.from(this.selectedGreetings);
if (selectedIds.length === 0) return;
for (const id of selectedIds) {
await this.greetingService.deleteGreeting(id);
}
await this.loadGreetings(... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L142-L157 | c3eca7062cd4513c2bf3d426f603006b06785db1 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/immersive/src/main/ets/dialog/ImmersiveDialog.ets | arkts | ImmersiveDialog | 底部弹框沉浸式适配
1、设置弹框尾部元素对导航条避让 | @CustomDialog
export struct ImmersiveDialog {
customController: CustomDialogController;
@State bottomHeight: number = 0;
aboutToAppear(): void {
window.getLastWindow(getContext(), (err, data) => {
const avoidAreaBottom = data.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR);
thi... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct ImmersiveDialog AST#component_body#Left { AST#property_declaration#Left customController : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right ; AS... | @CustomDialog
export struct ImmersiveDialog {
customController: CustomDialogController;
@State bottomHeight: number = 0;
aboutToAppear(): void {
window.getLastWindow(getContext(), (err, data) => {
const avoidAreaBottom = data.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR);
thi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/immersive/src/main/ets/dialog/ImmersiveDialog.ets#L23-L42 | 6a4afce01282a569b8f6a5b2603af5d4e0a5351f | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | example/BasicUsage.ets | arkts | watermark | 添加水印 | watermark(): void {
const cmd = FFmpegFactory.watermark('/input.mp4', '/logo.png', '/output.mp4');
this.run(cmd);
} | AST#method_declaration#Left watermark AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cmd = AST#expre... | watermark(): void {
const cmd = FFmpegFactory.watermark('/input.mp4', '/logo.png', '/output.mp4');
this.run(cmd);
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L49-L52 | 6e344ac4ed1e9f8775f6dfcd7a69cb13f1194f64 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/StatsManager.ets | arkts | notifyListeners | 通知监听器 | private notifyListeners(event: string, data: any): void {
const callbacks = this.listeners.get(event);
if (callbacks) {
callbacks.forEach(callback => callback(data));
}
} | AST#method_declaration#Left private notifyListeners AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left any AST#primary_t... | private notifyListeners(event: string, data: any): void {
const callbacks = this.listeners.get(event);
if (callbacks) {
callbacks.forEach(callback => callback(data));
}
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L358-L363 | 6bf96d0baf4820f28fc2a3a77b064d177eed2afe | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/VoiceStateUpdate.ets | arkts | Emitted whenever a user changes voice state - e.g. joins/leaves a channel, mutes/unmutes.
@event Client#voiceStateUpdate
@param {GuildMember} oldMember The member before the voice state update
@param {GuildMember} newMember The member after the voice state update
应用约束61:使用ES模块导出 | export default VoiceStateUpdateHandler; | AST#export_declaration#Left export default AST#expression#Left VoiceStateUpdateHandler AST#expression#Right ; AST#export_declaration#Right | export default VoiceStateUpdateHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/VoiceStateUpdate.ets#L121-L121 | 09988125646e8e0fb52c178350769418283845ee | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/PermissionUtil.ets | arkts | _requestPermissionsOnSetting | 用户首次拒绝后二次申请授权 | private static async _requestPermissionsOnSetting(permissions: Permissions[]) {
PermissionUtil._atManager.requestPermissionOnSetting(PermissionUtil._context, permissions)
.then((data: abilityAccessCtrl.GrantStatus[]) => {
Logger.info(TAG, 'request permission on setting success::' + JSON.stringify(data... | AST#method_declaration#Left private static async _requestPermissionsOnSetting AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para... | private static async _requestPermissionsOnSetting(permissions: Permissions[]) {
PermissionUtil._atManager.requestPermissionOnSetting(PermissionUtil._context, permissions)
.then((data: abilityAccessCtrl.GrantStatus[]) => {
Logger.info(TAG, 'request permission on setting success::' + JSON.stringify(data... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/PermissionUtil.ets#L56-L65 | 59c5aab6efe38ad222caec149fceed80ca9a2cce | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the Distribution OS version.
<p>Independent Software Vendor (ISV) may distribute OHOS with their own OS api version.
distributionOSVersion will return the ISV OS api version
If ISV not specified, it will return the same value as sdkApiVersion
@syscap SystemCapability.Startup.SystemInfo
@since 20
@arkts 1.2 | static get distributionOSApiVersion(): int; | AST#method_declaration#Left static get AST#ERROR#Left distributionOSApiVersion AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left int AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get distributionOSApiVersion(): int; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L421-L421 | 78838577b10615df725960bfe52e2acda9b28816 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets | arkts | setHighlightLineWidth | Sets the width of the highlight line in vp.
@param width | public setHighlightLineWidth(width: number): void {
this.mHighlightLineWidth = Utils.handleDataValues(width);
} | AST#method_declaration#Left public setHighlightLineWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pr... | public setHighlightLineWidth(width: number): void {
this.mHighlightLineWidth = Utils.handleDataValues(width);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets#L73-L75 | 3ca7a8a6e363568a6d5a7d217940afbb6227964d | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/controlPage/common/models/deviceCommandModel.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export class DeviceCommandModel {
commandName:string
serviceId:string
value:string
constructor | AST#export_declaration#Left export AST#ERROR#Left class DeviceCommandModel { commandName : AST#ERROR#Left string serviceId : string value : AST#ERROR#Right string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#exp... | export class DeviceCommandModel {
commandName:string
serviceId:string
value:string
constructor | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/controlPage/common/models/deviceCommandModel.ets#L16-L21 | 9d7b334e9a16de8bfebb633084dcb43faefb5f65 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets | arkts | getHighlightCircleFillColor | @Override | public getHighlightCircleFillColor(): number {
return this.mHighlightCircleFillColor;
} | AST#method_declaration#Left public getHighlightCircleFillColor 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 ... | public getHighlightCircleFillColor(): number {
return this.mHighlightCircleFillColor;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets#L55-L57 | e6cb69098a1571d3d60494954f44eed7ba57978f | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets | arkts | 根据文件名称的扩展名获取对应的mimetype,如果获取不到或者异常返回空字符串 | export function getMimeType(fileName: string) {
let pos = fileName.lastIndexOf(".")
let fileExtention = fileName.substring(pos);
try {
let typeId = uniformTypeDescriptor.getUniformDataTypeByFilenameExtension(fileExtention);
let typeDescriptor = uniformTypeDescriptor.getTypeDescriptor(typeId);
return ... | AST#export_declaration#Left export AST#function_declaration#Left function getMimeType AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { A... | export function getMimeType(fileName: string) {
let pos = fileName.lastIndexOf(".")
let fileExtention = fileName.substring(pos);
try {
let typeId = uniformTypeDescriptor.getUniformDataTypeByFilenameExtension(fileExtention);
let typeDescriptor = uniformTypeDescriptor.getTypeDescriptor(typeId);
return ... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L131-L142 | 02493b6024d669b446a8fa5ee6c9c73d72a43f1b | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | isDrawBottomYLabelEntryEnabled | returns true if drawing the bottom y-axis label entry is enabled
@return | public isDrawBottomYLabelEntryEnabled(): boolean {
return this.mDrawBottomYLabelEntry;
} | AST#method_declaration#Left public isDrawBottomYLabelEntryEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#L... | public isDrawBottomYLabelEntryEnabled(): boolean {
return this.mDrawBottomYLabelEntry;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L217-L219 | f776b971ce8d77855b0b85216e2f4d7ac95a3b75 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/shortcut/ShortcutManager.ets | arkts | calculateDaysUntil | 计算距离生日的天数 | private calculateDaysUntil(dateStr: string): number {
const birthday = new Date(dateStr);
const today = new Date();
const thisYear = today.getFullYear();
const thisYearBirthday = new Date(thisYear, birthday.getMonth(), birthday.getDate());
let targetDate = thisYearBirthday;
if (thisYearBirt... | AST#method_declaration#Left private calculateDaysUntil AST#parameter_list#Left ( AST#parameter#Left dateStr : 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 number AST#... | private calculateDaysUntil(dateStr: string): number {
const birthday = new Date(dateStr);
const today = new Date();
const thisYear = today.getFullYear();
const thisYearBirthday = new Date(thisYear, birthday.getMonth(), birthday.getDate());
let targetDate = thisYearBirthday;
if (thisYearBirt... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L434-L447 | 9fa8dd9aa6c07cc2b00d0abea1de71e0047fea74 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | getNetworkType | 获取网络类型。 | static async getNetworkType(): Promise<NetworkType> {
try {
if (NetworkUtil.hasNetWiFi()) {
return NetworkType.NETWORK_TYPE_WIFI
}
if (NetworkUtil.hasNetMobile()) {
let signalInfo: Array<radio.SignalInformation> = await NetworkUtil.getSignalInformation();
for (let item of s... | AST#method_declaration#Left static async getNetworkType 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 NetworkType AST#primary_type#Right AST#type_annotation#Righ... | static async getNetworkType(): Promise<NetworkType> {
try {
if (NetworkUtil.hasNetWiFi()) {
return NetworkType.NETWORK_TYPE_WIFI
}
if (NetworkUtil.hasNetMobile()) {
let signalInfo: Array<radio.SignalInformation> = await NetworkUtil.getSignalInformation();
for (let item of s... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L386-L413 | b983dd8e708877430a1669cd48ba1aa7547b5efd | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets | arkts | ArrayBuffer转utf8字符串 | export function buf2String(buf: ArrayBuffer) {
let msgArray = new Uint8Array(buf);
let textDecoder = util.TextDecoder.create("utf-8");
return textDecoder.decodeToString(msgArray)
} | AST#export_declaration#Left export AST#function_declaration#Left function buf2String AST#parameter_list#Left ( AST#parameter#Left buf : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS... | export function buf2String(buf: ArrayBuffer) {
let msgArray = new Uint8Array(buf);
let textDecoder = util.TextDecoder.create("utf-8");
return textDecoder.decodeToString(msgArray)
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L124-L128 | a68a8dc4c98ae00fa8fa679a4f43e0e0a758036d | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DeviceUtils.ets | arkts | getBatterySOC | 获取当前设备剩余电池电量百分比。
@returns | static getBatterySOC(): number {
return batteryInfo.batterySOC;
} | AST#method_declaration#Left static getBatterySOC 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 getBatterySOC(): number {
return batteryInfo.batterySOC;
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DeviceUtils.ets#L163-L165 | 0e1e1dfad0065417ec9e0e33b5d25fced73f850b | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NdkDrawing/entry/src/main/ets/pages/Index.ets | arkts | setPixelMap | Set the background picture | setPixelMap(p: PixelMap): void {
this.pMap = p;
} | AST#method_declaration#Left setPixelMap AST#parameter_list#Left ( AST#parameter#Left p : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AS... | setPixelMap(p: PixelMap): void {
this.pMap = p;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NdkDrawing/entry/src/main/ets/pages/Index.ets#L54-L56 | 386143efddd2f592f260d610797aadd5fbc52eed | gitee |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/common/PreferencesUtil.ets | arkts | getPreferences | 获取 Preferences 实例
@param context 应用上下文
@returns Preferences 实例 | private static async getPreferences(context: common.UIAbilityContext): Promise<preferences.Preferences> {
if (!context) {
const error = new Error('Context is null or undefined');
console.error('PreferencesUtil getPreferences: ' + error.message);
throw error;
}
try {
// 为了简单起见,每次直接获取,... | AST#method_declaration#Left private static async getPreferences AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para... | private static async getPreferences(context: common.UIAbilityContext): Promise<preferences.Preferences> {
if (!context) {
const error = new Error('Context is null or undefined');
console.error('PreferencesUtil getPreferences: ' + error.message);
throw error;
}
try {
const pref... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/PreferencesUtil.ets#L17-L34 | 524f26937cc1036c19744c6689f18993a0a6c912 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/privacyagreement/src/main/ets/components/PrivacyAgreement.ets | arkts | PrivacyAgreement | 功能描述:本示例主要介绍使用web组件实现隐私协议与用户协议的展示
推荐场景:应用中协议展示
核心组件
1.web 加载协议html
实现步骤
1.通过AppStorage获取点击的按钮是用户协议还是隐私协议
2.根据AppStorage获取的值匹配对应网址赋值给webUri在web组件中加载 | @Component
export struct PrivacyAgreement {
@State webUri: string = '';
webController: WebviewController = new webview.WebviewController();
aboutToAppear(): void {
let titleName: string | undefined = AppStorage.get('agreementTitle');
for (let i = 0; i < agreementDataArr.length; i++) {
if (agreement... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PrivacyAgreement AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right webUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_an... | @Component
export struct PrivacyAgreement {
@State webUri: string = '';
webController: WebviewController = new webview.WebviewController();
aboutToAppear(): void {
let titleName: string | undefined = AppStorage.get('agreementTitle');
for (let i = 0; i < agreementDataArr.length; i++) {
if (agreement... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/privacyagreement/src/main/ets/components/PrivacyAgreement.ets#L43-L66 | cabcd0c61eb718bd80f7ca755a416f76b74d8149 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/localization/I18nManager.ets | arkts | loadLanguage | 加载语言设置 | private async loadLanguage(): Promise<void> {
try {
const lang = await StorageManager.getString(this.LANGUAGE_KEY, 'zh') as Language;
this.currentLanguage = lang;
Logger.info('I18nManager', `Language loaded: ${lang}`);
} catch (error) {
Logger.error('I18nManager', `Failed to load languag... | AST#method_declaration#Left private async loadLanguage 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#... | private async loadLanguage(): Promise<void> {
try {
const lang = await StorageManager.getString(this.LANGUAGE_KEY, 'zh') as Language;
this.currentLanguage = lang;
Logger.info('I18nManager', `Language loaded: ${lang}`);
} catch (error) {
Logger.error('I18nManager', `Failed to load languag... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/localization/I18nManager.ets#L65-L73 | 19729df149cc57fb9c5ab8a5ccbcc0f6b228b1df | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogHub.ets | arkts | getTextPicker | 文本选择 弹窗
@param sheets 菜单项
@returns | static getTextPicker(uiContext?: UIContext): TextPickerBuilderProxy {
return new TextPickerBuilderProxy(uiContext)
} | AST#method_declaration#Left static getTextPicker AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TextPicker... | static getTextPicker(uiContext?: UIContext): TextPickerBuilderProxy {
return new TextPickerBuilderProxy(uiContext)
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L149-L151 | 220e70bb22e3485b6ff3451219c3171044daf1b1 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets | arkts | createAnimation | 创建移动动画
用于移动圆球和重绘canvas中凹陷部分 | createAnimation() {
if (!this.circleInfo) {
return;
}
// 动画等待时长
let animateDelay = 0;
// 动画执行次数
let animateIterations = 1;
this.canvasAnimator = animator.create({
duration: this.animateTime,
easing: "ease",
delay: animateDelay,
fill: "forwards",
direction:... | AST#method_declaration#Left createAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary... | createAnimation() {
if (!this.circleInfo) {
return;
}
let animateDelay = 0;
let animateIterations = 1;
this.canvasAnimator = animator.create({
duration: this.animateTime,
easing: "ease",
delay: animateDelay,
fill: "forwards",
direction: "normal",
i... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets#L82-L106 | 2389901eed6bab3562ec101666f85b3e3d709cba | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/SearchHistoryRepository.ets | arkts | removeSearchHistory | 根据关键词删除搜索历史记录
@param {string} keyword 搜索关键词
@returns {Promise<void>} Promise<void> | removeSearchHistory(keyword: string): Promise<void> {
return this.dataSource.removeSearchHistory(keyword);
} | AST#method_declaration#Left removeSearchHistory 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_type#L... | removeSearchHistory(keyword: string): Promise<void> {
return this.dataSource.removeSearchHistory(keyword);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/SearchHistoryRepository.ets#L46-L48 | 693d4102351a318cd1648e3a19f1491dd36d4347 | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Filter.d.ets | arkts | @file
@kit ArkUI
Declare FilterType
@enum { FilterType }
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare FilterType
@enum { FilterType }
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare enum FilterType {
/**
* The multi_line_filter type.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* The multi_line_filter type.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
MULTI_LINE_FILTER = 0,
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum FilterType AST#enum_body#Left { /**
* The multi_line_filter type.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* The multi_line_filter type.
* @syscap SystemCapability... | export declare enum FilterType {
MULTI_LINE_FILTER = 0,
LIST_FILTER = 1
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Filter.d.ets#L32-L57 | c5312c2d4a17fe154d6ebb71afb5e2d0b5ec2dfd | github | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationRequestUtil.ets | arkts | initBasicNotificationRequest | init basic NotificationRequest
@param notificationContent
@return return the created NotificationRequest | initBasicNotificationRequest(notificationContent: notification.NotificationContent) {
let result: NotificationRequestUtilResultType = {
slotType: notification.SlotType.CONTENT_INFORMATION,
id: 1, // 通知id,默认为1
content: notificationContent
}
return result;
} | AST#method_declaration#Left initBasicNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri... | initBasicNotificationRequest(notificationContent: notification.NotificationContent) {
let result: NotificationRequestUtilResultType = {
slotType: notification.SlotType.CONTENT_INFORMATION,
id: 1,
content: notificationContent
}
return result;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationRequestUtil.ets#L30-L37 | 87040a8f9c18ecdb9901af475a4ce35eba35fb05 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/entity/FootprintEntity.ets | arkts | FootprintEntity | @file 用户足迹数据库实体,映射 footprints 表。
@author Joker.X | @Table({ name: "footprints" })
export class FootprintEntity {
/**
* 主键,使用商品ID作为主键
*/
@PrimaryKey({ autoIncrement: false })
goodsId?: number;
/**
* 商品名称
*/
@Column({ type: ColumnType.TEXT })
goodsName?: string;
/**
* 商品副标题
*/
@Column({ type: ColumnType.TEXT })
goodsSubTitle?: string |... | AST#decorated_export_declaration#Left AST#decorator#Left @ Table ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "footprints" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expressio... | @Table({ name: "footprints" })
export class FootprintEntity {
@PrimaryKey({ autoIncrement: false })
goodsId?: number;
@Column({ type: ColumnType.TEXT })
goodsName?: string;
@Column({ type: ColumnType.TEXT })
goodsSubTitle?: string | null;
@Column({ type: ColumnType.TEXT })
goodsMainPic?: str... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/entity/FootprintEntity.ets#L7-L44 | 717a29ff38a3231f0e7c41618402250d410f96f1 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/dialog/BaseCustomDialog.ets | arkts | initAlertTitle | ------------------------- 保护、私有方法 protected | private methods -------------------------
Alert标题,初始化参数
@param options | private initAlertTitle(options: IBaseContentOptions | IBaseInputOptions) {
if ((options.primaryTitle || options.title) && !options.style?.customHeader) {
options.primaryTitle = options.primaryTitle ?? options.title; //弹框一级标题。
}
} | AST#method_declaration#Left private initAlertTitle AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left IBaseContentOptions AST#primary_type#Right | AST#primary_type#Left IBaseInputOptions AST#primary_type#Right AST#union_type#Right AST#type_annotatio... | private initAlertTitle(options: IBaseContentOptions | IBaseInputOptions) {
if ((options.primaryTitle || options.title) && !options.style?.customHeader) {
options.primaryTitle = options.primaryTitle ?? options.title;
}
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/BaseCustomDialog.ets#L22-L26 | 255e69abe098b9ff299620a250a488c494b7193b | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets | arkts | RGB color, red,green and blue. | export enum RGBIndex {
RED,
GREEN,
BLUE
} | AST#export_declaration#Left export AST#enum_declaration#Left enum RGBIndex AST#enum_body#Left { AST#enum_member#Left RED AST#enum_member#Right , AST#enum_member#Left GREEN AST#enum_member#Right , AST#enum_member#Left BLUE AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Righ... | export enum RGBIndex {
RED,
GREEN,
BLUE
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets#L210-L214 | 987c91e71878f37615f8de7fe6461f79820a0df2 | gitee | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | setting/src/main/ets/views/TipsView.ets | arkts | tipList | 设置列表 item | @Builder
tipList(list_title: Resource, tipList: TipsListItemModel[]) {
// 列表标题
Text(list_title)
.width('100%')
.textAlign(TextAlign.Start)
.fontColor(Color.Gray)
.fontSize(14)
.fontWeight(FontWeight.Medium)
.padding({ left: 12 })
.margin({ bottom: 8 })
// 列表
L... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tipList AST#parameter_list#Left ( AST#parameter#Left list_title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tipList : AST#type_annotation#L... | @Builder
tipList(list_title: Resource, tipList: TipsListItemModel[]) {
Text(list_title)
.width('100%')
.textAlign(TextAlign.Start)
.fontColor(Color.Gray)
.fontSize(14)
.fontWeight(FontWeight.Medium)
.padding({ left: 12 })
.margin({ bottom: 8 })
List({ space:... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/views/TipsView.ets#L35-L512 | f282424ef9a4a456564d1f890fba0ab70b1fda8f | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.SegmentButton.d.ets | arkts | create | The function used to create a SegmentButtonItemOptionsArray object.
@param { SegmentButtonItemTuple } elements - The SegmentButton items.
@returns { SegmentButtonItemOptionsArray } Returns the a new SegmentButtonItemOptionsArray object.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
The function ... | static create(elements: SegmentButtonItemTuple): SegmentButtonItemOptionsArray; | AST#method_declaration#Left static create AST#parameter_list#Left ( AST#parameter#Left elements : AST#type_annotation#Left AST#primary_type#Left SegmentButtonItemTuple AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Segment... | static create(elements: SegmentButtonItemTuple): SegmentButtonItemOptionsArray; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButton.d.ets#L1358-L1358 | 79aaba4887cf7aba4bdf5c4d97231a4aea034883 | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Tables/DayInfoApi.ets | arkts | queryList | 查询多组数据 | queryList(dates: string[], callback: Function): void {
let predicates: dataRdb.RdbPredicates = new dataRdb.RdbPredicates('dayInfo');
predicates.in('date', dates);
RdbUtils.query(predicates).then((resultSet) => {
let count: Number = resultSet.rowCount;
if (count <= 0) {
let result: DayInf... | AST#method_declaration#Left queryList AST#parameter_list#Left ( AST#parameter#Left dates : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#... | queryList(dates: string[], callback: Function): void {
let predicates: dataRdb.RdbPredicates = new dataRdb.RdbPredicates('dayInfo');
predicates.in('date', dates);
RdbUtils.query(predicates).then((resultSet) => {
let count: Number = resultSet.rowCount;
if (count <= 0) {
let result: DayInf... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Tables/DayInfoApi.ets#L54-L78 | ffbbc05784ddbc38cf13f89df85fa8786ec12c15 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets | arkts | toggleFavorite | 切换收藏状态 | private async toggleFavorite(): Promise<void> {
try {
if (this.contact) {
await this.contactService.updateContact({
id: this.contact.id,
isFavorite: !this.contact.isFavorite
});
// 更新本地状态
this.contact = {
...this.contact,
isFavor... | AST#method_declaration#Left private async toggleFavorite AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | private async toggleFavorite(): Promise<void> {
try {
if (this.contact) {
await this.contactService.updateContact({
id: this.contact.id,
isFavorite: !this.contact.isFavorite
});
this.contact = {
...this.contact,
isFavorite: !thi... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L87-L104 | 23155ae6cbd24b812e1803fa870dc681a0f6f1ee | github |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/register.ets | arkts | handleRegister | 处理注册请求 | private async handleRegister() {
// 验证输入
this.errorMessage = '';
if (!this.nickname.trim() || !this.email.trim() ||
!this.password.trim() || !this.confirmPassword.trim()) {
this.errorMessage = '请填写所有必填字段';
return;
}
if (this.password !== this.confirmPassword) {
this.errorMe... | AST#method_declaration#Left private async handleRegister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 验证输入 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . errorMessage ... | private async handleRegister() {
this.errorMessage = '';
if (!this.nickname.trim() || !this.email.trim() ||
!this.password.trim() || !this.confirmPassword.trim()) {
this.errorMessage = '请填写所有必填字段';
return;
}
if (this.password !== this.confirmPassword) {
this.errorMessage =... | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/register.ets#L253-L319 | 018677b14c01e0113176eeb934ae1b2f23c13361 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/pages/scrollingCharts/viewPageItems/frag_simple_scatter_index.ets | arkts | generateScatterData | 初始化数据
@param count 曲线图点的个数
@param range y轴范围 | private generateScatterData(dataSets: number, range: number, count: number): ScatterData {
let sets: JArrayList<IScatterDataSet> = new JArrayList<IScatterDataSet>();
let shapes = [ChartShape.SQUARE, ChartShape.CIRCLE, ChartShape.TRIANGLE, ChartShape.CROSS, ChartShape.X, ChartShape.CHEVRON_UP, ChartShape.CHEVRON... | AST#method_declaration#Left private generateScatterData AST#parameter_list#Left ( AST#parameter#Left dataSets : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left range : AST#type_annotation#Left AST#primary_type#Left number AS... | private generateScatterData(dataSets: number, range: number, count: number): ScatterData {
let sets: JArrayList<IScatterDataSet> = new JArrayList<IScatterDataSet>();
let shapes = [ChartShape.SQUARE, ChartShape.CIRCLE, ChartShape.TRIANGLE, ChartShape.CROSS, ChartShape.X, ChartShape.CHEVRON_UP, ChartShape.CHEVRON... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/viewPageItems/frag_simple_scatter_index.ets#L99-L119 | 91fe95cac4b1e46621e87f9ea75f70c65fa838b2 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.