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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/array_lib_func_003_T.ets | arkts | Introduction 库函数-array_pop | export function array_lib_func_003_T(taint_src : string) {
let arr : string[] = ["a","b",taint_src];
let t = arr.pop();
taint.Sink(t!);
} | AST#export_declaration#Left export AST#function_declaration#Left function array_lib_func_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function array_lib_func_003_T(taint_src : string) {
let arr : string[] = ["a","b",taint_src];
let t = arr.pop();
taint.Sink(t!);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/array_lib_func_003_T.ets#L6-L10 | b7e2b6b52530e1042e6415c1288b8118a9392252 | github | |
yiyefangzhou24/hmwechat | 27d11056003843c7e331e683478720d8efa49d17 | entry/src/main/ets/default/model/data/EmojiData.ets | arkts | emoji表情数据结构 | export class EmojiData{
file: string
tag: string
constructor | AST#export_declaration#Left export AST#ERROR#Left class EmojiData { file : string tag : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right | export class EmojiData{
file: string
tag: string
constructor | https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/data/EmojiData.ets#L5-L9 | a7784c7b3c647d197352253e2a35b836fe7305bc | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | push | 页面跳转
@param path 目标页面路径
@param options 跳转选项 | async push(path: string, options?: RouteOptions): Promise<void> {
try {
const routerOptions: router.RouterOptions = {
url: path,
params: options?.params
};
await router.pushUrl(routerOptions, options?.mode || router.RouterMode.Standard);
// 记录导航栈
this.navi... | AST#method_declaration#Left async push AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left RouteOptions AST#primary_t... | async push(path: string, options?: RouteOptions): Promise<void> {
try {
const routerOptions: router.RouterOptions = {
url: path,
params: options?.params
};
await router.pushUrl(routerOptions, options?.mode || router.RouterMode.Standard);
this.navigationSt... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L86-L106 | e86113a08add62fbc65a9af80ac0ec2e12c2ff4f | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets | arkts | updateAccount | 更新账号输入
@param {string} value - 账号值
@returns {void} 无返回值 | updateAccount(value: string): void {
this.account = value;
} | AST#method_declaration#Left updateAccount AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | updateAccount(value: string): void {
this.account = value;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets#L127-L129 | b859f2dd1cad22aac99922250df5ba6e3c803922 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/efRcpConfig.ets | arkts | 上传入参对象 | export class uploadParams extends commonParams {
/**
* 上传文件字段
*/
fileInfo: rcp.MultipartFormFields = {};
/**
* 断点续传参数(1.0.6+)
*/
transferRange?: rcp.TransferRange = {};
} | AST#export_declaration#Left export AST#class_declaration#Left class uploadParams extends AST#type_annotation#Left AST#primary_type#Left commonParams AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 上传文件字段
*/ AST#property_declaration#Left fileInfo : AST#type_annotation#Left AST#prim... | export class uploadParams extends commonParams {
fileInfo: rcp.MultipartFormFields = {};
transferRange?: rcp.TransferRange = {};
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L295-L304 | 4ea06e85593348d1c98fdcd6a8e6ea99c6e3751a | gitee | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/utils/FileUtils.ets | arkts | deleteFile | 异步删除文件
@param path
@returns | async deleteFile(path: string): Promise<void> {
try {
await fs.unlink(path)
} catch (err) {
LogUtil.error('FileUtils deleteFile failed: err msg=' + err.message + ' err code=' + err.code);
}
} | AST#method_declaration#Left async deleteFile AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr... | async deleteFile(path: string): Promise<void> {
try {
await fs.unlink(path)
} catch (err) {
LogUtil.error('FileUtils deleteFile failed: err msg=' + err.message + ' err code=' + err.code);
}
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L60-L66 | 8e117041fce6d002d9f7ce4e7291610c913c1d78 | gitee |
liudi25385/mybit.git | 865f64ff6b2e10f5b79100064dff05e67607a5bc | entry/src/main/ets/net/CustomNetPlugin.ets | arkts | willSendRequest | 发送Request 请求的所有信息 | willSendRequest(request: NetRequest): void {
} | AST#method_declaration#Left willSendRequest AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left NetRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | willSendRequest(request: NetRequest): void {
} | https://github.com/liudi25385/mybit.git/blob/865f64ff6b2e10f5b79100064dff05e67607a5bc/entry/src/main/ets/net/CustomNetPlugin.ets#L6-L8 | 34be375d9b38d69796493261f55c959eccdadece | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets | arkts | setOrientation | 横竖屏切换 | setOrientation(orientation: number) {
console.log(`setOrientation`)
if (this.windowClass !== undefined) {
console.log(`setOrientation enter`)
this.windowClass.setPreferredOrientation(orientation).then(() => {
console.info('setWindowOrientation: ' + orientation + ' Succeeded.');
}).catc... | AST#method_declaration#Left setOrientation AST#parameter_list#Left ( AST#parameter#Left orientation : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#e... | setOrientation(orientation: number) {
console.log(`setOrientation`)
if (this.windowClass !== undefined) {
console.log(`setOrientation enter`)
this.windowClass.setPreferredOrientation(orientation).then(() => {
console.info('setWindowOrientation: ' + orientation + ' Succeeded.');
}).catc... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets#L206-L216 | b589efd3aeac634ba5df2b5c72ecf7f6e6985bbc | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | importSettings | 导入设置数据
@param exportData 导入的设置数据
@returns 导入后的设置 | async importSettings(exportData: SettingsExportData): Promise<AppSettings> {
try {
// 验证导入数据的版本兼容性
if (!this.isVersionCompatible(exportData.version)) {
throw new Error(`不支持的设置版本:${exportData.version}`);
}
// 合并导入的设置与当前设置
const currentSettings = await this.getSettings();
... | AST#method_declaration#Left async importSettings AST#parameter_list#Left ( AST#parameter#Left exportData : AST#type_annotation#Left AST#primary_type#Left SettingsExportData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS... | async importSettings(exportData: SettingsExportData): Promise<AppSettings> {
try {
if (!this.isVersionCompatible(exportData.version)) {
throw new Error(`不支持的设置版本:${exportData.version}`);
}
const currentSettings = await this.getSettings();
const importedSettings: AppSet... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L397-L435 | fb505da051e9d1bf9dec0b796b13fff0533444c6 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/WordClickableText.ets | arkts | isHighlightWord | 是否高亮单词 | private isHighlightWord(str: string): boolean {
return this.isWord(str) && this.highlightWords.map(v => v.toLowerCase()).includes(str.toLowerCase());
} | AST#method_declaration#Left private isHighlightWord 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 boolean AST#primar... | private isHighlightWord(str: string): boolean {
return this.isWord(str) && this.highlightWords.map(v => v.toLowerCase()).includes(str.toLowerCase());
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/WordClickableText.ets#L24-L26 | ed4cf416335ec4484796ec37f9b3000166fe8afe | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/BreakpointState.ets | arkts | getValue | 根据当前断点返回适配值
@param {BreakpointValueOptions<T>} options - 断点值配置
@param {T | undefined} defaultValue - 默认值
@returns {T} 适配值
@example
state.getValue({ sm: $r("app.float.small"), md: $r("app.float.medium") }); | getValue<T>(options: BreakpointValueOptions<T>, defaultValue?: T): T {
const index = BREAKPOINT_ORDER.indexOf(this.current);
const fallbackValue = this.getFallbackValue(options, defaultValue);
if (index < 0) {
return fallbackValue;
}
// 优先取当前断点值
const currentValue = getValueByName(options... | AST#method_declaration#Left getValue AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BreakpointValueOptions AST#type_arguments#Left < AST#... | getValue<T>(options: BreakpointValueOptions<T>, defaultValue?: T): T {
const index = BREAKPOINT_ORDER.indexOf(this.current);
const fallbackValue = this.getFallbackValue(options, defaultValue);
if (index < 0) {
return fallbackValue;
}
const currentValue = getValueByName(options, BREAKPOIN... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L125-L155 | 4891042c955bd67e486957d6b37b9e362b75f720 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DateUtil.ets | arkts | getWeekOfMonth | 获取给定日期是当月的第几周
@param date
@returns | static getWeekOfMonth(date: number | string | Date): number {
let currentDate = DateUtil.getFormatDate(date);
let firstDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1); //获取该月的第一天
let firstDayOfWeek = firstDayOfMonth.getDay(); //获取该月的第一天是星期几
let weekNumber = Math.ceil((current... | AST#method_declaration#Left static getWeekOfMonth AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#... | static getWeekOfMonth(date: number | string | Date): number {
let currentDate = DateUtil.getFormatDate(date);
let firstDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
let firstDayOfWeek = firstDayOfMonth.getDay(); 是星期几
let weekNumber = Math.ceil((currentDate.getDate() + fir... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L321-L327 | 58d3ed574a106b7319e754cb7747a1f217948cc6 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/ai/AIAssistantService.ets | arkts | AI对话上下文接口 | export interface ConversationContext {
sessionId: string;
userId: string;
currentTopic?: string;
lastIntent?: string;
entities: Record<string, any>;
history: ChatMessage[];
userProfile: UserProfile;
preferences: ConversationPreferences;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ConversationContext AST#object_type#Left { AST#type_member#Left sessionId : 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 userId : AST#type_an... | export interface ConversationContext {
sessionId: string;
userId: string;
currentTopic?: string;
lastIntent?: string;
entities: Record<string, any>;
history: ChatMessage[];
userProfile: UserProfile;
preferences: ConversationPreferences;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/ai/AIAssistantService.ets#L89-L98 | cd47528b1e668e38e25345ad9ed01c4a4c92a062 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | Weather/product/default/src/main/ets/pages/Home.ets | arkts | aboutToAppear | [StartExclude Home] | aboutToAppear() {
this.smListener.on('change', this.isBreakpointSM);
this.mdListener.on('change', this.isBreakpointMD);
this.lgListener.on('change', this.isBreakpointLG);
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left thi... | aboutToAppear() {
this.smListener.on('change', this.isBreakpointSM);
this.mdListener.on('change', this.isBreakpointMD);
this.lgListener.on('change', this.isBreakpointLG);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/product/default/src/main/ets/pages/Home.ets#L90-L94 | 2118191f30e777ccf4153e43bebc2052ae636535 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/ui_tools.ets | arkts | Check avoid area and store them in storage.
@param windowClass The window.Window object.
@param storage The LocalStorage of that window.
@param free_window The type of window: true for free windows
(PC, 2in1, Free-window mode on Tablets),
false for traditional windows (Phones, regular float windows on Tablets). | export function get_avoid(windowClass: window.Window, storage: LocalStorage) {
console.log('[get_avoid] Get avoid areas: ');
try {
let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR;
let avoidArea = windowClass.getWindowAvoidArea(type);
let avoidBottom = meowPx2vp(avoidArea.bottomRect.height);
... | AST#export_declaration#Left export AST#function_declaration#Left function get_avoid 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#parameter#Ri... | export function get_avoid(windowClass: window.Window, storage: LocalStorage) {
console.log('[get_avoid] Get avoid areas: ');
try {
let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR;
let avoidArea = windowClass.getWindowAvoidArea(type);
let avoidBottom = meowPx2vp(avoidArea.bottomRect.height);
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L205-L237 | 552647648b3e0f3cc6ce61a8ca79cd641adad2f0 | gitee | |
robotzzh/AgricultureApp.git | 7b12c588dd1d07cc07a8b25577d785d30bd838f6 | entry/src/main/ets/models/StringUtils.ets | arkts | arrayBuffer2String | ArrayBuffer 转 String
@param input
@returns | arrayBuffer2String(input: ArrayBuffer) {
return this.uint8Array2String(new Uint8Array(input))
} | AST#method_declaration#Left arrayBuffer2String AST#parameter_list#Left ( AST#parameter#Left input : 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 { AST#statement#Left AST#return_statemen... | arrayBuffer2String(input: ArrayBuffer) {
return this.uint8Array2String(new Uint8Array(input))
} | https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/models/StringUtils.ets#L46-L48 | ff3f6e1cbad7141603ddc1799da1d7cdec86b198 | github |
openharmony/powermgr_power_manager | a7033a7ec43e06474b9447db4d0fd4ca339fd0c1 | power_dialog/entry/src/main/ets/common/constant.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, soft... | export default class Constants {
public static FULL_WIDTH = '100%'
public static FULL_HEIGHT = '100%'
public static DIALOG_WIDTH = 395
public static DIALOG_HEIGHT = 117
public static DIALOG_BORDER_RADIUS = 32
public static DIALOG_TITLE_FONT_SIZE = 16
public static DIALOG_TITLE_FONT_WEIGHT = 400
public... | AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left public static FULL_WIDTH = AST#expression#Left '100%' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left public static FULL_HEIGHT = AST#expression#Le... | export default class Constants {
public static FULL_WIDTH = '100%'
public static FULL_HEIGHT = '100%'
public static DIALOG_WIDTH = 395
public static DIALOG_HEIGHT = 117
public static DIALOG_BORDER_RADIUS = 32
public static DIALOG_TITLE_FONT_SIZE = 16
public static DIALOG_TITLE_FONT_WEIGHT = 400
public... | https://github.com/openharmony/powermgr_power_manager/blob/a7033a7ec43e06474b9447db4d0fd4ca339fd0c1/power_dialog/entry/src/main/ets/common/constant.ets#L16-L38 | 9338732a9203583a9fca17bd49eaa02dad1dc074 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/common/CommonNavigator.ets | arkts | toAbout | 跳转到关于我们
@returns {void} 无返回值 | static toAbout(): void {
navigateTo(CommonRoutes.About);
} | AST#method_declaration#Left static toAbout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expre... | static toAbout(): void {
navigateTo(CommonRoutes.About);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonNavigator.ets#L14-L16 | 1e6b805a96560c5457c4b9803bfdd88cddbd879e | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | isInverted | If this returns true, the y-axis is inverted.
@return | public isInverted(): boolean {
return this.mInverted;
} | AST#method_declaration#Left public isInverted AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre... | public isInverted(): boolean {
return this.mInverted;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L312-L314 | 5c3918c7bc9575935694cf46a07fdafd360a93b1 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/buffer/AbstractBuffer.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, soft... | export default abstract class AbstractBuffer<T> {
/** index in the buffer */
protected index: number = 0;
/** float-buffer that holds the data points to draw, order: x,y,x,y,... */
public buffer: number[] = [];
/** animation phase x-axis */
protected phaseX: number = 1;
/** animation phase y-axis */
pro... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class AbstractBuffer AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { /** index in the buffer */ AST#property_declaration#Left protected index : AST#type_annotati... | export default abstract class AbstractBuffer<T> {
protected index: number = 0;
public buffer: number[] = [];
protected phaseX: number = 1;
protected phaseY: number = 1;
protected mFrom: number = 0;
protected mTo: number = 0;
constructor(size: number) {
this.index = 0;
for (le... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/buffer/AbstractBuffer.ets#L16-L90 | d7d1a9782f4a84e0474a6b23e427b175c4eafb8e | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets | arkts | 分类枚举(按难易程度) | export enum ClassificationTypeEnum {
/**
* 容易
*/
EASY,
/**
* 简单
*/
SIMPLE,
/**
* 一般
*/
MIDDLE,
/**
* 困难
*/
HARD,
/**
* 易错
*/
EASY_MISTAKE
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ClassificationTypeEnum AST#enum_body#Left { /**
* 容易
*/ AST#enum_member#Left EASY AST#enum_member#Right , /**
* 简单
*/ AST#enum_member#Left SIMPLE AST#enum_member#Right , /**
* 一般
*/ AST#enum_member#Left MIDDLE AST#enum_member#Right , /*... | export enum ClassificationTypeEnum {
EASY,
SIMPLE,
MIDDLE,
HARD,
EASY_MISTAKE
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets#L22-L43 | 570eb094c75201ee32c4eae12a92c6533be15394 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/SpaceItem.ets | arkts | SpaceItem | 空格组件 | @Component
export struct SpaceItem {
private spaceWith: Resource | undefined = undefined;
@StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle();
build() {
if (this.spaceWith) {
Stack() {
Text('space')
.fontSize(this.inputStyle.symbol_fontSize)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SpaceItem AST#component_body#Left { AST#property_declaration#Left private spaceWith : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left undefine... | @Component
export struct SpaceItem {
private spaceWith: Resource | undefined = undefined;
@StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle();
build() {
if (this.spaceWith) {
Stack() {
Text('space')
.fontSize(this.inputStyle.symbol_fontSize)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/SpaceItem.ets#L28-L53 | 85c475e800c77aebfbd32cc59dd923e6b4972539 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/GetDate.ets | arkts | 日历表上周六对应的序列号,从周日开始算起,取值0~6
根据指定年份和月份获取该月在日历表上的日期排布数据
@param { number } specifiedMonth - 指定月份
@param { number } specifiedYear - 指定年份 | export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[]{
let currentFirstWeekDay: number = 0; // 初始化指定月的第一天是周几
let currentLastWeekDay: number = 0; // 初始化指定月的最后一天是周几
let currentAllDay: number[] = []; // 初始化指定月的日期排列数组
let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDate... | AST#export_declaration#Left export AST#function_declaration#Left function getMonthDate AST#parameter_list#Left ( AST#parameter#Left specifiedMonth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specifiedYear : AST#type_an... | export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[]{
let currentFirstWeekDay: number = 0;
let currentLastWeekDay: number = 0;
let currentAllDay: number[] = [];
let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDate();
currentFirstWeekDay = new Date(specifiedYe... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/GetDate.ets#L24-L44 | 0f4d08392f0daa31abca2444921946e35d3c3edc | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/routermodule/src/main/ets/model/RouterParam.ets | arkts | 路由参数 | export class RouterParam {
data?: Object;
model?: string;
} | AST#export_declaration#Left export AST#class_declaration#Left class RouterParam AST#class_body#Left { AST#property_declaration#Left data ? : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left model ? : AST... | export class RouterParam {
data?: Object;
model?: string;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/model/RouterParam.ets#L17-L20 | 1ca12b1785d57f73f5eb1317001726914cf74308 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clockin/src/main/ets/components/ClockInComponent.ets | arkts | ClockInComponent | 功能描述: 提供定位打卡组件,能够在地图上绘制打卡范围和显示用户当前位置标记,可以判断用户是否在打卡范围内,并显示详细的地理位置信息。同时支持动态更新用户位置,实时调整标记位置和打卡状态。
实现原理:
1. 使用MapComponent组件初始化地图,并使用地图控制器的addCircle接口绘制打卡范围。
2. 使用getCurrentLocation接口获取用户的当前位置,并使用地图控制器的addMarker在地图上添加标记。
3. 根据calculateDistance计算用户位置和打卡中心点的距离,判断用户是否在打卡范围内,保存结果。
4. 使用getAddressesFromLocation接口根据经纬度获取用户的地理位置... | @Component
export struct ClockInComponent {
// 是否在打卡区域内
@Link isInArea: boolean;
// 设置定位按钮位置,默认在右下角
@Prop locationButtonPosition?: Position | Edges | LocalizedEdges = {
right: getContext().resourceManager.getNumber($r('app.integer.clock_in_location_button_right').id),
bottom: getContext().resourceManage... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ClockInComponent AST#component_body#Left { // 是否在打卡区域内 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isInArea : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig... | @Component
export struct ClockInComponent {
@Link isInArea: boolean;
@Prop locationButtonPosition?: Position | Edges | LocalizedEdges = {
right: getContext().resourceManager.getNumber($r('app.integer.clock_in_location_button_right').id),
bottom: getContext().resourceManager.getNumber($r('app.integer.c... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clockin/src/main/ets/components/ClockInComponent.ets#L50-L189 | c5d176267fd00839d9529bd794d6d16b2e82e22d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | setColorMode | 设置应用的颜色模式。仅支持主线程调用。设置颜色模式,包括:深色模式、浅色模式、不设置(跟随系统)
@param colorMode | static setColorMode(colorMode: ConfigurationConstant.ColorMode = ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET) {
AppUtil.getApplicationContext().setColorMode(colorMode);
} | AST#method_declaration#Left static setColorMode AST#parameter_list#Left ( AST#parameter#Left colorMode : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ConfigurationConstant . ColorMode AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_exp... | static setColorMode(colorMode: ConfigurationConstant.ColorMode = ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET) {
AppUtil.getApplicationContext().setColorMode(colorMode);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L140-L142 | 212215e63da3d88ce23f19cb1542f45d51984eec | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/constant/CommonConstant.ets | arkts | Common constants for common component. | export class CommonConstants {
// custom dialog
static readonly CUSTOM_DIALOG_ICON_SIZE = 40;
// percent
static readonly FULL_PERCENT: string = '100%';
static readonly HALF_PERCENT: string = '50%';
// border radius
static readonly BORDER_RADIUS_SLIGHT: number = 2;
static readonly BORDER_RADIUS_SOFT: num... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // custom dialog AST#property_declaration#Left static readonly CUSTOM_DIALOG_ICON_SIZE = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right // percent AST#property_declaration#Left static ... | export class CommonConstants {
static readonly CUSTOM_DIALOG_ICON_SIZE = 40;
static readonly FULL_PERCENT: string = '100%';
static readonly HALF_PERCENT: string = '50%';
static readonly BORDER_RADIUS_SLIGHT: number = 2;
static readonly BORDER_RADIUS_SOFT: number = 14;
static readonly BORDER_RADIUS_... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/constant/CommonConstant.ets#L19-L75 | 1bd43847caaa85553150647a46c59948f5f388ba | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_cbc_encryption_decryption/aes_cbc_encryption_decryption_asynchronous.ets | arkts | decryptMessagePromise | 解密消息 | async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|CBC|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, iv);
let decryptData = await decoder.doFinal(cipherText);
return decryp... | AST#function_declaration#Left async function decryptMessagePromise 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#par... | async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|CBC|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, iv);
let decryptData = await decoder.doFinal(cipherText);
return decryp... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_cbc_encryption_decryption/aes_cbc_encryption_decryption_asynchronous.ets#L46-L51 | a5c070487191add831f61f59d7bb67043df4e7a0 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/array/ArrayUtils.ets | arkts | asSet | 将数组转换为Set集合
@param array 要转换的数组
@returns 返回新的Set集合 | static asSet<T>(arr: Array<T>): Set<T> {
return new Set(arr);
} | AST#method_declaration#Left static asSet AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#L... | static asSet<T>(arr: Array<T>): Set<T> {
return new Set(arr);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayUtils.ets#L9-L11 | fc9198f4be9159af935991cb9d5a220bdb058af3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/PhotoHelper.ets | arkts | selectEasy | 通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。
@param options
MIMEType 可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。
maxSelectNumber 选择媒体文件数量的最大值(最大可设置的值为500,若不设置则默认为50或9)。
isPhotoTakingSupported 是否支持拍照,true表示支持,false表示不支持,默认为true。
isSearchSupported 是否支持搜索,true表示支持,false表示不支持,默认为true。
isEditSupported 是否支持编辑照片,true表示支持,false表示不支持,默认为true。
isO... | static async selectEasy(options?: photoAccessHelper.PhotoSelectOptions): Promise<Array<string>> {
let photoSelectResult: photoAccessHelper.PhotoSelectResult = await PhotoHelper.select(options);
if (photoSelectResult && photoSelectResult.photoUris && photoSelectResult.photoUris.length > 0) {
return photoSe... | AST#method_declaration#Left static async selectEasy AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . PhotoSelectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p... | static async selectEasy(options?: photoAccessHelper.PhotoSelectOptions): Promise<Array<string>> {
let photoSelectResult: photoAccessHelper.PhotoSelectResult = await PhotoHelper.select(options);
if (photoSelectResult && photoSelectResult.photoUris && photoSelectResult.photoUris.length > 0) {
return photoSe... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PhotoHelper.ets#L80-L87 | 6e38b72e9a3498e945405b86c244ad5ed25fb5a3 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/auth/AuthService.ets | arkts | loginWithVerifyCode | 验证码登录 | async loginWithVerifyCode(params: VerifyCodeLoginParams): Promise<boolean> {
try {
Logger.info('AuthService', `Verify code login attempt: ${params.phone}`);
// Mock 验证码登录
// const response = await Http.post('/api/auth/login/verify-code', params);
const mockUser: UserInfo = {
... | AST#method_declaration#Left async loginWithVerifyCode AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left VerifyCodeLoginParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef... | async loginWithVerifyCode(params: VerifyCodeLoginParams): Promise<boolean> {
try {
Logger.info('AuthService', `Verify code login attempt: ${params.phone}`);
const mockUser: UserInfo = {
id: '1',
username: params.phone,
phone: params.phone
};
... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L258-L287 | fec1e194a3f1e07aa59f7d567bafc99779258b54 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationRequestUtil.ets | arkts | initBasicNotificationRequest | init basic NotificationRequest
@param notificationContent
@return return the created NotificationRequest | initBasicNotificationRequest(
notificationContent: notification.NotificationContent
): notification.NotificationRequest {
return {
notificationSlotType: notification.SlotType.CONTENT_INFORMATION,
id: 1, // 通知id,默认为1
content: notificationContent
};
} | 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
): notification.NotificationRequest {
return {
notificationSlotType: notification.SlotType.CONTENT_INFORMATION,
id: 1,
content: notificationContent
};
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationRequestUtil.ets#L25-L33 | 27d8024afe944c78d99ed083e1610b00cd6aea54 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets | arkts | @file
@kit ArkUI
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class ComposeTitleBarMenuItem {
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.Ark... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ComposeTitleBarMenuItem AST#class_body#Left { /**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Icon re... | export declare class ComposeTitleBarMenuItem {
value: ResourceStr;
label?: ResourceStr;
isEnabled?: boolean;
action?: () => void;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets#L30-L81 | 4b84014748c8d98b481c1da062b13dd2d6e0baec | github | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/offset/NavRouterView.ets | arkts | NavRouterView | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct NavRouterView {
@State isActive: boolean = false
@State dex: number = 0
@Link _offset: Position;
private componentKey: string;
build() {
NavRouter() {
Row() {
Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 })
Te... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavRouterView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isActive : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an... | @Component
export struct NavRouterView {
@State isActive: boolean = false
@State dex: number = 0
@Link _offset: Position;
private componentKey: string;
build() {
NavRouter() {
Row() {
Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 })
Te... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/offset/NavRouterView.ets#L16-L53 | f130f1859e07720b5910e9c344c4d25a9fe97f27 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | avscreen-capture-screen-record-master/entry/src/main/ets/pages/CAVScreenCaptureToStream.ets | arkts | [End release_fd2] | build() {
NavDestination() {
Row() {
Column() {
// Video area
Column() {
if (this.isPlayFlag) {
Stack() {
Video({ src: this.videoSrc, controller: this.controller })
.width('100%')
.height('100%')
... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#a... | build() {
NavDestination() {
Row() {
Column() {
Column() {
if (this.isPlayFlag) {
Stack() {
Video({ src: this.videoSrc, controller: this.controller })
.width('100%')
.height('100%')
.au... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/avscreen-capture-screen-record-master/entry/src/main/ets/pages/CAVScreenCaptureToStream.ets#L91-L238 | 43756ca9867bb6fd6858662c05800006402e3a49 | gitee | |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/template/ZAttributeModifier.ets | arkts | @author: HZWei
@date: 2024/12/7
@desc: NavDest模版的自定义属性基础类
通过此类可以实现NavDestination自定义属性的初始化
详情可见官网文档:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-universal-attributes-attribute-modifier-V5#applyselectedattribute | export abstract class ZAttributeModifier extends AttributeUpdater<NavDestinationModifier, NavDestinationInterface>{
abstract initModifier(instance: NavDestinationModifier)
initializeModifier(instance: NavDestinationModifier): void {
this.initModifier(instance)
// 不支持title属性,调用此方法会报错
}
} | AST#export_declaration#Left export AST#class_declaration#Left abstract class ZAttributeModifier extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeUpdater AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NavDestinationModifier AST#primary_type#Right AST#type_an... | export abstract class ZAttributeModifier extends AttributeUpdater<NavDestinationModifier, NavDestinationInterface>{
abstract initModifier(instance: NavDestinationModifier)
initializeModifier(instance: NavDestinationModifier): void {
this.initModifier(instance)
}
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/template/ZAttributeModifier.ets#L11-L17 | f765bfca3125ef554c4c356accf95133bde47a9e | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets | arkts | 查询参数类型
ArkTS不支持索引签名,使用Record类型代替 | export type QueryParams = Record<string, string | number | boolean | undefined | null>; | AST#export_declaration#Left export AST#type_declaration#Left type QueryParams = AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#unio... | export type QueryParams = Record<string, string | number | boolean | undefined | null>; | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L264-L264 | e543c3635323bac05b1afdeec9aaafdcd1d7f5bd | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets | arkts | push | 跳转到指定路由栈的指定路由页面 | public static push(info: NavRouterInfo, animated?: boolean) {
try {
RouterModule._stack.pushPathByName(
info.url,
info.param,
info.onPop,
animated,
);
} catch (err) {
Logger.error(TAG, 'navigation stack push failed::' + JSON.stringify(err));
}
} | 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 {
RouterModule._stack.pushPathByName(
info.url,
info.param,
info.onPop,
animated,
);
} catch (err) {
Logger.error(TAG, 'navigation stack push 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#L14-L25 | d9ffc25bd85fcfd463a0fbad5b70868b4949a6e1 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/Start/StartDialogPage.ets | arkts | StartDialogPageBuilder | @Builder export function StartDialogPageBuilder(parm: VHAgreementModel,param:VHWebinarData) { StartDialogPage({ agree: parm, webinar_info: param }) } | @Builder
export function StartDialogPageBuilder(param: object) {
StartDialogPage({
agree: param['agree'],
webinar_info: param['webinar_info'],
webinar_id: param['webinar_id'],
})
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function StartDialogPageBuilder AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li... | @Builder
export function StartDialogPageBuilder(param: object) {
StartDialogPage({
agree: param['agree'],
webinar_info: param['webinar_info'],
webinar_id: param['webinar_id'],
})
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/Start/StartDialogPage.ets#L17-L24 | 44dd58cdd6239bfe4d090930aa5b7ebe50cae06b | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/DateHelper.ets | arkts | hasMonth | 是否含有月 | static hasMonth(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Ymd || type == DateType.Ym;
} | AST#method_declaration#Left static hasMonth AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType 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_typ... | static hasMonth(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Ymd || type == DateType.Ym;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L54-L57 | a1c4af873ac37f82c4f20dad4a9da8fdd9428fd5 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | getVpByStr | 获取vp数据
@param str
@returns | static getVpByStr(str: string): number {
if (str.toLowerCase().endsWith('vp')) {
str = str.replaceAll('vp', '');
return parseInt(str);
} else if (str.toLowerCase().endsWith('px')) {
str = str.replaceAll('px', '');
return px2vp(parseInt(str));
} else if (str.toLowerCase().endsWith('lp... | AST#method_declaration#Left static getVpByStr 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 AST#primary_type#... | static getVpByStr(str: string): number {
if (str.toLowerCase().endsWith('vp')) {
str = str.replaceAll('vp', '');
return parseInt(str);
} else if (str.toLowerCase().endsWith('px')) {
str = str.replaceAll('px', '');
return px2vp(parseInt(str));
} else if (str.toLowerCase().endsWith('lp... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L248-L264 | b4303e282164425eac9c51f1dbd5d75ffc5296f5 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 错误代码枚举 | export enum ErrorCode {
SUCCESS = 0,
UNKNOWN_ERROR = 1000,
NETWORK_ERROR = 1001,
PERMISSION_DENIED = 1002,
DATA_NOT_FOUND = 1003,
INVALID_PARAMETER = 1004,
DATABASE_ERROR = 1005,
STORAGE_ERROR = 1006,
VALIDATION_ERROR = 1007
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ErrorCode AST#enum_body#Left { AST#enum_member#Left SUCCESS = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left UNKNOWN_ERROR = AST#expression#Left 1000 AST#expression#Right AST#enum_member#Right , AST#enum_member#Le... | export enum ErrorCode {
SUCCESS = 0,
UNKNOWN_ERROR = 1000,
NETWORK_ERROR = 1001,
PERMISSION_DENIED = 1002,
DATA_NOT_FOUND = 1003,
INVALID_PARAMETER = 1004,
DATABASE_ERROR = 1005,
STORAGE_ERROR = 1006,
VALIDATION_ERROR = 1007
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L118-L128 | 46e4eb213007ed212fd48c13b0976020467002b7 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | 聊天数据资源类 | export class ChatDataSource implements IChatDataSource {
/**
* 聊天信息数组
*/
private originDataArray: IChatMessage[] = [];
/**
* 消息监听数组
*/
private listeners: DataChangeListener[] = [];
/**
* 添加数据函数
*
* @param index
* @param data
*/
public addData(index: number, data: IChatMessage):... | AST#export_declaration#Left export AST#class_declaration#Left class ChatDataSource AST#implements_clause#Left implements IChatDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 聊天信息数组
*/ AST#property_declaration#Left private originDataArray : AST#type_annotation#Left AST#primary_type#Left AST#arra... | export class ChatDataSource implements IChatDataSource {
private originDataArray: IChatMessage[] = [];
private listeners: DataChangeListener[] = [];
public addData(index: number, data: IChatMessage): void {
this.originDataArray.splice(index, 0, data);
this.notifyDataAdd(index);
}
publi... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L8-L150 | 6e8a0b55ed9d88015861481b097935e0befff783 | gitee | |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/pages/SplashPage.ets | arkts | navigateToIndex | 导航到主页 | navigateToIndex() {
if (this.timerId !== -1) {
clearTimeout(this.timerId);
this.timerId = -1;
}
console.info('导航到主页...');
router.pushUrl({ url: 'pages/Index' });
} | AST#method_declaration#Left navigateToIndex AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#R... | navigateToIndex() {
if (this.timerId !== -1) {
clearTimeout(this.timerId);
this.timerId = -1;
}
console.info('导航到主页...');
router.pushUrl({ url: 'pages/Index' });
} | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/SplashPage.ets#L101-L109 | b748de045daaa752aa86091aed1a04a094541915 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | trim | 去除传入集合的每个值的前后空格
@param strs
@returns | static trim(strs: String[]): String[] {
return strs.map((value) => value.trim());
} | AST#method_declaration#Left static trim AST#parameter_list#Left ( AST#parameter#Left strs : 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_list#Right : AST#type_annotation#Left AST#pr... | static trim(strs: String[]): String[] {
return strs.map((value) => value.trim());
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L101-L103 | 50764e70a76ca31800f67fcbd24eabb40ffcb420 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | isUseAutoScaleMinRestriction | Returns true if autoscale restriction for axis min value is enabled
@Deprecated | public isUseAutoScaleMinRestriction(): boolean {
return this.mUseAutoScaleRestrictionMin;
} | AST#method_declaration#Left public isUseAutoScaleMinRestriction 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#Lef... | public isUseAutoScaleMinRestriction(): boolean {
return this.mUseAutoScaleRestrictionMin;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L463-L465 | 8e10f1c536a6601b5ba169a3b4d11721c2adba86 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | getIvParamsSpec | 获取转换IvParamsSpec
@param ivStr 字符串iv
@param ivCoding 编码方式(base64/hex/utf8/utf-8)
@returns | static getIvParamsSpec(ivStr: string, ivCoding: crypto.BhuCoding): cryptoFramework.IvParamsSpec {
let ivBlob: cryptoFramework.DataBlob = { data: CryptoHelper.strToUint8Array(ivStr, ivCoding) };
let ivParamsSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivBlob };
return ivParamsSpec;
} | AST#method_declaration#Left static getIvParamsSpec AST#parameter_list#Left ( AST#parameter#Left ivStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ivCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_... | static getIvParamsSpec(ivStr: string, ivCoding: crypto.BhuCoding): cryptoFramework.IvParamsSpec {
let ivBlob: cryptoFramework.DataBlob = { data: CryptoHelper.strToUint8Array(ivStr, ivCoding) };
let ivParamsSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivBlob };
return ivParamsSpec;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L243-L247 | b8eec995ee88d4169f5e06cf204819be7a32fe83 | gitee |
MUYS/imagePreview | 96212a51e8c5d6c37b9b9fb94e7d6d76047cdeb0 | library/src/main/ets/common/ExportModel.ets | arkts | 日期:2025/6/7 | export interface ImagePreviewConfig {
/**
* 双击缩放比例,默认 5
*/
doubleClickDefaultScale?: number
/**
* 最大缩放比例,默认 5
*/
maxScale?: number
/**
* 最小缩放比例,默认 1
*/
minScale?: number
/**
* 长按事件,若设置了该属性,子组件将不支持长按事件
*/
onLongPress?: (event: GestureEvent) => void
/**
* 单击事件,若设置了该属性,子组件将不支持单... | AST#export_declaration#Left export AST#interface_declaration#Left interface ImagePreviewConfig AST#object_type#Left { /**
* 双击缩放比例,默认 5
*/ AST#type_member#Left doubleClickDefaultScale ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /... | export interface ImagePreviewConfig {
doubleClickDefaultScale?: number
maxScale?: number
minScale?: number
onLongPress?: (event: GestureEvent) => void
onClick?: (event: GestureEvent) => void
width?: Length | LayoutPolicy
height?: Length | LayoutPolicy
autoReset?: boolean
dir... | https://github.com/MUYS/imagePreview/blob/96212a51e8c5d6c37b9b9fb94e7d6d76047cdeb0/library/src/main/ets/common/ExportModel.ets#L4-L45 | 04306bf5979c08957a90300ccb27db9d80982c65 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | decryptSegment | 解密,分段,异步
@param data 加密或者解密的数据。data不能为null。
@param priKey 指定解密私钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(RSA1024|PKCS1、RSA2048|PKCS1、等)。
@param len 自定义的数据拆分长度。 | static async decryptSegment(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1', len: number = 128): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cipher.init(cryptoFramework.CryptoMode.D... | AST#method_declaration#Left static async decryptSegment AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#... | static async decryptSegment(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1', len: number = 128): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cipher.init(cryptoFramework.CryptoMode.D... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L137-L155 | ca67cadf4d7bf42c73f2615b0db05be9b07e4eaa | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/RabinKarp.ets | arkts | findFirstMatch | 查找模式串在文本中的第一个出现位置
@param text 文本字符串
@param pattern 模式串
@returns 第一个匹配位置,如果未找到则返回 -1 | static findFirstMatch(text: string, pattern: string): number {
return RabinKarp.search(text, pattern);
} | AST#method_declaration#Left static findFirstMatch AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static findFirstMatch(text: string, pattern: string): number {
return RabinKarp.search(text, pattern);
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L181-L183 | 3263e3c2731db0d372295f38b668b4afc5c6b954 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputDeviceUtil.ets | arkts | getDeviceIcon | 获取设备的图标
@param sources 输入设备支持的源类型 | function getDeviceIcon(sources: string[]): Resource {
logger.info(`${TAG} getDeviceIcon: ${sources}`)
if (!sources || sources.length <= 0) {
return $r('app.media.icon_input_device_default')
}
let res: Resource
let sourceType = sources[0]
if (sourceType === 'keyboard') {
res = $r('app.media.icon_keyb... | AST#function_declaration#Left function getDeviceIcon AST#parameter_list#Left ( AST#parameter#Left sources : 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_list#Right : AST#type_annota... | function getDeviceIcon(sources: string[]): Resource {
logger.info(`${TAG} getDeviceIcon: ${sources}`)
if (!sources || sources.length <= 0) {
return $r('app.media.icon_input_device_default')
}
let res: Resource
let sourceType = sources[0]
if (sourceType === 'keyboard') {
res = $r('app.media.icon_keyb... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputDeviceUtil.ets#L90-L113 | 51cb2443148807f9ae9ce21deb4f7ca828aa7f33 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets | arkts | initializePage | 初始化页面 | async initializePage() {
try {
// 获取当前主题配置
this.currentTheme = this.themeManager.getCurrentTheme();
// 获取可用主题和字体
this.availableColorThemes = this.themeManager.getAvailableColorThemes();
this.availableFonts = this.themeManager.getAvailableFontConfigs();
// 设置当前选择状态
... | AST#method_declaration#Left async initializePage 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 AST#me... | async initializePage() {
try {
this.currentTheme = this.themeManager.getCurrentTheme();
this.availableColorThemes = this.themeManager.getAvailableColorThemes();
this.availableFonts = this.themeManager.getAvailableFontConfigs();
if (this.currentTheme) {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L44-L70 | 16efa8dfb944859c72b837a586f645d583508d90 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/parentchildcomponentsync/uniandbidirectionsync/UniAndBidirectionSyncCode.ets | arkts | 初始化圆形的可设置颜色 | export const COLOR_DATA: ColorData = {
Grey: '#eebebeba',
Blue: '#4A90E2',
Pink: '#8DF8BEBE',
Red: '#FFF30823'
} | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COLOR_DATA : AST#type_annotation#Left AST#primary_type#Left ColorData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left G... | export const COLOR_DATA: ColorData = {
Grey: '#eebebeba',
Blue: '#4A90E2',
Pink: '#8DF8BEBE',
Red: '#FFF30823'
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/parentchildcomponentsync/uniandbidirectionsync/UniAndBidirectionSyncCode.ets#L27-L32 | 2dbfda9f38a10c48ca72a7f919c66359bff447f7 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | updateLanguageSettings | 更新语言设置
@param languageSettings 语言设置
@returns 更新后的语言设置 | async updateLanguageSettings(languageSettings: Partial<LanguageSettings>): Promise<LanguageSettings> {
const updatedSettings = await this.updateSettings({ language: languageSettings });
return updatedSettings.language;
} | AST#method_declaration#Left async updateLanguageSettings AST#parameter_list#Left ( AST#parameter#Left languageSettings : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left LanguageSettings AST#primary_type#Right AST#type_... | async updateLanguageSettings(languageSettings: Partial<LanguageSettings>): Promise<LanguageSettings> {
const updatedSettings = await this.updateSettings({ language: languageSettings });
return updatedSettings.language;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L334-L337 | c4b57bce3b564526af8639d78201c94fa14e840b | github |
conradsheeran/steam-totp.git | af0eba089e77ff73e6983ce61fa89190c628721e | src/main/ets/pages/SteamTOTP.ets | arkts | getTimeOffset | 从 Steam 服务器获取时间偏移量(注意:使用该函数需要获取 ohos.permission.INTERNET 权限)
@returns { Promise<{ offset: number; latency: number; }> } | public static async getTimeOffset(): Promise<ITimeOffsetInfo> {
const start = Date.now();
return new Promise((resolve, reject) => {
http.createHttp().request(
"http://api.steampowered.com/ITwoFactorService/QueryTime/v1/",
{
method: http.RequestMethod.POST,
header: { 'C... | AST#method_declaration#Left public static async getTimeOffset 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 ITimeOffsetInfo AST#primary_type#Right AST#type_annot... | public static async getTimeOffset(): Promise<ITimeOffsetInfo> {
const start = Date.now();
return new Promise((resolve, reject) => {
http.createHttp().request(
"http://api.steampowered.com/ITwoFactorService/QueryTime/v1/",
{
method: http.RequestMethod.POST,
header: { 'C... | https://github.com/conradsheeran/steam-totp.git/blob/af0eba089e77ff73e6983ce61fa89190c628721e/src/main/ets/pages/SteamTOTP.ets#L111-L139 | 970274dd4588cc8cca7e963771fe68a4bfa69322 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpdfviewer/src/main/ets/view/WebPDFViewer.ets | arkts | WebPDFViewerComponent | 网络PDF文件路径,其中“#toolbar=0”屏蔽Web组件的工具栏 | @Component
export struct WebPDFViewerComponent {
@State tabsIndex: number = 0; // tabs组件选中的初始位置
@State fontColor: ResourceColor = $r("app.color.web_pdf_viewer_font_color") //未选中字体颜色
@State selectedFontColor: ResourceColor = $r("app.color.web_pdf_viewer_selected_font_color") //选中字体的颜色
private tabsController: Tab... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WebPDFViewerComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right tabsIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST... | @Component
export struct WebPDFViewerComponent {
@State tabsIndex: number = 0;
@State fontColor: ResourceColor = $r("app.color.web_pdf_viewer_font_color")
@State selectedFontColor: ResourceColor = $r("app.color.web_pdf_viewer_selected_font_color")
private tabsController: TabsController = new TabsController()... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpdfviewer/src/main/ets/view/WebPDFViewer.ets#L47-L121 | 368d306de1b53b8d4d8e4b8d394407312647db34 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/accessibility/AccessibilitySettingsPage.ets | arkts | buildTabBar | 构建标签栏 | @Builder
buildTabBar() {
Scroll() {
Row({ space: 0 }) {
ForEach(this.tabs, (tab, index: number) => {
Column({ space: 6 }) {
Image($r(`app.media.ic_${tab.icon}`))
.width('20vp')
.height('20vp')
.fillColor(this.selectedTab === index ? $r(... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBar 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 Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_elem... | @Builder
buildTabBar() {
Scroll() {
Row({ space: 0 }) {
ForEach(this.tabs, (tab, index: number) => {
Column({ space: 6 }) {
Image($r(`app.media.ic_${tab.icon}`))
.width('20vp')
.height('20vp')
.fillColor(this.selectedTab === index ? $r(... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/accessibility/AccessibilitySettingsPage.ets#L299-L337 | 48dea07c5adbc13d3853a880771e2b5a9d8a0a9f | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/SvgUtil.ets | arkts | 画svg到离线画板
@param context
@param offContext
@param resource svg资源,例如$r('app.media.svg_test')
@param width 绘制大小
@param height
@param dx 绘制左上角偏移x
@param dy | export async function drawSvg(context: Context, offContext: OffscreenCanvasRenderingContext2D
, resource: Resource, width: number, height: number, dx: number = 0, dy: number = 0) {
const unit8Array: Uint8Array = await context.resourceManager.getMediaContent(resource);
let textDecoder: ... | AST#export_declaration#Left export AST#function_declaration#Left async function drawSvg AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offContext : AST#type_annotation... | export async function drawSvg(context: Context, offContext: OffscreenCanvasRenderingContext2D
, resource: Resource, width: number, height: number, dx: number = 0, dy: number = 0) {
const unit8Array: Uint8Array = await context.resourceManager.getMediaContent(resource);
let textDecoder: ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/SvgUtil.ets#L28-L50 | b48cebb94f9fe7af85c397bef28e9c89b8431c03 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets | arkts | 对db操作进行封装,与业务隔离开 | export class DBUtils {
/**
* 初始化db
*/
initDB(): void {
if (store !== undefined) {
return;
}
relationalStore.getRdbStore(CONTEXT, STORE_CONFIG, async (err: BusinessError, rdbStore: relationalStore.RdbStore) => {
store = rdbStore;
if (err) {
logger.error(`init DB failed, co... | AST#export_declaration#Left export AST#class_declaration#Left class DBUtils AST#class_body#Left { /**
* 初始化db
*/ AST#method_declaration#Left initDB 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_... | export class DBUtils {
initDB(): void {
if (store !== undefined) {
return;
}
relationalStore.getRdbStore(CONTEXT, STORE_CONFIG, async (err: BusinessError, rdbStore: relationalStore.RdbStore) => {
store = rdbStore;
if (err) {
logger.error(`init DB failed, code is ${err.code}, m... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L32-L209 | c5d95303b62f2e57e6da81d16c17613b354f5e73 | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/map/MapManager.ets | arkts | addMarker | 添加标记 | addMarker(marker: MapMarker): void {
Logger.info('MapManager', `Marker added: ${marker.id}`);
} | AST#method_declaration#Left addMarker AST#parameter_list#Left ( AST#parameter#Left marker : AST#type_annotation#Left AST#primary_type#Left MapMarker AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | addMarker(marker: MapMarker): void {
Logger.info('MapManager', `Marker added: ${marker.id}`);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/map/MapManager.ets#L69-L71 | 6bf4335eb8c989d543dc3bad8c8cd25ba23650f1 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecomment/src/main/ets/components/view/ImageCommentView.ets | arkts | getCurrentDate | 获取当前时间 | getCurrentDate(): string {
const date: Date = new Date();
return `${date.getFullYear()}-${date.getMonth()}-${date.getDay()} ${date.getHours()}:${date.getMinutes()}`;
} | AST#method_declaration#Left getCurrentDate 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#variable_declaration#Left const AST#variable_declarator#Left date : A... | getCurrentDate(): string {
const date: Date = new Date();
return `${date.getFullYear()}-${date.getMonth()}-${date.getDay()} ${date.getHours()}:${date.getMinutes()}`;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/view/ImageCommentView.ets#L92-L95 | 22e40f4f4a247dfcf89912560cd5ab3051d34fe3 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/result/src/main/ets/RequestHelper.ets | arkts | start | 设置请求开始前执行的回调
@param {() => void} handler - 前置回调
@returns {RequestHelper<T>} 当前实例 | start(handler: () => void): RequestHelper<T> {
this.beforeStart = handler;
return this;
} | AST#method_declaration#Left start AST#parameter_list#Left ( AST#parameter#Left handler : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AS... | start(handler: () => void): RequestHelper<T> {
this.beforeStart = handler;
return this;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L50-L53 | c03bbc190344838087843279fe898cf040ffb466 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ecb_encryption_decryption/aes_ecb_encryption_decryption_synchronous.ets | arkts | decryptMessage | 解密消息 | function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|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('AES128|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/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ecb_encryption_decryption/aes_ecb_encryption_decryption_synchronous.ets#L29-L34 | 6fa08f39fa1cf7ecdedaa85dd03de3e0c1a25e7e | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets | arkts | submitGoodsComment | 提交商品评论
@param params 评论提交请求参数
@returns 提交结果响应 | async submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>> {
const resp: AxiosResponse<NetworkResponse<boolean>> =
await NetworkClient.http.post("goods/comment/submit", params);
return resp.data;
} | AST#method_declaration#Left async submitGoodsComment AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsCommentSubmitRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#... | async submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>> {
const resp: AxiosResponse<NetworkResponse<boolean>> =
await NetworkClient.http.post("goods/comment/submit", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets#L81-L85 | eeecd70fe75ff655fc32a38af958ee204dd7b185 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/RouterModule.ets | arkts | push | 跳转到指定路由栈的指定路由页面 | public static push(info: NavRouterInfo, animated?: boolean) {
try {
RouterModule._stack.pushPathByName(info.url, info.param, animated);
} catch (err) {
Logger.error(TAG, 'navigation stack push failed::' + JSON.stringify(err));
}
} | 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 {
RouterModule._stack.pushPathByName(info.url, info.param, animated);
} catch (err) {
Logger.error(TAG, 'navigation stack push failed::' + JSON.stringify(err));
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/RouterModule.ets#L14-L20 | d7543465df695a27eebf477b9bdd421b01bfa9b6 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets | arkts | 用来计算 图片所需要的偏移量
防止 图片超出显示视图
@param { ConstrainOffsetAndAnimationType } info - 所需要的数据
@return { [boolean, boolean] } - 返回是否移动
如果是 info.dimensionWH 是 "width" 返回值为 [ 左边超出, 右边超出]
如果是 info.dimensionWH 是 "height" 返回值为 [ 上边超出, 下边超出] | export function constrainOffsetAndAnimation(info: ConstrainOffsetAndAnimationType): [boolean, boolean] {
if (info.dimensionWH === ImageFitType.TYPE_DEFAULT) {
return [false, false]
}
const WIN_SIZE = windowSizeManager.get();
// 获取图片在指定轴上的原始尺寸
// const IMG_SIZE = info.dimensionWH === 'width' ? px2vp(IMG_DO... | AST#export_declaration#Left export AST#function_declaration#Left function constrainOffsetAndAnimation AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left ConstrainOffsetAndAnimationType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li... | export function constrainOffsetAndAnimation(info: ConstrainOffsetAndAnimationType): [boolean, boolean] {
if (info.dimensionWH === ImageFitType.TYPE_DEFAULT) {
return [false, false]
}
const WIN_SIZE = windowSizeManager.get();
const IMG_SIZE = getImgSize(info.imageDefaultSize, info.rotate, info.dimensio... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets#L124-L161 | aa3fe255f9618e82766db3c940ab15112d0e08f6 | gitee | |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/common/contants/CommonConstants.ets | arkts | Window to suppress auto-sync after seek/prepare | export const END_EPSILON_SEC = 0.05; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left END_EPSILON_SEC = AST#expression#Left 0.05 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const END_EPSILON_SEC = 0.05; | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/contants/CommonConstants.ets#L79-L79 | ca8eabeb92dc0daad77690f43bff0fdb4ae0b894 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/model/TipOptions.ets | arkts | 自定义Tip弹框 | export interface TipOptions extends BaseDialogOptions {
backgroundColor?: ResourceColor; //弹窗背板颜色。默认值:Color.Transparent
backgroundBlurStyle?: BlurStyle; //弹窗背板模糊材质。默认值:BlurStyle.COMPONENT_ULTRA_THICK
title: string;
content: string;
onAction?: ActionCallBack; //按钮的CallBack事件。
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TipOptions AST#extends_clause#Left extends BaseDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left backgroundColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_a... | export interface TipOptions extends BaseDialogOptions {
backgroundColor?: ResourceColor;
backgroundBlurStyle?: BlurStyle;
title: string;
content: string;
onAction?: ActionCallBack;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/model/TipOptions.ets#L4-L12 | dc2cf370c3b9b76130d5e71ed5b7aa220b2f58ec | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/product/entry/src/main/ets/widget/utils/CaseCardUtils.ets | arkts | 自定义卡片对象格式 | export interface CASES {
name: string,
url: string,
describe: string,
img: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CASES AST#object_type#Left { AST#type_member#Left name : 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 url : AST#type_annotation#Left AST#prim... | export interface CASES {
name: string,
url: string,
describe: string,
img: string
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/widget/utils/CaseCardUtils.ets#L2-L7 | fb7ba99efda645a2d33ff83d3c5da0a4ce7748b1 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | getMockPosts | 获取模拟帖子数据 | private getMockPosts(limit: number): CommunityPost[] {
const mockUser = this.currentUser || this.createDefaultUser();
const posts: CommunityPost[] = [];
for (let i = 0; i < limit; i++) {
posts.push({
id: `post_${i}`,
authorId: mockUser.id,
author: mockUser,
type: PostT... | AST#method_declaration#Left private getMockPosts AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left... | private getMockPosts(limit: number): CommunityPost[] {
const mockUser = this.currentUser || this.createDefaultUser();
const posts: CommunityPost[] = [];
for (let i = 0; i < limit; i++) {
posts.push({
id: `post_${i}`,
authorId: mockUser.id,
author: mockUser,
type: PostT... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L715-L743 | 64b497aeb81c53e4f89ebad31013470ad0de9dc0 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/VirtualEconomyService.ets | arkts | purchaseItem | 购买道具 | async purchaseItem(itemId: string): Promise<boolean> {
try {
const item = this.findItemById(itemId);
if (!item || item.isOwned) {
return false;
}
// 检查解锁条件
if (!this.checkUnlockConditions(item.unlockConditions || [])) {
return false;
}
// 检查余额
for (c... | AST#method_declaration#Left async purchaseItem AST#parameter_list#Left ( AST#parameter#Left itemId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | async purchaseItem(itemId: string): Promise<boolean> {
try {
const item = this.findItemById(itemId);
if (!item || item.isOwned) {
return false;
}
if (!this.checkUnlockConditions(item.unlockConditions || [])) {
return false;
}
for (const [currencyTy... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L408-L424 | af2e11619a7bfc9b8c9be0ada99c9b229c7a56f9 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/entity/DatabaseEntity.ets | arkts | 任务详情实体类 | export class TIndexInfo {
//时间戳 主键
public timestamp: String;
//任务ID
public taskId: String;
//场景标识
public flag: String;
//温度
public shellBackTemp: String;
public shellFrameTemp: String;
public shellFrontTemp: String;
public socThermalTemp: String;
public systemHTemp: String;
public gpuTemp: Str... | AST#export_declaration#Left export AST#class_declaration#Left class TIndexInfo AST#class_body#Left { //时间戳 主键 AST#property_declaration#Left public timestamp : AST#type_annotation#Left AST#primary_type#Left String AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //任务ID AST#property_decla... | export class TIndexInfo {
public timestamp: String;
public taskId: String;
public flag: String;
public shellBackTemp: String;
public shellFrameTemp: String;
public shellFrontTemp: String;
public socThermalTemp: String;
public systemHTemp: String;
public gpuTemp: String;
public ambientTem... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/entity/DatabaseEntity.ets#L146-L424 | 302c4850a8907b2bf705a25966d7a9c0054fa91a | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/SearchHistoryRepository.ets | arkts | getSearchHistoryCount | 获取搜索历史记录数量
@returns {Promise<number>} 搜索历史数量 | getSearchHistoryCount(): Promise<number> {
return this.dataSource.getSearchHistoryCount();
} | AST#method_declaration#Left getSearchHistoryCount 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 number AST#primary_type#Right AST#type_annotation#Right > AST#typ... | getSearchHistoryCount(): Promise<number> {
return this.dataSource.getSearchHistoryCount();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/SearchHistoryRepository.ets#L70-L72 | ebb6c6d1b277c3ee781a866dfbaab8dddd15b7a5 | github |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/net/wanAPI/response/IUserInfo.ets | arkts | 用户信息 | export interface IUserInfo {
coinInfo: CoinData;
userInfo: UserData;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IUserInfo AST#object_type#Left { AST#type_member#Left coinInfo : AST#type_annotation#Left AST#primary_type#Left CoinData AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left userInfo : AST#type_annotatio... | export interface IUserInfo {
coinInfo: CoinData;
userInfo: UserData;
} | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/net/wanAPI/response/IUserInfo.ets#L4-L7 | c89f119c40e65b71fe4e742dffcf0da7ee52e3c6 | github | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/StateManager.ets | arkts | refresh | 数据刷新
@param otaStatus 状态 | refresh(otaStatus: OtaStatus): void {
this.otaStatus = otaStatus;
if (this.otaStatus?.percent) {
this.percent = otaStatus?.percent;
}
} | AST#method_declaration#Left refresh AST#parameter_list#Left ( AST#parameter#Left otaStatus : AST#type_annotation#Left AST#primary_type#Left OtaStatus 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#Rig... | refresh(otaStatus: OtaStatus): void {
this.otaStatus = otaStatus;
if (this.otaStatus?.percent) {
this.percent = otaStatus?.percent;
}
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L241-L246 | 41270d25bff987340d5413e8506d47b6a90af30a | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/addDevice/pages/index.ets | arkts | toNetBySocket | softap socket配网 | private toNetBySocket() {
let params = {}
params["deviceId"] = this.nfcData.getDeviceId()
params["originalSsid"] = this.originalSsid
router.replace({
uri: 'pages/socketNetConfig',
params: {
params: params,
},
});
} | AST#method_declaration#Left private toNetBySocket AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left params AST#ERROR#Left = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#object_lit... | private toNetBySocket() {
let params = {}
params["deviceId"] = this.nfcData.getDeviceId()
params["originalSsid"] = this.originalSsid
router.replace({
uri: 'pages/socketNetConfig',
params: {
params: params,
},
});
} | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/addDevice/pages/index.ets#L76-L86 | 9d4e68488bdd606056abac4bde026b15f41fef59 | gitee |
Leeson-Wong/ark-layer.git | 9efa3553414a6b1eee890e3858c8cdcb308535d7 | core/PhaseExample.ets | arkts | ==================== 使用示例 ====================
示例 1: 使用预定义阶段 | export async function example1_PredefinedPhases() {
console.log('========== Example 1: Using Predefined Phases ==========')
// 阶段 1: 全局核心服务 (串行等待)
serviceManager.load({
phase: GLOBAL_PHASE,
sceneList: [
new ConfigService(),
new DatabaseService()
]
})
// 阶段 2: 业务核心服务 (串行等待)
serviceM... | AST#export_declaration#Left export AST#function_declaration#Left async function example1_PredefinedPhases 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_expressio... | export async function example1_PredefinedPhases() {
console.log('========== Example 1: Using Predefined Phases ==========')
serviceManager.load({
phase: GLOBAL_PHASE,
sceneList: [
new ConfigService(),
new DatabaseService()
]
})
serviceManager.load({
phase: BUSINESS_PHASE,
... | https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseExample.ets#L164-L205 | 2d4c68ec7f4dbb7153cde07c44d9ad157e78d0c3 | github | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/view/HeaderContainer.ets | arkts | HeaderContainer | 定义 HeaderContainer 组件 | @Component
export default struct HeaderContainer {
// 定义标题,标题可以是字符串或资源
private title: string | Resource
// 自定义组件闭包
@BuilderParam closer?: () => void = () => null
// 定义组件的渲染函数
build() {
Row() {
// 创建文本组件,显示标题,标题以竖线字符开头
Text('| ' + this.title)
// 设置文本的水平对齐方式为开始
.textAlign(Tex... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct HeaderContainer AST#component_body#Left { // 定义标题,标题可以是字符串或资源 AST#property_declaration#Left private title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AS... | @Component
export default struct HeaderContainer {
private title: string | Resource
@BuilderParam closer?: () => void = () => null
build() {
Row() {
Text('| ' + this.title)
.textAlign(TextAlign.Start)
.fontSize(DimensionUtil.getFp($r('app.float.title... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/HeaderContainer.ets#L6-L42 | 6a57e273962d65b458d5799a2be85abf864850a7 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | RowStartTop | 横向起始 + 垂直顶部 | @ComponentV2
export struct RowStartTop {
/**
* Row 构造参数
*/
@Param
options: RowOptions | RowOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
@Param
sizeV... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowStartTop AST#component_body#Left { /**
* Row 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left... | @ComponentV2
export struct RowStartTop {
@Param
options: RowOptions | RowOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Padding | Length ... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L785-L860 | e92d49788642e9f5b41d2cfa71db004c207508d1 | github |
gracienewd/openharmony-App-YunmoAi.git | 181952ab00aab5025a81b7b3a6b88d2a5258c76a | entry/src/main/ets/common/net/RequestUtils.ets | arkts | requestHttp | Next版本不支持在箭头函数上写纯泛型, function requestHttp(url: url地址, method: 请求方法类型,默认为get, data?: 参数类型) : 返回类型是: Promise里面的T类型的数据 | async function requestHttp<T>(url: string = '', method: http.RequestMethod = http.RequestMethod.GET, data?: object): Promise<T> {
//创建一个网络请求
const httpRequest = http.createHttp()
//拼接地址
let urlStr = BASE_URL + url
//get方法需要自己拼接
if (method = http.RequestMethod.GET) {
//如果data里面有值并且里面有对象的时候
if (data &... | AST#function_declaration#Left async function requestHttp AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = A... | async function requestHttp<T>(url: string = '', method: http.RequestMethod = http.RequestMethod.GET, data?: object): Promise<T> {
const httpRequest = http.createHttp()
let urlStr = BASE_URL + url
if (method = http.RequestMethod.GET) {
if (data && Object.keys(data).length) {
urlStr += "?" +... | https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/net/RequestUtils.ets#L18-L81 | 6ecb55758667c9848b64dd4e87572fca58ba3bdb | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | getAfterDayStr | 获取后一天日期,返回字符串 | static getAfterDayStr(date: number | string | Date, format: string = DATE_FORMAT4): string {
return DateUtils.getAmountDayStr(date, 1, format);
} | AST#method_declaration#Left static getAfterDayStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#... | static getAfterDayStr(date: number | string | Date, format: string = DATE_FORMAT4): string {
return DateUtils.getAmountDayStr(date, 1, format);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L298-L300 | bdbac47d77b7cf49c81716d8500e533a2afd6952 | gitee |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/SignIn.ets | arkts | fetchCheckInData | 从后端获取签到数据 | fetchCheckInData() {
let request = http.createHttp();
let url = `http://192.168.32.1:8080/api/user/${this.userId}/check-info`; // 替换为你的后端IP
request.request(url, { method: http.RequestMethod.GET })
.then((response: http.HttpResponse) => {
if (response.responseCode === 200 && typeof response.r... | AST#method_declaration#Left fetchCheckInData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left request = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#express... | fetchCheckInData() {
let request = http.createHttp();
let url = `http://192.168.32.1:8080/api/user/${this.userId}/check-info`;
request.request(url, { method: http.RequestMethod.GET })
.then((response: http.HttpResponse) => {
if (response.responseCode === 200 && typeof response.result === 's... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/SignIn.ets#L37-L65 | ea524dfcabb824bd634b206606a3f9e426c117ed | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/AudioUtil.ets | arkts | init | 初始化音频捕捉器 | static async init(readDataCallback: (buffer: ArrayBuffer) => void): Promise<string> {
let isAuth = await AuthUtil.checkPermissions('ohos.permission.MICROPHONE');
if (!isAuth) {
let res = await AuthUtil.reqPermissions('ohos.permission.MICROPHONE');
if (res < 0) {
return '用户取消授权录音权限~';
}... | AST#method_declaration#Left static async init AST#parameter_list#Left ( AST#parameter#Left readDataCallback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right ... | static async init(readDataCallback: (buffer: ArrayBuffer) => void): Promise<string> {
let isAuth = await AuthUtil.checkPermissions('ohos.permission.MICROPHONE');
if (!isAuth) {
let res = await AuthUtil.reqPermissions('ohos.permission.MICROPHONE');
if (res < 0) {
return '用户取消授权录音权限~';
}... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/AudioUtil.ets#L37-L67 | aa0bddeda3fcbabc5ac006c6a79ed6be0d7978eb | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | getLabelPosition | Returns the position of the LimitLine label (value).
@return | public getLabelPosition(): LimitLabelPosition {
return this.mLabelPosition;
} | AST#method_declaration#Left public getLabelPosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LimitLabelPosition AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left... | public getLabelPosition(): LimitLabelPosition {
return this.mLabelPosition;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L178-L180 | 7610ac674673532f7372d1cb227d44ee39a9b046 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/order/OrderNavigator.ets | arkts | toRefund | 跳转到退款申请
@param {number} orderId - 订单 ID
@returns {void} 无返回值 | static toRefund(orderId: number): void {
const params: OrderIdParam = { orderId };
navigateTo(OrderRoutes.Refund, params);
} | AST#method_declaration#Left static toRefund AST#parameter_list#Left ( AST#parameter#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | static toRefund(orderId: number): void {
const params: OrderIdParam = { orderId };
navigateTo(OrderRoutes.Refund, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderNavigator.ets#L65-L68 | 6d9727397002caf010d3dab50c69833939324189 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets | arkts | makeNode | The method that must be overridden is used to build the number of nodes and return the nodes to be mounted in the corresponding NodeContainer. //Called when the corresponding NodeContainer is created, or refreshed by calling the rebuild method. | makeNode(uiContext: UIContext): FrameNode | null {
console.log(' uicontext is undefined : '+ (uiContext === undefined));
if (this.rootNode != null) {
const parent: FrameNode = this.rootNode.getFrameNode()?.getParent() as FrameNode;
if (parent) {
console.info(JSON.stringify(parent.getInspecto... | AST#method_declaration#Left makeNode 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#union_type#Left AST#primary_type#Left Fram... | makeNode(uiContext: UIContext): FrameNode | null {
console.log(' uicontext is undefined : '+ (uiContext === undefined));
if (this.rootNode != null) {
const parent: FrameNode = this.rootNode.getFrameNode()?.getParent() as FrameNode;
if (parent) {
console.info(JSON.stringify(parent.getInspecto... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets#L51-L67 | 8e7c3cf7e9aca73a8f2761cc407e8254fc06c8f1 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/common/DataModel.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 class Model1 {
public message?: string | Resource | number = undefined //message是必填项
public duration?: string | Resource | number = undefined
public bottom?: string | Resource | number = undefined
constructor | AST#export_declaration#Left export AST#ERROR#Left class Model1 { AST#property_declaration#Left public message ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right... | export class Model1 {
public message?: string | Resource | number = undefined
public duration?: string | Resource | number = undefined
public bottom?: string | Resource | number = undefined
constructor | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/common/DataModel.ets#L16-L21 | d4d6cbca12cf4994fb8b82ee874786a363c365d3 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/editaddress/src/main/ets/common/CommonConstants.ets | arkts | 地址标签数组 | export const ADDRESS_LABEL: string[] = ['家', '公司', '学校', '父母', '朋友', '亲戚']; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ADDRESS_LABEL : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expre... | export const ADDRESS_LABEL: string[] = ['家', '公司', '学校', '父母', '朋友', '亲戚']; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/common/CommonConstants.ets#L100-L100 | d4952f6b8cc75f6989b5b9be415167d2a296c6a3 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/WebSocketManager.ets | arkts | heartbeat | Sends a heartbeat on the available connection. | heartbeat(): void {
if (!this.connection) return this.debug('No connection to heartbeat');
this.connection.heartbeat();
} | AST#method_declaration#Left heartbeat AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#ex... | heartbeat(): void {
if (!this.connection) return this.debug('No connection to heartbeat');
this.connection.heartbeat();
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/WebSocketManager.ets#L30-L33 | bf192ddf3ac402c116bf5a6ee0501ef510695faf | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/CommemorationDAO.ets | arkts | getAllCommemorations | 获取所有纪念日
@returns 纪念日数组 | async getAllCommemorations(): Promise<CommemorationEntity[]> {
const rdbStore = this.dbManager.getRdbStore();
if (!rdbStore) {
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore.RdbPredicates('commemorations');
predicates.orderByAsc('commemorat... | AST#method_declaration#Left async getAllCommemorations 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 AST#array_type#Left CommemorationEntity [ ] AST#array_type#R... | async getAllCommemorations(): Promise<CommemorationEntity[]> {
const rdbStore = this.dbManager.getRdbStore();
if (!rdbStore) {
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore.RdbPredicates('commemorations');
predicates.orderByAsc('commemorat... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/CommemorationDAO.ets#L119-L140 | 6430d6d3008c4b08d5ce42ee59fdba02719bebd9 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/entry4ability/Entry4Ability.ets | arkts | onForeground | [EndExclude save_uiContext_to_localstorage_in_entry_ability] [StartExclude save_uiContext_to_localstorage_in_entry_ability] | onForeground(): void {
// Ability has brought to foreground
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
} | AST#method_declaration#Left onForeground 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 { // Ability has brought to foreground AST#expression_statement#Left AST#expression#Left AST... | onForeground(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/entry4ability/Entry4Ability.ets#L54-L57 | 789d27a16119848005542fb4baa3c9b52bd39e45 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogHub.ets | arkts | getUIAbilityContext | /** @ComponentV2不支持 WithTheme组件 * 获取深色/浅色 模式 * @returns static getThemeColorMode(): ThemeColorMode { return DialogHub.config.dialogTheme.themeColorMode; } /** * 设置深色/浅色 模式 * @returns static setThemeColorMode(mode: ThemeColorMode): void { DialogHub.config.dialogTheme.themeColorMode = mode }
获取UIAbilityContext
@retu... | static getUIAbilityContext(): common.UIAbilityContext {
if (DialogHub.config?.uiAbilityContext) {
return DialogHub.config?.uiAbilityContext;
}
return getContext() as common.UIAbilityContext; //兜底
} | AST#method_declaration#Left static getUIAbilityContext AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statemen... | static getUIAbilityContext(): common.UIAbilityContext {
if (DialogHub.config?.uiAbilityContext) {
return DialogHub.config?.uiAbilityContext;
}
return getContext() as common.UIAbilityContext;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L262-L267 | 82b8925361a115cb5f48b9c280324657e7bce853 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getStringSync | 获取指定资源对应的字符串
@param resId 资源ID值
@param args 格式化字符串资源参数。
支持参数类型:%d、%f、%s、%%、%数字\$d、%数字\$f、%数字\$s;
说明:%%转义为%; %数字\$d表示使用第几个参数;
举例:%%d格式化后为%d字符串; %1\$d表示使用第一个参数 | static getStringSync(resId: number | Resource, args?: Array<string | number>): string {
if (args !== undefined && args.length > 0) {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getStringSync(resId, ...args);
} else {
return ResUtil.getResourceManager().getStringS... | AST#method_declaration#Left static getStringSync AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Righ... | static getStringSync(resId: number | Resource, args?: Array<string | number>): string {
if (args !== undefined && args.length > 0) {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getStringSync(resId, ...args);
} else {
return ResUtil.getResourceManager().getStringS... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L93-L107 | 98dc2107aa46164ff54af4778f779605b36b37a5 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/network/BaseNetWorkView.ets | arkts | buildDefaultError | 默认错误视图
@returns {void} 无返回值 | @Builder
buildDefaultError(): void {
EmptyNetwork({
onAction: this.onRetry
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDefaultError AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Le... | @Builder
buildDefaultError(): void {
EmptyNetwork({
onAction: this.onRetry
});
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/network/BaseNetWorkView.ets#L51-L56 | b3b59a6babd446d16b6a825e3573429d78459769 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 矩形区域接口 | export interface Rectangle extends Position, Size {} | AST#export_declaration#Left export AST#interface_declaration#Left interface Rectangle AST#extends_clause#Left extends Position , Size AST#extends_clause#Right AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface Rectangle extends Position, Size {} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L212-L212 | 3752386f9343dcaf78019fbdf64fc5102502b090 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/TaskPool.ets | arkts | queryItem | TODO: 知识点:在使用TaskPool时,执行的并发函数需要使用@Concurrent装饰器修饰,否则无法通过相关校验。 | @Concurrent
async function queryItem(context: common.Context): Promise<Array<Contact>> {
return await DatabaseConnection.getInstance().query(context);
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function queryItem AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_ann... | @Concurrent
async function queryItem(context: common.Context): Promise<Array<Contact>> {
return await DatabaseConnection.getInstance().query(context);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/TaskPool.ets#L26-L29 | 355cec1bdc00dc0b8c03cc70c653c38ea5c55ede | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/SearchPage.ets | arkts | performSearch | 执行搜索 | private async performSearch(keyword: string): Promise<void> {
try {
this.loading = true;
// 并行搜索联系人和祝福语
const [contacts, greetings] = await Promise.all([
this.searchContacts(keyword),
this.searchGreetings(keyword)
]);
this.searchResult = {
contacts... | AST#method_declaration#Left private async performSearch 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#generi... | private async performSearch(keyword: string): Promise<void> {
try {
this.loading = true;
const [contacts, greetings] = await Promise.all([
this.searchContacts(keyword),
this.searchGreetings(keyword)
]);
this.searchResult = {
contacts,
gree... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L106-L130 | f6aac22c24488cc26c8907f3ae3d21e79cbcc467 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | isFullScreen | 判断窗口是否全屏,默认为false。true表示全屏;false表示非全屏。
@param windowClass 不传该值,默认主窗口。
@returns | static isFullScreen(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return WindowUtil.getWindowProperties(windowClass).isFullScreen;
} | AST#method_declaration#Left static isFullScreen 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#e... | static isFullScreen(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return WindowUtil.getWindowProperties(windowClass).isFullScreen;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L335-L337 | 27addcd646a4bde8eedde241bd2213a564b73c82 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | hasBlank | 判断传入的字符串中是否包含有空值,只要有一个则返回true,否则false
@param strs 字符串列表
@return 是否包含空字符串 | static hasBlank(...strs: string[]): boolean {
if (ArrayUtil.strValIsEmpty(strs)) {
return true;
}
for (let str of strs) {
if (StrUtil.isBlank(str)) {
return true;
}
}
return false;
} | AST#method_declaration#Left static hasBlank AST#parameter_list#Left ( AST#parameter#Left ... strs : 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_list#Right : AST#type_annotation#Lef... | static hasBlank(...strs: string[]): boolean {
if (ArrayUtil.strValIsEmpty(strs)) {
return true;
}
for (let str of strs) {
if (StrUtil.isBlank(str)) {
return true;
}
}
return false;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L110-L120 | 6a101056ba1a9af663bf282d3e7bbd64779a4df2 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets | arkts | registerBuilder | [StartExclude sourcecode_router_module] 注册页面组件到路由表,builderName是路由名字,builder参数是包裹了页面组件的WrappedBuilder对象 | public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): void {
RouterModule.builderMap.set(builderName, builder);
} | AST#method_declaration#Left public static registerBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AS... | public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): void {
RouterModule.builderMap.set(builderName, builder);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets#L48-L50 | e9a7dd968f0177908474cafbde731ba0facfe47d | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.