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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/GoodsIdRequest.ets | arkts | @file 商品 ID 请求参数
@author Joker.X | export class GoodsIdRequest {
/**
* 商品 ID
*/
goodsId: number = 0;
/**
* @param {Partial<GoodsIdRequest>} init - 初始化数据
*/
constructor(init?: Partial<GoodsIdRequest>) {
if (!init) {
return;
}
this.goodsId = init.goodsId ?? this.goodsId;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class GoodsIdRequest AST#class_body#Left { /**
* 商品 ID
*/ AST#property_declaration#Left goodsId : 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#... | export class GoodsIdRequest {
goodsId: number = 0;
constructor(init?: Partial<GoodsIdRequest>) {
if (!init) {
return;
}
this.goodsId = init.goodsId ?? this.goodsId;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/GoodsIdRequest.ets#L5-L20 | e78e4a7aeb34a5a7e441b8b5b346c96be9f49cb0 | github | |
HunZiLei/ArkTS_PokePomodoro.git | 61a844a28808c014c39de7a868b0d331052d1bd4 | entry/src/main/ets/components/IndexTabPages/DDLState.ets | arkts | aboutToAppear | 数据库操作封装 结束 组件生命周期 | aboutToAppear() {
Logger.debug(`[DDLState] aboutToAppear`)
if (this.firstOpen) {
this.taskTable.getRdbStore(() => {
this.taskTable.query('', (result: TaskData[]) => {
this.tasks = result
for (let i = 0; i < this.tasks.length; ++i) {
this.tasks[i].setDDLState()
... | 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 Logger AST#expression#Right . debug AST#member_exp... | aboutToAppear() {
Logger.debug(`[DDLState] aboutToAppear`)
if (this.firstOpen) {
this.taskTable.getRdbStore(() => {
this.taskTable.query('', (result: TaskData[]) => {
this.tasks = result
for (let i = 0; i < this.tasks.length; ++i) {
this.tasks[i].setDDLState()
... | https://github.com/HunZiLei/ArkTS_PokePomodoro.git/blob/61a844a28808c014c39de7a868b0d331052d1bd4/entry/src/main/ets/components/IndexTabPages/DDLState.ets#L139-L157 | 9dd210a3c8a42d19a991b73edb115cd15d975fd2 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/plan/plan.ets | arkts | getShowContent | 每周锻炼时长 网路接口 | async getShowContent() {
let httpRequest = http.createHttp();
let url = address.IP+`/getVipUserCourseInfo`;
try {
let response = await httpRequest.request(url, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json',
'Authorization': `Bearer $... | AST#method_declaration#Left async getShowContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST... | async getShowContent() {
let httpRequest = http.createHttp();
let url = address.IP+`/getVipUserCourseInfo`;
try {
let response = await httpRequest.request(url, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json',
'Authorization': `Bearer $... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L152-L175 | 1c52a05f3002d846a695970b7076f2d786ee2466 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | executeTransaction | 执行事务
@param operation 事务操作
@returns 操作结果 | async executeTransaction<T>(operation: () => Promise<T>): Promise<T> {
await this.beginTransaction();
try {
const result = await operation();
await this.commit();
return result;
} catch (error) {
await this.rollback();
throw new Error(String(error));
}
} | AST#method_declaration#Left async executeTransaction AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left operation : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => ... | async executeTransaction<T>(operation: () => Promise<T>): Promise<T> {
await this.beginTransaction();
try {
const result = await operation();
await this.commit();
return result;
} catch (error) {
await this.rollback();
throw new Error(String(error));
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L542-L552 | 2a3c5db4972998107ba51ec68abeb96e93a8e975 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 生日统计 | export interface BirthdayStats {
monthlyDistribution: { month: number; count: number; percentage: number } | AST#export_declaration#Left export AST#interface_declaration#Left interface BirthdayStats AST#ERROR#Left { monthlyDistribution : AST#ERROR#Right AST#object_type#Left { AST#type_member#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Righ... | export interface BirthdayStats {
monthlyDistribution: { month: number; count: number; percentage: number } | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AnalyticsService.ets#L43-L44 | 1e677afb13805180340ea398889675a887230621 | github | |
Leeson-Wong/ark-layer.git | 9efa3553414a6b1eee890e3858c8cdcb308535d7 | core/PhaseExample.ets | arkts | ConfigService | ==================== 导出 ==================== | export {
// 示例服务
ConfigService,
DatabaseService,
UserService,
AuthService,
AnalyticsService,
NotificationService,
LogService
} | AST#export_declaration#Left export { // 示例服务 ConfigService , DatabaseService , UserService , AuthService , AnalyticsService , NotificationService , LogService } AST#export_declaration#Right | export {
ConfigService,
DatabaseService,
UserService,
AuthService,
AnalyticsService,
NotificationService,
LogService
} | https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseExample.ets#L345-L354 | a67fec0bb4956da1f267c9349b63ed06db804316 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/pages/Login.ets | arkts | navigateToRegister | 跳转到注册页 | navigateToRegister(): void {
Router.push(Routes.REGISTER);
} | AST#method_declaration#Left navigateToRegister 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#expre... | navigateToRegister(): void {
Router.push(Routes.REGISTER);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/pages/Login.ets#L60-L62 | 5c6a9429bf7dbecc42654e6b32d595025e4e2927 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets | arkts | pauseTranscoderingProcess | 暂停转码对应的流程。 | async pauseTranscoderingProcess() {
if (canIUse('SystemCapability.Multimedia.Media.AVTranscoder')) {
if (this.avTranscoder != undefined) { // 仅在调用start返回后调用pause为合理调用。
await this.avTranscoder.pause();
}
}
} | AST#method_declaration#Left async pauseTranscoderingProcess AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( ... | async pauseTranscoderingProcess() {
if (canIUse('SystemCapability.Multimedia.Media.AVTranscoder')) {
if (this.avTranscoder != undefined) {
await this.avTranscoder.pause();
}
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets#L91-L97 | fc398eb50bd99b56fee5bb74e7956f3bd87eb801 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | DFX/Debug/entry/src/main/ets/component/DebugInfo.ets | arkts | DebugInfo | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | @Component
export default struct DebugInfo {
@Prop debugWindow: boolean = false
@Link pssMemory: number
@Link sharedMemory: number
@Link privateMemory: number
build() {
Stack({ alignContent: Alignment.Top }) {
Text($r('app.string.navigation_information'))
.fontSize(25)
.width('80%')... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct DebugInfo AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right debugWindow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#t... | @Component
export default struct DebugInfo {
@Prop debugWindow: boolean = false
@Link pssMemory: number
@Link sharedMemory: number
@Link privateMemory: number
build() {
Stack({ alignContent: Alignment.Top }) {
Text($r('app.string.navigation_information'))
.fontSize(25)
.width('80%')... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/DFX/Debug/entry/src/main/ets/component/DebugInfo.ets#L16-L65 | 8dc9d96c825d13133584b149ee9bb86b706b751b | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ShareUtils.ets | arkts | 分享工具类 (Stage模型)
功能:封装文本、链接、图片、文件、PDF及混合内容分享
类似Swift中的static工具类或Kotlin中的object单例 | export class ShareUtils {
// 私有静态属性,存储UIAbility上下文
private static context: common.UIAbilityContext | null = null;
/**
* 初始化上下文
* @param context - UIAbility上下文
* 类似SwiftUI中的EnvironmentObject或Kotlin中的Context注入
*/
static init(context: common.UIAbilityContext): void {
ShareUtils.context = context;
... | AST#export_declaration#Left export AST#class_declaration#Left class ShareUtils AST#class_body#Left { // 私有静态属性,存储UIAbility上下文 AST#property_declaration#Left private static context : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Rig... | export class ShareUtils {
private static context: common.UIAbilityContext | null = null;
static init(context: common.UIAbilityContext): void {
ShareUtils.context = context;
}
static shareThisAppWithLoadedLink(){
ShareUtils.shareLink(AppSettings.Address.share_app, getString($r('app.string.app_nam... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L29-L392 | e128d09200c47abc34e8cdac7d5b72d328a63cdd | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | getLastLocation | 获取上一次位置
@returns | static getLastLocation(): geoLocationManager.Location {
return geoLocationManager.getLastLocation();
} | AST#method_declaration#Left static getLastLocation AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left geoLocationManager . Location AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statemen... | static getLastLocation(): geoLocationManager.Location {
return geoLocationManager.getLastLocation();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L81-L83 | a3b39f6dd22104652169570e7da37ca517b0d3c0 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/pages/inform.ets | arkts | deleteNotification | 删除单个通知 | private deleteNotification(id: number) {
this.notifications = this.notifications.filter(item => item.id !== id);
this.unreadCount = this.calculateUnreadCount();
CommonVariable.unreadCount=this.unreadCount;
} | AST#method_declaration#Left private deleteNotification 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#builder_function_body#Left { AST#expression_statement#Left AS... | private deleteNotification(id: number) {
this.notifications = this.notifications.filter(item => item.id !== id);
this.unreadCount = this.calculateUnreadCount();
CommonVariable.unreadCount=this.unreadCount;
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/inform.ets#L168-L172 | 9103a9c234ed51f48e16902bed443e127edf5c19 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/SafeAreaDemoPage.ets | arkts | 构建安全区示例页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.demo_safe_area_title"),
viewModel: this.vm
}) {
this.SafeAreaContent();
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_saf... | build() {
AppNavDestination({
title: $r("app.string.demo_safe_area_title"),
viewModel: this.vm
}) {
this.SafeAreaContent();
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/SafeAreaDemoPage.ets#L28-L35 | 2d5d35813ae9b97cfe3df6e30ace93e11acfceea | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | setLanguage | 设置应用的语言。仅支持主线程调用。
@param language 设置语言,当前支持的语言列表可以通过getSystemLanguages()获取。 | static setLanguage(language: string) {
AppUtil.getApplicationContext().setLanguage(language);
} | AST#method_declaration#Left static setLanguage AST#parameter_list#Left ( AST#parameter#Left language : 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#builder_function_body#Left { AST#expression_statement#Left AST#... | static setLanguage(language: string) {
AppUtil.getApplicationContext().setLanguage(language);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L185-L187 | 8ec650b6336259b6d9990a5316e80c8115a41250 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | sendMessageToRemoteService | 连接成功后发送消息 | async function sendMessageToRemoteService(score) {
console.log('[game]connectRemoteService sendMessageToRemoteService:')
if (mRemote == null) {
console.log('[game]connectRemoteService mRemote == null')
// prompt.showToast({
// message: "mRemote is null"
// });
return;
}
let option... | AST#function_declaration#Left async function sendMessageToRemoteService AST#parameter_list#Left ( AST#parameter#Left score AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#membe... | async function sendMessageToRemoteService(score) {
console.log('[game]connectRemoteService sendMessageToRemoteService:')
if (mRemote == null) {
console.log('[game]connectRemoteService mRemote == null')
return;
}
let option = new rpc.MessageOption();
let data = new rpc.MessageParcel();
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L103-L119 | b8cc164b33f6973fe43ae5ec4a7477bae1351842 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/DataSource.ets | arkts | getData | 获取指定数据项 | getData(index: number): string {
return this.faultMessage[index];
} | AST#method_declaration#Left 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 string AST#primary_type#Right AS... | getData(index: number): string {
return this.faultMessage[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/DataSource.ets#L91-L93 | edca7aa2ffb90839ac8610181ce50b3b4d2b45ea | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets | arkts | getSm4DecryptProperties | Sm4解密密钥属性信息 | function getSm4DecryptProperties(properties: HuksProperties[]): void {
let index = 0;
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM4
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128,
... | AST#function_declaration#Left function getSm4DecryptProperties AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | function getSm4DecryptProperties(properties: HuksProperties[]): void {
let index = 0;
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM4
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128,
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L98-L125 | a303b9865b284b0e5291de3bb10a577170462ef2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/Index.ets | arkts | VerticalAndHorizontalListComponent | 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 { VerticalAndHorizontalListComponent } from './src/main/ets/view/VerticalAndHorizontalList'; | AST#export_declaration#Left export { VerticalAndHorizontalListComponent } from './src/main/ets/view/VerticalAndHorizontalList' ; AST#export_declaration#Right | export { VerticalAndHorizontalListComponent } from './src/main/ets/view/VerticalAndHorizontalList'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/Index.ets#L16-L16 | ebfcaab2c546ba390510a48a0241413fed4e8a45 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LIstOptimizationBak/entry/src/main/ets/component/ReusableArticleCardView.ets | arkts | ReusableArticleCardView | DocsCode 1 | @Component
@Reusable
export struct ReusableArticleCardView {
@Prop articleItem: LearningResource = new LearningResource();
@Prop isCollected: boolean = false;
@Prop isLiked: boolean = false;
onCollected?: () => void;
onLiked?: () => void;
aboutToReuse(params: Record<string, Object>): void {
this.onColl... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right AST#decorator#Left @ Reusable AST#decorator#Right export struct ReusableArticleCardView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right articleItem : AST#type_annotation#Left AS... | @Component
@Reusable
export struct ReusableArticleCardView {
@Prop articleItem: LearningResource = new LearningResource();
@Prop isCollected: boolean = false;
@Prop isLiked: boolean = false;
onCollected?: () => void;
onLiked?: () => void;
aboutToReuse(params: Record<string, Object>): void {
this.onColl... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LIstOptimizationBak/entry/src/main/ets/component/ReusableArticleCardView.ets#L19-L99 | 65c4c258f2824b04dc908bb4a947d45e437217cd | gitee |
azhuge233/Wake-HarmonyOS.git | 68c4e961f9cf5fab8699af99313dd5854ea313a1 | entry/src/main/ets/wakewidget/wakeformability/WakeFormAbility.ets | arkts | onAddForm | Tips 卡片变换大小时会调用,新建变换后的 Form | onAddForm(want: Want) {
// Called to return a FormBindingData object.
const formID = want?.parameters?.[formInfo.FormParam.IDENTITY_KEY] as string;
// const formDimensions = want?.parameters?.[formInfo.FormParam.DIMENSION_KEY] as number;
Logger.debug(this.LOG_TAG, `onAddForm() formID: $... | AST#method_declaration#Left onAddForm AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // Called to return a FormBindingData object. AST#state... | onAddForm(want: Want) {
const formID = want?.parameters?.[formInfo.FormParam.IDENTITY_KEY] as string;
Logger.debug(this.LOG_TAG, `onAddForm() formID: ${formID}`);
return CommonUtils.createFormBindingData(formID);
} | https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/wakewidget/wakeformability/WakeFormAbility.ets#L19-L27 | be0289d2f76f00c68759a1e4e45a75b96e135202 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/TaskManagement/WorkScheduler/entry/src/main/ets/feature/WorkSchedulerSystem.ets | arkts | Publishes a notification of the specified content.
@param title Title of Notice.
@param text Content of Notification Text.
@param additionalText Additional text.
@permission ohos.permission.NOTIFICATION_CONTROLLER | export function publishNotification(title: string, text: string, additionalText: string): void {
notificationManager.publish({
content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title,
text,
additionalText
}
}... | AST#export_declaration#Left export AST#function_declaration#Left function publishNotification 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 text : AST#type_annotation#Le... | export function publishNotification(title: string, text: string, additionalText: string): void {
notificationManager.publish({
content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title,
text,
additionalText
}
}... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/TaskManagement/WorkScheduler/entry/src/main/ets/feature/WorkSchedulerSystem.ets#L74-L85 | a607f325e17e9464f06c7eee8827fbef47d2ec79 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets | arkts | ContentWillChange | [Start switch_the_tab_to_a_specific_tab] | @Entry
@Component
export struct ContentWillChange {
scroller: Scroller = new Scroller();
@State currentIndex: number = 2;
// [StartExclude switch_the_tab_to_a_specific_tab]
@State currentIndexTwo: number = 2;
@State currentIndexThree: number = 2;
private controller: TabsController = new TabsController();
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ContentWillChange AST#component_body#Left { AST#property_declaration#Left scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#ty... | @Entry
@Component
export struct ContentWillChange {
scroller: Scroller = new Scroller();
@State currentIndex: number = 2;
@State currentIndexTwo: number = 2;
@State currentIndexThree: number = 2;
private controller: TabsController = new TabsController();
private controllerTwo: TabsController = new TabsCo... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets#L19-L233 | 350d7e4c2da6932f3de340ec735d04569c46c5eb | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | getPrefs | 获取 Preferences 实例(懒加载并复用)
@returns {Promise<preferences.Preferences>} Preferences 实例 | private async getPrefs(): Promise<preferences.Preferences> {
try {
if (!this.prefsInstance) {
this.prefsInstance = await preferences.getPreferences(this.context, this.prefsName);
}
return this.prefsInstance;
} catch (error) {
throw this.wrapError(error, "获取 Preferences 实例失败");
... | AST#method_declaration#Left private async getPrefs 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#qualified_type#Left preferences . Preferences AST#qualified_... | private async getPrefs(): Promise<preferences.Preferences> {
try {
if (!this.prefsInstance) {
this.prefsInstance = await preferences.getPreferences(this.context, this.prefsName);
}
return this.prefsInstance;
} catch (error) {
throw this.wrapError(error, "获取 Preferences 实例失败");
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L28-L37 | 5e90e8d20839e3bf59c63256d444c6581f8ca7d4 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/advice/CosDownloaderAdviceData.ets | arkts | get | 获取单例实例 | public static get shared(): CosDownloaderAdviceData {
return this.instance;
} | AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CosDownloaderAdviceData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_stat... | public static get shared(): CosDownloaderAdviceData {
return this.instance;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/advice/CosDownloaderAdviceData.ets#L24-L26 | 90b0058ad1ff94459fb78604b36e5f0319653e85 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List/entry/src/main/ets/common/CommonConstants.ets | arkts | refresh time | export const REFRESH_TIME: number = 1500; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left REFRESH_TIME : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1500 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarati... | export const REFRESH_TIME: number = 1500; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L48-L48 | 38fe021f06f5706dbc0d7ecc7992613e54268a8f | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | setWindowBrightness | 设置屏幕亮度值。该方法已过时,推荐使用:WindowUtil.setWindowBrightness() | static async setWindowBrightness(brightness: number, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return WindowUtil.setWindowBrightness(brightness, windowClass);
} | AST#method_declaration#Left static async setWindowBrightness AST#parameter_list#Left ( AST#parameter#Left brightness : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#L... | static async setWindowBrightness(brightness: number, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return WindowUtil.setWindowBrightness(brightness, windowClass);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L585-L587 | c25c443992273df09ebce70ba1d26b41fb1bf10f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | buildSearchBar | 构建搜索栏 | @Builder
buildSearchBar() {
Column({ space: 16 }) {
// 搜索输入框
Row({ space: 12 }) {
Button() {
Text('←')
.fontSize(24)
.fontColor('#666666')
}
.type(ButtonType.Circle)
.width('40vp')
.height('40vp')
.backgroundColor('trans... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_para... | @Builder
buildSearchBar() {
Column({ space: 16 }) {
Row({ space: 12 }) {
Button() {
Text('←')
.fontSize(24)
.fontColor('#666666')
}
.type(ButtonType.Circle)
.width('40vp')
.height('40vp')
.backgroundColor('transparent')... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L200-L263 | b3ccde40055882a40eadf4ac36300a63326604df | github |
Huarrrr/MiShop_HarmonyOS.git | a94d941f50550522c8324416afe4551ed4a2df93 | entry/src/main/ets/widgets/CategoryGrid.ets | arkts | CategoryGrid | swiper + grid 翻页的宫格 分类 | @Component
export struct CategoryGrid {
private swiperController: SwiperController = new SwiperController()
@State private gridPosition: number = 0
categoryList: Array<CategoryData>
categoryPage: Array<string>
aboutToAppear(): void {
let list = []
let page = Math.ceil(this.categoryList.length / 10)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CategoryGrid AST#component_body#Left { AST#property_declaration#Left private swiperController : AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right = AST#ex... | @Component
export struct CategoryGrid {
private swiperController: SwiperController = new SwiperController()
@State private gridPosition: number = 0
categoryList: Array<CategoryData>
categoryPage: Array<string>
aboutToAppear(): void {
let list = []
let page = Math.ceil(this.categoryList.length / 10)
... | https://github.com/Huarrrr/MiShop_HarmonyOS.git/blob/a94d941f50550522c8324416afe4551ed4a2df93/entry/src/main/ets/widgets/CategoryGrid.ets#L4-L61 | d31f9429fd86177725edc458e1a0c6e9ec976932 | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/ImageKnifeDispatcher.ets | arkts | progressCallBack | 回调下载进度
@param requestList 请求列表
@param data 进度 | private progressCallBack(requestList:List<ImageKnifeRequestWithSource>, data: number) {
for (let i = 0; i < requestList.length; i++) {
let requestWithSource:ImageKnifeRequestWithSource = requestList[i]
if (requestWithSource.request.imageKnifeOption.progressListener !== undefined && requestWithSource.sou... | AST#method_declaration#Left private progressCallBack AST#parameter_list#Left ( AST#parameter#Left requestList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left List AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ImageKnifeRequestWithSource AST#primary_type#Right AST#type_a... | private progressCallBack(requestList:List<ImageKnifeRequestWithSource>, data: number) {
for (let i = 0; i < requestList.length; i++) {
let requestWithSource:ImageKnifeRequestWithSource = requestList[i]
if (requestWithSource.request.imageKnifeOption.progressListener !== undefined && requestWithSource.sou... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnifeDispatcher.ets#L334-L341 | 3d3564bbd7e900869ded7cecc4e526896fb1952e | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/ConfigService.ets | arkts | validateApiKey | 验证API密钥格式
@param apiKey - API密钥
@returns 是否有效 | private validateApiKey(apiKey: string): boolean {
// DeepSeek API密钥通常以 "sk-" 开头
if (!apiKey || apiKey.trim().length === 0) {
return false;
}
// 基本格式验证
const trimmedKey = apiKey.trim();
if (trimmedKey.length < 10) {
return false;
}
// DeepSeek密钥格式检查(可选)
// 通常格式为 sk-xxxx.... | AST#method_declaration#Left private validateApiKey AST#parameter_list#Left ( AST#parameter#Left apiKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#prim... | private validateApiKey(apiKey: string): boolean {
if (!apiKey || apiKey.trim().length === 0) {
return false;
}
const trimmedKey = apiKey.trim();
if (trimmedKey.length < 10) {
return false;
}
if (trimmedKey.startsWith('sk-')) {
return true;
}
... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/ConfigService.ets#L205-L225 | 39703868ceef749eb1639df1f13ddfa39e666422 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | createPost | 发布帖子 | async createPost(post: Omit<CommunityPost, 'id' | 'author' | 'createdAt' | 'updatedAt' | 'likes' | 'comments' | 'shares' | 'views' | 'isLiked' | 'isSaved' | 'isReported'>): Promise<CommunityPost | null> {
try {
if (!this.currentUser) {
throw new Error('User not logged in');
}
const newPos... | AST#method_declaration#Left async createPost AST#parameter_list#Left ( AST#parameter#Left post : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Omit AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CommunityPost AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Lef... | async createPost(post: Omit<CommunityPost, 'id' | 'author' | 'createdAt' | 'updatedAt' | 'likes' | 'comments' | 'shares' | 'views' | 'isLiked' | 'isSaved' | 'isReported'>): Promise<CommunityPost | null> {
try {
if (!this.currentUser) {
throw new Error('User not logged in');
}
const newPos... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L317-L346 | 301c3e243b5a54cab29bbcd3f592e39d8d334576 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWarmPlayerView.ets | arkts | onPipControlPanelStatusChange | 画中画控制中心播放状态
@param state: VHPlayerPipControlPanelStatus | onPipControlPanelStatusChange(state: VHPipControlPanelStatus){
if(state == VHPipControlPanelStatus.VH_CONTROL_PAUSE){
this.vodPlayer?.pausePlay();
}else{
this.vodPlayer?.resumePlay();
}
} | AST#method_declaration#Left onPipControlPanelStatusChange AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left VHPipControlPanelStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_co... | onPipControlPanelStatusChange(state: VHPipControlPanelStatus){
if(state == VHPipControlPanelStatus.VH_CONTROL_PAUSE){
this.vodPlayer?.pausePlay();
}else{
this.vodPlayer?.resumePlay();
}
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L174-L180 | 9485df7b95043af0ba8e29b7368fd5897173c222 | gitee |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | 构造函数,接收一个泛型数组作为参数,用于初始化数据源 | constructor(dataSource: Array<T>) {
// 初始化数据源
this.dataSource = dataSource;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dataSource : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_argumen... | constructor(dataSource: Array<T>) {
this.dataSource = dataSource;
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L11-L14 | b8480fa336a4a420e836d5d84cd705f9729eec91 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/hilogmonitormanagement/Index.ets | arkts | HiLogMonitorManagement | 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 { HiLogMonitorManagement } from "./src/main/ets/model/HiLogMonitorManagement"; | AST#export_declaration#Left export { HiLogMonitorManagement } from "./src/main/ets/model/HiLogMonitorManagement" ; AST#export_declaration#Right | export { HiLogMonitorManagement } from "./src/main/ets/model/HiLogMonitorManagement"; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/hilogmonitormanagement/Index.ets#L16-L16 | 8d07b715f9298332c22bf5c71b1d204627bf539d | gitee |
queueit/harmony-sdk.git | ba7b4b38c03730bfbe305789acba6db0012d5f5c | queueit_sdk/src/main/ets/Index.ets | arkts | QueueError | --- Error Handling --- | export { QueueError } from './data/QueueError'; | AST#export_declaration#Left export { QueueError } from './data/QueueError' ; AST#export_declaration#Right | export { QueueError } from './data/QueueError'; | https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/queueit_sdk/src/main/ets/Index.ets#L21-L21 | c576e2553d9d06582584ea24875521f95ef20600 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/StorageStatistic/entry/src/main/ets/model/StorageData.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface StorageData {
name: ResourceStr
size: number
color: ResourceColor
} | AST#export_declaration#Left export AST#interface_declaration#Left interface StorageData AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left size : AST#type_annotation#Lef... | export interface StorageData {
name: ResourceStr
size: number
color: ResourceColor
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/StorageStatistic/entry/src/main/ets/model/StorageData.ets#L16-L20 | a714c106d07558634f45f95945859b9f92a8755c | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | avscreen-capture-screen-record-master/entry/src/main/ets/model/MyAVScreenCapture.ets | arkts | Perform screen recording using the ArkTS method. | export class MyAVScreenCapture {
private static instance: MyAVScreenCapture;
private screenCapture?: media.AVScreenCaptureRecorder;
private path: string = '';
private fileName: string = '';
private file: fs.File | null = null;
private displayInfo: display.Display = AppStorage.get('displayInfo') as display.D... | AST#export_declaration#Left export AST#class_declaration#Left class MyAVScreenCapture AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left MyAVScreenCapture AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#prope... | export class MyAVScreenCapture {
private static instance: MyAVScreenCapture;
private screenCapture?: media.AVScreenCaptureRecorder;
private path: string = '';
private fileName: string = '';
private file: fs.File | null = null;
private displayInfo: display.Display = AppStorage.get('displayInfo') as display.D... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/avscreen-capture-screen-record-master/entry/src/main/ets/model/MyAVScreenCapture.ets#L23-L96 | 373172a87daf2e18849ce9d29450ecf3bb716228 | gitee | |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Tab.ets | arkts | bottomTabBuilder | 自定义 bottomTabBuilder
@param index
@param name | @Builder bottomTabBuilder(index: number, item: ColorItem) {
Column() {
Text(item.name)
.fontColor(this.bottomCurrent === index ? item.color : this.fontColor)
.fontSize(16)
.fontWeight(this.bottomCurrent === index ? FontWeight.Bold : FontWeight.Normal)
.lineHeight(22)
}.widt... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bottomTabBuilder 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#Left item : AST#type_annotation#Le... | @Builder bottomTabBuilder(index: number, item: ColorItem) {
Column() {
Text(item.name)
.fontColor(this.bottomCurrent === index ? item.color : this.fontColor)
.fontSize(16)
.fontWeight(this.bottomCurrent === index ? FontWeight.Bold : FontWeight.Normal)
.lineHeight(22)
}.widt... | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Tab.ets#L91-L99 | 3869c667bb9588f512a8d07a3b18eea5e267ce2a | github |
openharmony/communication_wifi | 387ba7fa8f98578629a6148635a4d630b2b99aa1 | wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets | arkts | getDataToDef | 获取数据并指定默认 | getDataToDef(key, def) {
let data;
if (mPreferences && mPreferences.hasSync(key)) {
data = mPreferences.getSync(key, def);
} else {
data = def;
}
LogUtil.info('getDataToDef key == ' + key + ' data == ' + data);
return data;
} | AST#method_declaration#Left getDataToDef AST#parameter_list#Left ( AST#parameter#Left key AST#parameter#Right , AST#parameter#Left def AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data AST#variable_declarator#... | getDataToDef(key, def) {
let data;
if (mPreferences && mPreferences.hasSync(key)) {
data = mPreferences.getSync(key, def);
} else {
data = def;
}
LogUtil.info('getDataToDef key == ' + key + ' data == ' + data);
return data;
} | https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets#L38-L47 | 729eb5d65db5f01763c0a28c1d102f9a97211d86 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/entry/src/main/ets/managers/WaterFlowDataSource.ets | arkts | unregisterDataChangeListener | 注销改变数据的控制器 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/entry/src/main/ets/managers/WaterFlowDataSource.ets#L88-L93 | b0dc247094764e1cd90658343c0600ddcc34c0ed | gitee |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/common/constants/CommonConstants.ets | arkts | 应用中使用的各种常量。 | export default class CommonConstants {
/**
* 关系型数据库设置。
*/
static readonly STORE_CONFIG: relationalStore.StoreConfig = {
name: 'database.db',
securityLevel: relationalStore.SecurityLevel.S1
};
/**
* Schedule 数据表设置。
*/
static readonly SCHEDULE_TABLE: Table = {
tableName: 'scheduleTable',... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* 关系型数据库设置。
*/ AST#property_declaration#Left static readonly STORE_CONFIG : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . StoreConfig AST#qualified_type#... | export default class CommonConstants {
static readonly STORE_CONFIG: relationalStore.StoreConfig = {
name: 'database.db',
securityLevel: relationalStore.SecurityLevel.S1
};
static readonly SCHEDULE_TABLE: Table = {
tableName: 'scheduleTable',
sqlCreate: 'CREATE TABLE IF NOT EXISTS scheduleTa... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/common/constants/CommonConstants.ets#L22-L111 | b32419aed91e5c7251b75dbaca1eb9a13d36ee40 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets | arkts | getHeight | Get height.
@returns | getHeight(): number {
return (this.bottom - this.top);
} | AST#method_declaration#Left getHeight AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#parenthesized_express... | getHeight(): number {
return (this.bottom - this.top);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets#L74-L76 | 8ec99d6185e84d5bc00bf3ea36b3f7d80a5a325c | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/main/MainNavigator.ets | arkts | toCategory | 跳转到分类页
@returns {void} 无返回值 | static toCategory(): void {
navigateTo(MainRoutes.Category);
} | AST#method_declaration#Left static toCategory AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_ex... | static toCategory(): void {
navigateTo(MainRoutes.Category);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/main/MainNavigator.ets#L30-L32 | 2b8e60ae150d3a3e4c3c13303e0bfb2f903c60ec | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Game/Game2048/entry/src/main/ets/model/GameModuel.ets | arkts | DataType | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Observed
export class DataType {
constructor(public id: number, public data: number) {
this.id = id;
this.data = data;
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class DataType AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left public AST#ERROR#Left id AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left number A... | @Observed
export class DataType {
constructor(public id: number, public data: number) {
this.id = id;
this.data = data;
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Game/Game2048/entry/src/main/ets/model/GameModuel.ets#L16-L22 | 21b87759cd5adcd0970c555066ab00bb236ca31e | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/AgvMovementService.ets | arkts | AGV移动控制服务类
提供AGV的移动控制、状态查询等功能 | export class AgvMovementService {
/**
* 查询AGV心跳状态
* @returns AGV心跳状态
*/
static async heartbeat(): Promise<HeartbeatResult> {
try {
console.info('[AgvMovementService] 💓 查询AGV心跳状态');
const response = await HttpUtil.get('/agv/movement/heartbeat');
interface HeartbeatData {
st... | AST#export_declaration#Left export AST#class_declaration#Left class AgvMovementService AST#class_body#Left { /**
* 查询AGV心跳状态
* @returns AGV心跳状态
*/ AST#method_declaration#Left static async heartbeat AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic... | export class AgvMovementService {
static async heartbeat(): Promise<HeartbeatResult> {
try {
console.info('[AgvMovementService] 💓 查询AGV心跳状态');
const response = await HttpUtil.get('/agv/movement/heartbeat');
interface HeartbeatData {
status?: string;
}
const heartbeatDa... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/AgvMovementService.ets#L23-L165 | c3d7b57d124b02b31ef3a0e52780e5a46dde9ec0 | github | |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/pages/QuestionBankPage.ets | arkts | getPopularCategories | 获取常用分类(前6个) | private getPopularCategories(): string[] {
// 返回前6个常用分类
return this.categories.slice(0, 8);
} | AST#method_declaration#Left private getPopularCategories AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 返回前6个常用分类 AST#statement#Left A... | private getPopularCategories(): string[] {
return this.categories.slice(0, 8);
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/pages/QuestionBankPage.ets#L110-L113 | 4059903dbfed91f4a19ee8417d343a10dad55729 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets | arkts | 用户信息 | export interface UserInfo {
id: number;
username: string;
nickname: string;
avatar: string;
email?: string;
phone?: string;
gender?: number;
birthday?: string;
signature?: string;
status?: number;
token?: string;
dreamsCount?: number;
completedDreamsCount?: number;
followersCount?: number;
... | AST#export_declaration#Left export AST#interface_declaration#Left interface UserInfo AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left username : AST#type_annotation#Left AS... | export interface UserInfo {
id: number;
username: string;
nickname: string;
avatar: string;
email?: string;
phone?: string;
gender?: number;
birthday?: string;
signature?: string;
status?: number;
token?: string;
dreamsCount?: number;
completedDreamsCount?: number;
followersCount?: number;
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L296-L312 | 61eb606e4ea896dbbd67ae2d0f78a72321799eca | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/MeViewModel.ets | arkts | getUserOrderStatistics | 用户订单统计
@returns {void} 无返回值 | getUserOrderStatistics(): void {
if (!this.userState.isLoggedIn()) {
return;
}
RequestHelper.repository<OrderCount>(this.orderRepository.getUserOrderCount())
.toast(false)
.execute()
.then((data: OrderCount): void => {
this.orderCount = OrderCount.fromResponse(data);
})... | AST#method_declaration#Left getUserOrderStatistics 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#call_expression#... | getUserOrderStatistics(): void {
if (!this.userState.isLoggedIn()) {
return;
}
RequestHelper.repository<OrderCount>(this.orderRepository.getUserOrderCount())
.toast(false)
.execute()
.then((data: OrderCount): void => {
this.orderCount = OrderCount.fromResponse(data);
})... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MeViewModel.ets#L106-L116 | 44daca8581b1213680da0d8992c8d3ebe934117f | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_json/src/main/ets/json/JSONObject.ets | arkts | parse | json字符串转换为JSONObject对象
@param jsonStr json字符串
@returns JSONObject 对象 | public static parse(jsonStr: string): JSONObject {
let json = new JSONObject();
//去除字符串中的换行符
const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n');
//转换成json对象
let jVal: Record<string, JSONValue> = JSON.parse(replaceStr);
//循环赋值
Object.entries(jVal... | AST#method_declaration#Left public static parse AST#parameter_list#Left ( AST#parameter#Left jsonStr : 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 JSONObject AST#pri... | public static parse(jsonStr: string): JSONObject {
let json = new JSONObject();
const replaceStr = jsonStr.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n');
let jVal: Record<string, JSONValue> = JSON.parse(replaceStr);
Object.entries(jVal).forEach((item) => {
i... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONObject.ets#L36-L61 | 45808014630c2273adcd922f990e0cdafc7b5200 | gitee |
ccccjiemo/egl.git | d18849c3da975ccf9373fd09874aa5637ccbe6bd | Index.d.ets | arkts | destroyContext | 销毁上下文
@param context
@returns | destroyContext(context: EGLContext): boolean; | AST#method_declaration#Left destroyContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left EGLContext 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... | destroyContext(context: EGLContext): boolean; | https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L169-L169 | ba83e7220f91481bbf2b026fc05b26d0422da733 | github |
peng-boy/arkTs.git | 68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0 | products/default/src/main/ets/views/HspView.ets | arkts | MyHSPBuilder | import { add } from 'common' | @Builder
export function MyHSPBuilder(name: string, param: string) {
MyHSP({ name: name, value: param });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function MyHSPBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : ... | @Builder
export function MyHSPBuilder(name: string, param: string) {
MyHSP({ name: name, value: param });
} | https://github.com/peng-boy/arkTs.git/blob/68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0/products/default/src/main/ets/views/HspView.ets#L3-L6 | 9da9dd4adb050209e32744c21b441566097d939c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | deleteContact | 删除联系人(同时删除相关的纪念日和祝福历史)
@param id 联系人ID | async deleteContact(id: number): Promise<boolean> {
this.checkInitialization();
try {
// 删除关联的纪念日和祝福历史(外键约束会自动处理,但为了安全起见手动删除)
await this.commemorationDAO.deleteCommemorationsByContactId(id);
await this.greetingHistoryDAO.deleteGreetingHistoryByContactId(id);
// 删除联系人
const result... | AST#method_declaration#Left async deleteContact 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 AST#generic_type#Left P... | async deleteContact(id: number): Promise<boolean> {
this.checkInitialization();
try {
await this.commemorationDAO.deleteCommemorationsByContactId(id);
await this.greetingHistoryDAO.deleteGreetingHistoryByContactId(id);
const result = await this.contactDAO.deleteContact(id);
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L136-L151 | 0f74749167e02fb37e0ae3793774cd7774c5cd16 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets | arkts | encodeECB128 | 加密-ECB模式-128位
@param str 待加密的字符串
@param aesKey AES密钥-128位
@returns | static async encodeECB128(str: string, aesKey: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeECB(str, aesKey, 'AES128', 'AES128|ECB|PKCS7', 128);
} | AST#method_declaration#Left static async encodeECB128 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | static async encodeECB128(str: string, aesKey: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeECB(str, aesKey, 'AES128', 'AES128|ECB|PKCS7', 128);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L148-L150 | b4d90145b9f9398818ee5cb9611afd5919d6833f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationManager.ets | arkts | 通知配置接口 | export interface NotificationConfig {
type: NotificationType;
title: string;
content: string;
contact?: Contact;
actionUrl?: string;
imageUrl?: string;
sound?: string;
vibration?: boolean;
priority?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationConfig AST#object_type#Left { AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left NotificationType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type... | export interface NotificationConfig {
type: NotificationType;
title: string;
content: string;
contact?: Contact;
actionUrl?: string;
imageUrl?: string;
sound?: string;
vibration?: boolean;
priority?: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L31-L41 | c444cd88ff957e3734e9693dc5b3024e27c6a0ce | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/title/TitleWithLine.ets | arkts | 构建标题组件
@returns {void} 无返回值 | build(): void {
Row() {
Column()
.width($r("app.float.space_padding_small_x"))
.height(20)
.backgroundColor(this.lineColor)
.borderRadius($r("app.float.radius_small_x"));
SpaceHorizontalSmall();
Text(this.text)
.fontSize($r("app.float.headline_large"))
... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_eleme... | build(): void {
Row() {
Column()
.width($r("app.float.space_padding_small_x"))
.height(20)
.backgroundColor(this.lineColor)
.borderRadius($r("app.float.radius_small_x"));
SpaceHorizontalSmall();
Text(this.text)
.fontSize($r("app.float.headline_large"))
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/title/TitleWithLine.ets#L29-L46 | 3b1cd414ceddf624ac56994ea997cccaa6afbd8b | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets | arkts | notifyDataChanged | Call this method to let the ChartData know that the underlying data has
changed. Calling this performs all necessary recalculations needed when
the contained data has changed. | public notifyDataChanged(): void {
this.calcMinMax();
} | AST#method_declaration#Left public notifyDataChanged 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... | public notifyDataChanged(): void {
this.calcMinMax();
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L99-L101 | cffaeb728d3f92f9406a105322f80fc4d05f3def | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | getAllConfigs | 获取所有配置 | getAllConfigs(): LLMConfig[] {
return this.configs.slice(); // 返回副本
} | AST#method_declaration#Left getAllConfigs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left LLMConfig [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left ... | getAllConfigs(): LLMConfig[] {
return this.configs.slice();
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L180-L182 | 9baeffe0c8048856599c8b344da4baeb2ff89801 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | addCryptoEvent | 添加自定义加解密拦截
@param cryptoEvent 加解密操作事件 efRcpConfig.cryptoEvent
@returns | addCryptoEvent(cryptoEvent: efRcpConfig.cryptoEvent): EfRcp {
if (this.cfg.interceptors) {
this.cfg.interceptors.push(new EfCryptoInterceptor(cryptoEvent));
} else {
this.cfg.interceptors = [new EfCryptoInterceptor(cryptoEvent)];
}
return this;
} | AST#method_declaration#Left addCryptoEvent AST#parameter_list#Left ( AST#parameter#Left cryptoEvent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . cryptoEvent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | addCryptoEvent(cryptoEvent: efRcpConfig.cryptoEvent): EfRcp {
if (this.cfg.interceptors) {
this.cfg.interceptors.push(new EfCryptoInterceptor(cryptoEvent));
} else {
this.cfg.interceptors = [new EfCryptoInterceptor(cryptoEvent)];
}
return this;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L264-L271 | 38229da913e4d12bff363d3d7153fd925e2146b7 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocache/src/main/ets/model/VideoPlayerManager.ets | arkts | initPlayer | 初始化视频播放管理器
@param context
@param surfaceId
@param callback
@returns | async initPlayer(context: common.UIAbilityContext, surfaceId: string,
callback: (avPlayer: media.AVPlayer) => void): Promise<void> {
logger.info(TAG, `initPlayer==initCamera surfaceId== ${surfaceId}`);
this.surfaceID = surfaceId;
try {
// 创建avPlayer实例对象
this.avPlayer = await media.createAVPl... | AST#method_declaration#Left async initPlayer AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left surfaceI... | async initPlayer(context: common.UIAbilityContext, surfaceId: string,
callback: (avPlayer: media.AVPlayer) => void): Promise<void> {
logger.info(TAG, `initPlayer==initCamera surfaceId== ${surfaceId}`);
this.surfaceID = surfaceId;
try {
this.avPlayer = await media.createAVPlayer();
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/model/VideoPlayerManager.ets#L48-L62 | 48675fdd43b6b5d570038aba2c2b0ca5b5ca40b4 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.inputMethodList.d.ets | arkts | @file
@kit IMEKit
Define pattern options of keyboard.
@interface PatternOptions
@syscap SystemCapability.MiscServices.InputMethodFramework
@since 11 | export interface PatternOptions {
/**
* The default selected pattern, The defaultSelected will default to 0 if left blank
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
defaultSelected?: number;
/**
* the patterns of input method.
*
* @t... | AST#export_declaration#Left export AST#interface_declaration#Left interface PatternOptions AST#object_type#Left { /**
* The default selected pattern, The defaultSelected will default to 0 if left blank
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/ AST... | export interface PatternOptions {
defaultSelected?: number;
patterns: Array<Pattern>;
action: (index: number) => void;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.inputMethodList.d.ets#L28-L53 | 44b0019f4f2c408285621d3c73cdf7cd7036f14d | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | incrementTestResultForWord | 增加单词的测试结果 | async incrementTestResultForWord(word: WordUser, result: number): Promise<void> {
word.incrementTestResult(result);
await WordUserDbAccess.shared.saveWordUser(word);
} | AST#method_declaration#Left async incrementTestResultForWord AST#parameter_list#Left ( AST#parameter#Left word : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left numbe... | async incrementTestResultForWord(word: WordUser, result: number): Promise<void> {
word.incrementTestResult(result);
await WordUserDbAccess.shared.saveWordUser(word);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L853-L856 | 6bce3c5301f61613da3b346328db87827ff93d86 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/drag_drop_tools.ets | arkts | Pass a DragEvent and some of the contents of correct type would be added to meowScratchingBoard
@param e DragEvent | export function drop_to_scratching_board(e: DragEvent, storage: LocalStorage, openLinks: boolean) {
let drop_ok = false;
try {
let drop_data_records = e.getData().getRecords();
let result_list_string: string[] = [];
let last_link: string = ''; // For comparision and avoid opening duplicate links!~
f... | AST#export_declaration#Left export AST#function_declaration#Left function drop_to_scratching_board AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left DragEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left storage : AST#type_annota... | export function drop_to_scratching_board(e: DragEvent, storage: LocalStorage, openLinks: boolean) {
let drop_ok = false;
try {
let drop_data_records = e.getData().getRecords();
let result_list_string: string[] = [];
let last_link: string = '';
for (let i = 0; i < drop_data_records.length; i++) {
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/drag_drop_tools.ets#L9-L99 | 0f2142ce69c6e0820289b624e0d400ca95d4b374 | gitee | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/AlarmClockUtils.ets | arkts | 查找最近的闹钟提醒时间。
@param alarmItems 闹钟项数组
@returns 最近的闹钟时间信息 | export function findNearestAlarmTime(alarmItems: Array<AlarmItem>): {
days: number,
hours: number,
minutes: number
} | AST#export_declaration#Left export AST#function_declaration#Left function findNearestAlarmTime AST#parameter_list#Left ( AST#parameter#Left alarmItems : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AlarmItem AST#prima... | export function findNearestAlarmTime(alarmItems: Array<AlarmItem>): {
days: number,
hours: number,
minutes: number
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/AlarmClockUtils.ets#L25-L29 | 0acc5e272552a3e8aa2cfcde481df418bbc315f9 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | checkOnlineDictUsable | / 检查 在线字典 是否可用 | public checkOnlineDictUsable(showMessage: boolean = true): boolean {
if (this.isActive) { return true } // 非会员才做检查
if (this.maxOnlineDictUseCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.onlineDict)) {
if (showMessage) {
Toast.showMessage(getStringF($r('app.string.member_manager... | AST#method_declaration#Left public checkOnlineDictUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right A... | public checkOnlineDictUsable(showMessage: boolean = true): boolean {
if (this.isActive) { return true }
if (this.maxOnlineDictUseCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.onlineDict)) {
if (showMessage) {
Toast.showMessage(getStringF($r('app.string.member_manager_msg_limit... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L362-L373 | 746c1606ce2d9d282134a6e296cbdff3e8fdce22 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | 悬浮的球和凸起的球 选中时大小需要小于正常尺寸
6 则是多余的尺寸 | export const SURPLUSRADIUS = 6; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SURPLUSRADIUS = AST#expression#Left 6 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const SURPLUSRADIUS = 6; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L24-L24 | e1e81113d33a53cbabcdc6ac79e5c390bb85c614 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusAndClick.ets | arkts | FocusAndClick | [Start dynamic_focus_click_count] | @Entry
@Component
export struct FocusAndClick {
@State count: number = 0;
@State name: string = 'Button';
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button(this.name)
.fontSize(30)
.onClick(() => {
this.count++;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FocusAndClick AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right count : AST#type_annotation#Left AST#primary_type#Lef... | @Entry
@Component
export struct FocusAndClick {
@State count: number = 0;
@State name: string = 'Button';
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button(this.name)
.fontSize(30)
.onClick(() => {
this.count++;
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusAndClick.ets#L20-L53 | 5688cd2860d470393ddc740db669be5b01f10606 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/components/UICall.ets | arkts | UICall | 被呼叫页
提示语不同,头像相同
按钮group: mic操作按钮,挂断,扬声器操作按钮 | @Component
export default struct UICall {
private controller: IndexController | null = null;
@Link mRemote: Caller;
@State use: boolean = true;
@State useMic: boolean = true;
@State useSpeaker: boolean = false;
private tips: string | Resource = "";
async changeMic(open: boolean): Promise<void> {
if (... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct UICall AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left IndexController AST#primary_type#Right | AST#primary_type#... | @Component
export default struct UICall {
private controller: IndexController | null = null;
@Link mRemote: Caller;
@State use: boolean = true;
@State useMic: boolean = true;
@State useSpeaker: boolean = false;
private tips: string | Resource = "";
async changeMic(open: boolean): Promise<void> {
if (... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/components/UICall.ets#L26-L116 | 2f273900e30dea1e6e99852dc60a6f4cd288d492 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/FileBackupExtension/entry/src/main/ets/common/BackupExtension.ets | arkts | onBackupEx | onBackupEx | async onBackupEx(backupInfo: string): Promise<string> {
console.log(`onBackupEx ok`);
let errorInfo: ErrorInfo = {
type: 'ErrorInfo',
errorCode: 0,
errorInfo: 'app diy error info'
}
return JSON.stringify(errorInfo);
} | AST#method_declaration#Left async onBackupEx AST#parameter_list#Left ( AST#parameter#Left backupInfo : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | async onBackupEx(backupInfo: string): Promise<string> {
console.log(`onBackupEx ok`);
let errorInfo: ErrorInfo = {
type: 'ErrorInfo',
errorCode: 0,
errorInfo: 'app diy error info'
}
return JSON.stringify(errorInfo);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileBackupExtension/entry/src/main/ets/common/BackupExtension.ets#L40-L48 | 4137b2250826cc6d3e7da4ab1f317bc69df1ccba | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Full custom transition rotate z. | export const FULL_CUSTOM_TRANSITION_ROTATE_Z = 1; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left FULL_CUSTOM_TRANSITION_ROTATE_Z = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const FULL_CUSTOM_TRANSITION_ROTATE_Z = 1; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L100-L100 | c892124848d8410dd3a5eaf5f0c25a148f9e8d49 | gitee | |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/common/AccountData.ets | arkts | updateAccount | 更新账户 | static async updateAccount(id: string, updatedAccount: AccountItem): Promise<boolean> {
try {
if (!AccountDataManager.preferencesStore) {
return false;
}
const accounts = await AccountDataManager.getAllAccounts();
const index = accounts.findIndex(account => account.id === id);
... | AST#method_declaration#Left static async updateAccount 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#Left updatedAccount : AST#type_annotation#Left AST#primary_type#Left Account... | static async updateAccount(id: string, updatedAccount: AccountItem): Promise<boolean> {
try {
if (!AccountDataManager.preferencesStore) {
return false;
}
const accounts = await AccountDataManager.getAllAccounts();
const index = accounts.findIndex(account => account.id === id);
... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L104-L125 | 1287286b1160dec484a3e0569032f4d01d3d0da7 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/PictureManager.ets | arkts | PictureManagerComponent | 使用图片选择和下载保存样例
核心组件:
1. SaveNetWorkPictures
2. SelectPictures
3. SavePictureFromWeb
实现步骤:
1. 通过photoViewPicker.select()拉起图库界面,用户可以预览并选择一个或多个文件,即可实现拉起手机相册并进行图片的预览与选择
2. 通过http中request方法获取在线图片数据,使用createPixelMap方法将获取到的图片数据转换成pixelmap展示到页面中,将图片保存到图库或者用户选择的路径
3. 通过Web.onContextMenuShow长按图片获取图片链接,通过request.download将图片下载到沙箱... | @Component
export struct PictureManagerComponent {
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
@Builder
TabBuilder(index: number, name: string | Resource) {
Column() {
Text(name)
.fontFamily('HarmonyHeiTi-Medium')
.fontSize(16)
.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PictureManagerComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ... | @Component
export struct PictureManagerComponent {
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
@Builder
TabBuilder(index: number, name: string | Resource) {
Column() {
Text(name)
.fontFamily('HarmonyHeiTi-Medium')
.fontSize(16)
.... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/PictureManager.ets#L35-L89 | 74cf443966a279ee56b82a8c48be2d9b0529185c | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/ui2abc/libarkts/plugins/input/f.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export function f() {
console.log("Hello, world!")
} | AST#export_declaration#Left export AST#function_declaration#Left function f AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left con... | export function f() {
console.log("Hello, world!")
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/ui2abc/libarkts/plugins/input/f.ets#L16-L18 | e62be8cfcd03005da9125dd46870c0c22ffd3758 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_seg_encryption_decryption/sm4_gcm_seg_encryption_decryption_synchronous.ets | arkts | encryptMessageUpdateBySegment | 分段加密消息 | function encryptMessageUpdateBySegment(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let updateLength = 20; // 假设以20字节为单位进行分段update,实际并无要求
let cip... | AST#function_declaration#Left function encryptMessageUpdateBySegment AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p... | function encryptMessageUpdateBySegment(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let updateLength = 20;
let cipherText = new Uint8Array();
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_seg_encryption_decryption/sm4_gcm_seg_encryption_decryption_synchronous.ets#L48-... | 310165fce0818e61d1aef9c27c87147490ab5d6a | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/components/Encode.ets | arkts | 指定的对称密钥材料
@returns | export function genKeyMaterialBlob():
cryptoFramework.DataBlob {
let key = stringToUint8Array('Whh82GtW/EVjBkD8');
return { data: key };
} | AST#export_declaration#Left export AST#function_declaration#Left function genKeyMaterialBlob AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ... | export function genKeyMaterialBlob():
cryptoFramework.DataBlob {
let key = stringToUint8Array('Whh82GtW/EVjBkD8');
return { data: key };
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/components/Encode.ets#L39-L43 | 94adf650c4a391f270bfbf6862c3592620021725 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | avscreen-capture-screen-record-master/entry/src/main/ets/pages/CAVScreenCaptureToFile.ets | arkts | releaseFD | [End create_file_fd1] [Start release_fd1] | async releaseFD() {
if (this.file?.fd != undefined && this.file.fd?.valueOf() > 0) {
// 关闭文件
try {
fs.close(this.file.fd);
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testTag', `close fail. code = ${err.code}, message = ${err.message}`);
}... | AST#method_declaration#Left async releaseFD AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#express... | async releaseFD() {
if (this.file?.fd != undefined && this.file.fd?.valueOf() > 0) {
try {
fs.close(this.file.fd);
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testTag', `close fail. code = ${err.code}, message = ${err.message}`);
}
}
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/avscreen-capture-screen-record-master/entry/src/main/ets/pages/CAVScreenCaptureToFile.ets#L77-L87 | 5da4f74aab9e0c6f9a1fde943538216959866234 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | confirmLogout | 确认退出登录
@returns {void} 无返回值 | confirmLogout(): void {
this.userState.logout();
this.hideLogoutDialog();
navigateBack();
} | AST#method_declaration#Left confirmLogout 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... | confirmLogout(): void {
this.userState.logout();
this.hideLogoutDialog();
navigateBack();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L50-L54 | 53f127b5c3c7d37fd3c9425da129766fba6dd402 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/hashing/TextEncoder.ets | arkts | get | 获取编码器的编码方式
@returns 编码方式名称 | public get encoding(): string {
return 'utf-8';
} | AST#method_declaration#Left public get AST#ERROR#Left encod in g AST#ERROR#Right 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 AS... | public get encoding(): string {
return 'utf-8';
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/TextEncoder.ets#L49-L51 | d432c6c014082212b75992d739b979915eb2b976 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets | arkts | CreateSubscriberCallBack | 创建订阅者回调 | function CreateSubscriberCallBack(err, data) {
subscriber = data;
//订阅公共事件
commonEvent.subscribe(subscriber, SubscribeCallBack);
} | AST#function_declaration#Left function CreateSubscriberCallBack AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_exp... | function CreateSubscriberCallBack(err, data) {
subscriber = data;
commonEvent.subscribe(subscriber, SubscribeCallBack);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L389-L393 | 182d912ab4309120ab17b589cf56cab262c8c081 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets | arkts | updateCommentContent | 更新评论内容
@param {string} value - 评论内容
@returns {void} 无返回值 | updateCommentContent(value: string): void {
this.commentContent = value;
} | AST#method_declaration#Left updateCommentContent AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty... | updateCommentContent(value: string): void {
this.commentContent = value;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets#L55-L57 | 230d35e178a2a69812bb462792a0086f0e5b304d | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 设置变更源枚举 | export enum SettingsChangeSource {
USER = 'user',
SYSTEM = 'system',
IMPORT = 'import',
MIGRATION = 'migration'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum SettingsChangeSource AST#enum_body#Left { AST#enum_member#Left USER = AST#expression#Left 'user' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SYSTEM = AST#expression#Left 'system' AST#expression#Right AST#enum_member#Right , AST#enum... | export enum SettingsChangeSource {
USER = 'user',
SYSTEM = 'system',
IMPORT = 'import',
MIGRATION = 'migration'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L511-L516 | 1436b3542ebc80e7177dc86d25d505ae5d83d606 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.DialogV2.d.ets | arkts | Declare the callback when the visibility of PopoverDialogV2 is changed.
@typedef { function } PopoverDialogV2OnVisibleChange
@param { boolean } visible - The visibility of PopoverDialogV2.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export declare type PopoverDialogV2OnVisibleChange = (visible: boolean) => void; | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type PopoverDialogV2OnVisibleChange = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left visible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right A... | export declare type PopoverDialogV2OnVisibleChange = (visible: boolean) => void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L778-L778 | 7367b697109f1cf5e94c6703a3d9c7320d6f6535 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/ReusePage.ets | arkts | initCalenderData | 二级列表Scroller对象 初始化日历中一年的数据 | initCalenderData() {
for (let k = this.currentYear; k < 2035; ++k) {
for (let i = 1; i <= 12; i++) {
// 获取每个月的日数据
const monthDays: number[] = getMonthDate(i, k);
const month: Month = {
month: i + MONTH,
num: i,
days: monthDays,
year: k
};... | AST#method_declaration#Left initCalenderData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left k = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expr... | initCalenderData() {
for (let k = this.currentYear; k < 2035; ++k) {
for (let i = 1; i <= 12; i++) {
const monthDays: number[] = getMonthDate(i, k);
const month: Month = {
month: i + MONTH,
num: i,
days: monthDays,
year: k
};
thi... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/ReusePage.ets#L101-L115 | 06336f8f21669525133e7f871f44f77ff20680d1 | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/Logger.ets | arkts | debug | 记录调试级别的日志。
@param args 要记录的日志信息 | debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
} | AST#method_declaration#Left debug AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim... | debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/Logger.ets#L24-L26 | d2b183403f3b7b972910c554b053f2f50f41d916 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/view/home/WeekCalendarComponent.ets | arkts | WeekCalendar | default calendar width percent | @Component
export struct WeekCalendar {
@Link homeStore: HomeStore;
currentPage: number = 1;
private scroller: Scroller = new Scroller();
scrollWidth: number = DEFAULT_SCROLL_WIDTH;
private isLoadMore: boolean = false;
private isPageScroll: boolean = false;
aboutToAppear() {
try {
let displayCl... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WeekCalendar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right homeStore : AST#type_annotation#Left AST#primary_type#Left HomeStore AST#primary_type#Right AST#type_a... | @Component
export struct WeekCalendar {
@Link homeStore: HomeStore;
currentPage: number = 1;
private scroller: Scroller = new Scroller();
scrollWidth: number = DEFAULT_SCROLL_WIDTH;
private isLoadMore: boolean = false;
private isPageScroll: boolean = false;
aboutToAppear() {
try {
let displayCl... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/view/home/WeekCalendarComponent.ets#L30-L162 | ce130b3a4f7374ff0653d5dbd0188b482060ef51 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets | arkts | initWeb | 此函数为自定义函数,可作为初始化函数使用 通过UIContext初始化BuilderNode,再通过BuilderNode中的build接口初始化@Builder中的内容 | initWeb(url:string, uiContext:UIContext, control:WebviewController) {
if (this.rootnode != null) {
return;
}
// 创建节点,需要uiContext
this.rootnode = new BuilderNode(uiContext);
// 创建动态Web组件
this.rootnode.build(wrap, { url:url, controller:control });
} | AST#method_declaration#Left initWeb AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Rig... | initWeb(url:string, uiContext:UIContext, control:WebviewController) {
if (this.rootnode != null) {
return;
}
this.rootnode = new BuilderNode(uiContext);
this.rootnode.build(wrap, { url:url, controller:control });
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets#L84-L92 | acf431a80c7f24d8e81c8a0d998d98154a1b1bd7 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/EpisodeDetailPage.ets | arkts | formatDescription | 格式化描述,在时间戳前换行 | formatDescription(desc: string): string {
if (!desc) return '';
let result = desc.replace(/(\d{1,2}:\d{2}(?::\d{2})?)/g, '\n$1');
return result.replace(/^\n/, '').trim();
} | AST#method_declaration#Left formatDescription AST#parameter_list#Left ( AST#parameter#Left desc : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | formatDescription(desc: string): string {
if (!desc) return '';
let result = desc.replace(/(\d{1,2}:\d{2}(?::\d{2})?)/g, '\n$1');
return result.replace(/^\n/, '').trim();
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/EpisodeDetailPage.ets#L368-L372 | 4aac5ddd67fb84f3144dd03c5cde5916fcdc0761 | github |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/view/component/Dialog.ets | arkts | 导出默认的提示操作类实例 | export default new PromptActionClass(); | AST#export_declaration#Left export default AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PromptActionClass AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AS... | export default new PromptActionClass(); | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Dialog.ets#L83-L83 | 5b38fb65a74a838dbcfceb13f7b84fa6895bb94b | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets | arkts | configure | Get PreferencesHandler instance.
@return instance
public static getInstance() { if (this.instance == null) { this.instance = new PreferencesHandler(); } return this.instance; }
Configure PreferencesHandler.
@param context Context | public async configure(context: Context) {
this.preferences = await data_preferences.getPreferences(context, CommonConstants.PREFERENCE_ID);
this.preferences.on('change', (data: Record<string, Object>) => {
for (let preferencesListener of this.listeners) {
preferencesListener.onDataChanged(data.ke... | AST#method_declaration#Left public async configure AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left ... | public async configure(context: Context) {
this.preferences = await data_preferences.getPreferences(context, CommonConstants.PREFERENCE_ID);
this.preferences.on('change', (data: Record<string, Object>) => {
for (let preferencesListener of this.listeners) {
preferencesListener.onDataChanged(data.ke... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets#L50-L57 | eecbacf7aecfabc2b85db03deaefbeef645210fc | gitee |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Lists.ets | arkts | aboutToAppear | 栅格数据
生命周期函数,创建组件实例后,执行build渲染函数之前 | aboutToAppear() {
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right | aboutToAppear() {
} | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Lists.ets#L18-L20 | 09895a1c64e2d56bde42b4e950489b81a38bf551 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BaseDataSet.ets | arkts | setLabel | ###### ###### OTHER STYLING RELATED METHODS ##### ###### | public setLabel(label: string): void {
this.mLabel = label;
} | AST#method_declaration#Left public setLabel AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Ri... | public setLabel(label: string): void {
this.mLabel = label;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L246-L248 | e39ecb8e7010ab4bc6361e950cbcbf40e4feb039 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageflip/src/main/ets/components/mainpage/PageFlip.ets | arkts | registerEmitter | 添加事件订阅 | registerEmitter(windowClass: window.Window) {
// 定义返回主页时发送的事件id
let innerEvent: emitter.InnerEvent = { eventId: 2 };
emitter.on(innerEvent, (data: emitter.EventData) => {
// 收到返回事件,显示状态栏和导航栏,退出全屏模式,再返回主页
if (data?.data?.backPressed) {
windowClass.setWindowSystemBarEnable(['status', 'navi... | AST#method_declaration#Left registerEmitter AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block... | registerEmitter(windowClass: window.Window) {
let innerEvent: emitter.InnerEvent = { eventId: 2 };
emitter.on(innerEvent, (data: emitter.EventData) => {
if (data?.data?.backPressed) {
windowClass.setWindowSystemBarEnable(['status', 'navigation'])
.then(() => {
if ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/components/mainpage/PageFlip.ets#L94-L114 | 549262dd9d2f0747ee68abe0d21835344bde6965 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/TextToSpeechService.ets | arkts | initialize | 初始化TTS引擎 | async initialize(): Promise<void> {
if (this.isInitialized) {
this.logService.tts('TTS已初始化,跳过');
return;
}
try {
this.logService.tts('开始初始化TTS引擎...');
// 创建TTS引擎参数
const extraParams: Record<string, Object> = {
"style": "interaction-broadcast", // 交互播报风格
"locat... | AST#method_declaration#Left async initialize 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_argum... | async initialize(): Promise<void> {
if (this.isInitialized) {
this.logService.tts('TTS已初始化,跳过');
return;
}
try {
this.logService.tts('开始初始化TTS引擎...');
const extraParams: Record<string, Object> = {
"style": "interaction-broadcast",
"locate": "CN",
"na... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L66-L115 | 722785efe5f346cc63c711579300fcb224bcdbc2 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ComponentReuse/positive/src/main/ets/common/CommonConstants.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 CommonConstants {
static readonly Full_WIDTH: string = '100%';
static readonly Full_HIIGHT: string = '100%';
static readonly INDEX_CONTENT_WIDTH: string = '91.1%';
static readonly DIVIDER_HEIGHT: number = 0.5;
static readonly DIVIDER_WIDTH: string = '93%';
static readonly INDEX_TITLE_HEIGHT: nu... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { AST#property_declaration#Left static readonly Full_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; ... | export class CommonConstants {
static readonly Full_WIDTH: string = '100%';
static readonly Full_HIIGHT: string = '100%';
static readonly INDEX_CONTENT_WIDTH: string = '91.1%';
static readonly DIVIDER_HEIGHT: number = 0.5;
static readonly DIVIDER_WIDTH: string = '93%';
static readonly INDEX_TITLE_HEIGHT: nu... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/positive/src/main/ets/common/CommonConstants.ets#L16-L24 | 8b89ef6bc3414a4d5770ad6462b0e113d88c93e6 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | saveLearned | MARK: - Functions for Learned wordIds in this plan / 保存此plan中,指定wordId的某天的学习记录 | saveLearned(wordId: number, dayOf: DayOf): void {
//相同的字多次出现在多个不同的Piece中,
//会导致,同一天中,相同的字出现在不同的Box中,如:新字,复习+1天
//所以这里需要找出所有的pieceNo,同时遍历当天所有的box执行一次保存,才能将进度条改变,否则始进度条始终有剩余
//by ko 2021.07.31
this.pieces
.filter((p) => (p.wordIds ?? []).includes(wordId))
.forEach((piece) => {
dayO... | AST#method_declaration#Left saveLearned AST#parameter_list#Left ( AST#parameter#Left wordId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Righ... | saveLearned(wordId: number, dayOf: DayOf): void {
this.pieces
.filter((p) => (p.wordIds ?? []).includes(wordId))
.forEach((piece) => {
dayOf.boxes
.filter((b) => b.pieceNo === piece.pieceNo)
.forEach((box) => {
this.saveLearn(dayOf.num, box.dis... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L273-L287 | 1914a4c61b89cb7518555dba5fe62aa2696f61f1 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BarChartModel.ets | arkts | setHighlightFullBarEnabled | Set this to true to make the highlight operation full-bar oriented, false to make it highlight single values (relevant
only for stacked). If enabled, highlighting operations will highlight the whole bar, even if only a single stack entry
was tapped.
Default: false
@param enabled | public setHighlightFullBarEnabled(enabled: boolean): void {
this.mHighlightFullBarEnabled = enabled;
} | AST#method_declaration#Left public setHighlightFullBarEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left voi... | public setHighlightFullBarEnabled(enabled: boolean): void {
this.mHighlightFullBarEnabled = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L243-L245 | 52fe03f72af48af08441b1fd100d70d3f3125f72 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/view/ContactData.ets | arkts | Information of contact. | export const contactList: Array<Contact> = [
{
avatar: undefined,
name: 'A'
},
{
avatar: $r('app.media.avatar_pink'),
name: 'Amy'
},
{
avatar: $r('app.media.avatar_blue'),
name: 'Allen'
},
{
avatar: $r('app.media.avatar_purple'),
name: 'Aiden'
},
{
avatar: undefined... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left contactList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right >... | export const contactList: Array<Contact> = [
{
avatar: undefined,
name: 'A'
},
{
avatar: $r('app.media.avatar_pink'),
name: 'Amy'
},
{
avatar: $r('app.media.avatar_blue'),
name: 'Allen'
},
{
avatar: $r('app.media.avatar_purple'),
name: 'Aiden'
},
{
avatar: undefined... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/view/ContactData.ets#L27-L72 | 4bf0eb0ea686b41a19c647dc9d1777d27bb19dc2 | gitee | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/map_lib_func_006_F.ets | arkts | Introduction 库函数-map_entries | export function map_lib_func_006_F(taint_src : string) {
let map = new Map<string,string>();
map.set("t","_");
map.set("tt","a");
taint.Sink(map.entries());
} | AST#export_declaration#Left export AST#function_declaration#Left function map_lib_func_006_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function map_lib_func_006_F(taint_src : string) {
let map = new Map<string,string>();
map.set("t","_");
map.set("tt","a");
taint.Sink(map.entries());
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/map_lib_func_006_F.ets#L7-L12 | da82a4a942b3f7f9a68565f0b9ac809ca78cb127 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshRight.ets | arkts | aboutToDisappear | [End get_list_view_right] | aboutToDisappear() {
this.newsData = [];
} | AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newsData AST#member_expression#Ri... | aboutToDisappear() {
this.newsData = [];
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshRight.ets#L247-L249 | e39d528acf3e7b36974a8c50a762aefb8a4b0932 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/entity/DatabaseEntity.ets | arkts | dubai 器件功耗 | export class TPowerSensorInfo {
//主键 自增
public id: string;
public taskId: string;
public sensor: string;
public power: string;
public current: string;
public percent: string;
public color: Resource;
constructor(taskId?: string, sensor?: string, power?: string, current?: string, percent?: string, color... | AST#export_declaration#Left export AST#class_declaration#Left class TPowerSensorInfo AST#class_body#Left { //主键 自增 AST#property_declaration#Left public id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Le... | export class TPowerSensorInfo {
public id: string;
public taskId: string;
public sensor: string;
public power: string;
public current: string;
public percent: string;
public color: Resource;
constructor(taskId?: string, sensor?: string, power?: string, current?: string, percent?: string, color?: Reso... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/entity/DatabaseEntity.ets#L468-L497 | f1b13396444fe420c4ef82e68282c4f14fa79fdd | gitee | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/components/QuestionItem.ets | arkts | itemEnd | 划出组件 —— 当前用于删除问题 | @Builder
itemEnd(optionIndex: number) {
Row({ space: 16 }) {
Button() {
SymbolGlyph($r('sys.symbol.trash_fill'))
.fontSize(24)
.fontColor([Color.White])
}
.width(40)
.height(40)
.backgroundColor(Color.Red)
.onClick(() => {
// 开启菜单项触感反馈
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemEnd AST#parameter_list#Left ( AST#parameter#Left optionIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#... | @Builder
itemEnd(optionIndex: number) {
Row({ space: 16 }) {
Button() {
SymbolGlyph($r('sys.symbol.trash_fill'))
.fontSize(24)
.fontColor([Color.White])
}
.width(40)
.height(40)
.backgroundColor(Color.Red)
.onClick(() => {
if (this.a... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/components/QuestionItem.ets#L27-L50 | ea376d010cd7656aa9f2aed86bddf8c43a086225 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.