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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets | arkts | updateCapacity | Reset the capacity of lruCache | public updateCapacity(newCapacity: number): void {
this.lruCache.updateCapacity(newCapacity);
} | AST#method_declaration#Left public updateCapacity AST#parameter_list#Left ( AST#parameter#Left newCapacity : 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#pri... | public updateCapacity(newCapacity: number): void {
this.lruCache.updateCapacity(newCapacity);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets#L31-L33 | 2870b3651817e3e8332e92ee4b341bc07eba0e92 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/ToolBarData.ets | arkts | ToolBarData is used to initialize ToolBarComponent. | export default class ToolBarData {
num: number = 0;
text: Resource = $r('app.string.nav_index');
icon_after: Resource = $rawfile('index/home.png');
icon: Resource = $rawfile('index/home_selected.png');
} | AST#export_declaration#Left export default AST#class_declaration#Left class ToolBarData AST#class_body#Left { AST#property_declaration#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration... | export default class ToolBarData {
num: number = 0;
text: Resource = $r('app.string.nav_index');
icon_after: Resource = $rawfile('index/home.png');
icon: Resource = $rawfile('index/home_selected.png');
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/viewmodel/ToolBarData.ets#L19-L24 | 4f84660335d0e3a9cd14de39b7c457bf9605c114 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index_backup.ets | arkts | buildClickableRow | 构建可点击行 | @Builder
buildClickableRow(title: string, description: string, onClick: () => void) {
Row() {
Column({ space: 4 }) {
Text(title)
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
Text(description)
.fontSize(14)
.fontColor('#6... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildClickableRow AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annot... | @Builder
buildClickableRow(title: string, description: string, onClick: () => void) {
Row() {
Column({ space: 4 }) {
Text(title)
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
Text(description)
.fontSize(14)
.fontColor('#6... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1007-L1029 | 1a10d3771738397144bca1882f564507d4d8b0d0 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ImageUtil.ets | arkts | savePixelMap | 保存pixelMap到本地
@param pixelMap PixelMap
@param path 文件夹路径
@param name 文件名
@param format 目标格式。默认png。当前只支持jpg(image/jpeg)、webp和png(image/png)。
@returns | static async savePixelMap(pixelMap: image.PixelMap, path: string, name: string, format: string = 'image/png'): Promise<string> {
if (!FileUtil.accessSync(path)) {
FileUtil.mkdirSync(path) //如果文件夹不存在就创建
}
let filePath = path + FileUtil.separator + name;
let file = FileUtil.openSync(filePath)
le... | AST#method_declaration#Left static async savePixelMap AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left path : ... | static async savePixelMap(pixelMap: image.PixelMap, path: string, name: string, format: string = 'image/png'): Promise<string> {
if (!FileUtil.accessSync(path)) {
FileUtil.mkdirSync(path)
}
let filePath = path + FileUtil.separator + name;
let file = FileUtil.openSync(filePath)
let packOpts: i... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L80-L90 | 0814fffd5e435dc2f8401dd5f437ee5cd0d122d1 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/common/component/TextMatchUtils.ets | arkts | matchReplace | 替换匹配到的字符串,不重写默认不替换 | matchReplace(start: number, text: string): string {
return text
} | AST#method_declaration#Left matchReplace AST#parameter_list#Left ( AST#parameter#Left start : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | matchReplace(start: number, text: string): string {
return text
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/common/component/TextMatchUtils.ets#L165-L167 | 9232fd11fb00ac9a37da77ca321ed18acc8ed295 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.fs.d.ets | arkts | WriteOptions type
@extends Options
@interface WriteOptions
@syscap SystemCapability.FileManagement.File.FileIO
@since 20 | export interface WriteOptions extends Options {
/**
* The offset when writing the file.
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/
offset?: number;
/**
* The length for writing.
*
* @type { ?number }
* @syscap SystemCapability.FileMan... | AST#export_declaration#Left export AST#interface_declaration#Left interface WriteOptions AST#extends_clause#Left extends Options AST#extends_clause#Right AST#object_type#Left { /**
* The offset when writing the file.
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20... | export interface WriteOptions extends Options {
offset?: number;
length?: number;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4398-L4415 | 0a88142c1b27631d64118a986d20e3dc7b9bc84e | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/FileUtil.ets | arkts | getRawFileContentSync | 获取resources/rawfile目录下对应的rawfile文件内容,使用同步形式返回
@param path rawfile文件路径
@returns | static getRawFileContentSync(path: string): Uint8Array {
let resourceManager = getContext().resourceManager;
return resourceManager.getRawFileContentSync(path);
} | AST#method_declaration#Left static getRawFileContentSync 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 Uint8Array A... | static getRawFileContentSync(path: string): Uint8Array {
let resourceManager = getContext().resourceManager;
return resourceManager.getRawFileContentSync(path);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L234-L237 | 884df4a07d220c31f8209d6704d632ca0d16ccab | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customview/src/main/ets/view/CustomView.ets | arkts | achieveEffect | 实现动画效果 | achieveEffect(temIndex: number) {
// 高性能知识点:scrollToIndex方法,开启smooth动效时,会对经过的所有item进行加载和布局计算,当大量加载item时会导致性能问题
this.scroller.scrollToIndex(temIndex, true, ScrollAlign.START);
this.wantGoIndex = temIndex;
// 动画效果
animateTo({
duration: Math.abs(temIndex - this.currentIndex) * this.durationRadix,... | AST#method_declaration#Left achieveEffect AST#parameter_list#Left ( AST#parameter#Left temIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 高性能知识点:scrollToIndex方法,开启smooth动效时,会对经过的所有... | achieveEffect(temIndex: number) {
this.scroller.scrollToIndex(temIndex, true, ScrollAlign.START);
this.wantGoIndex = temIndex;
animateTo({
duration: Math.abs(temIndex - this.currentIndex) * this.durationRadix,
curve: Curve.EaseInOut,
iterations: this.iterationsDefault,
play... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customview/src/main/ets/view/CustomView.ets#L204-L220 | 5172acf4ad3de811a04419a2f3cb68648307ac50 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ClickResponseOptimization/entry/src/main/ets/common/constants/WorldConstants.ets | arkts | 最佳实践:点击响应优化 | export default class Constants {
/**
* percent
*/
static readonly FULL_SCREEN: string = '100%';
static readonly ACCOUNT_POSITION_X: string = '46%';
static readonly PERCENT_50 = '50%';
static readonly PERCENT_90 = '90%';
/**
* opacity
*/
static readonly FULL_OPACITY: number = 1;
static readon... | AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { /**
* percent
*/ AST#property_declaration#Left static readonly FULL_SCREEN : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100... | export default class Constants {
static readonly FULL_SCREEN: string = '100%';
static readonly ACCOUNT_POSITION_X: string = '46%';
static readonly PERCENT_50 = '50%';
static readonly PERCENT_90 = '90%';
static readonly FULL_OPACITY: number = 1;
static readonly NONE_OPACITY: number = 0;
static rea... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/common/constants/WorldConstants.ets#L19-L54 | 6a5a527a0ca0631f2e56c07d7b2824f8a3d8d280 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LanguageSettingsPage.ets | arkts | updateAutoDetect | 更新自动检测设置 | private async updateAutoDetect(enabled: boolean): Promise<void> {
try {
await this.i18nManager.updateConfig({ autoDetect: enabled });
this.config.autoDetect = enabled;
if (enabled) {
// 执行语言检测
await this.detectLanguage();
}
} catch (error) {
hilog.error(LogCo... | AST#method_declaration#Left private async updateAutoDetect AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge... | private async updateAutoDetect(enabled: boolean): Promise<void> {
try {
await this.i18nManager.updateConfig({ autoDetect: enabled });
this.config.autoDetect = enabled;
if (enabled) {
await this.detectLanguage();
}
} catch (error) {
hilog.error(LogConstants.D... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L595-L607 | 6dafa7138b5d2b255eb67a2d33d6069c01813042 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | udid | 设备Udid | static udid(): string {
return deviceInfo.udid
} | AST#method_declaration#Left static udid 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#return_statement#Left return AST#expression#Left AST#member_expression#L... | static udid(): string {
return deviceInfo.udid
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L222-L224 | 280f93744e679174dfabd2b721e184041f71de88 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/BreakpointState.ets | arkts | updateByWidth | 更新窗口宽度并计算断点
@param {number} windowWidthVp - 窗口宽度(vp)
@returns {void} 无返回值
@example
state.updateByWidth(360); | updateByWidth(windowWidthVp: number): void {
this.windowWidthVp = windowWidthVp;
const next = this.resolveBreakpoint(windowWidthVp);
if (this.current !== next) {
this.current = next;
}
} | AST#method_declaration#Left updateByWidth AST#parameter_list#Left ( AST#parameter#Left windowWidthVp : 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_t... | updateByWidth(windowWidthVp: number): void {
this.windowWidthVp = windowWidthVp;
const next = this.resolveBreakpoint(windowWidthVp);
if (this.current !== next) {
this.current = next;
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L63-L69 | 1f7ee907290500e839346861b8aa9461e88a060b | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/voice/util/SecretKey.ets | arkts | 应用约束60:使用ES模块导出语法 | export default SecretKey; | AST#export_declaration#Left export default AST#expression#Left SecretKey AST#expression#Right ; AST#export_declaration#Right | export default SecretKey; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/util/SecretKey.ets#L22-L22 | fa66078ed2acbf5415be4bcc19bf5df873d762d1 | github | |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/components/SwipeCardStack.ets | arkts | reset | 重置卡片栈 | public reset(): void {
this.currentIndex = 0;
this.cardState = CardState.IDLE;
this.topCardAnimation = {
translateX: 0,
translateY: 0,
rotation: 0,
scale: 1,
opacity: 1
};
this.backgroundCardAnimation = {
translateX: 0,
translateY: 0,
rotation: 0,
... | AST#method_declaration#Left public reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#membe... | public reset(): void {
this.currentIndex = 0;
this.cardState = CardState.IDLE;
this.topCardAnimation = {
translateX: 0,
translateY: 0,
rotation: 0,
scale: 1,
opacity: 1
};
this.backgroundCardAnimation = {
translateX: 0,
translateY: 0,
rotation: 0,
... | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L498-L516 | 05f553b13732c0b83198c9ce155ee46bc0deac25 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BaseDataSet.ets | arkts | notifyDataSetChanged | Use this method to tell the data set that the underlying data has changed. | public notifyDataSetChanged(): void {
this.calcMinMax();
} | AST#method_declaration#Left public notifyDataSetChanged AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left ... | public notifyDataSetChanged(): void {
this.calcMinMax();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L110-L112 | 9835d7206553ba3a14d5b8fad1de37b324ab26a0 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | XiaoyiAgentDemo/entry/src/main/ets/entryability/InsightIntentExecutorImpl.ets | arkts | onExecuteInUIAbilityBackgroundMode | Intention execution method for backend execution. | async onExecuteInUIAbilityBackgroundMode(
intentName: string,
params: Record<string, object>
): Promise<insightIntent.ExecuteResult> {
try {
switch (intentName) {
// Play audio intention.
case 'PlayHiddenAudio':
const stringParam: Record<string, string> = this.convertToRec... | AST#method_declaration#Left async onExecuteInUIAbilityBackgroundMode AST#parameter_list#Left ( AST#parameter#Left intentName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_typ... | async onExecuteInUIAbilityBackgroundMode(
intentName: string,
params: Record<string, object>
): Promise<insightIntent.ExecuteResult> {
try {
switch (intentName) {
case 'PlayHiddenAudio':
const stringParam: Record<string, string> = this.convertToRecord(params);
r... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/XiaoyiAgentDemo/entry/src/main/ets/entryability/InsightIntentExecutorImpl.ets#L32-L57 | 9bff51916fb512a4686ed55b041fa767f94912b1 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/common/RdbHelper.ets | arkts | getMoodEntryByDate | Get mood entry for a specific date
@param date - Date string in YYYY-MM-DD format
@returns MoodEntry or null if not found | async getMoodEntryByDate(date: string): Promise<MoodEntry | null> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_MOOD_ENTRIES);
predicates.equalTo('date', date);
try {
const resultSet = await t... | AST#method_declaration#Left async getMoodEntryByDate AST#parameter_list#Left ( AST#parameter#Left date : 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... | async getMoodEntryByDate(date: string): Promise<MoodEntry | null> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_MOOD_ENTRIES);
predicates.equalTo('date', date);
try {
const resultSet = await t... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L488-L519 | 46a50f19a8a12ee2a3d972ccbdd5d56d03cb5bf9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/components/common/EmptyView.ets | arkts | ContactsEmptyView | 联系人空状态组件 | @Component
export struct ContactsEmptyView {
onAddContact?: () => void;
build() {
EmptyView({
message: '还没有添加联系人',
description: '快来添加第一个联系人,开始记录美好时光',
icon: $r('app.media.ic_contacts_empty'),
showAction: true,
actionText: '添加联系人',
onAction: this.onAddContact
})
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ContactsEmptyView AST#component_body#Left { AST#property_declaration#Left onAddContact ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Le... | @Component
export struct ContactsEmptyView {
onAddContact?: () => void;
build() {
EmptyView({
message: '还没有添加联系人',
description: '快来添加第一个联系人,开始记录美好时光',
icon: $r('app.media.ic_contacts_empty'),
showAction: true,
actionText: '添加联系人',
onAction: this.onAddContact
})
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/EmptyView.ets#L81-L95 | 6b3219867eb582792122d9b219cccf8562404f81 | github |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/drawing/ets/@ohos.graphics.common2D.ets | arkts | Provides the definition of the rectangle.
@typedef Rect
@syscap SystemCapability.Graphics.Drawing
@since 11 | export interface Rect {
/**
* Left Position of Rectangle.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 11
*/
left: number;
/**
* Top side position of the rectangle
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since ... | AST#export_declaration#Left export AST#interface_declaration#Left interface Rect AST#object_type#Left { /**
* Left Position of Rectangle.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 11
*/ AST#type_member#Left left : AST#type_annotation#Left AST#primary_type#Left numb... | export interface Rect {
left: number;
top: number;
right: number;
bottom: number;
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.common2D.ets#L71-L100 | d0e1697281eaca7e6eda2a49f849f85aff72f72d | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets | arkts | createCameraInputFn | Create the cameraInput output object | createCameraInputFn(cameraManager: camera.CameraManager,
cameraDevice: camera.CameraDevice): camera.CameraInput | undefined {
Logger.info(TAG, 'createCameraInputFn is called.');
let cameraInput: camera.CameraInput | undefined = undefined;
try {
cameraInput = cameraManager.createCameraInput(cameraD... | AST#method_declaration#Left createCameraInputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ca... | createCameraInputFn(cameraManager: camera.CameraManager,
cameraDevice: camera.CameraDevice): camera.CameraInput | undefined {
Logger.info(TAG, 'createCameraInputFn is called.');
let cameraInput: camera.CameraInput | undefined = undefined;
try {
cameraInput = cameraManager.createCameraInput(cameraD... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets#L261-L272 | a9413fda863ee92a21d629f150fe06c0e522fbf5 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | generateCryptoKey | 生成非对称密钥
@param symAlgName 秘钥规格
@returns 指定秘钥规格的非对称公私 | static async generateCryptoKey(symAlgName: string): Promise<OutDTO<CryptoKey>> {
// 创建非对称密钥生成器
let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName);
// 通过非对称密钥生成器,随机生成非对称密钥
let promiseKeyPair = await rsaGenerator.generateKeyPair();
// 转换成可以读懂的公私钥字符串
let pubKey = StrAndUintUtil.unitArray2S... | AST#method_declaration#Left static async generateCryptoKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : 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#... | static async generateCryptoKey(symAlgName: string): Promise<OutDTO<CryptoKey>> {
let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName);
let promiseKeyPair = await rsaGenerator.generateKeyPair();
let pubKey = StrAndUintUtil.unitArray2String(promiseKeyPair.pubKey.getEncoded().data);
l... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L104-L113 | f30e4fc52bda4ac228c132072946465a20d108a7 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/DistributeDraw/entry/src/main/ets/viewmodel/Position.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Position {
/**
* Indicates whether the position is the start position.
*/
isFirstPosition: boolean;
/**
* Indicates whether the position is the end position.
*/
isEndPosition: boolean;
/**
* Position x.
*/
positionX: number;
/**
* Position y.
*/
positionY:... | AST#export_declaration#Left export default AST#class_declaration#Left class Position AST#class_body#Left { /**
* Indicates whether the position is the start position.
*/ AST#property_declaration#Left isFirstPosition : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotatio... | export default class Position {
isFirstPosition: boolean;
isEndPosition: boolean;
positionX: number;
positionY: number;
constructor(isFirstPosition: boolean, isEndPosition: boolean, positionX: number, positionY: number) {
this.isFirstPosition = isFirstPosition;
this.isEndPosition = isE... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/viewmodel/Position.ets#L16-L43 | 2fc4faf7c94cf1595ed29525a43cc7d48cb21fcf | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/components/enhanced/EnhancedTextInput.ets | arkts | placeholder | 链式调用方法 | placeholder(value: string): EnhancedTextInput {
this.placeholder = value;
return this;
} | AST#method_declaration#Left placeholder 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 EnhancedTextInput AST#primar... | placeholder(value: string): EnhancedTextInput {
this.placeholder = value;
return this;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/enhanced/EnhancedTextInput.ets#L322-L325 | d1edafe4f7763022ccc6d79f3a365268c42eac97 | github |
wenqi1/MallHomepage.git | a09765bee60b214f73b875570f8721a004d0bc3b | entry/src/main/ets/pages/MainPage.ets | arkts | TabBar | 自定义底部导航图标 | @Builder TabBar(tabBarData: TabBarData) {
Column({space: MainPageConstants.TAB_SPACE}) {
Image(this.currentIndex === tabBarData.index ? tabBarData.selectImg : tabBarData.img)
.height($r('app.float.main_page_tab_image_size'))
.width($r('app.float.main_page_tab_image_size'))
Text(tabBarDat... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBar AST#parameter_list#Left ( AST#parameter#Left tabBarData : AST#type_annotation#Left AST#primary_type#Left TabBarData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bod... | @Builder TabBar(tabBarData: TabBarData) {
Column({space: MainPageConstants.TAB_SPACE}) {
Image(this.currentIndex === tabBarData.index ? tabBarData.selectImg : tabBarData.img)
.height($r('app.float.main_page_tab_image_size'))
.width($r('app.float.main_page_tab_image_size'))
Text(tabBarDat... | https://github.com/wenqi1/MallHomepage.git/blob/a09765bee60b214f73b875570f8721a004d0bc3b/entry/src/main/ets/pages/MainPage.ets#L11-L20 | 3d9bcc5b30ddbb7cfe098b1c5c420bea300a1e88 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/exception_throw/exception_try_002_F.ets | arkts | Introduction 异常抛出-try块 | export function exception_try_002_F(taint_src : string) {
try {
let _t = taint_src;
let clean = "_";
taint.Sink(clean);
} catch (e) {}
} | AST#export_declaration#Left export AST#function_declaration#Left function exception_try_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement... | export function exception_try_002_F(taint_src : string) {
try {
let _t = taint_src;
let clean = "_";
taint.Sink(clean);
} catch (e) {}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/exception_throw/exception_try_002_F.ets#L6-L12 | 1b816ecaacc08c89182abc1404f70af1662594c7 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/demoCollect/startAbility/frame/AbilityKit/StartAbility/entry/src/main/ets/viewdata/InitialData.ets | arkts | 页面数据 | export const InitialList: ListItemType[] = [
new ListItemType($r('app.media.mail_1'), $r('app.string.ImgName_1')),
new ListItemType($r('app.media.airplane_2'), $r('app.string.ImgName_2')),
new ListItemType($r('app.media.consumption_3'), $r('app.string.ImgName_3')),
new ListItemType($r('app.media.movie_4'), $r('... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left InitialList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ListItemType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#e... | export const InitialList: ListItemType[] = [
new ListItemType($r('app.media.mail_1'), $r('app.string.ImgName_1')),
new ListItemType($r('app.media.airplane_2'), $r('app.string.ImgName_2')),
new ListItemType($r('app.media.consumption_3'), $r('app.string.ImgName_3')),
new ListItemType($r('app.media.movie_4'), $r('... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/frame/AbilityKit/StartAbility/entry/src/main/ets/viewdata/InitialData.ets#L14-L29 | 12892262accdae76e9a320cffb9b711a7717f738 | gitee | |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets | arkts | Nft页面样式 | export const NftStyle = {
ANIMATOR_WIDTH: 240,
ANIMATOR_HEIGHT: 240,
ANIMATOR_MARGIN_TOP: 162,
ANIMATOR_LAYOUT_WIDTH: '100%',
ANIMATOR_LAYOUT_HEIGHT: '100%',
IMAGE_BACKGROUND_WIDTH: '100%',
IMAGE_BACKGROUND_HEIGHT: '100%',
TEXT_GONE_MARGIN_TOP: 28,
IMAGE_GONE_ASPECT_RATIO: 2,
IMAGE_GONE_WIDTH: '100%... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left NftStyle = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left ANIMATOR_WIDTH AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#R... | export const NftStyle = {
ANIMATOR_WIDTH: 240,
ANIMATOR_HEIGHT: 240,
ANIMATOR_MARGIN_TOP: 162,
ANIMATOR_LAYOUT_WIDTH: '100%',
ANIMATOR_LAYOUT_HEIGHT: '100%',
IMAGE_BACKGROUND_WIDTH: '100%',
IMAGE_BACKGROUND_HEIGHT: '100%',
TEXT_GONE_MARGIN_TOP: 28,
IMAGE_GONE_ASPECT_RATIO: 2,
IMAGE_GONE_WIDTH: '100%... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets#L108-L149 | 82a76c466a3d9338b20645bdec062d72eb34534a | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets | arkts | decode | 解密
@param decodeStr 待解密的字符串
@param priKey SM2私钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 | static decode(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeAsym(str, priKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, dataCoding, false);
} | AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | static decode(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeAsym(str, priKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, dataCoding, false);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L57-L60 | 125367ff3d607aa15990e30cf902ccac8d9733ed | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | onDidDisappear | 后续看是否直接设置关闭 setInsiderTopClose(onClose?: VoidCallback){ if(this.builderOptions.attaches?.length){ this.builderOptions.attaches.push(PresetAttach.insideTopRightClose) }else{ this.builderOptions.attaches = [PresetAttach.insideTopRightClose] } this.builderOptions.attachAction = attachAction; }
弹窗消失时回调
@param action | onDidDisappear(action: (reason?: CloseReason) => void) {
this.builderOptions.onDidDisappear = action
return this
} | AST#method_declaration#Left onDidDisappear AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left reason ? : AST#type_annotation#Left AST#primary_type#Left CloseReason AST#primary_type#Right AST#type_annotation#Right AST#paramet... | onDidDisappear(action: (reason?: CloseReason) => void) {
this.builderOptions.onDidDisappear = action
return this
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L224-L227 | 4fefad9b79d457e6fdcc0244e58706700dc212a9 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webgetcameraimage/Index.ets | arkts | WebGetCameraImageView | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { WebGetCameraImageView } from './src/main/ets/components/mainpage/MainPage' | AST#export_declaration#Left export { WebGetCameraImageView } from './src/main/ets/components/mainpage/MainPage' AST#export_declaration#Right | export { WebGetCameraImageView } from './src/main/ets/components/mainpage/MainPage' | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webgetcameraimage/Index.ets#L16-L16 | 9a033315f745c561fc7d3f577006be2319c64d78 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets | arkts | getCenterX | Get the center point of x.
@returns | getCenterX(): number {
return (this.left + this.getWidth() / 2);
} | AST#method_declaration#Left getCenterX AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#parenthesized_expres... | getCenterX(): number {
return (this.left + this.getWidth() / 2);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets#L90-L92 | 24cdbed10fee2f4cc9866ae6b65e579ac684b2e3 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | checkHideTransUsable | / 检查 是否可以使用隐藏翻译 | public checkHideTransUsable(showMessage: boolean = true): boolean {
if (!this.nonMember.isLockedHideTrans) { return true } // 非会员 锁定隐藏翻译 功能是否启用
if (this.isActive) { return true } // 非会员才做检查
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_use_hide_trans'))
}
retur... | AST#method_declaration#Left public checkHideTransUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AS... | public checkHideTransUsable(showMessage: boolean = true): boolean {
if (!this.nonMember.isLockedHideTrans) { return true }
if (this.isActive) { return true }
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_use_hide_trans'))
}
return false
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L314-L323 | 35d172ff082e529aad91c271d6fa7e408b6ef6f5 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets | arkts | notifyPopListener | 页面返回监控 | notifyPopListener() {
for (let listener of this.popListeners) {
const currentRecord = this.globalPageRecordStack.peek()
listener(currentRecord)
}
} | AST#method_declaration#Left notifyPopListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( let listener of AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . popListeners AST#member_expression#... | notifyPopListener() {
for (let listener of this.popListeners) {
const currentRecord = this.globalPageRecordStack.peek()
listener(currentRecord)
}
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets#L122-L127 | eb01cd3c49c182187d1f8628a65958c464236e2a | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/FolderDialog.ets | arkts | getFolders | allFolders 改变时触发。
获取当前用户创建的文件夹。 | public getFolders(): void {
this.folders = ArrayUtil.subArray(this.allFolders,
(folder: Folder) => folder.owner === this.folder.owner && folder.folderType === FolderType.NORMAL);
} | AST#method_declaration#Left public getFolders AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#... | public getFolders(): void {
this.folders = ArrayUtil.subArray(this.allFolders,
(folder: Folder) => folder.owner === this.folder.owner && folder.folderType === FolderType.NORMAL);
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/FolderDialog.ets#L136-L139 | 729d8afb7636200de26bcaa591f6ec7c54cd5cb4 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets | arkts | getPx | Obtains the screen horizontal adaptation px. | static getPx(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return DimensionUtil.adaptDimension(beforeVp);
} | AST#method_declaration#Left static getPx AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | static getPx(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return DimensionUtil.adaptDimension(beforeVp);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets#L38-L41 | ee35a1c2d874a8a8755513be69987925eb417762 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets | arkts | exportKeyItem | 导出密钥 | function exportKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: ThrowObject) {
return new Promise<huks.HuksReturnResult>((resolve, reject) => {
try {
huks.exportKeyItem(keyAlias, huksOptions, (error, data) => {
if (error) {
reject(error);
} else {
res... | AST#function_declaration#Left function exportKeyItem AST#parameter_list#Left ( AST#parameter#Left keyAlias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left AST#qu... | function exportKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: ThrowObject) {
return new Promise<huks.HuksReturnResult>((resolve, reject) => {
try {
huks.exportKeyItem(keyAlias, huksOptions, (error, data) => {
if (error) {
reject(error);
} else {
res... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets#L285-L300 | 731520e1903ba8108383432bc10c4c9530dfb547 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets | arkts | 封装的文件操作工具类 | export class FileUtils {
// 文件路径分隔符
static readonly SEPARATOR: string = '/';
/**
* 获取目录中的文件名列表
*
* @param path 文件绝对路径
*/
static getFilesInDir(path: string) {
const fileNames = fs.listFileSync(path);
return fileNames;
}
/**
* 获取文件状态
*
* @param path 文件绝对路径
*/
static getFile... | AST#export_declaration#Left export AST#class_declaration#Left class FileUtils AST#class_body#Left { // 文件路径分隔符 AST#property_declaration#Left static readonly SEPARATOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/' AST#expression#Right ;... | export class FileUtils {
static readonly SEPARATOR: string = '/';
static getFilesInDir(path: string) {
const fileNames = fs.listFileSync(path);
return fileNames;
}
static getFileStat(path: string): fs.Stat {
return fs.statSync(path);
}
static deleteFile(path: string): void {
f... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets#L20-L132 | 3e8189b7acaacda814efd00647a129eda7272fa5 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets | arkts | formatDate | 格式化日期
@param dateString ISO格式日期字符串
@returns 格式化后的日期字符串 | formatDate(dateString: string): string {
if (!dateString) return '';
const date = new Date(dateString);
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString... | AST#method_declaration#Left formatDate AST#parameter_list#Left ( AST#parameter#Left dateString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | formatDate(dateString: string): string {
if (!dateString) return '';
const date = new Date(dateString);
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets#L190-L194 | c2389dac8dc81c4d9028d6e65933ca495209e6c1 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | getLongestLabel | Returns the longest formatted label (in terms of characters), this axis
contains.
@return | public getLongestLabel(): string {
let longest: string = "";
let longestLength: number = 0;
for (let i = 0; i < this.mEntries.length; i++) {
let text: string = this.getFormattedLabel(i) || "";
const textLength = Utils.getLabelTextSizeWithoutPaint(text, this.textSizeCache).width;
if (textLe... | AST#method_declaration#Left public getLongestLabel 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 let AST#variable_declarator#Left lo... | public getLongestLabel(): string {
let longest: string = "";
let longestLength: number = 0;
for (let i = 0; i < this.mEntries.length; i++) {
let text: string = this.getFormattedLabel(i) || "";
const textLength = Utils.getLabelTextSizeWithoutPaint(text, this.textSizeCache).width;
if (textLe... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L523-L535 | e0cf77ee11e510a8b95f3da8ab43a9932b85d20d | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/ConfigService.ets | arkts | initialize | 初始化配置服务
@param context - 应用上下文 | async initialize(context: common.UIAbilityContext): Promise<void> {
try {
this.context = context;
// 获取Preferences实例
this.dataPreferences = await preferences.getPreferences(
context,
ConfigService.PREF_NAME
);
console.info('[ConfigService] 配置服务初始化成功');
} catch (er... | AST#method_declaration#Left async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | async initialize(context: common.UIAbilityContext): Promise<void> {
try {
this.context = context;
this.dataPreferences = await preferences.getPreferences(
context,
ConfigService.PREF_NAME
);
console.info('[ConfigService] 配置服务初始化成功');
} catch (error) {
const... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/ConfigService.ets#L56-L72 | 641e7d2fc9020e865503923fec363ddb546c55a0 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloader.ets | arkts | downloadCFileFromCos | MARK: - COS文件下载方法 | private downloadCFileFromCos(fname: string, proccessing: (progress: number) => void, finished: (fileUrl: string | null, metaInfo: CMetaInfo | null, error: string | null) => void): void {
// 生成文件名,将文本转为拼音并转换为.mp3格式
const fileName = StringPyHelper.convertUnicodeForPinyin(fname)
// 缓存文件夹路径
c... | AST#method_declaration#Left private downloadCFileFromCos AST#parameter_list#Left ( AST#parameter#Left fname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left proccessing : AST#type_annotation#Left AST#function_type#Left AST#... | private downloadCFileFromCos(fname: string, proccessing: (progress: number) => void, finished: (fileUrl: string | null, metaInfo: CMetaInfo | null, error: string | null) => void): void {
const fileName = StringPyHelper.convertUnicodeForPinyin(fname)
const context = getConte... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloader.ets#L62-L135 | b84f9fbe74ec613b777773c4cd37cb8ceda29abe | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AssetUtil.ets | arkts | canIUse | 当前设备是否支持该模块
@returns | static canIUse() {
return canIUse("SystemCapability.Security.Asset")
} | AST#method_declaration#Left static canIUse AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( AST#expression#Left "Syste... | static canIUse() {
return canIUse("SystemCapability.Security.Asset")
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AssetUtil.ets#L205-L207 | 57b1daa8fd9078b2c8d728d08b07b758342d59f5 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/ActionParameter.ets | arkts | TODO 参数初始化
author: 桃花镇童长老ᥫ᭡
since: 2025/06/16 | export class ActionParameter {
public static config: DialogConfig = new DialogConfig(); //默认样式
/**
* 初始化BaseDialogOptions参数
* @param options
*/
static initBaseDefault(options: BaseDialogOptions) {
options.uiContext = options.uiContext ?? DialogHelper.getMainUIContext();
options.isModal = optio... | AST#export_declaration#Left export AST#class_declaration#Left class ActionParameter AST#class_body#Left { AST#property_declaration#Left public static config : AST#type_annotation#Left AST#primary_type#Left DialogConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#e... | export class ActionParameter {
public static config: DialogConfig = new DialogConfig();
static initBaseDefault(options: BaseDialogOptions) {
options.uiContext = options.uiContext ?? DialogHelper.getMainUIContext();
options.isModal = options.isModal ?? ActionParameter.config.isModal;
options.show... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L46-L690 | 7f309ab1ae9a87abf540d997c9033f84717c5161 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets | arkts | get | 获取单例实例 | public static get shared(): VersionChecker {
return VersionChecker.instance;
} | AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left VersionChecker AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Lef... | public static get shared(): VersionChecker {
return VersionChecker.instance;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/VersionChecker/VersionChecker.ets#L23-L25 | 8baaa63df2ceecd5614dcbe251dc869ac3435ed3 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | accessStep | Checks whether the web page can go back or forward the given number of steps.
@param { number } step - The number of steps.
@returns { boolean } True if the web page can go back else false.
@throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
<br>2. Incorrect ... | accessStep(step: number): boolean; | AST#method_declaration#Left accessStep AST#parameter_list#Left ( AST#parameter#Left step : 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 boolean AST#primary_type#Right... | accessStep(step: number): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L453-L453 | 7c393dfe44a35fe2b72605c882016a87fa9cd62a | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Native/DrawingToXComponent/entry/src/main/ets/common/CommonConstants.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class CommonConstants {
/**
* Height and width is 100%.
* */
static readonly FULL_PARENT: string = '100%';
/**
* XComponentId is XComponentId.
* */
static readonly X_COMPONENT_ID: string = 'XComponentId';
/**
* XComponentId is XComponentId.
* */
static readonly X_COMPONENT_T... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Height and width is 100%.
* */ AST#property_declaration#Left static readonly FULL_PARENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ... | export default class CommonConstants {
static readonly FULL_PARENT: string = '100%';
static readonly X_COMPONENT_ID: string = 'XComponentId';
static readonly X_COMPONENT_TYPE: string = 'surface';
static readonly X_COMPONENT_LIBRARY_NAME: string = 'entry';
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Native/DrawingToXComponent/entry/src/main/ets/common/CommonConstants.ets#L16-L33 | a2ae3d0247924738179ae83494bcfc5c93f090f7 | gitee | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/constant/CommonConstants.ets | arkts | 星期枚举类 | export enum WeekDays {
DEFAULT_NUMBER_MONDAY = 1,
DEFAULT_NUMBER_TUESDAY = 2,
DEFAULT_NUMBER_WEDNESDAY = 3,
DEFAULT_NUMBER_THURSDAY = 4,
DEFAULT_NUMBER_FRIDAY = 5,
DEFAULT_NUMBER_SATURDAY = 6,
DEFAULT_NUMBER_SUNDAY = 7
} | AST#export_declaration#Left export AST#enum_declaration#Left enum WeekDays AST#enum_body#Left { AST#enum_member#Left DEFAULT_NUMBER_MONDAY = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DEFAULT_NUMBER_TUESDAY = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right ,... | export enum WeekDays {
DEFAULT_NUMBER_MONDAY = 1,
DEFAULT_NUMBER_TUESDAY = 2,
DEFAULT_NUMBER_WEDNESDAY = 3,
DEFAULT_NUMBER_THURSDAY = 4,
DEFAULT_NUMBER_FRIDAY = 5,
DEFAULT_NUMBER_SATURDAY = 6,
DEFAULT_NUMBER_SUNDAY = 7
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/constant/CommonConstants.ets#L144-L152 | f0ebeee145dd5de0882aad510ae988be06b0a81c | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 圆角大小枚举 | export enum BorderRadius {
NONE = 'none',
SMALL = 'small',
MEDIUM = 'medium',
LARGE = 'large',
EXTRA_LARGE = 'extra_large'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum BorderRadius AST#enum_body#Left { AST#enum_member#Left NONE = AST#expression#Left 'none' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SMALL = AST#expression#Left 'small' AST#expression#Right AST#enum_member#Right , AST#enum_member#Le... | export enum BorderRadius {
NONE = 'none',
SMALL = 'small',
MEDIUM = 'medium',
LARGE = 'large',
EXTRA_LARGE = 'extra_large'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L549-L555 | 112304d3f0911b1d823deb0b9cb7996a8869ca84 | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/PreferencesUtils.ets | arkts | getSync | 获取缓存值
@param key
@param defValue
@param preferenceName
@returns | static getSync(key: string, defValue: preferences.ValueType, preferenceName: string = defaultPreferenceName) {
let preferences = PreferencesUtils.getPreferencesSync(preferenceName) //获取实例
return preferences.getSync(key, defValue)
} | AST#method_declaration#Left static getSync AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defValue : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ... | static getSync(key: string, defValue: preferences.ValueType, preferenceName: string = defaultPreferenceName) {
let preferences = PreferencesUtils.getPreferencesSync(preferenceName)
return preferences.getSync(key, defValue)
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PreferencesUtils.ets#L77-L80 | 7ceb8510e63d719737c91c93e12f816ab2a6318a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageFileIO/entry/src/main/ets/pages/ResumeDownload.ets | arkts | resourceToString | downloadUtil.ets 见下文 | function resourceToString(resource: Resource) {
return getContext().resourceManager.getStringSync(resource);
} | AST#function_declaration#Left function resourceToString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return... | function resourceToString(resource: Resource) {
return getContext().resourceManager.getStringSync(resource);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageFileIO/entry/src/main/ets/pages/ResumeDownload.ets#L21-L23 | eb9d4cf437f4068ccd37081caad916ee932eb85a | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets | arkts | initCanvas | *
初始化 canvas 数据 | initCanvas() {
this.circleInfo = new ConcaveCircle(this.context, this.tabsMenu.length);
// 图片宽度比凹槽小取圆直径的 70%
let ratio = 0.7;
this.imageWH = this.circleInfo.circleDiameter * ratio;
this.createAnimation()
} | AST#method_declaration#Left initCanvas AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . circleInfo AST#member_expr... | initCanvas() {
this.circleInfo = new ConcaveCircle(this.context, this.tabsMenu.length);
let ratio = 0.7;
this.imageWH = this.circleInfo.circleDiameter * ratio;
this.createAnimation()
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets#L129-L135 | 6d68a70a747737ccb696499dc355c70d2db09b1d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/ContactTypes.ets | arkts | 联系人更新参数接口 | export interface UpdateContactParams extends Partial<CreateContactParams> {
id: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UpdateContactParams AST#extends_clause#Left extends AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CreateContactParams AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments... | export interface UpdateContactParams extends Partial<CreateContactParams> {
id: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/ContactTypes.ets#L149-L151 | 63af2de7323e94f8c2d4b45a0d41293f89ad6980 | github | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelUpdate.ets | arkts | 应用约束60:使用ES模块导出代替module.exports | export default ChannelUpdateHandler; | AST#export_declaration#Left export default AST#expression#Left ChannelUpdateHandler AST#expression#Right ; AST#export_declaration#Right | export default ChannelUpdateHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelUpdate.ets#L18-L18 | 3b623e9ba9b70fd777db4d882a1679d7c6dfcb3c | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CrashUtil.ets | arkts | isHandled | 判断错误观测器是否存在
@returns | static isHandled(): boolean {
return CrashUtil.observerId !== undefined;
} | AST#method_declaration#Left static isHandled 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#binary_expres... | static isHandled(): boolean {
return CrashUtil.observerId !== undefined;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L91-L93 | ba8267d82a8b3afc6cecba1174107531fce6b899 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ReviewUtils.ets | arkts | openInWebBrowser | 通过系统浏览器打开华为应用市场的Web页面
@param packageName 目标应用的包名 | static openInWebBrowser(context: common.UIAbilityContext, packageName: string): void {
const webUrl = `https://appgallery.huawei.com/app/detail?id=${packageName}`;
const want: Want = {
action: 'ohos.want.action.viewData',
uri: webUrl
};
context.startAbility(want)
.then(() => {
... | AST#method_declaration#Left static openInWebBrowser AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p... | static openInWebBrowser(context: common.UIAbilityContext, packageName: string): void {
const webUrl = `https://appgallery.huawei.com/app/detail?id=${packageName}`;
const want: Want = {
action: 'ohos.want.action.viewData',
uri: webUrl
};
context.startAbility(want)
.then(() => {
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ReviewUtils.ets#L115-L134 | 8af0252c2581a53e12ccefe90e9c87703d4f0e87 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/toggle/toggleWithDialog.ets | arkts | ToggleWithDialogBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function ToggleWithDialogBuilder(name: string, param: Object) {
toggleWithDialog()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToggleWithDialogBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le... | @Builder
export function ToggleWithDialogBuilder(name: string, param: Object) {
toggleWithDialog()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/toggle/toggleWithDialog.ets#L17-L20 | 9042e74604ac4d855c0f1548eaca0e5ac97556a7 | gitee |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/NotificationManager.ets | arkts | cancelAllNotifications | 取消所有通知 | async cancelAllNotifications(): Promise<void> {
try {
await reminderAgentManager.cancelAllReminders()
console.info('All system reminders cancelled')
} catch (err) {
const error = err as BusinessError
console.error('Failed to cancel all reminders:', error.message)
}
} | AST#method_declaration#Left async cancelAllNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | async cancelAllNotifications(): Promise<void> {
try {
await reminderAgentManager.cancelAllReminders()
console.info('All system reminders cancelled')
} catch (err) {
const error = err as BusinessError
console.error('Failed to cancel all reminders:', error.message)
}
} | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/NotificationManager.ets#L169-L177 | 7d0f5a9a67b8027b1a047e0a0db0a866b1e81d63 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/DFX/Debug/entry/src/main/ets/component/DebugInfo.ets | arkts | DebugInfo | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | @Component
export default struct DebugInfo {
@Prop debugWindow: boolean
@Link vssMemory: number
@Link pssMemory: number
@Link sharedMemory: number
@Link privateMemory: number
build() {
Stack({ alignContent: Alignment.Top }) {
Text($r('app.string.navigation_information'))
.fontSize(22)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct DebugInfo AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right debugWindow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#t... | @Component
export default struct DebugInfo {
@Prop debugWindow: boolean
@Link vssMemory: number
@Link pssMemory: number
@Link sharedMemory: number
@Link privateMemory: number
build() {
Stack({ alignContent: Alignment.Top }) {
Text($r('app.string.navigation_information'))
.fontSize(22)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/DFX/Debug/entry/src/main/ets/component/DebugInfo.ets#L16-L71 | bfcdda826e8407bb11bbb516e3907e1c2f51a3b9 | gitee |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Lists.ets | arkts | bodyBuilder | 内容展示(自定义builder渲染) | @Builder bodyBuilder() {
Column(){
// 纵向,单列
Text('纵向,单列')
.fontSize(14)
.margin({ top:20, bottom: 12})
// space间隔,initialIndex初始索引值
List({ space: 10, initialIndex: 0}){
ForEach(this.numberData, (item: number) => {
ListItem() {
Text(item.toString(... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 纵向,单列 AST#arkt... | @Builder bodyBuilder() {
Column(){
Text('纵向,单列')
.fontSize(14)
.margin({ top:20, bottom: 12})
List({ space: 10, initialIndex: 0}){
ForEach(this.numberData, (item: number) => {
ListItem() {
Text(item.toString())
.fontSize(14)
... | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Lists.ets#L46-L166 | c5568e0f34456f933a854ef609a9d8ce62c5f614 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | hasApiKey | ==================== API配置相关方法 ====================
检查是否已配置API密钥 | async hasApiKey(): Promise<boolean> {
return await this.configService.hasApiKey();
} | AST#method_declaration#Left async hasApiKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | async hasApiKey(): Promise<boolean> {
return await this.configService.hasApiKey();
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L685-L687 | 0ddde301ff5009bb825c8e9d30fd2ab9284bc993 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/ECDSA.ets | arkts | signSegment | 对数据进行分段签名,异步
@param data 待签名数据
@param priKey 私钥
@param algName 指定签名算法(ECC256|SHA256、ECC256|SHA512、ECC384|SHA256、等)。
@param len 自定义的数据拆分长度,此处取64
@returns | static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName = 'ECC256|SHA256',
len: number = 64): Promise<cryptoFramework.DataBlob> {
return await CryptoUtil.signSegment(data, priKey, algName, len);
} | AST#method_declaration#Left static async signSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualifi... | static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName = 'ECC256|SHA256',
len: number = 64): Promise<cryptoFramework.DataBlob> {
return await CryptoUtil.signSegment(data, priKey, algName, len);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/ECDSA.ets#L88-L91 | b069ecf82ad8360f6dea1ad4812551fd73680d61 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | get | ==================== 纪念日相关操作 ====================
获取纪念日DAO | get commemorations(): CommemorationDAO {
this.checkInitialization();
return this.commemorationDAO;
} | AST#method_declaration#Left get AST#ERROR#Left commemorations AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CommemorationDAO AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Lef... | get commemorations(): CommemorationDAO {
this.checkInitialization();
return this.commemorationDAO;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L158-L161 | a89bd7301120754b26ce47398cc660a77a22c325 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Custom transition translate. | export const CUSTOM_TRANSITION_TRANSLATE: CustomTransition = { x: 500, y: 500 }; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CUSTOM_TRANSITION_TRANSLATE : AST#type_annotation#Left AST#primary_type#Left CustomTransition AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left ... | export const CUSTOM_TRANSITION_TRANSLATE: CustomTransition = { x: 500, y: 500 }; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L90-L90 | 0c27b31e79f164d1d55da0577ea499f40996ebae | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clickanimation/src/main/ets/views/ClickAnimationSamplePage.ets | arkts | videoBackgroundSlotParam | 背景视频插槽 | @Builder
videoBackgroundSlotParam() {
Video({
src: $r('app.media.click_animation_test_video'),
previewUri: $r('app.media.click_animation_cover'),
controller: this.controller
})
.height($r('app.string.click_animation_full_size'))
.width($r('app.string.click_animation_full_size'))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right videoBackgroundSlotParam 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 Video ( AST#component_parameters#Left { AST#compo... | @Builder
videoBackgroundSlotParam() {
Video({
src: $r('app.media.click_animation_test_video'),
previewUri: $r('app.media.click_animation_cover'),
controller: this.controller
})
.height($r('app.string.click_animation_full_size'))
.width($r('app.string.click_animation_full_size'))
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/views/ClickAnimationSamplePage.ets#L76-L98 | 742ea81b2e54bf82fe6d893e27f24263945f4224 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/MultiDeviceAppDev/AppMarket/entry/src/main/ets/common/IndexSwiper.ets | arkts | IndexSwiper | 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... | @Component
export default struct IndexSwiper {
@StorageProp('currentBreakpoint') currentBreakpoint: string = 'md'
@Builder swiperItem(imageSrc) {
Image(imageSrc)
.width('100%')
.aspectRatio(2.5)
.objectFit(ImageFit.Fill)
}
build() {
Swiper() {
this.swiperItem($r('app.media.ic_p... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct IndexSwiper AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'currentBreakpoint' AST#expression#Right ) AST#decorator#Right currentBreakpoint : AST... | @Component
export default struct IndexSwiper {
@StorageProp('currentBreakpoint') currentBreakpoint: string = 'md'
@Builder swiperItem(imageSrc) {
Image(imageSrc)
.width('100%')
.aspectRatio(2.5)
.objectFit(ImageFit.Fill)
}
build() {
Swiper() {
this.swiperItem($r('app.media.ic_p... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/MultiDeviceAppDev/AppMarket/entry/src/main/ets/common/IndexSwiper.ets#L16-L43 | 215590ce02bdb208a1368945d87ad49da278fef9 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/notification/NotificationUtil.ets | arkts | 获取可拉起本应用的Want
@returns {Promise<WantAgent>} 返回WantAgent对象 | export async function getSelfWantAgent(): Promise<WantAgent> {
const context = ContextUtil.getUIAbilityCtx();
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
deviceId: '',
bundleName: context.abilityInfo.bundleName,
moduleName: context.abilit... | AST#export_declaration#Left export AST#function_declaration#Left async function getSelfWantAgent 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 WantAgent AST#prim... | export async function getSelfWantAgent(): Promise<WantAgent> {
const context = ContextUtil.getUIAbilityCtx();
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
deviceId: '',
bundleName: context.abilityInfo.bundleName,
moduleName: context.abilit... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L440-L459 | c2aaad556012c8b52acba784e97f52439a87691c | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets | arkts | resetOffsetXY | Reset offset to the input value.
@param offsetX
@param offsetY | public resetOffsetXY(offsetX: number, offsetY: number) {
if (this.xLocationType === XLocationEnum.XLeft) {
this.offsetXLeft = this.offsetXRight - offsetX < CommonConstant.OFFSET_RANGE * 2 ?
this.offsetXLeft : offsetX;
}
if (this.xLocationType === XLocationEnum.XRight) {
this.offsetXRight... | AST#method_declaration#Left public resetOffsetXY AST#parameter_list#Left ( AST#parameter#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offsetY : AST#type_annotation#Left AST#primary_type#Left number AST#prim... | public resetOffsetXY(offsetX: number, offsetY: number) {
if (this.xLocationType === XLocationEnum.XLeft) {
this.offsetXLeft = this.offsetXRight - offsetX < CommonConstant.OFFSET_RANGE * 2 ?
this.offsetXLeft : offsetX;
}
if (this.xLocationType === XLocationEnum.XRight) {
this.offsetXRight... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets#L111-L131 | 15bf00cb52b6efc1df5f6125431829f0eeaaf99d | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.advertising.AutoAdComponent.d.ets | arkts | The method to build auto ad component.
@syscap SystemCapability.Advertising.Ads
@since 11
The method to build auto ad component.
@syscap SystemCapability.Advertising.Ads
@atomicservice
@since 12 | build(): void;
}
export { AutoAdComponent } | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ; } export AST#ERROR#Right AST#build_body#Left { AST#expression_statement#Left AST#expression#Left AutoAdComponent AST#expression#Right AST#expression_statement#Right } A... | build(): void;
}
export { AutoAdComponent } | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.advertising.AutoAdComponent.d.ets#L107-L110 | cde1f0b737dd0d7fff43382735f0586a15dfe9c2 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets | arkts | toEntity | 将领域模型转换为数据库实体
@param {Footprint} footprint 足迹领域模型
@returns {FootprintEntity} 数据库实体 | private toEntity(footprint: Footprint): FootprintEntity {
const entity: FootprintEntity = new FootprintEntity();
entity.goodsId = footprint.goodsId;
entity.goodsName = footprint.goodsName;
entity.goodsSubTitle = footprint.goodsSubTitle ?? null;
entity.goodsMainPic = footprint.goodsMainPic;
entit... | AST#method_declaration#Left private toEntity AST#parameter_list#Left ( AST#parameter#Left footprint : AST#type_annotation#Left AST#primary_type#Left Footprint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FootprintEntity ... | private toEntity(footprint: Footprint): FootprintEntity {
const entity: FootprintEntity = new FootprintEntity();
entity.goodsId = footprint.goodsId;
entity.goodsName = footprint.goodsName;
entity.goodsSubTitle = footprint.goodsSubTitle ?? null;
entity.goodsMainPic = footprint.goodsMainPic;
entit... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L110-L120 | 24855db72e823454ac1d5abd718c525cb466ca6c | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page1.ets | arkts | pageTransition | 自定义方式1:完全自定义转场过程的效果 | pageTransition() {
PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => {
this.scale2 = 1
this.opacity2 = progress
}) // 进场过程中会逐帧触发onEnter回调,入参为动效的归一化进度(0% -- 100%)
PageTransitionExit({ duration: 1500, curve: Curve.Ease })
... | AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression... | pageTransition() {
PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => {
this.scale2 = 1
this.opacity2 = progress
})
PageTransitionExit({ duration: 1500, curve: Curve.Ease })
.onExit((type: RouteType, progress: number) =... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page1.ets#L31-L42 | 0a3b127d235f7923b3f82565b9b065f7f27da382 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WaterFlowSample/entry/src/main/ets/pages/CustomItemHeightPage.ets | arkts | CustomItemHeightPage | [EndExclude quick_start] | @Entry
@Component
export struct CustomItemHeightPage {
// [StartExclude quick_start]
@State minSize: number = 120;
@State maxSize: number = 260;
scroller: Scroller = new Scroller();
dataSource: SectionsWaterFlowDataSource = new SectionsWaterFlowDataSource();
private itemHeightArray: number[] = [];
// [End... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct CustomItemHeightPage AST#component_body#Left { // [StartExclude quick_start] AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right minSize : AST#ty... | @Entry
@Component
export struct CustomItemHeightPage {
@State minSize: number = 120;
@State maxSize: number = 260;
scroller: Scroller = new Scroller();
dataSource: SectionsWaterFlowDataSource = new SectionsWaterFlowDataSource();
private itemHeightArray: number[] = [];
@State sections: WaterFlowSect... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/CustomItemHeightPage.ets#L81-L137 | 10f60dc4112912fd661881974b81f69557b9ba86 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets | arkts | listen | TODO 知识点:订阅输入法代插入、向左删除事件,从而获得键盘输入内容 | listen() {
if (this.isListen) {
return;
}
this.inputController.on('insertText', (text: string) => {
if (this.codeText.length >= this.verifyCodeLength || isNaN(Number(text)) || text === ' ') {
return;
}
this.codeText += text;
if (this.codeText.length === this.verifyCodeL... | AST#method_declaration#Left listen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isListen AST#member_expression#Right AST#expression#Right ) AST#... | listen() {
if (this.isListen) {
return;
}
this.inputController.on('insertText', (text: string) => {
if (this.codeText.length >= this.verifyCodeLength || isNaN(Number(text)) || text === ' ') {
return;
}
this.codeText += text;
if (this.codeText.length === this.verifyCodeL... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets#L118-L139 | da0078618a5a68f48df938245de847ae36a566bf | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets | arkts | getTitleOpacityOptions | 获取子标题显隐参数
@returns {number} 子标题显隐系数 | getTitleOpacityOptions(): number {
return (this.heightValue - this.animationAttribute.normalTitleHeight) /
(this.animationAttribute.expandTitleHeight - this.animationAttribute.normalTitleHeight)
} | AST#method_declaration#Left getTitleOpacityOptions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_e... | getTitleOpacityOptions(): number {
return (this.heightValue - this.animationAttribute.normalTitleHeight) /
(this.animationAttribute.expandTitleHeight - this.animationAttribute.normalTitleHeight)
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets#L226-L229 | 1221169a1d0802763898ee563e9c1ba0f2a94de9 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringCrypto.ets | arkts | sha256 | 计算字符串的 SHA256 哈希值
@param input 输入字符串
@returns 十六进制格式的哈希值 | static async sha256(input: string): Promise<string> {
return StringCrypto._computeHash(input, 'SHA256');
} | AST#method_declaration#Left static async sha256 AST#parameter_list#Left ( AST#parameter#Left input : 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... | static async sha256(input: string): Promise<string> {
return StringCrypto._computeHash(input, 'SHA256');
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringCrypto.ets#L27-L29 | 37042eda682a3418b90977846f339429acc6f3a2 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/InteractiveGameService.ets | arkts | getGameStatistics | 获取游戏统计数据 | getGameStatistics(): GameStatistics | null {
return this.gameStatistics;
} | AST#method_declaration#Left getGameStatistics AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left GameStatistics AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_state... | getGameStatistics(): GameStatistics | null {
return this.gameStatistics;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L448-L450 | 56061b7ae50faa20d8f2d8508fe63ef471a12acd | github |
anhao0226/harmony-music-player.git | 4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073 | entry/src/main/ets/common/utils/TimeUtil.ets | arkts | @param duration
@returns | export function formatDuration(duration: number): string {
let minute: number = Math.floor(duration / 60);
let seconds = Math.floor(duration % 60);
return `${new String(minute).padStart(2, '0')}:${new String(seconds).padStart(2, '0')}`;
} | AST#export_declaration#Left export AST#function_declaration#Left function formatDuration AST#parameter_list#Left ( AST#parameter#Left duration : 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#Lef... | export function formatDuration(duration: number): string {
let minute: number = Math.floor(duration / 60);
let seconds = Math.floor(duration % 60);
return `${new String(minute).padStart(2, '0')}:${new String(seconds).padStart(2, '0')}`;
} | https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/common/utils/TimeUtil.ets#L6-L10 | 270c9ca24a427a66b986fbb7ba2feb0347843956 | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/MD5.ets | arkts | digestSegment | MD5摘要,分段,同步
@param data 待摘要的数据
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
@param len 自定义的数据拆分长度
@returns | static async digestSegment(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
return CryptoUtil.digestSegment(data, 'MD5', resultCoding, len);
} | AST#method_declaration#Left static async digestSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qua... | static async digestSegment(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
return CryptoUtil.digestSegment(data, 'MD5', resultCoding, len);
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/MD5.ets#L59-L61 | 46a0c2143f7fdfa306d672977486be94789e7f11 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | getFilePath | 通过URI或路径,获取文件路径
@param uriOrPath URI或路径
@returns | static getFilePath(uriOrPath: string): string {
return Helper.getFileUri(uriOrPath).path;
} | AST#method_declaration#Left static getFilePath AST#parameter_list#Left ( AST#parameter#Left uriOrPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static getFilePath(uriOrPath: string): string {
return Helper.getFileUri(uriOrPath).path;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L268-L270 | 6554b617064441e5c6a2175d40fcb6f0ea56fe8a | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/PureTabsExt/entry/src/main/ets/view/InTabComponent.ets | arkts | [EndExclude tabs_bar_translate] | build() {
// [Start tabs_fading_edge]
Tabs({controller: this.subController}){
// [StartExclude tabs_fading_edge]
// [StartExclude tabs_bar_translate]
ForEach(this.tabItems, (item: string, index: number) => {
TabContent(){
List({ space: 10 }) {
ForEach(this.content... | AST#build_method#Left build ( ) AST#build_body#Left { // [Start tabs_fading_edge] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Tabs ( AST#component_parameters#Left { AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AS... | build() {
Tabs({controller: this.subController}){
ForEach(this.tabItems, (item: string, index: number) => {
TabContent(){
List({ space: 10 }) {
ForEach(this.contents, (item: number, index: number) => {
this.contentBuilder()
})
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/view/InTabComponent.ets#L116-L140 | 18cbabd0d593fa4e278bec1b3c74d3b8ac61ab1a | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/Socket/entry/src/main/ets/model/ChatBox.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 class ChatBox {
isSend: boolean
message: string
date: string
constructor | AST#export_declaration#Left export AST#ERROR#Left class ChatBox { isSend : AST#ERROR#Left boolean message : string date : AST#ERROR#Right string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Ri... | export class ChatBox {
isSend: boolean
message: string
date: string
constructor | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/Socket/entry/src/main/ets/model/ChatBox.ets#L16-L21 | 60c3f6dc6af43cf5357abefe484e36b91647dce5 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogBuilder.ets | arkts | TipsDialogBuilder | TipsDialog | @Builder
export function TipsDialogBuilder(options: DialogOptions) {
TipsDialog(options)
.height(options.height)
.width(options.width)
.constraintSize({ maxWidth: options.maxWidth, maxHeight: options.maxHeight })
.backgroundColor(options.backgroundColor)
.backgroundBlurStyle(options.backgroundBlur... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TipsDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramete... | @Builder
export function TipsDialogBuilder(options: DialogOptions) {
TipsDialog(options)
.height(options.height)
.width(options.width)
.constraintSize({ maxWidth: options.maxWidth, maxHeight: options.maxHeight })
.backgroundColor(options.backgroundColor)
.backgroundBlurStyle(options.backgroundBlur... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L79-L92 | bba0c810c75fb9980cf93c7e27726e580effbd5d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/ContactDAO.ets | arkts | insertContact | 插入新联系人
@param contact 联系人实体
@returns 插入的记录ID | async insertContact(contact: ContactEntity): Promise<number> {
const rdbStore = this.dbManager.getRdbStore();
if (!rdbStore) {
throw new Error('Database not initialized');
}
try {
const currentTime = new Date().toISOString();
const valueBucket: relationalStore.ValuesBucket = {
... | AST#method_declaration#Left async insertContact AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left ContactEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic... | async insertContact(contact: ContactEntity): Promise<number> {
const rdbStore = this.dbManager.getRdbStore();
if (!rdbStore) {
throw new Error('Database not initialized');
}
try {
const currentTime = new Date().toISOString();
const valueBucket: relationalStore.ValuesBucket = {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/ContactDAO.ets#L21-L57 | 48ed320caca34decd22eb5499558001e1afa27de | github |
openharmony/notification_common_event_service | 5ee1b4f273fe5bab5c2c14b85b7efbd76ece9558 | interfaces/kits/ani/common_event/ets/commonEvent/commonEventPublishData.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface CommonEventPublishData {
bundleName?: string;
code?: number;
data?: string;
subscriberPermissions?: Array<string>;
isOrdered?: boolean;
isSticky?: boolean;
parameters?: Record<string, Object>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CommonEventPublishData AST#object_type#Left { AST#type_member#Left bundleName ? : 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 code ? : AST#t... | export interface CommonEventPublishData {
bundleName?: string;
code?: number;
data?: string;
subscriberPermissions?: Array<string>;
isOrdered?: boolean;
isSticky?: boolean;
parameters?: Record<string, Object>;
} | https://github.com/openharmony/notification_common_event_service/blob/5ee1b4f273fe5bab5c2c14b85b7efbd76ece9558/interfaces/kits/ani/common_event/ets/commonEvent/commonEventPublishData.ets#L16-L24 | ca8b9575444be0e4c52a91a478a2f0081c0d34e3 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets | arkts | buildThemeTypeSection | 构建主题类型选择 | @Builder
buildThemeTypeSection() {
Card() {
Column({ space: UIConstants.DEFAULT_PADDING }) {
Row() {
Text('主题风格')
.fontSize(UIConstants.FONT_SIZE_HEADING)
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.text_primary'))
.layoutWeight(1... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildThemeTypeSection 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 Card ( ) AST#container_content_body#Left { AST#arkts... | @Builder
buildThemeTypeSection() {
Card() {
Column({ space: UIConstants.DEFAULT_PADDING }) {
Row() {
Text('主题风格')
.fontSize(UIConstants.FONT_SIZE_HEADING)
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.text_primary'))
.layoutWeight(1... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L385-L446 | f440db6056e029ca90567cea936191e48b0df58e | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/CommonModifier.d.ets | arkts | @file
@kit ArkUI
Defines Common Modifier
@extends CommonAttribute
@implements AttributeModifier
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare class CommonModifier {
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class CommonModifier AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right | export declare class CommonModifier {
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/CommonModifier.d.ets#L31-L34 | a59a703d4aee7d95a06fcc814c7752e0f98cc896 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Connectivity/Wlan/entry/src/main/ets/pages/Index.ets | arkts | addListener | 监听wifi的变化 | addListener() {
// 连接状态改变时,修改连接信息
wifi.on('wifiConnectionChange', async state => {
Logger.log(TAG, `wifiConnectionChange: ${state}`);
await this.getLinkedInfo();
})
// wifi状态改变时,先清空wifi列表,然后判断是否是开启状态,如果是就扫描
wifi.on('wifiStateChange', state => {
Logger.log(TAG, `wifiStateLisener sta... | AST#method_declaration#Left addListener 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 wifi AST#expression#Right . on AST... | addListener() {
wifi.on('wifiConnectionChange', async state => {
Logger.log(TAG, `wifiConnectionChange: ${state}`);
await this.getLinkedInfo();
})
wifi.on('wifiStateChange', state => {
Logger.log(TAG, `wifiStateLisener state: ${state}`);
AppStorage.SetOrCreate('wifiList', [... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Connectivity/Wlan/entry/src/main/ets/pages/Index.ets#L63-L77 | e58fd34d3c48e2eeec647765d97f929715dbc4de | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/src/main/ets/repository/AccountStoreRepository.ets | arkts | savePassword | 保存密码
@param {string} password 用户密码
@returns {Promise<void>} Promise<void> | savePassword(password: string): Promise<void> {
return this.dataSource.setPassword(password);
} | AST#method_declaration#Left savePassword AST#parameter_list#Left ( AST#parameter#Left password : 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... | savePassword(password: string): Promise<void> {
return this.dataSource.setPassword(password);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/AccountStoreRepository.ets#L45-L47 | ea2dd2a2b371bedf78b630905be50ab96a039ed1 | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | API 配置常量
API Configuration Constants
Source: 前后端联调配置 | export default class ApiConstants {
/**
* 后端服务基础地址
* 注意:真机调试时需要替换为电脑的局域网 IP
* For real device testing, replace with your computer's LAN IP
*/
static readonly BASE_URL: string = 'http://10.0.2.2:8080'; // 模拟器专用地址
/**
* 登录接口
*/
static readonly LOGIN_URL: string = '/api/auth/login';
/**
*... | AST#export_declaration#Left export default AST#class_declaration#Left class ApiConstants AST#class_body#Left { /**
* 后端服务基础地址
* 注意:真机调试时需要替换为电脑的局域网 IP
* For real device testing, replace with your computer's LAN IP
*/ AST#property_declaration#Left static readonly BASE_URL : AST#type_annotation#Left AST#prima... | export default class ApiConstants {
static readonly BASE_URL: string = 'http://10.0.2.2:8080';
static readonly LOGIN_URL: string = '/api/auth/login';
static readonly REGISTER_URL: string = '/api/auth/register';
static readonly USER_INFO_URL: string = '/api/user/info';
static readonly RESE... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/constants/ApiConstants.ets#L21-L68 | 45ae4492d6fa5703194558db8cbc801ab1f7c74f | github | |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/components/SwipeCardStack.ets | arkts | buildCard | 构建单个卡片 | @Builder
private buildCard(data: object, dataIndex: number, stackIndex: number): void {
Stack() {
if (this.cardBuilder) {
this.cardBuilder(data, dataIndex);
}
}
.width(this.componentWidth * LayoutConstants.DEFAULT_CARD_WIDTH_RATIO)
.height(this.componentHeight * LayoutConstants.DEF... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildCard AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataIndex : AST#type_annotati... | @Builder
private buildCard(data: object, dataIndex: number, stackIndex: number): void {
Stack() {
if (this.cardBuilder) {
this.cardBuilder(data, dataIndex);
}
}
.width(this.componentWidth * LayoutConstants.DEFAULT_CARD_WIDTH_RATIO)
.height(this.componentHeight * LayoutConstants.DEF... | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L123-L208 | e694c3cb6a5cb5adc76835bcf6d0be27424f7fee | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | initAVPlayer | 初始化AVPlayer
@param timeUpdateCb AVPlayer timeUpdate 事件回调
@param stateUpdateCb AVPlayer stateChange 事件回调
@param completeCb AVPlayer 单曲complete状态 事件回调
@returns {Promise<void>} | async initAVPlayer(timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): Promise<void> {
if (this.avPlayer) {
return;
}
// 创建AVPlayer实例对象
let avPlayer: media.AVPlayer = await media.createAVPlayer();
if (!avPlayer) {
logger.error('avPlayer init failed.');
return;
... | AST#method_declaration#Left async initAVPlayer AST#parameter_list#Left ( AST#parameter#Left timeUpdateCb : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stateUpdateCb : AST#type_annotation#Left AST#primary_type#Left Func... | async initAVPlayer(timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): Promise<void> {
if (this.avPlayer) {
return;
}
let avPlayer: media.AVPlayer = await media.createAVPlayer();
if (!avPlayer) {
logger.error('avPlayer init failed.');
return;
}
th... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets#L35-L50 | 8ddab5a009790c0daf545419610344e43eb3ca1b | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ShareUtils.ets | arkts | shareText | 分享文本
@param text - 文本内容
@param summary - 描述(可选) | static shareText(text: string, summary?: string): void {
const data = new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: text
});
if (summary) {
data.addRecord({
utd: utd.UniformDataType.PLAIN_TEXT,
content: summary
});
}
ShareUtils.s... | AST#method_declaration#Left static shareText 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 summary ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | static shareText(text: string, summary?: string): void {
const data = new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: text
});
if (summary) {
data.addRecord({
utd: utd.UniformDataType.PLAIN_TEXT,
content: summary
});
}
ShareUtils.s... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L133-L147 | d1e0959df4eacb78c739f5571db577eb7d7aa5aa | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets | arkts | drawFlower | Painted outer disc petal. | drawFlower() {
let beginAngle = this.startAngle + this.avgAngle;
const pointY = this.screenWidth * CommonConstants.FLOWER_POINT_Y_RATIOS;
const radius = this.screenWidth * CommonConstants.FLOWER_RADIUS_RATIOS;
const innerRadius = this.screenWidth * CommonConstants.FLOWER_INNER_RATIOS;
for (let i = 0... | AST#method_declaration#Left drawFlower AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left beginAngle = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expressi... | drawFlower() {
let beginAngle = this.startAngle + this.avgAngle;
const pointY = this.screenWidth * CommonConstants.FLOWER_POINT_Y_RATIOS;
const radius = this.screenWidth * CommonConstants.FLOWER_RADIUS_RATIOS;
const innerRadius = this.screenWidth * CommonConstants.FLOWER_INNER_RATIOS;
for (let i = 0... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets#L90-L106 | 16d3ccd5d1b6bd3c3a37fb1e08445e0ce293f962 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/EncryptUtils.ets | arkts | generateUUID | 生成UUID | static generateUUID(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
} | AST#method_declaration#Left static generateUUID 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#return_statement#Left return AST#expression#Left AST#call_expres... | static generateUUID(): string {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/EncryptUtils.ets#L69-L75 | 676b74d016b59e7d50b7604d9279c56cf16b2b79 | github |
ccccjiemo/egl.git | d18849c3da975ccf9373fd09874aa5637ccbe6bd | Index.d.ets | arkts | query | eglQuerySurface
@param attribute egl.EGLConfigAttribute | query(dpy: EGLDisplay, attribute: EGLConfigAttribute | number): number | undefined; | AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left dpy : AST#type_annotation#Left AST#primary_type#Left EGLDisplay AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attribute : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left EGLConfi... | query(dpy: EGLDisplay, attribute: EGLConfigAttribute | number): number | undefined; | https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L62-L62 | b4baa9dda887efa660fe28592f5e72274b618641 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/chat/AIAssistantPage.ets | arkts | buildMessageItem | 构建消息项 | @Builder
buildMessageItem(message: ChatMessage, index: number) {
Row() {
if (message.sender === MessageSender.USER) {
// 用户消息 - 右对齐
Blank().layoutWeight(1)
this.buildUserMessage(message)
} else {
// AI消息 - 左对齐
this.buildAssistantMessage(message)
Blank().... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMessageItem AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ChatMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annot... | @Builder
buildMessageItem(message: ChatMessage, index: number) {
Row() {
if (message.sender === MessageSender.USER) {
Blank().layoutWeight(1)
this.buildUserMessage(message)
} else {
this.buildAssistantMessage(message)
Blank().layoutWeight(1)
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L172-L187 | f645aeaa9ff618c59ff8a326aa32f4b1105e4e52 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/AttributeUpdater.d.ets | arkts | get | Get attribute of the modifier.
@returns { T | undefined } The attribute of the modifier.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | get attribute(): T | undefined; | AST#method_declaration#Left get AST#ERROR#Left attribute AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Ri... | get attribute(): T | undefined; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/AttributeUpdater.d.ets#L81-L81 | be2f7681d001a6a0dd09b21f75bf127f1e2de921 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.FoldSplitContainer.d.ets | arkts | The layout options for the container when the foldable screen is expanded.
@interface ExpandedRegionLayoutOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export interface ExpandedRegionLayoutOptions {
/**
* The ratio of the widths of two areas in the horizontal direction.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
horizontalSplitRatio?: number;
/**
* The ratio of t... | AST#export_declaration#Left export AST#interface_declaration#Left interface ExpandedRegionLayoutOptions AST#object_type#Left { /**
* The ratio of the widths of two areas in the horizontal direction.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since... | export interface ExpandedRegionLayoutOptions {
horizontalSplitRatio?: number;
verticalSplitRatio?: number;
isExtraRegionPerpendicular?: boolean;
extraRegionPosition?: ExtraRegionPosition;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FoldSplitContainer.d.ets#L60-L97 | e1cf198735bc50f113b1a1c8c21f65baa5ed55d0 | gitee | |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/data/Repository.ets | arkts | getEpisodes | 获取剧集分集列表
@param seriesId
@param seasonId
@returns | public getEpisodes(seriesId: string, seasonId: string): Promise<Array<FinItem>> {
return this.requireApi().getEpisodes(seriesId, seasonId)
} | AST#method_declaration#Left public getEpisodes AST#parameter_list#Left ( AST#parameter#Left seriesId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seasonId : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | public getEpisodes(seriesId: string, seasonId: string): Promise<Array<FinItem>> {
return this.requireApi().getEpisodes(seriesId, seasonId)
} | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L116-L118 | 39fa9d915b1d67c1ab0f8717817c67234b54b373 | github |
SeaEpoch/SepWeather.git | e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c | entry/src/main/ets/common/utils/Logger.ets | arkts | constructor.
@param Prefix Identifies the log tag.
@param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. | constructor(prefix: string = '[debug] ', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '[debug] ' AST#expression#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_annot... | constructor(prefix: string = '[debug] ', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | https://github.com/SeaEpoch/SepWeather.git/blob/e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c/entry/src/main/ets/common/utils/Logger.ets#L14-L17 | 4f46f3f74e6d80250b18f4872732b4ecd5964397 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | 一级列表可视区域的起始索引和终点索引。
@interface
@property {number} start - 可视区域起点索引。
@property {number} end - 可视区域终点索引。 | export interface ListIndexPosition {
start: number,
end: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ListIndexPosition AST#object_type#Left { AST#type_member#Left start : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left end : AST#type_annotation#... | export interface ListIndexPosition {
start: number,
end: number
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L49-L52 | 7478b98e19c0a431245a154cf0e0aa08d32399fe | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.