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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/greeting/GreetingService.ets | arkts | createGreeting | 创建祝福语
@param params 创建参数
@returns 创建的祝福语 | async createGreeting(params: CreateGreetingParams): Promise<Greeting> {
try {
// 验证数据
const validationResult = this.validateGreetingParams(params);
if (!validationResult.isValid) {
throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`);
}
// 检查祝福语数量限制
const tot... | AST#method_declaration#Left async createGreeting AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateGreetingParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#... | async createGreeting(params: CreateGreetingParams): Promise<Greeting> {
try {
const validationResult = this.validateGreetingParams(params);
if (!validationResult.isValid) {
throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`);
}
const totalCount = await thi... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/greeting/GreetingService.ets#L103-L148 | 0ff7a00208c2276626ce9fe00fc6124f1ccf6687 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationManagementUtil.ets | arkts | getAllNotifications | Get all current notifications and quantities. | async getAllNotifications() {
let result: getAllNotificationsResultType = {
groupNotifications: this.typeNotifications,
countsByType: this.countsByType
}
return result;
} | AST#method_declaration#Left async getAllNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left getAllNotificationsResultType AST#primary_type#R... | async getAllNotifications() {
let result: getAllNotificationsResultType = {
groupNotifications: this.typeNotifications,
countsByType: this.countsByType
}
return result;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationManagementUtil.ets#L84-L90 | fd2b4f69baf54191f053d9f9bb9f1c3205155be7 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseLoadingBuilderProxy.ets | arkts | content | 弹窗加载中内容文本
@param content
@returns | content(content: ResourceStr) {
this.builderOptions.content = content;
return this;
} | AST#method_declaration#Left content AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Lef... | content(content: ResourceStr) {
this.builderOptions.content = content;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseLoadingBuilderProxy.ets#L13-L16 | 9b35556e4ef96ea2ba6ebf5aaa5d5d29d25493a6 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/AttributeUpdater.d.ets | arkts | function that returns a default param of AttributeUpdater.
@typedef { function } Initializer<T>
@returns { T }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export type Initializer<T> = () => T; | AST#export_declaration#Left export AST#type_declaration#Left type Initializer AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#p... | export type Initializer<T> = () => T; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/AttributeUpdater.d.ets#L33-L33 | 13dd61f536d0db29b9d1fbd4dc03e3420611dd29 | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/practice/PracticePage.ets | arkts | aboutToAppear | ************************************build********************************************* | aboutToAppear() {
this.fetchGraphData();
this.getTodayInfo(this.Years,this.Month,this.Day)
this.getWeightInfo()
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fetchGraphData AST#mem... | aboutToAppear() {
this.fetchGraphData();
this.getTodayInfo(this.Years,this.Month,this.Day)
this.getWeightInfo()
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/PracticePage.ets#L418-L422 | 7ffe988e6af6725aaaaa583dcde05d5c10fcd488 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/managers/StorageManager.ets | arkts | clear | 清空存储
@param config 存储配置
@returns 操作结果 | static async clear(config?: StorageConfig): Promise<StorageResult<void>> {
try {
if (!this.isInitialized) {
throw new Error('StorageManager 未初始化');
}
const storageName = config?.name || AppConstants.STORAGE_NAME;
const prefs = this.preferences.get(storageName);
if (!pre... | AST#method_declaration#Left static async clear AST#parameter_list#Left ( AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left StorageConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic... | static async clear(config?: StorageConfig): Promise<StorageResult<void>> {
try {
if (!this.isInitialized) {
throw new Error('StorageManager 未初始化');
}
const storageName = config?.name || AppConstants.STORAGE_NAME;
const prefs = this.preferences.get(storageName);
if (!pre... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L233-L255 | 484caad0281c69c8381e9f1cb5bcd82a5ee0cc96 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | Page begin event at the begin of web page loading.
@typedef OnPageBeginEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare interface OnPageBeginEvent {
/**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
url: string;
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnPageBeginEvent AST#object_type#Left { /**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left url... | export declare interface OnPageBeginEvent {
url: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L264-L274 | 9d8dc88ff06d51c253575f2e86311122833a9624 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets | arkts | isNeedUpdateBookDb | 判断 BookDb 是否有更新 | public async isNeedUpdateBookDb(info: CMetaInfo): Promise<boolean> {
if (this.isExistBookDb(info.baseName!)) {
return await this.cmetaInfoManager.isNeedUpdateForMeta(info);
}
return true; // 不存在,即表示要更新
} | AST#method_declaration#Left public async isNeedUpdateBookDb AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left CMetaInfo 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... | public async isNeedUpdateBookDb(info: CMetaInfo): Promise<boolean> {
if (this.isExistBookDb(info.baseName!)) {
return await this.cmetaInfoManager.isNeedUpdateForMeta(info);
}
return true;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets#L226-L231 | 826a43508046aee3129b9d2231b2847e168d60c2 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/plan/DayOfRow.ets | arkts | get | /判断 是否是今天 | get isToday() :boolean {
if(this.plan.startDate){
const num = DateUtils.daysTo(new Date(), this.plan.startDate)
return this.dayOf.num === num
}else{
return false
}
} | AST#method_declaration#Left get AST#ERROR#Left isToday AST#ERROR#Right 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#if_statement#Left if ( AST#expression#Le... | get isToday() :boolean {
if(this.plan.startDate){
const num = DateUtils.daysTo(new Date(), this.plan.startDate)
return this.dayOf.num === num
}else{
return false
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/plan/DayOfRow.ets#L33-L41 | 9bd6d7c101c428b81417a001ff28f1fd93f94719 | github |
hefengbao/jingmo-for-HarmonyOS.git | a208f3fdc95c0914749072e811301b9dfd6678d6 | features/classicalliterature/writing/src/main/ets/model/Writing.ets | arkts | search | 参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/batch-database-operations-guide
@param context
@param query
@returns | @Concurrent
export async function search(context: Context, query: string): Promise<Array<relationalStore.ValuesBucket>> {
let store: relationalStore.RdbStore = await relationalStore.getRdbStore(context, DbConfigConst.STORE_CONFIG);
let logger: Logger = new Logger('Writing#search');
// 查询所有数据
let resultSet = aw... | AST#decorated_export_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right export async function search AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left q... | @Concurrent
export async function search(context: Context, query: string): Promise<Array<relationalStore.ValuesBucket>> {
let store: relationalStore.RdbStore = await relationalStore.getRdbStore(context, DbConfigConst.STORE_CONFIG);
let logger: Logger = new Logger('Writing#search');
let resultSet = await store... | https://github.com/hefengbao/jingmo-for-HarmonyOS.git/blob/a208f3fdc95c0914749072e811301b9dfd6678d6/features/classicalliterature/writing/src/main/ets/model/Writing.ets#L301-L314 | 5b00347c1348170323109ce56019c440372ce0b0 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/toggle/toggleType.ets | arkts | ToggleTypeBuilder | 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 ToggleTypeBuilder(name: string, param: Object) {
ToggleTypeExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToggleTypeBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left par... | @Builder
export function ToggleTypeBuilder(name: string, param: Object) {
ToggleTypeExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/toggle/toggleType.ets#L16-L19 | 325d87f3dcc532367e9efa8b9488eff5590ef39c | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | setBadge | 设置桌面角标个数,在应用的桌面图标上呈现。 | static async setBadge(badgeNumber: number): Promise<void> {
return notificationManager.setBadgeNumber(badgeNumber);
} | AST#method_declaration#Left static async setBadge AST#parameter_list#Left ( AST#parameter#Left badgeNumber : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_... | static async setBadge(badgeNumber: number): Promise<void> {
return notificationManager.setBadgeNumber(badgeNumber);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L321-L323 | 250756fbb6a8a8ca957cee6994a1c33b7ea67fa4 | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | example/BasicUsage.ets | arkts | remux | ============================================================ 零拷贝(最快) ============================================================ 封装格式转换 | remux(): void {
const cmd = FFmpegFactory.remux('/input.mp4', '/output.mkv', ContainerFormat.MKV);
this.run(cmd);
} | AST#method_declaration#Left remux AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cmd = AST#expressio... | remux(): void {
const cmd = FFmpegFactory.remux('/input.mp4', '/output.mkv', ContainerFormat.MKV);
this.run(cmd);
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L21-L24 | aed53bc8d23285e71acd5db71eba279f8f53c979 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/component/TextAreaDialogView.ets | arkts | TextAreaDialogView | TODO TextAreaDialog组件
author: 桃花镇童长老ᥫ᭡
since: 2024/08/01 | @Component
export struct TextAreaDialogView {
private controller: TextInputController = new TextInputController()
@Prop options: TextAreaOptions;
@State customOptions: BaseContentOptions | undefined = undefined;
@State modifier: TextAreaModifier = new TextAreaModifier();
@State text: string = '';
@State tex... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextAreaDialogView AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left TextInputController AST#primary_type#Right AST#type_annotation#Right = AST... | @Component
export struct TextAreaDialogView {
private controller: TextInputController = new TextInputController()
@Prop options: TextAreaOptions;
@State customOptions: BaseContentOptions | undefined = undefined;
@State modifier: TextAreaModifier = new TextAreaModifier();
@State text: string = '';
@State tex... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/component/TextAreaDialogView.ets#L29-L137 | 26afd4c4f8cdff2491ad945a6b1ac13754dd8442 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleStatsManager.ets | arkts | calculateRealStreakDays | 计算真实的连续使用天数 | private calculateRealStreakDays(tasks: TaskItem[]): number {
if (tasks.length === 0) return 0;
const today = new Date();
today.setHours(0, 0, 0, 0);
// 获取所有任务的创建日期,按日期分组
const tasksByDate = new Map<string, number>();
tasks.forEach(task => {
const taskDate = new Date(task.createdAt);
... | AST#method_declaration#Left private calculateRealStreakDays AST#parameter_list#Left ( AST#parameter#Left tasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type... | private calculateRealStreakDays(tasks: TaskItem[]): number {
if (tasks.length === 0) return 0;
const today = new Date();
today.setHours(0, 0, 0, 0);
const tasksByDate = new Map<string, number>();
tasks.forEach(task => {
const taskDate = new Date(task.createdAt);
taskDate.setHours... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleStatsManager.ets#L175-L206 | 249a6981c90c36cf3f216ef59e9114464a53a40a | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/http/FileUtil.ets | arkts | getCacheDirPath | 获取缓存目录下的文件夹路径或文件路径。
@param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录
@param fileName 文件名(test.text);fileName传空字符串表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns | static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir; //根目录
if (StringUtils.isNotEmpty(dirPath)) {
if (FileUtil.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。
file... | AST#method_declaration#Left static getCacheDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_anno... | static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir;
if (StringUtils.isNotEmpty(dirPath)) {
if (FileUtil.hasDirPath(dirPath)) {
filePath = dirPath;
... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/FileUtil.ets#L63-L79 | ddec3156ab1a6fb7665b753c25f2c97e995158a0 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | 游戏偏好接口 | export interface GamePreferences {
enableNotifications: boolean;
enableSounds: boolean;
enableAnimations: boolean;
difficultyLevel: TaskDifficulty;
autoClaimRewards: boolean;
showProgressBars: boolean;
celebrationStyle: CelebrationStyle;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GamePreferences AST#object_type#Left { AST#type_member#Left enableNotifications : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left enableSounds ... | export interface GamePreferences {
enableNotifications: boolean;
enableSounds: boolean;
enableAnimations: boolean;
difficultyLevel: TaskDifficulty;
autoClaimRewards: boolean;
showProgressBars: boolean;
celebrationStyle: CelebrationStyle;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L215-L223 | 1de1538d6fc71ca132e91ab2a1593b00e6b5f47c | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/greeting/GreetingService.ets | arkts | deleteGreeting | 删除祝福语
@param greetingId 祝福语ID
@returns 是否成功 | async deleteGreeting(greetingId: string): Promise<boolean> {
try {
// 检查祝福语是否存在
const existingGreeting: Greeting | null = await this.getGreetingById(greetingId);
if (!existingGreeting) {
throw new Error('祝福语不存在');
}
await this.databaseService.executeTransaction(async () => {
... | AST#method_declaration#Left async deleteGreeting AST#parameter_list#Left ( AST#parameter#Left greetingId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty... | async deleteGreeting(greetingId: string): Promise<boolean> {
try {
const existingGreeting: Greeting | null = await this.getGreetingById(greetingId);
if (!existingGreeting) {
throw new Error('祝福语不存在');
}
await this.databaseService.executeTransaction(async () => {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/greeting/GreetingService.ets#L216-L251 | 023b0bef2d70e50bac7587ab0b489bbed2fa03a1 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets | arkts | 地点类 | export class Location {
index: number = 0; // 省、市、区index。0表示省,1表示市,2表示区
name: string = ''; // 用于显示省、市、区名
} | AST#export_declaration#Left export AST#class_declaration#Left class Location AST#class_body#Left { AST#property_declaration#Left index : 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#Right //... | export class Location {
index: number = 0;
name: string = '';
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L84-L87 | 5237c4057b576ec7bc1aa5333e21261cc9af2e8a | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc/entry/src/main/ets/common/InputComponent.ets | arkts | InputComponent | 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 struct InputComponent {
@Link result: string
@Link expression: string
private isLand: boolean = false
build() {
Stack({ alignContent: this.isLand ? Alignment.BottomStart : Alignment.TopEnd }) {
Column() {
Row() {
Text(this.expression)
.margin({ top: '3%... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InputComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right result : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annot... | @Component
export struct InputComponent {
@Link result: string
@Link expression: string
private isLand: boolean = false
build() {
Stack({ alignContent: this.isLand ? Alignment.BottomStart : Alignment.TopEnd }) {
Column() {
Row() {
Text(this.expression)
.margin({ top: '3%... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc/entry/src/main/ets/common/InputComponent.ets#L15-L59 | cb5f3e1cab8ca069f604ef0a0c6b7666c85cd74f | gitee |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/Pointer.ets | arkts | removeById | Removes a pointer with given [id] and returns a boolean result.
@param id The id of the pointer to remove. If the id is not existent, nothing happens.
@return True if a pointer was removed, false otherwise. | removeById(id: number): boolean {
for (let pointer of this.pointers) {
if (pointer.id === id) {
pointer.reset();
return true;
}
}
return false;
} | AST#method_declaration#Left removeById AST#parameter_list#Left ( AST#parameter#Left id : 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 A... | removeById(id: number): boolean {
for (let pointer of this.pointers) {
if (pointer.id === id) {
pointer.reset();
return true;
}
}
return false;
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L96-L104 | 013d647d567dd9fab7de4a21d9c6a549c98939ad | github |
robotzzh/AgricultureApp.git | 7b12c588dd1d07cc07a8b25577d785d30bd838f6 | entry/src/main/ets/common/History_Info.ets | arkts | 01 03 00 00 00 01 84 0A 读取含水量
01 03 00 01 00 01 D5 CA 只读取温度
01 03 00 02 00 01 25 CA 读取电导率
01 03 00 03 00 01 74 0A 读取PH
01 03 00 04 00 01 C5 CB 读取K
01 03 00 05 00 01 94 0B 读取P
01 03 00 06 00 01 64 0B 读取K
01 03 00 07 00 01 35 CB 读取盐度
01 03 00 08 00 01 05 C8 读取总溶解固体
01 03 02 00 2A 39 9B 响应
00 2A 读取含水量 扩大十倍
01 03 02 00 F9... | export default class History_Info{
fieldId : number;
name: string;
history_humidity: ArrayList<number> = new ArrayList<number>();
history_temperature: ArrayList<number> = new ArrayList<number>();
history_conductivity: ArrayList<number> = new ArrayList<number>();
history_PH: ArrayList<number> = new ArrayL... | AST#export_declaration#Left export default AST#class_declaration#Left class History_Info AST#class_body#Left { AST#property_declaration#Left fieldId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left nam... | export default class History_Info{
fieldId : number;
name: string;
history_humidity: ArrayList<number> = new ArrayList<number>();
history_temperature: ArrayList<number> = new ArrayList<number>();
history_conductivity: ArrayList<number> = new ArrayList<number>();
history_PH: ArrayList<number> = new ArrayL... | https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/common/History_Info.ets#L32-L223 | c23995daf69970446111a281eb58566e3129f772 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets | arkts | exit | 主动退出 | exit(): void {
Logger.info(TAG, `exit`);
this.clearSound();
this.exitVoiceCall(); // 停止录音和播放,切换音频场景
TimerUtil.getInstance().stopTimer(); // 停掉计时器
OptionModel.destroy();
setTimeout(() => {
BufferModel.destroy(); // 停止线程延迟200ms,给stop执行一些时间
if (this.ctx) {
this.ctx.terminateSelf... | AST#method_declaration#Left exit AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST... | exit(): void {
Logger.info(TAG, `exit`);
this.clearSound();
this.exitVoiceCall();
TimerUtil.getInstance().stopTimer();
OptionModel.destroy();
setTimeout(() => {
BufferModel.destroy();
if (this.ctx) {
this.ctx.terminateSelf();
}
}, 400);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets#L98-L110 | 155aaec7c3cbb6abe95dbea8a6aa76151aa88053 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SimpleCalculator/entry/src/main/ets/model/CalculateModel.ets | arkts | inputSymbol | Input Symbols.
@param value Input Operators. | inputSymbol(value: string) {
if (CheckEmptyUtil.isEmpty(value)) {
return;
}
let len = this.expressions.length;
switch (value) {
case Symbol.CLEAN:
this.expressions = []; | AST#method_declaration#Left inputSymbol 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#ERROR#Left { AST#ERROR#Left AST#statement#Left AST#if_statement#Left if (... | inputSymbol(value: string) {
if (CheckEmptyUtil.isEmpty(value)) {
return;
}
let len = this.expressions.length;
switch (value) {
case Symbol.CLEAN:
this.expressions = []; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SimpleCalculator/entry/src/main/ets/model/CalculateModel.ets#L33-L40 | 02dc9275cc58785140475e2ef66d8fed9b87a636 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets | arkts | genGcmParamsSpec | 生成GCM所需数据
@returns | private static genGcmParamsSpec(): crypto.GcmParamsSpec {
let ivBlob: crypto.DataBlob = { data: RandomUtil.randomUnitBySize(12) };
let aadBlob: crypto.DataBlob = { data: RandomUtil.randomUnitBySize(8) };
let tagBlob: crypto.DataBlob = {
data: RandomUtil.randomUnitBySize(16)
};
// GCM的authTag在加... | AST#method_declaration#Left private static genGcmParamsSpec AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . GcmParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statem... | private static genGcmParamsSpec(): crypto.GcmParamsSpec {
let ivBlob: crypto.DataBlob = { data: RandomUtil.randomUnitBySize(12) };
let aadBlob: crypto.DataBlob = { data: RandomUtil.randomUnitBySize(8) };
let tagBlob: crypto.DataBlob = {
data: RandomUtil.randomUnitBySize(16)
};
let gcmPara... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L40-L54 | 431738ede348c24dc1bba18875691d4101987da8 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets | arkts | CustomContentDialog | Declare custom content dialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | @CustomDialog
export declare struct CustomContentDialog {
/**
* Sets the CustomContentDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
controller: CustomDialogController;
/**... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct CustomContentDialog AST#component_body#Left { /**
* Sets the CustomContentDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkU... | @CustomDialog
export declare struct CustomContentDialog {
controller: CustomDialogController;
primaryTitle?: ResourceStr;
secondaryTitle?: ResourceStr;
@BuilderParam
contentBuilder: () => void;
contentAreaPadding?: Padding;
localizedContentAreaPadding?: Localize... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets#L743-L829 | f37a5b2c1693ac6f45675d407b8548bc8b7cd381 | github |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/JsonEncodingVisitor.ets | arkts | JSON 编码 Visitor
将消息编码为 Protobuf JSON 格式
使用方式:
```typescript
const visitor = new JsonEncodingVisitor()
message.traverse(visitor)
const json = visitor.finish()
```
递归深度保护:
- 最大嵌套深度:100 层
- 超过限制会抛出错误 | export class JsonEncodingVisitor implements Visitor {
private json: Record<string, Object> = {}
private recursionDepth: number = 0
private readonly maxRecursionDepth: number = 100
// 字段编号到字段名的映射
// 注意:生成的消息类会设置此映射
// 临时实现:使用字段编号作为 key
private fieldNames: Map<number, string> = new Map()
constructor | AST#export_declaration#Left export AST#ERROR#Left class JsonEncodingVisitor AST#implements_clause#Left implements Visitor AST#implements_clause#Right { AST#property_declaration#Left private json : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#L... | export class JsonEncodingVisitor implements Visitor {
private json: Record<string, Object> = {}
private recursionDepth: number = 0
private readonly maxRecursionDepth: number = 100
private fieldNames: Map<number, string> = new Map()
constructor | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/JsonEncodingVisitor.ets#L42-L52 | a919d72316d29fc1cb0116190ced5fa4f5ff18fb | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | setWindowLayoutFullScreen | 设置窗口的布局是否为沉浸式布局(该沉浸式布局状态栏、导航栏仍然显示)。
@param isLayoutFullScreen true表示沉浸式布局;false表示非沉浸式布局。
@param windowClass 不传该值,默认主窗口。 | static async setWindowLayoutFullScreen(isLayoutFullScreen: boolean,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setWindowLayoutFullScreen(isLayoutFullScreen);
} | AST#method_declaration#Left static async setWindowLayoutFullScreen AST#parameter_list#Left ( AST#parameter#Left isLayoutFullScreen : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST... | static async setWindowLayoutFullScreen(isLayoutFullScreen: boolean,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setWindowLayoutFullScreen(isLayoutFullScreen);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L89-L92 | 0c869373c1146ac4f2ce3e578d752b9c745b9815 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/IChatDataSource.ets | arkts | 聊天数据资源接口 | export interface IChatDataSource extends IDataSource {
// 添加数据函数
addData(index: number, data: IChatMessage): void;
// 插入数据函数
pushData(data: ChatMessage): void;
// 更新数据函数
updateData(index: number, data: IChatMessage): void;
// 删除数据函数
removeData(index: number): void;
// 清除数据函数
clearData(): void;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IChatDataSource AST#extends_clause#Left extends IDataSource AST#extends_clause#Right AST#object_type#Left { // 添加数据函数 AST#type_member#Left addData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Le... | export interface IChatDataSource extends IDataSource {
addData(index: number, data: IChatMessage): void;
pushData(data: ChatMessage): void;
updateData(index: number, data: IChatMessage): void;
removeData(index: number): void;
clearData(): void;
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/IChatDataSource.ets#L7-L22 | 759b40048d192797a7fed943513c4a11058b7a8f | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIAssistantService.ets | arkts | 用户档案接口 | export interface UserProfile {
name: string;
preferences: UserPreferences;
behavior: UserBehavior;
relationships: ContactRelationship[];
interests: string[];
communicationStyle: CommunicationStyle;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserProfile AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left preferences : AST#type_annotation... | export interface UserProfile {
name: string;
preferences: UserPreferences;
behavior: UserBehavior;
relationships: ContactRelationship[];
interests: string[];
communicationStyle: CommunicationStyle;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L103-L110 | 46974681a60da60ac87419438ed0b55eb7893823 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/ui/base/TabBarUtil.ets | arkts | @Author csx
@DateTime 2024/6/11 14:39:06
@TODO TabBarUtil 自定义底部tabbar工具类
参考 https://developer.huawei.com/consumer/cn/forum/topic/0201141759960178032?fid=0109140870620153026 | export class TabBarUtil {
} | AST#export_declaration#Left export AST#class_declaration#Left class TabBarUtil AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right | export class TabBarUtil {
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/ui/base/TabBarUtil.ets#L23-L24 | 8f7efeaf867bfdce26aefa3076571a37bdf1ee3b | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets | arkts | @file 认证相关网络数据源实现类
@author Joker.X | export class AuthNetworkDataSourceImpl implements AuthNetworkDataSource {
/**
* 微信 APP 授权登录
* @param {Record<string, string>} params - 微信授权参数
* @returns {Promise<NetworkResponse<Auth>>} 登录结果
*/
async loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Auth>> {
const response: Axios... | AST#export_declaration#Left export AST#class_declaration#Left class AuthNetworkDataSourceImpl AST#implements_clause#Left implements AuthNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 微信 APP 授权登录
* @param {Record<string, string>} params - 微信授权参数
* @returns {Promise<NetworkResponse<Aut... | export class AuthNetworkDataSourceImpl implements AuthNetworkDataSource {
async loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Auth>> {
const response: AxiosResponse<NetworkResponse<Auth>> =
await NetworkClient.http.post("user/login/wxApp", params);
return response.data;
}
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets#L10-L97 | d5eed7c206532c0c4b1ccbd6bef8a80b6853c586 | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getAppProvisionType | 获取应用程序签名证书文件的类型,分为debug和release两种类型。
@returns | static getAppProvisionType(): string {
return AppUtils.getAppInfoSync().appProvisionType
} | AST#method_declaration#Left static getAppProvisionType 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#memb... | static getAppProvisionType(): string {
return AppUtils.getAppInfoSync().appProvisionType
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L166-L168 | c6618bb37f1ba188d0dea01287349e193af7e580 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/model/Contact.ets | arkts | 分类 | constructor(id: number = -1, name: string = '', phone: string = '', email: string = '', address: string = '',
avatar: string = '', category: string = '') {
this.id = id;
this.name = name;
this.phone = phone;
this.email = email;
this.address = address;
this.avatar = avatar;
this.category ... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AS... | constructor(id: number = -1, name: string = '', phone: string = '', email: string = '', address: string = '',
avatar: string = '', category: string = '') {
this.id = id;
this.name = name;
this.phone = phone;
this.email = email;
this.address = address;
this.avatar = avatar;
this.category ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/model/Contact.ets#L30-L39 | b24c0edaba00c3d1f5c9c34409719c7df51e62fd | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/har2/Index.ets | arkts | addHar2 | [Start export_add_har2] | export { addHar2 } from './src/main/ets/utils/Calc' | AST#export_declaration#Left export { addHar2 } from './src/main/ets/utils/Calc' AST#export_declaration#Right | export { addHar2 } from './src/main/ets/utils/Calc' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/har2/Index.ets#L19-L19 | 0aaff3c26fd75a1fd202d938fdcafee7ed7be3e3 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/pages/WidgetCard2x4.ets | arkts | buildHeader | 构建头部 | @Builder
buildHeader() {
Row() {
Image($r('app.media.ic_birthday_cake'))
.width('20vp')
.height('20vp')
.fillColor($r('app.color.primary'))
Text('AI生日提醒')
.fontSize(16)
.fontColor($r('app.color.text_primary'))
.fontWeight(FontWeight.Medium)
.lay... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Image($r('app.media.ic_birthday_cake'))
.width('20vp')
.height('20vp')
.fillColor($r('app.color.primary'))
Text('AI生日提醒')
.fontSize(16)
.fontColor($r('app.color.text_primary'))
.fontWeight(FontWeight.Medium)
.lay... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L39-L67 | 8e972b7334f0e36a926e5205627794c181e5517a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/routermodule/src/main/ets/foldableRouter/FoldableRouter.ets | arkts | 兼容折叠屏下的路由跳转 | export class FoldableRouter {
/**
* 兼容折叠屏下的路由跳转
* @param uri 路由名称
* @param param 路由参数
*/
public static pushUri(uri: string, param: ESObject) {
// 记录当前进入路由名称
AppStorage.setOrCreate('enterRouteName', uri);
// 定义事件3
let innerEvent: emitter.InnerEvent = {
eventId: 3
};
let even... | AST#export_declaration#Left export AST#class_declaration#Left class FoldableRouter AST#class_body#Left { /**
* 兼容折叠屏下的路由跳转
* @param uri 路由名称
* @param param 路由参数
*/ AST#method_declaration#Left public static pushUri AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#L... | export class FoldableRouter {
public static pushUri(uri: string, param: ESObject) {
AppStorage.setOrCreate('enterRouteName', uri);
let innerEvent: emitter.InnerEvent = {
eventId: 3
};
let eventData: emitter.EventData = {
data: {
navMode: NavMode.ChildPageMode
}
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/foldableRouter/FoldableRouter.ets#L40-L88 | 9ffef56a34957a2c66037fe7286e05aa926d4f0d | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/pages/Index.ets | arkts | resetState | 重置状态 | resetState(): void {
this.backgroundCancel = Color.Gray;
this.fontColorCancel = Color.White;
this.backgroundWord = Color.Gray;
this.fontColorWord = Color.White;
this.backgroundVoice = Color.White;
this.fontColorVoice = Color.Black;
this.waterRipplesBg = $r("app.string.voice_record_water_ripp... | AST#method_declaration#Left resetState 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#member_... | resetState(): void {
this.backgroundCancel = Color.Gray;
this.fontColorCancel = Color.White;
this.backgroundWord = Color.Gray;
this.fontColorWord = Color.White;
this.backgroundVoice = Color.White;
this.fontColorVoice = Color.Black;
this.waterRipplesBg = $r("app.string.voice_record_water_ripp... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/pages/Index.ets#L92-L102 | 7b551f86b9d1f9b9ab73afb69c2a46d1475af828 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/WeatherManager.ets | arkts | getWeatherIcon | 获取天气图标 | private getWeatherIcon(weatherType: number): string {
const icons = ['☀️', '⛅', '☁️', '🌧️'];
return icons[weatherType] || '☀️';
} | AST#method_declaration#Left private getWeatherIcon AST#parameter_list#Left ( AST#parameter#Left weatherType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#... | private getWeatherIcon(weatherType: number): string {
const icons = ['☀️', '⛅', '☁️', '🌧️'];
return icons[weatherType] || '☀️';
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/WeatherManager.ets#L163-L166 | dac97a6597c96f9dc7f8cbe2da63dde0db9ad489 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets | arkts | msToHHMMSS | 毫秒转换为“HH:mm:ss”字符串格式 | static msToHHMMSS(timeMs: number): string {
const MS_ONE_SECOND: number = 1000;
const SECONDS_ONE_HOUR: number = 3600;
const SECONDS_ONE_MIN: number = 60;
const FLAG_NUMBER: number = 10; // 显示两位数判断
let hours = Math.floor(timeMs / (SECONDS_ONE_HOUR * MS_ONE_SECOND));
let hourStr = hours + ':';
... | AST#method_declaration#Left static msToHHMMSS AST#parameter_list#Left ( AST#parameter#Left timeMs : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static msToHHMMSS(timeMs: number): string {
const MS_ONE_SECOND: number = 1000;
const SECONDS_ONE_HOUR: number = 3600;
const SECONDS_ONE_MIN: number = 60;
const FLAG_NUMBER: number = 10;
let hours = Math.floor(timeMs / (SECONDS_ONE_HOUR * MS_ONE_SECOND));
let hourStr = hours + ':';
if (hou... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets#L21-L46 | 46da08b31a3f9f3e7c55f99727f2d6bb8c59dec2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/Index.ets | arkts | MainPage | 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 { MainPage } from './src/main/ets/pages/MainPage'; | AST#export_declaration#Left export { MainPage } from './src/main/ets/pages/MainPage' ; AST#export_declaration#Right | export { MainPage } from './src/main/ets/pages/MainPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/Index.ets#L17-L17 | 07b9d1c90d7ddff93560c1b88bd9a5d0d5605531 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/empty/Empty.ets | arkts | buildAction | 构建操作按钮
@returns {void} 无返回值 | @Builder
private buildAction(): void {
if (this.onAction) {
SpaceVerticalMedium();
IBestButton({
text: this.actionText,
type: "primary",
plain: true,
hairline: true,
round: true,
btnWidth: P70
})
.onClick(() => {
if (this.onActi... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildAction AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if... | @Builder
private buildAction(): void {
if (this.onAction) {
SpaceVerticalMedium();
IBestButton({
text: this.actionText,
type: "primary",
plain: true,
hairline: true,
round: true,
btnWidth: P70
})
.onClick(() => {
if (this.onActi... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/Empty.ets#L54-L74 | 6c0e6cf1c92e153dbe0513e0e217c034fa295201 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets | arkts | Contains information needed to determine the highlighted value. | export default class Highlight {
/**
* the x-value of the highlighted value
*/
private mX: number = Number.NaN;
/**
* the y-value of the highlighted value
*/
private mY: number = Number.NaN;
/**
* the x-pixel of the highlight
*/
private mXPx: number;
/**
... | AST#export_declaration#Left export default AST#class_declaration#Left class Highlight AST#class_body#Left { /**
* the x-value of the highlighted value
*/ AST#property_declaration#Left private mX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expr... | export default class Highlight {
private mX: number = Number.NaN;
private mY: number = Number.NaN;
private mXPx: number;
private mYPx: number;
private mDataIndex: number = -1;
private mDataSetIndex: number;
private mStackIndex: number = -1;
... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets#L21-L242 | b6c51dfc94dc021642af4d53e657d3dfa81b9408 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | getDisplayWidth | 获取设备的屏幕宽度,单位为VP。
@returns | static getDisplayWidth(): number {
return px2vp(display.getDefaultDisplaySync().width);
} | AST#method_declaration#Left static getDisplayWidth 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#call_exp... | static getDisplayWidth(): number {
return px2vp(display.getDefaultDisplaySync().width);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L194-L196 | 76ade1f6207e5b3f0a3b63bfb288e84c50fce353 | gitee |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/data/Repository.ets | arkts | getItemData | 获取媒体的用户数据
@param id
@returns | public getItemData(id: string): Promise<FinItemData> {
return this.requireApi().getItemData(id)
} | AST#method_declaration#Left public getItemData AST#parameter_list#Left ( AST#parameter#Left id : 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... | public getItemData(id: string): Promise<FinItemData> {
return this.requireApi().getItemData(id)
} | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L161-L163 | 0cb601fcbe41df9f8e1393ec223f9363a842e305 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/SpeechRecognizerHelper.ets | arkts | isBusy | 判断引擎是否繁忙。true:引擎正处于繁忙状态。false:引擎没有处于繁忙状态。
@param sessionId 会话ID。 | static isBusy(): boolean {
return SpeechRecognizerHelper.recognitionEngine?.isBusy() ?? false;
} | AST#method_declaration#Left static isBusy 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_expressio... | static isBusy(): boolean {
return SpeechRecognizerHelper.recognitionEngine?.isBusy() ?? false;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/SpeechRecognizerHelper.ets#L113-L115 | 4d512de16dfe2d5b2455a180268702bcb92747c0 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets | arkts | setFullScreen | @des 开启沉浸式 | setFullScreen(windowStage: window.WindowStage) {
let windowClass: window.Window = windowStage.getMainWindowSync()
let isLayoutFullScreen = true
try {
windowClass.setWindowLayoutFullScreen(isLayoutFullScreen)
let bottomType = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR
let bottomAvoidAre... | AST#method_declaration#Left setFullScreen AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bl... | setFullScreen(windowStage: window.WindowStage) {
let windowClass: window.Window = windowStage.getMainWindowSync()
let isLayoutFullScreen = true
try {
windowClass.setWindowLayoutFullScreen(isLayoutFullScreen)
let bottomType = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR
let bottomAvoidAre... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets#L30-L48 | 8cbaf5302e5f8e0098795bfb06f07c074c63e3d0 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/GlobalDataManager.ets | arkts | isLoaded | 检查数据是否已加载 | isLoaded(): boolean {
return this.isDataLoaded;
} | AST#method_declaration#Left isLoaded AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Lef... | isLoaded(): boolean {
return this.isDataLoaded;
} | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L303-L305 | 438403bca2f6610974e6f81391d8bc3f7c9bda8f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | 推荐算法接口 | export interface RecommendationAlgorithm {
name: string;
version: string;
type: AlgorithmType;
weight: number; // 算法权重
parameters: Record<string, string | number | boolean>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RecommendationAlgorithm AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left version : AST#type_an... | export interface RecommendationAlgorithm {
name: string;
version: string;
type: AlgorithmType;
weight: number;
parameters: Record<string, string | number | boolean>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L184-L190 | c261ff6390761616c1445bda5fd90a239b532a9f | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/utils/BackgroundUtil.ets | arkts | stopContinuousTask | Stop background task.
@param context | public static stopContinuousTask(context: common.UIAbilityContext): void {
if (canIUse('SystemCapability.ResourceSchedule.BackgroundTaskManager.Core')) {
try {
backgroundTaskManager.stopBackgroundRunning(context).then(() => {
Logger.info('this avPlayer: ', 'stopBackgroundRunning succeeded');... | AST#method_declaration#Left public static stopContinuousTask 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#paramet... | public static stopContinuousTask(context: common.UIAbilityContext): void {
if (canIUse('SystemCapability.ResourceSchedule.BackgroundTaskManager.Core')) {
try {
backgroundTaskManager.stopBackgroundRunning(context).then(() => {
Logger.info('this avPlayer: ', 'stopBackgroundRunning succeeded');... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/utils/BackgroundUtil.ets#L68-L81 | 256aa4122ea6442583bf99f6e9f244f192a75713 | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/Login.ets | arkts | aboutToAppear | 在此生命周期函数中,检查是否有自动登录数据。
如果有则自动登录。 | public aboutToAppear(): void {
// 获取自动登录的用户数据。若没有则返回空字符串
PreferencesUtil.getPreferences(CommonConstants.LOGIN_PREFERENCES, '')
.then((value: string) => {
// 若存在自动登录用户,则自动登录
if ((JSON.parse(value) as string).length !== 0) {
this.account.username = JSON.parse(value) as string;
... | AST#method_declaration#Left public aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 获取自动登录的用户数据。若没有则返回空字符串 AST#expression_statement#Left AST#expression#Left AST#ca... | public aboutToAppear(): void {
PreferencesUtil.getPreferences(CommonConstants.LOGIN_PREFERENCES, '')
.then((value: string) => {
if ((JSON.parse(value) as string).length !== 0) {
this.account.username = JSON.parse(value) as string;
PreferencesUtil.getPrefere... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/Login.ets#L48-L68 | 7bdd5ad809b972bae932cef2cd4c994146cc8f43 | github |
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/pages/学习/28.剩余参数和展开运算符.ets | arkts | sum | 剩余参数和展开运算符,这两个东西和js一样 | function sum(n1: number, n2: number, ...args: number[]) {
let s = n1 + n2
if (args.length > 0) {
for(const item of args) {
s += item
}
}
return s
} | AST#function_declaration#Left function sum AST#parameter_list#Left ( AST#parameter#Left n1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left n2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | function sum(n1: number, n2: number, ...args: number[]) {
let s = n1 + n2
if (args.length > 0) {
for(const item of args) {
s += item
}
}
return s
} | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/28.剩余参数和展开运算符.ets#L4-L12 | ebfa575bdad754719c1e2a2b3dd764f8979f6977 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets | arkts | getTimeString | 视频时长转换 | static getTimeString(time: number): string {
if (time === -1 || time === undefined) {
time = 0;
}
const TIMESTAMP: number = 1000;
const TIME_UNIT: number = 60;
const MAX_HOURS: number = 24;
let hour = Math.floor(time % (TIMESTAMP * TIME_UNIT * TIME_UNIT * MAX_HOURS) / (TIMESTAMP * TIME_UNI... | AST#method_declaration#Left static getTimeString AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | static getTimeString(time: number): string {
if (time === -1 || time === undefined) {
time = 0;
}
const TIMESTAMP: number = 1000;
const TIME_UNIT: number = 60;
const MAX_HOURS: number = 24;
let hour = Math.floor(time % (TIMESTAMP * TIME_UNIT * TIME_UNIT * MAX_HOURS) / (TIMESTAMP * TIME_UNI... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets#L79-L93 | b7db962e46694eb61fdc110a6ee4c930511e4335 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets | arkts | getData | 根据index获取具体项 | public getData(index: number): FriendMoment {
// 判断组件是否已经缓存到最后一项数据了
if (index == this.momentList.length - 1) {
// 目前json文件只有3个,所以对3取余后加一实现循环获取3个json
getFriendMomentByTaskPool(FriendMomentJsonUrl.FRIEND_MOMENT_JSON_URL[this.getJsonIndex % 3]);
this.getJsonIndex++;
}
return this.momentLi... | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FriendMoment AST#primary_... | public getData(index: number): FriendMoment {
if (index == this.momentList.length - 1) {
getFriendMomentByTaskPool(FriendMomentJsonUrl.FRIEND_MOMENT_JSON_URL[this.getJsonIndex % 3]);
this.getJsonIndex++;
}
return this.momentList[index];
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets#L300-L308 | 7d9c13d6131651c07adcc0e4265d53d9a9ada63c | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/PickerUtil.ets | arkts | selectPhotoVideoCallBack | 拉起照片和视频选择 - 回调方式
@param options 选择入参详见efPickerOptions 参数中只有maxNumber使用
@returns | static async selectPhotoVideoCallBack(options?: efPickerOptions): Promise<void> {
if (!options) {
options = new efPickerOptions();
options.maxNumber = 5;
}
if (!options.maxNumber) {
options.maxNumber = 5;
}
try {
let selectOpts = new photoAccessHelper.PhotoSelectOptions();
... | AST#method_declaration#Left static async selectPhotoVideoCallBack AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left efPickerOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary... | static async selectPhotoVideoCallBack(options?: efPickerOptions): Promise<void> {
if (!options) {
options = new efPickerOptions();
options.maxNumber = 5;
}
if (!options.maxNumber) {
options.maxNumber = 5;
}
try {
let selectOpts = new photoAccessHelper.PhotoSelectOptions();
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PickerUtil.ets#L134-L159 | 4c9c0492adf398df87f4879ea6712008ce239b83 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/sorting/RadixSort.ets | arkts | sort | 基数排序算法
@param arr 需要排序的数组
@returns 排序后的数组 | public static sort(arr: number[]): number[] {
if (arr.length === 0) {
return [];
}
const result = [...arr];
const max = Math.max(...result);
let exp = 1;
// 对每一位进行计数排序
while (Math.floor(max / exp) > 0) {
RadixSort.countingSort(result, exp);
exp *= 10;
}
return re... | AST#method_declaration#Left public static sort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ... | public static sort(arr: number[]): number[] {
if (arr.length === 0) {
return [];
}
const result = [...arr];
const max = Math.max(...result);
let exp = 1;
while (Math.floor(max / exp) > 0) {
RadixSort.countingSort(result, exp);
exp *= 10;
}
return result;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/RadixSort.ets#L10-L26 | ad6ff75e77f2a35316b92bdfa0fe43217c5c29c6 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets | arkts | terminateSecondAbility | Stop SecondAbility itself.
@param context Context of SecondAbility. | terminateSecondAbility(context: common.UIAbilityContext) {
context.terminateSelf().then(() => {
Logger.info(CommonConstants.TAG, 'terminate second ability self succeed');
}).catch((error: Error) => {
Logger.error(CommonConstants.TAG, `terminate second ability self failed with ${error}`);
});
} | AST#method_declaration#Left terminateSecondAbility 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#Ri... | terminateSecondAbility(context: common.UIAbilityContext) {
context.terminateSelf().then(() => {
Logger.info(CommonConstants.TAG, 'terminate second ability self succeed');
}).catch((error: Error) => {
Logger.error(CommonConstants.TAG, `terminate second ability self failed with ${error}`);
});
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets#L106-L112 | 56e941065d219aef4f07a479a5ba341e048e3496 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ModelConfigService.ets | arkts | getInstance | 获取单例实例 | public static getInstance(): ModelConfigService {
if (!ModelConfigService.instance) {
ModelConfigService.instance = new ModelConfigService();
}
return ModelConfigService.instance;
} | AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ModelConfigService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expr... | public static getInstance(): ModelConfigService {
if (!ModelConfigService.instance) {
ModelConfigService.instance = new ModelConfigService();
}
return ModelConfigService.instance;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ModelConfigService.ets#L288-L293 | ac5461370c786cab2d61598fd0fd4b0c2eef3d96 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/constants/ImageCropConstants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class ImageCropConstants {
static readonly THREE_FOUR: number = 4 / 3; // 裁剪比例
static readonly NINE_SIXTH: number = 16 / 9; // 裁剪比例
static readonly ONE_ONE: number = 1; // 裁剪比例
static readonly RAWFILE_PICPATH: string = "depthCopy.png"; // rawfile中的图片... | AST#export_declaration#Left export AST#class_declaration#Left class ImageCropConstants AST#class_body#Left { AST#property_declaration#Left static readonly THREE_FOUR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left ... | export class ImageCropConstants {
static readonly THREE_FOUR: number = 4 / 3;
static readonly NINE_SIXTH: number = 16 / 9;
static readonly ONE_ONE: number = 1;
static readonly RAWFILE_PICPATH: string = "depthCopy.png";
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/constants/ImageCropConstants.ets#L16-L21 | 22fda828611f5bdcca91720e4e70d7d90f0a13f0 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScatterDataSet.ets | arkts | setScatterShapeHoleRadius | Sets a new IShapeRenderer responsible for drawing this DataSet.
This can also be used to set a custom IShapeRenderer aside from the default ones.
@param shapeRenderer
Sets the radius of the hole in the shape (applies to Square, Circle and Triangle)
Set this to <= 0 to remove holes.
@param holeRadius | public setScatterShapeHoleRadius(holeRadius: number): void {
this.mScatterShapeHoleRadius = holeRadius;
} | AST#method_declaration#Left public setScatterShapeHoleRadius AST#parameter_list#Left ( AST#parameter#Left holeRadius : 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 vo... | public setScatterShapeHoleRadius(holeRadius: number): void {
this.mScatterShapeHoleRadius = holeRadius;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScatterDataSet.ets#L103-L105 | e1cd1ff04f9a3a781e225d8de6bb933167eae704 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/pages/RegisterPage.ets | arkts | if | 检查响应状态 | if (response.responseCode === 201) {
let responseData = JSON.parse(response.result as string) as ApiResponse;
if (responseData.success) {
this.showMessage('注册成功', 'success');
setTimeout(() => {
router.pushUrl({ url: 'pages/Index' });
}, 1000);
} else {
... | AST#method_declaration#Left if AST#parameter_list#Left ( AST#parameter#Left response AST#parameter#Right AST#ERROR#Left . responseCode === 201 AST#ERROR#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left responseData = AST#expres... | if (response.responseCode === 201) {
let responseData = JSON.parse(response.result as string) as ApiResponse;
if (responseData.success) {
this.showMessage('注册成功', 'success');
setTimeout(() => {
router.pushUrl({ url: 'pages/Index' });
}, 1000);
} else {
... | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/RegisterPage.ets#L195-L205 | 75909dd8e59428687ace4da03fc1f72e0f337ca4 | github |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/pages/DiaryEdit.ets | arkts | formatTime | 格式化时间显示 (例如 10:30) | formatTime(timestamp: number): string {
let date = new Date(timestamp);
return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
} | AST#method_declaration#Left formatTime AST#parameter_list#Left ( AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | formatTime(timestamp: number): string {
let date = new Date(timestamp);
return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
} | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/pages/DiaryEdit.ets#L45-L48 | ed8441f4c6172323c20825aa54bc11faa7fe8905 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ChatbotEngine.ets | arkts | processRegularInput | 处理常规输入 | private async processRegularInput(
input: string,
context: ConversationContext
): Promise<AIResponse> {
try {
// 这里应该调用AIAssistantService的处理逻辑
// 为了避免循环依赖,这里提供基础实现
const response = this.generateContextualResponse(input, context);
const suggestions = this.generateQuickReplySu... | AST#method_declaration#Left private async processRegularInput 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#Left context : AST#type_annotation#Left AST#primary_type#Left Conv... | private async processRegularInput(
input: string,
context: ConversationContext
): Promise<AIResponse> {
try {
const response = this.generateContextualResponse(input, context);
const suggestions = this.generateQuickReplySuggestions(input, context);
return this.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L419-L436 | 2c719b2a2b644f21be26eb9b652a45885f8afcda | github |
queueit/harmony-sdk.git | ba7b4b38c03730bfbe305789acba6db0012d5f5c | entry/src/main/ets/demowithprotectedapi/exceptions/MustBeQueuedError.ets | arkts | src/main/ets/exceptions/MustBeQueuedError.ts
Thrown when an API call to a protected endpoint returns a redirect-to-queue response. | export class MustBeQueuedError extends Error {
/**
* @param redirectUrl The full URL from the 'x-queueit-redirect' header that the user should be redirected to.
*/
public redirectUrl: string;
constructor(redirectUrl: string) {
super(`Must be queued. Redirect to: ${redirectUrl}`);
... | AST#export_declaration#Left export AST#class_declaration#Left class MustBeQueuedError extends AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* @param redirectUrl The full URL from the 'x-queueit-redirect' header that the user should b... | export class MustBeQueuedError extends Error {
public redirectUrl: string;
constructor(redirectUrl: string) {
super(`Must be queued. Redirect to: ${redirectUrl}`);
this.redirectUrl = redirectUrl;
this.name = 'MustBeQueuedError';
}
} | https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/entry/src/main/ets/demowithprotectedapi/exceptions/MustBeQueuedError.ets#L6-L17 | 9fcf67596826fa3d3eb498755e8320ed7e2a36b0 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | getLabel | Returns the label that is drawn next to the limit line.
@return | public getLabel(): string {
return this.mLabel;
} | AST#method_declaration#Left public getLabel 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_expressi... | public getLabel(): string {
return this.mLabel;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L197-L199 | 61d2d3b3104ea9c6c0754035598a6d0c2f49b101 | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | getWindowHeightPx | 获取屏幕高度
@returns | public getWindowHeightPx(): number {
return WindowUtils.windowHeight_px
} | AST#method_declaration#Left public getWindowHeightPx AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member... | public getWindowHeightPx(): number {
return WindowUtils.windowHeight_px
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L195-L197 | a60c7348eaee74a869c7f22adf537b78b1b98d52 | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhCountDownBtn.ets | arkts | JhCountDownBtn | 边框圆角 | @Preview
@Component
export struct JhCountDownBtn {
public getVCode?: () => Promise<boolean> // 验证码获取回调
@Prop public getCodeText: string = _normalText
@Prop public resendAfterText: string = _resendAfterText
@Prop public textColor?: ResourceColor = KColors.kThemeColor
@Prop public bgColor?: ResourceColor = Colo... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct JhCountDownBtn AST#component_body#Left { AST#property_declaration#Left public getVCode ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) A... | @Preview
@Component
export struct JhCountDownBtn {
public getVCode?: () => Promise<boolean>
@Prop public getCodeText: string = _normalText
@Prop public resendAfterText: string = _resendAfterText
@Prop public textColor?: ResourceColor = KColors.kThemeColor
@Prop public bgColor?: ResourceColor = Color.Transpar... | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhCountDownBtn.ets#L18-L65 | 8c529f4965a3f717af6066466e257a1fc1af34b5 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/MaterialEdit.ets | arkts | aboutToDisappear | 保存当前的素材 | async aboutToDisappear(): Promise<void> {
this.onOpen();
await this.saveChange();
this.onClose();
} | AST#method_declaration#Left async aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type... | async aboutToDisappear(): Promise<void> {
this.onOpen();
await this.saveChange();
this.onClose();
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/MaterialEdit.ets#L77-L81 | b65ab013e028d4bb15c85e3995b8af5cefd42d88 | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/utils/HttpUtil.ets | arkts | put | PUT请求 | static put<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const putConfig: RequestConfig = {
method: http.RequestMethod.PUT,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, putConfig);
... | AST#method_declaration#Left static put AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation... | static put<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const putConfig: RequestConfig = {
method: http.RequestMethod.PUT,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, putConfig);
... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L155-L163 | 2f86965f9cbffc4acd2bb2f50b8b0f2e950fcc1d | github |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/MomentsPage.ets | arkts | createNewPost | 创建新的Post对象(不使用扩展运算符) | private createNewPost(oldPost: Post, updates: Partial<Post>): Post {
return {
id: updates.id !== undefined ? updates.id : oldPost.id,
userName: updates.userName !== undefined ? updates.userName : oldPost.userName,
avatar: updates.avatar !== undefined ? updates.avatar : oldPost.avatar,
text: ... | AST#method_declaration#Left private createNewPost AST#parameter_list#Left ( AST#parameter#Left oldPost : AST#type_annotation#Left AST#primary_type#Left Post AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#Left AST#generic_type... | private createNewPost(oldPost: Post, updates: Partial<Post>): Post {
return {
id: updates.id !== undefined ? updates.id : oldPost.id,
userName: updates.userName !== undefined ? updates.userName : oldPost.userName,
avatar: updates.avatar !== undefined ? updates.avatar : oldPost.avatar,
text: ... | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/MomentsPage.ets#L266-L279 | 90b6a2c847a4ea8bef154e26a32257cdd8b4ec2e | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | Chat message for UI display | export interface ChatMessage {
id: string;
content: string;
isUser: boolean;
timestamp: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ChatMessage AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#type_annotation#Left ... | export interface ChatMessage {
id: string;
content: string;
isUser: boolean;
timestamp: number;
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L23-L28 | 69e34db25933f9a76ce2be449f41a5eaab1169b1 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets | arkts | updateCurState | 更新AVSession实例状态
@param {AVSessionUpdateState} updateState 更新状态数据
@returns {void} | updateCurState(updateState: AVSessionUpdateState): void {
const newState: string | undefined = updateState.playerState;
const newElapsedTime: number | undefined = updateState.curTime;
const newLoopMode: number | undefined = updateState.loopMode;
logger.info('avsession updateCurState', newState + '', new... | AST#method_declaration#Left updateCurState AST#parameter_list#Left ( AST#parameter#Left updateState : AST#type_annotation#Left AST#primary_type#Left AVSessionUpdateState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void ... | updateCurState(updateState: AVSessionUpdateState): void {
const newState: string | undefined = updateState.playerState;
const newElapsedTime: number | undefined = updateState.curTime;
const newLoopMode: number | undefined = updateState.loopMode;
logger.info('avsession updateCurState', newState + '', new... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L232-L257 | 2c7bfcd15aef172aab27113d46aad8ab5acf0bf8 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/promise_callback/promise_callback_001_T.ets | arkts | Introduction 异步-Promise-then | export function promise_callback_001_T(taint_src : string) {
let p = f(taint_src);
p.then((result) => {
taint.Sink(result);
})
} | AST#export_declaration#Left export AST#function_declaration#Left function promise_callback_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem... | export function promise_callback_001_T(taint_src : string) {
let p = f(taint_src);
p.then((result) => {
taint.Sink(result);
})
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/promise_callback/promise_callback_001_T.ets#L6-L11 | 959665479a15fd6642e936684a5b2a265cc97187 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkWebSecurity/arkwebsecurity/src/main/ets/pages/ErrorSamples/SetCookies.ets | arkts | unknownUrl from external source | build() {
Column() {
Button('configCookieSync')
.onClick(() => {
try {
// unknownUrl is not verified.
webview.WebCookieManager.configCookieSync(this.unknownUrl, 'a=b');
} catch (error) {
hilog.error(0x0000, 'ArkWebSecurity',
`ErrorC... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'configCookieSync' AST#exp... | build() {
Column() {
Button('configCookieSync')
.onClick(() => {
try {
webview.WebCookieManager.configCookieSync(this.unknownUrl, 'a=b');
} catch (error) {
hilog.error(0x0000, 'ArkWebSecurity',
`ErrorCode: ${(error as BusinessError... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkWebSecurity/arkwebsecurity/src/main/ets/pages/ErrorSamples/SetCookies.ets#L27-L41 | 713f314289f0d3b622308ba5a6c839d511817322 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/floatwindow/Index.ets | arkts | FloatWindowMainPage | 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 { FloatWindowMainPage } from './src/main/ets/pages/FloatWindowMainPage' | AST#export_declaration#Left export { FloatWindowMainPage } from './src/main/ets/pages/FloatWindowMainPage' AST#export_declaration#Right | export { FloatWindowMainPage } from './src/main/ets/pages/FloatWindowMainPage' | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/floatwindow/Index.ets#L15-L15 | 2045f317df8d0df21416507f2fd70719bc4275fa | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/KvUtil.ets | arkts | put | 添加指定类型的键值对到数据库。
@param key 要添加数据的Key
@param value 要添加数据的value,支持Uint8Array、number 、 string 、boolean。
@param callback | static async put(key: string, value: Uint8Array | string | number | boolean): Promise<void> {
let kvStore = await KvUtil.getKvStore();
return kvStore.put(key, value);
} | AST#method_declaration#Left static async put 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 value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8... | static async put(key: string, value: Uint8Array | string | number | boolean): Promise<void> {
let kvStore = await KvUtil.getKvStore();
return kvStore.put(key, value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L61-L64 | 925bbc0670569d5fc20bb84ca69cdfb0bb207668 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | releaseAVPlayer | 释放AVPlayer资源 | releaseAVPlayer(): void {
if (!this.avPlayer) {
return;
}
this.avPlayer.release();
this.avPlayer = undefined;
} | AST#method_declaration#Left releaseAVPlayer AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left ... | releaseAVPlayer(): void {
if (!this.avPlayer) {
return;
}
this.avPlayer.release();
this.avPlayer = undefined;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets#L66-L73 | 0a880f2c9dd78607529792dc7b0832105486f475 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listslidetohistory/src/main/ets/model/BasicDataSource.ets | arkts | 附近的人主题数据 | export class FriendMoment {
id: string; // 唯一id
userName: string; // 用户名
avatar: string; // 头像
text: string; // 文字
image?: string; // 文字配图
constructor(id: string, userName: string, avatar: string, text: string, image?: string) {
this.id = id;
this.userName = userName;
this.avatar = avatar;
... | AST#export_declaration#Left export AST#class_declaration#Left class FriendMoment AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 唯一id AST#property_declaration#Left userName... | export class FriendMoment {
id: string;
userName: string;
avatar: string;
text: string;
image?: string; 配图
constructor(id: string, userName: string, avatar: string, text: string, image?: string) {
this.id = id;
this.userName = userName;
this.avatar = avatar;
this.text = text;
if (im... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/src/main/ets/model/BasicDataSource.ets#L74-L90 | 1b12b820ceedce736f9d0aaf5eafd4cfa52b1128 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/view/ContributorsPage.ets | arkts | ContributorsContent | 贡献者页面内容视图
@returns {void} 无返回值 | @Builder
private ContributorsContent() {
Text("贡献者页面内容视图")
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ContributorsContent 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 Text ( AST#expression#Left "贡献者页面内容视图" AST#exp... | @Builder
private ContributorsContent() {
Text("贡献者页面内容视图")
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/ContributorsPage.ets#L33-L36 | 2748514af71d1fdaa332f50176fe4def6df7a9a3 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/NotificationUtil.ets | arkts | publishPicture | 推送带有图片的通知
@param options 通知实体
@returns | static async publishPicture(options: NoticeOptions): Promise<void> {
if (!options) {
options = new NoticeOptions();
}
if (!options.id) {
options.id = RandomUtil.randomNumber(300001, 400000);
}
if (options.isOngoing == undefined) {
options.isOngoing = true;
}
if (options.isS... | AST#method_declaration#Left static async publishPicture AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NoticeOptions 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 publishPicture(options: NoticeOptions): Promise<void> {
if (!options) {
options = new NoticeOptions();
}
if (!options.id) {
options.id = RandomUtil.randomNumber(300001, 400000);
}
if (options.isOngoing == undefined) {
options.isOngoing = true;
}
if (options.isS... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L303-L373 | 666e2fedae7f91d5fb94ca9443a6ef0c2c25abaa | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildMemberRemove.ets | arkts | handle | 应用约束10:显式指定参数类型,避免使用any | handle(packet: Object): void {
const client = this.packetManager.client;
const data: Object = packet.d; // 使用Object代替未明确类型的对象
client.actions.GuildMemberRemove.handle(data);
} | AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#... | handle(packet: Object): void {
const client = this.packetManager.client;
const data: Object = packet.d;
client.actions.GuildMemberRemove.handle(data);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildMemberRemove.ets#L6-L10 | 2e76f8403a17d96176e9e04e444637f1812187ce | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets | arkts | getImageSource | 获取图片的属性
@param context
@param imageSrc | async getImageSource(imageSrc: string): Promise<ImageAttribute> {
Logger.info(`getImageSource start`);
let media = photoAccessHelper.getPhotoAccessHelper(AppStorage.get<common.UIAbilityContext>('context'));
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates... | AST#method_declaration#Left async getImageSource AST#parameter_list#Left ( AST#parameter#Left imageSrc : 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 getImageSource(imageSrc: string): Promise<ImageAttribute> {
Logger.info(`getImageSource start`);
let media = photoAccessHelper.getPhotoAccessHelper(AppStorage.get<common.UIAbilityContext>('context'));
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets#L187-L220 | ee35d07030a078294c760764eae3f66bfc101fd3 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/viewmodel/WindowViewModel.ets | arkts | getVerifyMap | 获取验证码集合
Get verify items map.
@return {Map<number, VerifyItem>} verifyMap - 验证码映射表 | getVerifyMap(): Map<number, VerifyItem> {
let verifyMap: Map<number, VerifyItem> = new Map();
// Source: 从 WindowManager 项目迁移的验证码数据
verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK'));
verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR'));
return v... | AST#method_declaration#Left getVerifyMap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#... | getVerifyMap(): Map<number, VerifyItem> {
let verifyMap: Map<number, VerifyItem> = new Map();
verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK'));
verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR'));
return verifyMap;
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/WindowViewModel.ets#L30-L36 | 060431306cdb63b0fd51f8d3319095d2abe69318 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets | arkts | getHardQuestionCount | 获取困难题数量
@returns | public getHardQuestionCount(): number {
return this.examDetails.filter(item => item.classificationType === ClassificationTypeEnum.HARD).length;
} | AST#method_declaration#Left public getHardQuestionCount 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#mem... | public getHardQuestionCount(): number {
return this.examDetails.filter(item => item.classificationType === ClassificationTypeEnum.HARD).length;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L244-L246 | 73c1ecd819d889c46a35c442bb7b57f0e6149e6d | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/TextPickerDialogView.ets | arkts | aboutToAppear | 底部导航条的高度 | aboutToAppear(): void {
//设置默认值
this.setDefaultValue()
this.isBottomCheck = !!this.options.bottomCheck?.isChecked
this.indicatorHeight = SysUtil.getIndicatorHeight();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { //设置默认值 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#ex... | aboutToAppear(): void {
this.setDefaultValue()
this.isBottomCheck = !!this.options.bottomCheck?.isChecked
this.indicatorHeight = SysUtil.getIndicatorHeight();
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/TextPickerDialogView.ets#L24-L29 | d3f978122b826353ebf1ce17a5126658894985dd | github |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets | arkts | getReferenceLineBol | 参考线持久化,再次进入,确定开关是否开启 | getReferenceLineBol(bol: boolean): void {
let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig;
cameraConfig.referenceLineBol = bol;
GlobalContext.get().setObject('cameraConfig', cameraConfig);
this.referenceLineBol = bol;
} | AST#method_declaration#Left getReferenceLineBol AST#parameter_list#Left ( AST#parameter#Left bol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type... | getReferenceLineBol(bol: boolean): void {
let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig;
cameraConfig.referenceLineBol = bol;
GlobalContext.get().setObject('cameraConfig', cameraConfig);
this.referenceLineBol = bol;
} | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets#L54-L59 | ec5827768cdeea9f3441e8d5da73d4ad5fdbb806 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/PrefUtil.ets | arkts | @Author 幻凡ss
@DateTime 2024/7/4 00:12
@TODO PrefUtil 首选项工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Feftool | export class PrefUtil {
/**
* 全局缓存
*/
private static pref: dataPreferences.Preferences | null = null
/**
* 默认首选项名称
*/
private static prefName: string = 'ef_data' //首选项默认名字
/**
* 首选项初始化
* @param context
* @param name
*/
static init(name?: string) {
if (name) {
PrefUtil.prefN... | AST#export_declaration#Left export AST#class_declaration#Left class PrefUtil AST#class_body#Left { /**
* 全局缓存
*/ AST#property_declaration#Left private static pref : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left dataPreferences . Preferences AST#qualified_type#Right AST... | export class PrefUtil {
private static pref: dataPreferences.Preferences | null = null
private static prefName: string = 'ef_data'
static init(name?: string) {
if (name) {
PrefUtil.prefName = name;
}
PrefUtil.pref = dataPreferences.getPreferencesSync(getContext(), { name: PrefUtil.pref... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/PrefUtil.ets#L27-L136 | 4b368bc3608ac1681850c5e1c94722ce427c187d | gitee | |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/io/FsFile.ets | arkts | writeJson | Function to write JSON data to a file.
@param file The file to write JSON data to.
@param data The JSON data to write. | function writeJson<T>(file: FsFile, data: T): void {
const text = JSON.stringify(data);
fs.writeFileSync(file, text, 'utf-8');
} | AST#function_declaration#Left function writeJson AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#primary_type#Left FsFile AST#primary_type#Right AST#type_annotation#Right AST#parame... | function writeJson<T>(file: FsFile, data: T): void {
const text = JSON.stringify(data);
fs.writeFileSync(file, text, 'utf-8');
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/io/FsFile.ets#L53-L56 | 26ad2415e7487739d907861858a50dc228d30e42 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/BookGroups.ets | arkts | BookGroups | @author 2008
@datetime 2024/7/22 22:39
@className: BookGroup
书籍分组 | @Observed
export class BookGroups {
//分组Id
groupId?:number;
//分组名称
groupName:string = "";
//封面是否仅用当前分组
coverOnly:boolean = false;
//封面样式类型 0默认1自定义2全图
coverType:number = 0;
//分组封面
coverUrl?:string;
//分组描述
groupDescribe?:string;
//排序
sort:number = 1;
//是否自动刷新
enableRefresh:boolean = true;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class BookGroups AST#class_body#Left { //分组Id AST#property_declaration#Left groupId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /... | @Observed
export class BookGroups {
groupId?:number;
groupName:string = "";
coverOnly:boolean = false;
coverType:number = 0;
coverUrl?:string;
groupDescribe?:string;
sort:number = 1;
enableRefresh:boolean = true;
show:boolean = true;
groupType:number = 0;
createTim... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/BookGroups.ets#L7-L45 | 2d584b5ad85f57ed9e78d847cc58fddfa5e5a4e9 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/CustomContentBuilderProxy.ets | arkts | localizedContentAreaPadding | 自定义内容弹窗内padding(可选)
@default 为空时,系统默认{ top:24vp, bottom:24vp, right:24vp, left:24vp } | localizedContentAreaPadding(localizedContentAreaPadding: LocalizedPadding) {
this.builderOptions.localizedContentAreaPadding = localizedContentAreaPadding;
return this;
} | AST#method_declaration#Left localizedContentAreaPadding AST#parameter_list#Left ( AST#parameter#Left localizedContentAreaPadding : AST#type_annotation#Left AST#primary_type#Left LocalizedPadding AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS... | localizedContentAreaPadding(localizedContentAreaPadding: LocalizedPadding) {
this.builderOptions.localizedContentAreaPadding = localizedContentAreaPadding;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/CustomContentBuilderProxy.ets#L66-L69 | 5940666b4f2bfba335a42643e5790fc7ba7ea668 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CrashUtil.ets | arkts | getExceptionList | 获取异常日志的集合。 | static async getExceptionList(): Promise<ExceptionInfo[]> {
let json = await CrashUtil.getExceptionJson();
if (StrUtil.isNotEmpty(json)) {
return JSONUtil.jsonToArray<ExceptionInfo>(json);
}
return [];
} | AST#method_declaration#Left static async getExceptionList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ExceptionInfo [ ] AST#array_type#Righ... | static async getExceptionList(): Promise<ExceptionInfo[]> {
let json = await CrashUtil.getExceptionJson();
if (StrUtil.isNotEmpty(json)) {
return JSONUtil.jsonToArray<ExceptionInfo>(json);
}
return [];
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L143-L149 | 93e1d80238f72e0d204f06f8cb875b0dce7109bb | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/CorePage.ets | arkts | CounterCard | 计数器卡片
@returns {void} 无返回值 | @Builder
private CounterCard(): void {
Column() {
ColumnBase({ widthValue: P100 }) {
Text($r("app.string.main_core_counter_label"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_subtitle"));
SpaceVerticalSmall();
Text(`${this.counterState.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CounterCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e... | @Builder
private CounterCard(): void {
Column() {
ColumnBase({ widthValue: P100 }) {
Text($r("app.string.main_core_counter_label"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_subtitle"));
SpaceVerticalSmall();
Text(`${this.counterState.... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/CorePage.ets#L88-L108 | a5c8cd1a0c09811f8aab911ac8edb7b0e7d8719c | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets | arkts | The constant of ServicesComponent. | export class GoodsService {
/**
* The space of List.
*/
static readonly SPACE: number = 20;
/**
* The height of List.
*/
static readonly LIST_HEIGHT: number = 94;
}; | AST#export_declaration#Left export AST#class_declaration#Left class GoodsService AST#class_body#Left { /**
* The space of List.
*/ AST#property_declaration#Left static readonly SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 A... | export class GoodsService {
static readonly SPACE: number = 20;
static readonly LIST_HEIGHT: number = 94;
}; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets#L359-L369 | 613c00899c7d5dd1e8794d1a8fb91ecb3fce4168 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LanguageSettingsPage.ets | arkts | buildSettingItem | 构建设置项 | @Builder
buildSettingItem(title: string, description: string, value: boolean, onChanged: (value: boolean) => void) {
Row({ space: 16 }) {
Column({ space: 4 }) {
Text(title)
.fontSize(14)
.fontColor($r('app.color.text_primary'))
.alignRules({ left: { anchor: '__container... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSettingItem 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_annota... | @Builder
buildSettingItem(title: string, description: string, value: boolean, onChanged: (value: boolean) => void) {
Row({ space: 16 }) {
Column({ space: 4 }) {
Text(title)
.fontSize(14)
.fontColor($r('app.color.text_primary'))
.alignRules({ left: { anchor: '__container... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L459-L486 | 4ea14dd587aabee3b3f610c978ac33b01242191c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/data/WaterFlowDataSource.ets | arkts | 瀑布流子组件懒加载数据结构 | export class WaterFlowDataSource implements IDataSource {
private dataArray: ViewItem[] = [];
private listeners: DataChangeListener[] = [];
totalCount(): number {
return this.dataArray.length;
}
getData(index: number): ViewItem {
return this.dataArray[index];
}
notifyDataReload(): void {
th... | AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ViewItem [ ] AS... | export class WaterFlowDataSource implements IDataSource {
private dataArray: ViewItem[] = [];
private listeners: DataChangeListener[] = [];
totalCount(): number {
return this.dataArray.length;
}
getData(index: number): ViewItem {
return this.dataArray[index];
}
notifyDataReload(): void {
th... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/data/WaterFlowDataSource.ets#L19-L114 | 13a6923fb0a030c2b86ee29e4a4419959169234c | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/src/main/ets/interceptors/LogInterceptor.ets | arkts | logResponse | 打印响应日志
@param {AxiosResponse} response - 响应结果
@returns {void} 无返回值 | function logResponse(response: AxiosResponse): void {
const config: InternalAxiosRequestConfig = response.config as InternalAxiosRequestConfig;
const url: string = buildRequestUrl(config);
const status: string = String(response.status);
const data: string = safeStringify(response.data as Unknown, true);
logIn... | AST#function_declaration#Left function logResponse AST#parameter_list#Left ( AST#parameter#Left response : AST#type_annotation#Left AST#primary_type#Left AxiosResponse AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS... | function logResponse(response: AxiosResponse): void {
const config: InternalAxiosRequestConfig = response.config as InternalAxiosRequestConfig;
const url: string = buildRequestUrl(config);
const status: string = String(response.status);
const data: string = safeStringify(response.data as Unknown, true);
logIn... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L85-L96 | 574cd7e073ca111673a65fb64237825c917b4cad | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/social/CommunityPage.ets | arkts | buildTabBar | 构建标签栏 | @Builder
buildTabBar() {
Row() {
ForEach(this.tabs, (tab, index: number) => {
Column({ space: 4 }) {
Stack() {
Image($r(`app.media.ic_${tab.icon}`))
.width('20vp')
.height('20vp')
.fillColor(this.selectedTab === index ? $r('app.color.pr... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#... | @Builder
buildTabBar() {
Row() {
ForEach(this.tabs, (tab, index: number) => {
Column({ space: 4 }) {
Stack() {
Image($r(`app.media.ic_${tab.icon}`))
.width('20vp')
.height('20vp')
.fillColor(this.selectedTab === index ? $r('app.color.pr... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/CommunityPage.ets#L129-L174 | 66bd5b92a3ca4c4afb499428b4a626f0b8873ddc | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_json/src/main/ets/json/JSONArrayList.ets | arkts | if | 判断是否是json数组 | if (JSONUtil.isJSONArray(replaceStr)) {
//转换成jsonArray
let res = JSONArrayList.parse(replaceStr);
//返回结果
let list = new ArrayList<T>();
//递归
res.forEach(item => {
if (item instanceof HashMap) {
let tmp = item as HashMap<string, JSONValue>;
let jsonObj = ne... | AST#method_declaration#Left if AST#ERROR#Left ( JSONUtil . isJSONArray AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left replaceStr AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left ) AST#ERROR#Right AST#block_statement#Left { //转换成jsonArray AST#statement#Left AST#variable_declaration#Left let AS... | if (JSONUtil.isJSONArray(replaceStr)) {
let res = JSONArrayList.parse(replaceStr);
let list = new ArrayList<T>();
res.forEach(item => {
if (item instanceof HashMap) {
let tmp = item as HashMap<string, JSONValue>;
let jsonObj = new JSONObject();
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONArrayList.ets#L69-L92 | f93ecf0fc82269d73e12c788dc8f1b71c2b4a0c4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/etswrapper/src/main/cpp/types/libetswrapper/index.d.ets | arkts | 设置当前活跃的abilityID | export const setTopAbilityID: (abilityID: string) => void; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left setTopAbilityID : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left abilityID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#... | export const setTopAbilityID: (abilityID: string) => void; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/cpp/types/libetswrapper/index.d.ets#L36-L36 | 8b0c80cb70c5ec0f08bab2d749b07ffc066948cc | gitee | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | example/BasicUsage.ets | arkts | concat | 视频拼接 | concat(): void {
const cmd = FFmpegFactory.concat(['/p1.mp4', '/p2.mp4', '/p3.mp4'], '/merged.mp4');
this.run(cmd);
} | AST#method_declaration#Left concat AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cmd = AST#expressi... | concat(): void {
const cmd = FFmpegFactory.concat(['/p1.mp4', '/p2.mp4', '/p3.mp4'], '/merged.mp4');
this.run(cmd);
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L61-L64 | 0e6405e0c5141a578590aae44ed8f268ff721e7a | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.