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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/utils/Utils.ets | arkts | 用于将数字转换为两位数格式的函数 | export function padTo2Digits(num: number) {
return num.toString().padStart(2, '0');
} | AST#export_declaration#Left export AST#function_declaration#Left function padTo2Digits AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#s... | export function padTo2Digits(num: number) {
return num.toString().padStart(2, '0');
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/utils/Utils.ets#L22-L24 | b86653c16da97c99fca588ce22ba86b122bb63e3 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/net/SocketImpl.ets | arkts | socket 封装类 | export default class SocketImpl {
private tcpSocket: socket.TCPSocket | null = null;
async createSocket(localIp: string, port: number): Promise<boolean> {
Logger.info(TAG,`tcp bind localIp: ${localIp}`);
try {
if (this.tcpSocket) {
this.tcpSocket.close();
this.tcpSocket = null;
... | AST#export_declaration#Left export default AST#class_declaration#Left class SocketImpl AST#class_body#Left { AST#property_declaration#Left private tcpSocket : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left socket . TCPSocket AST#qualified_type#Right AST#primary_type#Right | A... | export default class SocketImpl {
private tcpSocket: socket.TCPSocket | null = null;
async createSocket(localIp: string, port: number): Promise<boolean> {
Logger.info(TAG,`tcp bind localIp: ${localIp}`);
try {
if (this.tcpSocket) {
this.tcpSocket.close();
this.tcpSocket = null;
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/net/SocketImpl.ets#L23-L147 | 4c0c93b4f69ab827d933cc007b338672a932d9d0 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/agent-assignment/99.0.0/package/index.ets | arkts | HelloWorldNPM | 应用约束26同上,添加返回类型 | function HelloWorldNPM(): string {
return "Hello World NPM";
} | AST#function_declaration#Left function HelloWorldNPM AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left "Hello Wor... | function HelloWorldNPM(): string {
return "Hello World NPM";
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/agent-assignment/99.0.0/package/index.ets#L7-L9 | 7fc284621fc1efc3df12103db478ce2c92680f12 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/SpeechRecognizerHelper.ets | arkts | setListener | 设置语音识别回调。
@param listener 回调对象,识别过程中所有回调信息均通过此对象返回。 | static setListener(listener: speechRecognizer.RecognitionListener): void {
SpeechRecognizerHelper.recognitionEngine?.setListener(listener);
} | AST#method_declaration#Left static setListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . RecognitionListener AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramet... | static setListener(listener: speechRecognizer.RecognitionListener): void {
SpeechRecognizerHelper.recognitionEngine?.setListener(listener);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/SpeechRecognizerHelper.ets#L37-L39 | db5b2ea2d65dbd935eba708abe138c7ccd4952d1 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/PreferencesService.ets | arkts | delete | 删除键值对
@param key 键 | async delete(key: string): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.delete(key);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `Failed to delete key: ${b... | AST#method_declaration#Left async delete AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise... | async delete(key: string): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.delete(key);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `Failed to delete key: ${b... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L251-L261 | 4ade616127a1187e072024b1f46f8df69a9178dd | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/data/FestivalData.ets | arkts | 节日数据管理类
优化版本:添加缓存机制提升查询性能 | export class FestivalData {
// 缓存机制:按日期缓存节日数据(限制缓存大小防止内存泄漏)
private static festivalCache = new Map<string, FestivalInfo[]>();
private static legalHolidayCache = new Map<string, boolean>();
private static readonly MAX_CACHE_SIZE = 1000; // 最大缓存条目数
/**
* 生成缓存键
*/
private static getCacheKey(year: numb... | AST#export_declaration#Left export AST#class_declaration#Left class FestivalData AST#class_body#Left { // 缓存机制:按日期缓存节日数据(限制缓存大小防止内存泄漏) AST#property_declaration#Left private static festivalCache = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#exp... | export class FestivalData {
private static festivalCache = new Map<string, FestivalInfo[]>();
private static legalHolidayCache = new Map<string, boolean>();
private static readonly MAX_CACHE_SIZE = 1000;
private static getCacheKey(year: number, month: number, day: number, isLunar: boolean): string {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData.ets#L163-L364 | aa6765415368bf31f47162798bdc3e5df263899c | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWebHelper.ets | arkts | existHttpAuthCredentials | 判断是否存在任何已保存的HTTP身份验证凭据,该方法为同步方法。存在返回true,不存在返回false。
@returns | static existHttpAuthCredentials(): boolean {
return webview.WebDataBase.existHttpAuthCredentials();
} | AST#method_declaration#Left static existHttpAuthCredentials AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AS... | static existHttpAuthCredentials(): boolean {
return webview.WebDataBase.existHttpAuthCredentials();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L296-L298 | 6f8b9f998330535fb94a69f05377b67c5b8e78f5 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/GreetingGenerationService.ets | arkts | extractContactInfo | 提取联系人关键信息 | private extractContactInfo(contact: Contact): ContactSummary {
return {
name: contact.name,
age: contact.birthday?.age,
gender: this.getGenderText(contact.gender),
relation: this.getRelationText(contact.relation),
occupation: contact.occupation,
interests: contact.interests,
... | AST#method_declaration#Left private extractContactInfo AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ContactSum... | private extractContactInfo(contact: Contact): ContactSummary {
return {
name: contact.name,
age: contact.birthday?.age,
gender: this.getGenderText(contact.gender),
relation: this.getRelationText(contact.relation),
occupation: contact.occupation,
interests: contact.interests,
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L232-L244 | c19f24c08f88862da81c5b097c0d10811b98ee6b | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/MultiDeviceAppDev/MultiMusic/entry/src/main/ets/common/TitleBar.ets | arkts | TitleBar | 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... | @Entry
@Component
export default struct TitleBar {
@LocalStorageProp("currentBreakpoint") currentBreakpoint: string = 'md';
@Builder
TitleIcon(imageSrc: Resource) {
Column() {
Image(imageSrc).height(24).width(24)
}
.alignItems(HorizontalAlign.End)
.justifyContent(FlexAlign.Center)
.widt... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export default struct TitleBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ LocalStorageProp ( AST#expression#Left "currentBreakpoint" AST#expression#Ri... | @Entry
@Component
export default struct TitleBar {
@LocalStorageProp("currentBreakpoint") currentBreakpoint: string = 'md';
@Builder
TitleIcon(imageSrc: Resource) {
Column() {
Image(imageSrc).height(24).width(24)
}
.alignItems(HorizontalAlign.End)
.justifyContent(FlexAlign.Center)
.widt... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/MultiDeviceAppDev/MultiMusic/entry/src/main/ets/common/TitleBar.ets#L16-L60 | 19cf2335da2742cdf23a0625bd2cfca5ed1619c6 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | formatTime | 格式化播放时间 | formatTime(seconds: number): string {
const totalSeconds = Math.floor(seconds);
const mins = Math.floor(totalSeconds / 60);
const hours = Math.floor(mins / 60);
const remainingSeconds = totalSeconds % 60;
if (hours > 0) {
return `${hours}:${(mins % 60).toString().padStart(2, '0')}:${remaining... | AST#method_declaration#Left formatTime AST#parameter_list#Left ( AST#parameter#Left seconds : 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#Rig... | formatTime(seconds: number): string {
const totalSeconds = Math.floor(seconds);
const mins = Math.floor(totalSeconds / 60);
const hours = Math.floor(mins / 60);
const remainingSeconds = totalSeconds % 60;
if (hours > 0) {
return `${hours}:${(mins % 60).toString().padStart(2, '0')}:${remaining... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L1368-L1379 | 45fe98332485e9e5db53d517a5a9e0752e38a78d | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets | arkts | fill | Add 0 if the date is less than two digits
@param value-Data value | fill(value: number): string {
let maxNumber = 9;
return (value > maxNumber ? '' : '0') + value;
} | AST#method_declaration#Left fill AST#parameter_list#Left ( AST#parameter#Left value : 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 AST#t... | fill(value: number): string {
let maxNumber = 9;
return (value > maxNumber ? '' : '0') + value;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets#L41-L44 | c8fae88e51267ab896eff23bef71a44625f4c8f7 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/componentstack/src/main/ets/view/ComponentStack.ets | arkts | 快截图标区域2 顶部偏移量 | build() {
Column() {
Row() {
// 上图下文字透明背景样式
IconList2({ ratio: this.ratio })
}
.width('100%')
.height(this.height2)
.opacity(this.opacity2)
// 商品列表组件
ProductList()
.width('100%')
.height(`calc((100% + ${SCROLL_OFFSET}vp ))`)
}
.margi... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 上图下文字透明背景样... | build() {
Column() {
Row() {
IconList2({ ratio: this.ratio })
}
.width('100%')
.height(this.height2)
.opacity(this.opacity2)
ProductList()
.width('100%')
.height(`calc((100% + ${SCROLL_OFFSET}vp ))`)
}
.margin({ top: this.marginTop... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/view/ComponentStack.ets#L257-L273 | 3ee7dfeb3e0285d981fed5b64eaaab4d3fe17e6d | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getToDaySteps | Get today's steps.
@param {DataRdb.RdbStore} rdbStore RDB database.
@param {number} dimensionFlag Card Specifications.
@param {string} formId Form ID. | function getToDaySteps(rdbStore: DataRdb.RdbStore, dimensionFlag: number, formId: string) {
let getSensorData: Promise<SensorData> = DatabaseUtils.getSensorData(rdbStore, DateUtils.getDate(0));
getSensorData.then((sensorData: SensorData) => {
let stepValue: number = 0;
if (sensorData) {
stepValue = se... | AST#function_declaration#Left function getToDaySteps AST#parameter_list#Left ( AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DataRdb . RdbStore AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dimens... | function getToDaySteps(rdbStore: DataRdb.RdbStore, dimensionFlag: number, formId: string) {
let getSensorData: Promise<SensorData> = DatabaseUtils.getSensorData(rdbStore, DateUtils.getDate(0));
getSensorData.then((sensorData: SensorData) => {
let stepValue: number = 0;
if (sensorData) {
stepValue = se... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/entryformability/EntryFormAbility.ets#L127-L138 | 32acdf05a1adb55c853610bbb9212f49cdbda491 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ar/ARCardService.ets | arkts | renderARScene | 渲染AR场景 | async renderARScene(cardData: ARCardData): Promise<void> {
try {
const startTime = Date.now();
// 清除现有场景
await this.clearScene();
// 设置场景配置
await this.applySceneConfig(cardData.sceneConfig);
// 加载3D模型
await this.loadModels(cardData.models);
... | AST#method_declaration#Left async renderARScene AST#parameter_list#Left ( AST#parameter#Left cardData : AST#type_annotation#Left AST#primary_type#Left ARCardData 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_t... | async renderARScene(cardData: ARCardData): Promise<void> {
try {
const startTime = Date.now();
await this.clearScene();
await this.applySceneConfig(cardData.sceneConfig);
await this.loadModels(cardData.models);
await this.startAni... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L443-L472 | e8891b9ed5cbde92d57e5b48409701f80eb72dc1 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets | arkts | buildSecurity | 构建当前请求的证书配置
@param security 当前请求证书配置
@returns | private static buildSecurity(security: efRcpConfig.securityCfg): rcp.SecurityConfiguration {
let securityCfg: rcp.SecurityConfiguration = {
remoteValidation: security.remoteValidation,
serverAuthentication: security.serverAuthentication,
certificate: security.certificate
}
return securityC... | AST#method_declaration#Left private static buildSecurity AST#parameter_list#Left ( AST#parameter#Left security : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . securityCfg AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_... | private static buildSecurity(security: efRcpConfig.securityCfg): rcp.SecurityConfiguration {
let securityCfg: rcp.SecurityConfiguration = {
remoteValidation: security.remoteValidation,
serverAuthentication: security.serverAuthentication,
certificate: security.certificate
}
return securityC... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L106-L113 | 41e04dc93bb2d34df8178514336424708bcc8d5e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/DialogOptionsFactory.ets | arkts | getOptionsByDialogType | 工厂方法,拿到option
@param dialogType
@returns | public static getOptionsByDialogType(dialogType: DialogTypeEnum): promptAction.BaseDialogOptions {
let options: promptAction.BaseDialogOptions = {
maskColor: Color.Transparent,
autoCancel: false
};
switch (dialogType) {
case DialogTypeEnum.BOTTOM:
DialogOptionsFactory.fillBottomOpt... | AST#method_declaration#Left public static getOptionsByDialogType AST#parameter_list#Left ( AST#parameter#Left dialogType : AST#type_annotation#Left AST#primary_type#Left DialogTypeEnum AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Le... | public static getOptionsByDialogType(dialogType: DialogTypeEnum): promptAction.BaseDialogOptions {
let options: promptAction.BaseDialogOptions = {
maskColor: Color.Transparent,
autoCancel: false
};
switch (dialogType) {
case DialogTypeEnum.BOTTOM:
DialogOptionsFactory.fillBottomOpt... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/DialogOptionsFactory.ets#L26-L33 | f6d5ec6b6798d3ca66257d894e276318cddbc4cb | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/model/DataModel.ets | arkts | The DataModel file instead of network data. | export default class DataModel {
public static readonly TAB_VIEW_MENU: Resource[] = [
$r('app.string.home_tab_index'),
$r('app.string.home_tab_food'),
$r('app.string.home_tab_men_clothing'),
$r('app.string.home_tab_fresh_food'),
$r('app.string.home_tab_furniture'),
$r('app.string.home_tab_mom_... | AST#export_declaration#Left export default AST#class_declaration#Left class DataModel AST#class_body#Left { AST#property_declaration#Left public static readonly TAB_VIEW_MENU : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation... | export default class DataModel {
public static readonly TAB_VIEW_MENU: Resource[] = [
$r('app.string.home_tab_index'),
$r('app.string.home_tab_food'),
$r('app.string.home_tab_men_clothing'),
$r('app.string.home_tab_fresh_food'),
$r('app.string.home_tab_furniture'),
$r('app.string.home_tab_mom_... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/model/DataModel.ets#L25-L135 | 313dac82d8f1f013ca2740d616f571ed12761f6a | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/common/CommonNetworkDataSource.ets | arkts | @file 通用基础接口数据源
@author Joker.X | export interface CommonNetworkDataSource {
/**
* 获取系统参数配置
* @param key 参数键
* @returns 参数值响应
*/
getParam(key: string): Promise<NetworkResponse<string>>;
/**
* 获取实体信息与路径
* @returns 实体信息响应
*/
getEntityPathInfo(): Promise<NetworkResponse<Unknown>>;
/**
* 获取字典数据
* @param request 字典数据请求... | AST#export_declaration#Left export AST#interface_declaration#Left interface CommonNetworkDataSource AST#object_type#Left { /**
* 获取系统参数配置
* @param key 参数键
* @returns 参数值响应
*/ AST#type_member#Left getParam AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left strin... | export interface CommonNetworkDataSource {
getParam(key: string): Promise<NetworkResponse<string>>;
getEntityPathInfo(): Promise<NetworkResponse<Unknown>>;
getDictData(request: DictDataRequest): Promise<NetworkResponse<DictDataResponse>>;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/common/CommonNetworkDataSource.ets#L7-L27 | e378e2ade84074b6dcfb6cad04d957dc0eceedd3 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets | arkts | getLenHex | 获取16进制数据长度
@param data
@returns | private getLenHex(data: string): string {
let byte: number = Number.parseInt("0x" + data.slice(0, 2));
let len_size: number = byte > 127 ? byte - 0x80 + 1 : 1;
return data.slice(0, len_size * 2);
} | AST#method_declaration#Left private getLenHex AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | private getLenHex(data: string): string {
let byte: number = Number.parseInt("0x" + data.slice(0, 2));
let len_size: number = byte > 127 ? byte - 0x80 + 1 : 1;
return data.slice(0, len_size * 2);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L184-L188 | 8992c7c08bbd713734ae6266bf10578bd74c2cc1 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/complete/FormKitDemo/entry/src/main/ets/viewmodel/InitialData.ets | arkts | 页面数据类 | export class ListItemType {
ImgSrc: Resource;
ImgName: Resource;
introduce: Resource;
collect: number;
constructor(ImgSrc: Resource, ImgName: Resource, introduce: Resource, collect: number) {
this.ImgSrc = ImgSrc;
this.ImgName = ImgName;
this.introduce = introduce;
this.collect = collect;
}... | AST#export_declaration#Left export AST#class_declaration#Left class ListItemType AST#class_body#Left { AST#property_declaration#Left ImgSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left ImgName : ... | export class ListItemType {
ImgSrc: Resource;
ImgName: Resource;
introduce: Resource;
collect: number;
constructor(ImgSrc: Resource, ImgName: Resource, introduce: Resource, collect: number) {
this.ImgSrc = ImgSrc;
this.ImgName = ImgName;
this.introduce = introduce;
this.collect = collect;
}... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/FormKitDemo/entry/src/main/ets/viewmodel/InitialData.ets#L4-L16 | 00830bcd9e6bc04a91a2006d1af8a48f14b14d23 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onActionCancel | The Pinch gesture is successfully recognized and a callback is triggered when the touch cancel event
is received.
@param { Callback<void> } event
@returns { PinchGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onActionCancel(event: Callback<void>): PinchGesture; | AST#method_declaration#Left onActionCancel AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | onActionCancel(event: Callback<void>): PinchGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L640-L640 | 54e1996c8ab3e3c3f9f7510462ceeb46b7bb46ac | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/keyAgree/X25519Sync.ets | arkts | x25519 | X25519动态协商密钥,要求密钥长度为256位的非对称密钥
@param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
@param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns 256位共享密钥字符串 | static x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'X25519', 256, keyCoding, resultCoding);
} | AST#method_declaration#Left static x25519 AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , ... | static x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'X25519', 256, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/keyAgree/X25519Sync.ets#L35-L38 | e31112d9c7c2b2ce519b06a417a1484668aac351 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/user/src/main/ets/view/ProfilePage.ets | arkts | 构建个人中心页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.user_profile_title"),
viewModel: this.vm
}) {
this.ProfileContent();
}
} | 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.user_pro... | build() {
AppNavDestination({
title: $r("app.string.user_profile_title"),
viewModel: this.vm
}) {
this.ProfileContent();
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/user/src/main/ets/view/ProfilePage.ets#L22-L29 | 5e0ab02868f689825ae2506b7e63c0bf179f5dff | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets | arkts | selectImgFile | 选择图库文件 | selectImgFile() {
let imgPicker = new picker.PhotoViewPicker();
imgPicker.select().then((result) => {
if (result.photoUris.length > 0) {
this.uploadFilePath = result.photoUris[0]
this.msgHistory += "select file: " + this.uploadFilePath + "\r\n";
this.canUpload = true
let se... | AST#method_declaration#Left selectImgFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imgPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi... | selectImgFile() {
let imgPicker = new picker.PhotoViewPicker();
imgPicker.select().then((result) => {
if (result.photoUris.length > 0) {
this.uploadFilePath = result.photoUris[0]
this.msgHistory += "select file: " + this.uploadFilePath + "\r\n";
this.canUpload = true
let se... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets#L204-L218 | 5def338960ac5ff23fcc143fe7a29f31532c36f0 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/SettingDialog.ets | arkts | getMirrorBol | Mirror persistence, enter again, confirm if the switch is turned on | getMirrorBol(bol: boolean) {
this.settingDataObj.mirrorBol = bol;
} | AST#method_declaration#Left getMirrorBol AST#parameter_list#Left ( AST#parameter#Left bol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression... | getMirrorBol(bol: boolean) {
this.settingDataObj.mirrorBol = bol;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/SettingDialog.ets#L44-L46 | ad27154a9446035f6fb648d4bab0a206b99496f5 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/ConfigService.ets | arkts | saveApiConfig | 保存完整API配置
@param config - API配置 | async saveApiConfig(config: ApiConfig): Promise<void> {
if (!this.dataPreferences) {
throw new Error('配置服务未初始化');
}
try {
// 验证API密钥格式
if (!this.validateApiKey(config.apiKey)) {
throw new Error('API密钥格式无效');
}
await this.dataPreferences.put(ConfigService.KEY_API_KEY, ... | AST#method_declaration#Left async saveApiConfig AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left ApiConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type... | async saveApiConfig(config: ApiConfig): Promise<void> {
if (!this.dataPreferences) {
throw new Error('配置服务未初始化');
}
try {
if (!this.validateApiKey(config.apiKey)) {
throw new Error('API密钥格式无效');
}
await this.dataPreferences.put(ConfigService.KEY_API_KEY, config.apiKe... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/ConfigService.ets#L154-L177 | ea9e8791f2f26be4a41bdc65c812ff6d248ab224 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/calendar/BirthdayListPage.ets | arkts | loadBirthdaysByFilter | 根据筛选条件加载生日 | private async loadBirthdaysByFilter(filter: string): Promise<void> {
const groups: BirthdayGroup[] = [];
switch (filter) {
case 'today':
const todayContacts = await this.contactService.getTodayBirthdayContacts();
groups.push({
title: '今天生日',
description: `${todayContac... | AST#method_declaration#Left private async loadBirthdaysByFilter AST#parameter_list#Left ( AST#parameter#Left filter : 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... | private async loadBirthdaysByFilter(filter: string): Promise<void> {
const groups: BirthdayGroup[] = [];
switch (filter) {
case 'today':
const todayContacts = await this.contactService.getTodayBirthdayContacts();
groups.push({
title: '今天生日',
description: `${todayContac... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/calendar/BirthdayListPage.ets#L58-L100 | 9d8c04c1cc180b626e29ec6cd690f5935abb064f | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | tag | Set gesture's tag.
@param { string } tag
@returns { this }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | tag(tag: string): this; | AST#method_declaration#Left tag AST#parameter_list#Left ( AST#parameter#Left tag : 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 this AST#primary_type#Right AST#type_a... | tag(tag: string): this; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L339-L339 | f58fab4f9b8d6f07e5c6fd697b0b96af6942658b | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/NodeAPI/NodeAPIClassicUseCases/NodeAPILoadModuleWithInfo/har2/Index.ets | arkts | MainPage | 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 { MainPage } from './src/main/ets/components/MainPage' | AST#export_declaration#Left export { MainPage } from './src/main/ets/components/MainPage' AST#export_declaration#Right | export { MainPage } from './src/main/ets/components/MainPage' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/NodeAPI/NodeAPIClassicUseCases/NodeAPILoadModuleWithInfo/har2/Index.ets#L16-L16 | da2a499898b2c0966e34ef0439765b2a3db7c2d1 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/view/ApplicationException.ets | arkts | ApplicationExceptionView | 延时时间
场景描述: 本示例介绍了通过应用事件打点hiAppEvent获取上一次应用异常信息的方法,主要分为应用崩溃、应用卡死以及系统查杀三种
推荐场景: 应用异常信息获取场景,如:调试应用等
核心组件:
1. FaultArea
2. FaultConstruction
实现步骤:
1. 依次构建应用异常,应用退出后,进入本页面,等待订阅消息通知,待收到订阅消息后,通过EventSubscription.ets中的onReceive函数,
接收到异常信息数据,并通过AppStorage.setOrCreate('appEventGroups',异常信息数据)双向绑定异常信息
2. @StorageLink('appEven... | @Component
export struct ApplicationExceptionView {
// 初始化被点击的异常事件下标
@Provide eventIndex: number = -1;
aboutToAppear(): void {
// 事件订阅(获取上次异常退出信息)
eventSubscription();
}
build() {
Column() {
// 场景描述组件
FunctionDescription({
title: $r('app.string.application_exception_applicati... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ApplicationExceptionView AST#component_body#Left { // 初始化被点击的异常事件下标 AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right eventIndex : AST#type_annotation#Left AST#primary_type#Left number AST... | @Component
export struct ApplicationExceptionView {
@Provide eventIndex: number = -1;
aboutToAppear(): void {
eventSubscription();
}
build() {
Column() {
FunctionDescription({
title: $r('app.string.application_exception_application_fault_title'),
content: $r('app.s... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/view/ApplicationException.ets#L42-L65 | 966af838326836a60de0d2c3166d1bc4307821eb | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FoldableGuilde/entry/src/main/ets/modules/Folder.ets | arkts | Folder | [Start Folder] | @Component
export struct Folder {
@State len_wid: number = 480;
@State w: string = '40%';
build() {
Column() {
// UpperItems puts the required id hovering to the upper half of the screen into upperItems, and the other components will be stacked in the lower half of the screen
FolderStack({ upperI... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Folder AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right len_wid : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#... | @Component
export struct Folder {
@State len_wid: number = 480;
@State w: string = '40%';
build() {
Column() {
FolderStack({ upperItems: ['upperitemsId'] }) {
Column() {
Text('video zone')
.height('100%')
.width('100%')
.textAlign(Te... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/modules/Folder.ets#L17-L92 | e641f82f9ec1b5b817ce518243578e1bd8335893 | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets | arkts | rotateFirstAnim | 先向外翻转90°,前后置切换触发 | private async rotateFirstAnim() {
Logger.info(TAG, 'rotateFirstAnim E');
// 获取已完成的surface截图
let shotPixel = BlurAnimateUtil.getSurfaceShot();
// 后置切前置
if (this.curPosition === 1) {
Logger.info(TAG, 'rotateFirstAnim BACK');
// 直板机后置切前置截图旋转补偿90°
await shotPixel.rotate(BlurAnimateUtil... | AST#method_declaration#Left private async rotateFirstAnim 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 Logger AST#expression... | private async rotateFirstAnim() {
Logger.info(TAG, 'rotateFirstAnim E');
let shotPixel = BlurAnimateUtil.getSurfaceShot();
if (this.curPosition === 1) {
Logger.info(TAG, 'rotateFirstAnim BACK');
await shotPixel.rotate(BlurAnimateUtil.IMG_ROTATE_ANGLE_90);
this.shot... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets#L152-L194 | a3da936dd6006d86717279446629f38232d36b39 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets | arkts | radioContent | Radio集合
@param radioContent
@returns | radioContent(radioContent: Array<SheetInfo>) {
this.builderOptions.radioContent = radioContent
return this;
} | AST#method_declaration#Left radioContent AST#parameter_list#Left ( AST#parameter#Left radioContent : 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 SheetInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | radioContent(radioContent: Array<SheetInfo>) {
this.builderOptions.radioContent = radioContent
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets#L56-L59 | 21e0d8db027ac4f534a44ec563aa8cbf6d6db41f | github |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/utils/DateUtil.ets | arkts | getCalendarDays | 获取某年某月的日历数组(包含上月和下月的日期) | static getCalendarDays(year: number, month: number): CalendarDay[] {
const firstDay = DateUtil.getFirstDayOfMonth(year, month)
const daysInMonth = DateUtil.getDaysInMonth(year, month)
// 计算上个月的年份和月份
let prevYear = year
let prevMonth = month - 1
if (prevMonth < 0) {
prevMonth = 11
... | AST#method_declaration#Left static getCalendarDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | static getCalendarDays(year: number, month: number): CalendarDay[] {
const firstDay = DateUtil.getFirstDayOfMonth(year, month)
const daysInMonth = DateUtil.getDaysInMonth(year, month)
let prevYear = year
let prevMonth = month - 1
if (prevMonth < 0) {
prevMonth = 11
prevYear = y... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L36-L83 | 9f8ed55fe35447272de7cb65b50bb4f82550c851 | github |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/ImageEditInterface.ets | arkts | 编辑过程中点击取消按钮,展示挽留弹窗的选项配置 | export interface ImageEditCancelRetainDialogOption {
/**
* 弹窗标题,不配置如果是仅画笔或文字则提示"是否放弃当前编辑的内容?",否则提示"是否放弃当前图片操作?"
*/
title?: ResourceStr,
/**
* 肯定含义的按钮文案,不配置默认为"是",用户点击后隐藏挽留弹窗然后回调业务通知用户取消,由业务自己处理页面退出
*/
positiveButtonText?: ResourceStr
/**
* 否定含义的按钮文案,不配置默认为"否",用户点击后隐藏挽留弹窗,继续停留在编辑页面
*/
nega... | AST#export_declaration#Left export AST#interface_declaration#Left interface ImageEditCancelRetainDialogOption AST#object_type#Left { /**
* 弹窗标题,不配置如果是仅画笔或文字则提示"是否放弃当前编辑的内容?",否则提示"是否放弃当前图片操作?"
*/ AST#type_member#Left title ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#ty... | export interface ImageEditCancelRetainDialogOption {
title?: ResourceStr,
positiveButtonText?: ResourceStr
negativeButtonText?: ResourceStr
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L141-L155 | d5f5f802e7a71bd797d891c1fa51c7b494186e7d | gitee | |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | changeData | 修改数据 | changeData(index: number, data: T): void {
this.dataSource.splice(index, 1, data);
this.notifyDataChange(index);
} | AST#method_declaration#Left changeData 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 data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#t... | changeData(index: number, data: T): void {
this.dataSource.splice(index, 1, data);
this.notifyDataChange(index);
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L53-L56 | 62403230ad0b037e55de088be4275f00abc4e693 | github |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets | arkts | onLoadMore | 上拉加载更多逻辑 | onLoadMore() {
this.isLoading = true;
this.pageIndex++;
setTimeout(() => {
// 模拟加载更多数据
const moreData: OrderItem[] = [
{
shopName: 'OMINI南京东路店',
status: this.selectedTab,
waitTime: '00:18:45',
address: '上海市黄浦区南京东路829号第一食品商店3层',
time: '20... | AST#method_declaration#Left onLoadMore 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 . isLoading AST#member_expression#Right =... | onLoadMore() {
this.isLoading = true;
this.pageIndex++;
setTimeout(() => {
const moreData: OrderItem[] = [
{
shopName: 'OMINI南京东路店',
status: this.selectedTab,
waitTime: '00:18:45',
address: '上海市黄浦区南京东路829号第一食品商店3层',
time: '2025-07-16 10... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets#L376-L402 | b0f3fa6ad2d9d59824ba515f991160a90af6f9b9 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Utils/DMPStack.ets | arkts | isEmpty | 检查栈是否为空 | isEmpty(): boolean {
return this._items.length === 0;
} | AST#method_declaration#Left isEmpty AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left... | isEmpty(): boolean {
return this._items.length === 0;
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPStack.ets#L24-L26 | e903c9521dbb1ae7de17f98fd197754e4522763b | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | initSafeAreaObserver | 初始化安全区监听
@param {window.Window} windowClass - 当前窗口
@returns {void} 无返回值 | private initSafeAreaObserver(windowClass: window.Window): void {
const displayId = this.getDisplayId();
if (displayId === undefined) {
console.error("Failed to obtain displayId for safe area.");
return;
}
const navigationArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGAT... | AST#method_declaration#Left private initSafeAreaObserver 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#Ri... | private initSafeAreaObserver(windowClass: window.Window): void {
const displayId = this.getDisplayId();
if (displayId === undefined) {
console.error("Failed to obtain displayId for safe area.");
return;
}
const navigationArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGAT... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/adapter/WindowAdapter.ets#L106-L149 | d49ef81523fa33e726ec1e8171f2f83bf395246e | github |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/Pointer.ets | arkts | get | Returns true if this pointer is used and active, false otherwise. | get isUsed(): boolean {
return this.id >= 0;
} | AST#method_declaration#Left get AST#ERROR#Left isUsed AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expressi... | get isUsed(): boolean {
return this.id >= 0;
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L167-L169 | 9d6cb500d2b66e9f21d4f8983dd85834a2b3e030 | github |
MUYS/imagePreview | 96212a51e8c5d6c37b9b9fb94e7d6d76047cdeb0 | library/BuildProfile.ets | arkts | Use these variables when you tailor your ArkTS code. They must be of the const type. | export const HAR_VERSION = '2.1.2'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '2.1.2' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const HAR_VERSION = '2.1.2'; | https://github.com/MUYS/imagePreview/blob/96212a51e8c5d6c37b9b9fb94e7d6d76047cdeb0/library/BuildProfile.ets#L4-L4 | 695a8f6236ca47fd456d22e4997806074da9cd7b | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSA.ets | arkts | encodePKCS1Segment | 加密-分段
@param encodeStr 待加密的字符串
@param pubKey RSA公钥 | static async encodePKCS1Segment(str: string, pubKey: string): Promise<string> {
return CryptoUtil.encodeAsymSegment(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | AST#method_declaration#Left static async encodePKCS1Segment 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 pubKey : AST#type_annotation#Left AST#primary_type#Left string AS... | static async encodePKCS1Segment(str: string, pubKey: string): Promise<string> {
return CryptoUtil.encodeAsymSegment(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L60-L62 | ed8ff2afbc33cce35fdddf65c56a0453302507e4 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/GreetingTypes.ets | arkts | AI服务提供商枚举 | export enum AIProvider {
OPENAI = 'openai',
BAIDU = 'baidu',
ALIBABA = 'alibaba',
TENCENT = 'tencent',
CUSTOM = 'custom'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum AIProvider AST#enum_body#Left { AST#enum_member#Left OPENAI = AST#expression#Left 'openai' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left BAIDU = AST#expression#Left 'baidu' AST#expression#Right AST#enum_member#Right , AST#enum_member#... | export enum AIProvider {
OPENAI = 'openai',
BAIDU = 'baidu',
ALIBABA = 'alibaba',
TENCENT = 'tencent',
CUSTOM = 'custom'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/GreetingTypes.ets#L92-L98 | cab8f34166a155158d0b50edb9bc28a4aa5301c7 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/ReminderService.ets | arkts | Base on ohos reminder agent service | export default class ReminderService {
/**
* open notification permission
*/
public openNotificationPermission() {
notification.requestEnableNotification().then(() => {
console.info('Enable notification success');
}).catch((err: Error) => {
console.error('Enable notification failed because... | AST#export_declaration#Left export default AST#class_declaration#Left class ReminderService AST#class_body#Left { /**
* open notification permission
*/ AST#method_declaration#Left public openNotificationPermission AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression... | export default class ReminderService {
public openNotificationPermission() {
notification.requestEnableNotification().then(() => {
console.info('Enable notification success');
}).catch((err: Error) => {
console.error('Enable notification failed because ' + JSON.stringify(err));
});
}
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/ReminderService.ets#L24-L90 | b285a07aba672d81a15c227fa8430c6ef418c8be | gitee | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/transform/SepiaTransformation.ets | arkts | SepiaTransformation | 图片变换:乌墨色滤波效果 | @Sendable
export class SepiaTransformation extends PixelMapTransformation {
constructor() {
super();
}
async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> {
let imageInfo: image.ImageInfo = await toTransform.getImageInfo();
if (!imageInfo.size) {... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class SepiaTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#p... | @Sendable
export class SepiaTransformation extends PixelMapTransformation {
constructor() {
super();
}
async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> {
let imageInfo: image.ImageInfo = await toTransform.getImageInfo();
if (!imageInfo.size) {... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/SepiaTransformation.ets#L22-L46 | 05524164c54910cad92aad9b0ac96afce3f776c4 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | getLunarLeapMonth | 获取农历闰月
@param year 农历年份
@returns 闰月月份,0表示无闰月 | getLunarLeapMonth(year: number): number {
return LunarUtils.getLunarLeapMonth(year);
} | AST#method_declaration#Left getLunarLeapMonth AST#parameter_list#Left ( AST#parameter#Left year : 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 number AST#primary_type... | getLunarLeapMonth(year: number): number {
return LunarUtils.getLunarLeapMonth(year);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L538-L540 | 1cdbba599c110d6e863e885792836a003c88fbb8 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | setSelectionShift | sets the distance the highlighted piechart-slice of this DataSet is
"shifted" away from the center of the chart, default 12f
@param shift | public setSelectionShift(shift: number): void {
this.mShift = Utils.handleDataValues(shift);
} | AST#method_declaration#Left public setSelectionShift AST#parameter_list#Left ( AST#parameter#Left shift : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | public setSelectionShift(shift: number): void {
this.mShift = Utils.handleDataValues(shift);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L133-L135 | 4abc4e83d5df607431daf6fe6e64c5778ce46120 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/component/MenuSheetLayout.ets | arkts | MenuSheetLayout | 自定义底部菜单组件 | @Preview
@ComponentV2
export struct MenuSheetLayout {
@Require @Param options: MenuSheetOptions;
@Event onItemClick: Callback<MenuBean>;
aboutToAppear(): void {
this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background');
}
build() {
Column() {
Grid() {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MenuSheetLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Righ... | @Preview
@ComponentV2
export struct MenuSheetLayout {
@Require @Param options: MenuSheetOptions;
@Event onItemClick: Callback<MenuBean>;
aboutToAppear(): void {
this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background');
}
build() {
Column() {
Grid() {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/MenuSheetLayout.ets#L16-L66 | f561db72c7a0fb8d1c38b67d1f19a9caf98339f8 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets | arkts | pushData | 向列表追加数据 | public pushData(data: FriendMoment): void {
this.momentList.push(data);
this.notifyDataAdd(this.momentList.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left FriendMoment 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... | public pushData(data: FriendMoment): void {
this.momentList.push(data);
this.notifyDataAdd(this.momentList.length - 1);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets#L317-L320 | 8e2010904b792f4da16a233c24de9ddbf59a798f | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/AboutSample/entry/src/main/ets/viewmodel/AboutViewModel.ets | arkts | getAboutUsInfo | Get about us information.
@return {Array<ListItemData>} aboutUsInfo | getAboutUsInfo() {
let aboutUsInfo: Array<ListItemData> = [];
let officialWeb: ListItemData = new ListItemData();
officialWeb.title = $r('app.string.home_page');
officialWeb.summary = $r("app.string.home_weblink");
aboutUsInfo.push(officialWeb);
let publicAccount: ListItemData = new ListItemData... | AST#method_declaration#Left getAboutUsInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left aboutUsInfo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < ... | getAboutUsInfo() {
let aboutUsInfo: Array<ListItemData> = [];
let officialWeb: ListItemData = new ListItemData();
officialWeb.title = $r('app.string.home_page');
officialWeb.summary = $r("app.string.home_weblink");
aboutUsInfo.push(officialWeb);
let publicAccount: ListItemData = new ListItemData... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/AboutSample/entry/src/main/ets/viewmodel/AboutViewModel.ets#L33-L44 | 78de56842f6d1adbc568de8782b4b8a39b4f5cba | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets | arkts | leftFixedTitle | 底部左侧纵向滚动列表的标题
@param title 标题名 | @Builder
leftFixedTitle(title: string) {
Column() {
Text(title)
.fontWeight(FontWeight.Bold)
.height($r('app.string.vertical_horizontal_linkage_fixed_title_height_size'))
.textAlign(TextAlign.Start)
.padding($r('app.string.vertical_horizontal_linkage_vertical_horizontal_conta... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right leftFixedTitle 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_list#Right AST#builder_function_body... | @Builder
leftFixedTitle(title: string) {
Column() {
Text(title)
.fontWeight(FontWeight.Bold)
.height($r('app.string.vertical_horizontal_linkage_fixed_title_height_size'))
.textAlign(TextAlign.Start)
.padding($r('app.string.vertical_horizontal_linkage_vertical_horizontal_conta... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L300-L312 | f5eb5751eec54497b72a9fd5a71d3e1038c888ed | gitee |
Million-mo/tree-sitter-arkts.git | 2fd0ad75e2d848709edcf4be038f27b178114ef6 | examples/decorators_complete.ets | arkts | GlobalBuilder | ============================================ UI构建装饰器 ============================================ @Builder - 自定义构建函数(全局) | @Builder
function GlobalBuilder(title: string) {
Text(title)
.fontSize(20)
.fontWeight(FontWeight.Bold)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function GlobalBuilder 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_list#Right AST#b... | @Builder
function GlobalBuilder(title: string) {
Text(title)
.fontSize(20)
.fontWeight(FontWeight.Bold)
} | https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/decorators_complete.ets#L133-L138 | b6d9d8b8feab2927dc987db9b9a886cd3d8b5df2 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webgetcameraimage/src/main/ets/components/mainpage/MainPage.ets | arkts | invokeCamera | 调用系统相机,拍照后返回图片地址
@param callback 回调接口,返回照片的路径 | async invokeCamera(callback: (uri: string) => void) {
try {
let pickerProfile: cameraPicker.PickerProfile = {
cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK
};
let pickerResult: cameraPicker.PickerResult = await cameraPicker.pick(getContext(),
[cameraPicker.PickerMediaT... | AST#method_declaration#Left async invokeCamera AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#R... | async invokeCamera(callback: (uri: string) => void) {
try {
let pickerProfile: cameraPicker.PickerProfile = {
cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK
};
let pickerResult: cameraPicker.PickerResult = await cameraPicker.pick(getContext(),
[cameraPicker.PickerMediaT... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webgetcameraimage/src/main/ets/components/mainpage/MainPage.ets#L72-L87 | 85707ac39ac0398d65252b2b25b36867033fcbaf | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/treeview/source/treeview.ets | arkts | createNode | TreeViewNodeItemFactory create default node
@returns NodeItemView | public createNode(): NodeItemView {
return {
imageNode: undefined,
inputText: new InputText(),
mainTitleNode: new MainTitleNode(''),
imageCollapse: undefined,
fontColor: undefined,
};
} | AST#method_declaration#Left public createNode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NodeItemView AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_... | public createNode(): NodeItemView {
return {
imageNode: undefined,
inputText: new InputText(),
mainTitleNode: new MainTitleNode(''),
imageCollapse: undefined,
fontColor: undefined,
};
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L304-L312 | cb19142bf2f0befaeac4c446f926e3b3f67b8f3b | gitee |
ericple/ohos-weather | f197791bce462c5eb1b22945c25f5bcd5fcc9f7c | libNMC/src/main/ets/Data/Warning.ets | arkts | along with this program. If not, see <https://www.gnu.org/licenses/>. | export interface Warning {
id: string,
sender: string,
pubTime: string,
title: string,
startTime: string,
endTime: string,
status: string,
level: string,
severity: string,
severityColor: string,
type: string;
typeName: string,
urgency: string,
certainty: string,
text: string,
related: st... | AST#export_declaration#Left export AST#interface_declaration#Left interface Warning AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left sender : AST#type_annotation#Left AST#p... | export interface Warning {
id: string,
sender: string,
pubTime: string,
title: string,
startTime: string,
endTime: string,
status: string,
level: string,
severity: string,
severityColor: string,
type: string;
typeName: string,
urgency: string,
certainty: string,
text: string,
related: st... | https://github.com/ericple/ohos-weather/blob/f197791bce462c5eb1b22945c25f5bcd5fcc9f7c/libNMC/src/main/ets/Data/Warning.ets#L18-L35 | 9b31fc7d0a539edac94264c342c0b33e04dcbb17 | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/ScanUtils.ets | arkts | generateBarcode | 码图生成,使用Promise异步返回生成的码图。
@param content 码内容字符串
@param options 用于设置生成码图的参数:
scanType 码类型。
width 码图宽,单位:px。取值范围:[200, 4096]。
height 码图高,单位:px。取值范围:[200, 4096]。
margin 边距,单位:px,默认值为1,取值范围:[1, 10]。
level 纠错水平,默认值为LEVEL_H。此参数只在生成QR码时有效。
backgroundColor 生成码图背景颜色,HEX格式颜色,默认为白色(0xffffff)。
pixelMapColor 生成码图颜色,HEX格式颜色,默认为黑色... | static generateBarcode(content: string, options?: generateBarcode.CreateOptions): Promise<image.PixelMap> {
if (!options) {
options = {
scanType: scanCore.ScanType.QR_CODE,
height: 800,
width: 800,
margin: 5
}
}
return generateBarcode.createBarcode(content, option... | AST#method_declaration#Left static generateBarcode AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualifi... | static generateBarcode(content: string, options?: generateBarcode.CreateOptions): Promise<image.PixelMap> {
if (!options) {
options = {
scanType: scanCore.ScanType.QR_CODE,
height: 800,
width: 800,
margin: 5
}
}
return generateBarcode.createBarcode(content, option... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ScanUtils.ets#L69-L79 | caaf32c5fb86e0a83b85a73e1ddd6173ebd4563c | gitee |
LiuAnclouds/Harmony-ArkTS-App.git | 2119ce333927599b81a31081bc913e1416837308 | WeatherMind/entry/src/main/ets/pages/ChooseCity.ets | arkts | groupCitiesByLetter | 按首字母分组城市 | private groupCitiesByLetter(): Map<string, CityWithInfo[]> {
let groups = new Map<string, CityWithInfo[]>();
let citiesToGroup = this.isSearching ? this.filteredCities : this.allCities;
citiesToGroup.forEach(city => {
let letter = city.first_letter || city.city_name.charAt(0).toUpperCase();
if... | AST#method_declaration#Left private groupCitiesByLetter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#t... | private groupCitiesByLetter(): Map<string, CityWithInfo[]> {
let groups = new Map<string, CityWithInfo[]>();
let citiesToGroup = this.isSearching ? this.filteredCities : this.allCities;
citiesToGroup.forEach(city => {
let letter = city.first_letter || city.city_name.charAt(0).toUpperCase();
if... | https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L339-L353 | 7bd7007a8416c97c8954d537637e849df31f0056 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets | arkts | 购物车数据模型 | export interface Cart {
goodsId: number;
goodsName: string;
goodsMainPic: string;
spec: CartSpec[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Cart AST#object_type#Left { AST#type_member#Left goodsId : 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 goodsName : AST#type_annotation#Left ... | export interface Cart {
goodsId: number;
goodsName: string;
goodsMainPic: string;
spec: CartSpec[];
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets#L68-L73 | cd79063556323e9df0f904ac6db8ccdc67316ba8 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | signSegment | 对数据进行分段签名,异步
@param data 待签名数据
@param priKey 私钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、、等)。
@param len 自定义的数据拆分长度,此处取64
@returns | static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256', len: number = 64): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.signSegment(data, priKey, algName, len);
} | AST#method_declaration#Left static async signSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualifi... | static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256', len: number = 64): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.signSegment(data, priKey, algName, len);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L287-L289 | 64a066f8a4bb7b6c6db75fdad7caa44e339f87fa | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindMenuCustomBuilder.ets | arkts | BindMenuCustomBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function BindMenuCustomBuilder(name: string, param: Object) {
BindMenuCustomBuilderExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindMenuCustomBuilder 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... | @Builder
export function BindMenuCustomBuilder(name: string, param: Object) {
BindMenuCustomBuilderExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindMenuCustomBuilder.ets#L16-L19 | 1f2ea0f23f0d15082cdcd7b059a7b75326908e5d | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets | arkts | onEncrypt | 生成dlp文件 | async onEncrypt() {
Logger.info(TAG + 'new file and encrypt');
let context = getContext() as common.UIAbilityContext; // 获取当前UIAbilityContext
let flag = wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION |
wantConstant.Flags.FLAG_AUTH_PERSISTABLE_URI_PERMISSION;
let targetBundleName = 'com.ohos.dlpma... | AST#method_declaration#Left async onEncrypt 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 Logger AST#expression#Right . info ... | async onEncrypt() {
Logger.info(TAG + 'new file and encrypt');
let context = getContext() as common.UIAbilityContext;
let flag = wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION |
wantConstant.Flags.FLAG_AUTH_PERSISTABLE_URI_PERMISSION;
let targetBundleName = 'com.ohos.dlpmanager';
uriPermissi... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets#L152-L179 | 3549b16a7c21ffbea95125dec7902b8eaae59b0c | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/webPerformance/Index.ets | arkts | WebHome | 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 { WebHome } from './src/main/ets/pages/WebHome'; | AST#export_declaration#Left export { WebHome } from './src/main/ets/pages/WebHome' ; AST#export_declaration#Right | export { WebHome } from './src/main/ets/pages/WebHome'; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/webPerformance/Index.ets#L16-L16 | 5d5d3ae3a80174f0ae2746e9ee1641c9212e0d31 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinKit.ets | arkts | SpinKit | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinKit {
@Param spinSize: number = 36;
@Param spinColor: ResourceColor = Color.White;
@Param spinType: SpinType = SpinType.spinA;
build() {
if (this.spinType == SpinType.spinA) {
SpinA({ spinSize: this.spinSize, spinColor: this.spinColor })
} else if (this.spinType == ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinKit AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotat... | @ComponentV2
export struct SpinKit {
@Param spinSize: number = 36;
@Param spinColor: ResourceColor = Color.White;
@Param spinType: SpinType = SpinType.spinA;
build() {
if (this.spinType == SpinType.spinA) {
SpinA({ spinSize: this.spinSize, spinColor: this.spinColor })
} else if (this.spinType == ... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinKit.ets#L52-L118 | 5cca2c7583bf76418f75ec02622f6c73d07e52f5 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringEncrypt.ets | arkts | encodedToBase64 | 将字符串进行Base64编码
@param str 要编码的字符串
@returns Base64编码后的字符串或null | static encodedToBase64(str: string | null): string | null {
return new Base64Encoder(str).encodedString();
} | AST#method_declaration#Left static encodedToBase64 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) ... | static encodedToBase64(str: string | null): string | null {
return new Base64Encoder(str).encodedString();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L15-L17 | be5bb41c311371a94065625371db765f857b3847 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/RouteBuild.ets | arkts | getBuilder | 获取路由构建器
@param name 路由名称
@returns 路由构建器 | static getBuilder(name: string): WrappedBuilder<[]> | undefined {
return RouteBuild.builderMap.get(name);
} | AST#method_declaration#Left static getBuilder 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_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST... | static getBuilder(name: string): WrappedBuilder<[]> | undefined {
return RouteBuild.builderMap.get(name);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/RouteBuild.ets#L22-L24 | fcb54044a8ed3b4426381766076e18c68208ba61 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/ui/RcpLoadingUtil.ets | arkts | 引入命名路由页面
@Author csx
@DateTime 2024/6/19 00:16
@TODO RcpLoadingUtil 子窗口方式实现全局加载框
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_rcp | export class RcpLoadingUtil {
/**
* 缓存窗体集合,关闭时需要
*/
private static cacheWindow: window.Window;
/**
* 解决重复多次弹出关闭可能导致的异常
*/
private static showTimes: number = 0;
/**
* 根据参数创建窗口
* @param options
* @returns
*/
static async showLoading(options?: rcpLoadingOptions): Promise<void> {
le... | AST#export_declaration#Left export AST#class_declaration#Left class RcpLoadingUtil AST#class_body#Left { /**
* 缓存窗体集合,关闭时需要
*/ AST#property_declaration#Left private static cacheWindow : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type... | export class RcpLoadingUtil {
private static cacheWindow: window.Window;
private static showTimes: number = 0;
static async showLoading(options?: rcpLoadingOptions): Promise<void> {
let ctx = getContext() as common.UIAbilityContext;
RcpLoadingUtil.showTimes += 1
if (RcpLoadingUtil.showT... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/ui/RcpLoadingUtil.ets#L31-L105 | 9ba5be59479205f72150f88e906ba624c94ff65e | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets | arkts | generateSound | 生成声音 | private async generateSound(text: string) {
// this.generator.startDownloadIfNeeded(text, (data, msg) => {
// this.processReceivedData(text, data, msg);
// });
} | AST#method_declaration#Left private async generateSound AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // this.generator.startDownlo... | private async generateSound(text: string) {
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets#L90-L94 | 657ef6bdd6be90eafa65738e6ba129e820377ac0 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/view/CartPage.ets | arkts | CheckboxSlot | 选择框插槽
@param {number} goodsId 商品ID
@param {CartGoodsSpec} spec 规格信息
@returns {void} 无返回值 | @Builder
private CheckboxSlot(goodsId: number, spec: CartGoodsSpec) {
IBestCheckbox({
value: this.vm.isSpecSelected(goodsId, spec.id),
shape: "round",
onChange: (): void => {
this.vm.toggleSpecSelected(goodsId, spec.id);
}
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CheckboxSlot AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left spec : AST#type_annotat... | @Builder
private CheckboxSlot(goodsId: number, spec: CartGoodsSpec) {
IBestCheckbox({
value: this.vm.isSpecSelected(goodsId, spec.id),
shape: "round",
onChange: (): void => {
this.vm.toggleSpecSelected(goodsId, spec.id);
}
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CartPage.ets#L143-L152 | 7c766f5aa6ab5e56e56ab1bfa26db50b5e796f88 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/marquee/Index.ets | arkts | MarqueeViewComponent | 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 { MarqueeViewComponent } from './src/main/ets/view/Marquee'; | AST#export_declaration#Left export { MarqueeViewComponent } from './src/main/ets/view/Marquee' ; AST#export_declaration#Right | export { MarqueeViewComponent } from './src/main/ets/view/Marquee'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/Index.ets#L16-L16 | bc7296ac78d6ab6194d6f8687b9f53dc67c15551 | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/SettingsStorage.ets | arkts | 获取所有设置 | export interface AppSettings {
defaultSiteT: boolean;
vibrationON: boolean;
holdCheckON: boolean;
buttonPositionRIGHT: boolean;
themeColor: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AppSettings AST#object_type#Left { AST#type_member#Left defaultSiteT : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left vibrationON : AST#type_a... | export interface AppSettings {
defaultSiteT: boolean;
vibrationON: boolean;
holdCheckON: boolean;
buttonPositionRIGHT: boolean;
themeColor: string;
} | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L106-L112 | 41f33f62b94bc65d0a26acf557ea5b224d24f088 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.batteryInfo.d.ets | arkts | Extra key of common event COMMON_EVENT_BATTERY_CHANGED.
@enum { string }
@syscap SystemCapability.PowerManager.BatteryManager.Core
@since 20 | export enum CommonEventBatteryChangedKey {
/**
* Extra code of batterySOC.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/
EXTRA_SOC = 'soc',
/**
* Extra code of chargingStatus.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core... | AST#export_declaration#Left export AST#enum_declaration#Left enum CommonEventBatteryChangedKey AST#enum_body#Left { /**
* Extra code of batterySOC.
*
* @syscap SystemCapability.PowerManager.BatteryManager.Core
* @since 20
*/ AST#enum_member#Left EXTRA_SOC = AST#expression#Left 'soc' AST#express... | export enum CommonEventBatteryChangedKey {
EXTRA_SOC = 'soc',
EXTRA_CHARGE_STATE = 'chargeState',
EXTRA_HEALTH_STATE = 'healthState',
EXTRA_PLUGGED_TYPE = 'pluggedType',
EXTRA_VOLTAGE = 'voltage',
EXTRA_TECHNOLOGY = 'technology',
EXTRA_TEMPERATURE = 'temper... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.batteryInfo.d.ets#L397-L461 | b73ebe60b3fa1189db8ca95ae04b09370c8dd596 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | JSCrash/entry/src/main/ets/pages/CannotReadPropertyXXXOfUndefinedCase.ets | arkts | updateGestureValue | [Start updateGestureValue1] Update the attributes related to manual effects | public updateGestureValue(screenWidth: number, recentScale: number,
sceneContainerSessionList: SCBSceneContainerSession[]): void {
// Calculation of the distance moved by the hand
this.translationUpY =
(this.multiCardsNum >= 1) ? sceneContainerSessionList[this.multiCardsNum - 1].needRenderTranslate.tr... | AST#method_declaration#Left public updateGestureValue AST#parameter_list#Left ( AST#parameter#Left screenWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left recentScale : AST#type_annotation#Left AST#primary_type#Left nu... | public updateGestureValue(screenWidth: number, recentScale: number,
sceneContainerSessionList: SCBSceneContainerSession[]): void {
this.translationUpY =
(this.multiCardsNum >= 1) ? sceneContainerSessionList[this.multiCardsNum - 1].needRenderTranslate.translateY :
0;
this.translationDownY... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/CannotReadPropertyXXXOfUndefinedCase.ets#L28-L38 | 03db2fbb7376ded3ffb4bf0a87007d6daf6cc7df | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | getRelationLabel | 获取关系标签 | private getRelationLabel(relation: RelationType): string {
switch (relation) {
case RelationType.FAMILY:
return '家人';
case RelationType.FRIEND:
return '朋友';
case RelationType.COLLEAGUE:
return '同事';
case RelationType.OTHER:
return '其他';
default:
... | AST#method_declaration#Left private getRelationLabel AST#parameter_list#Left ( AST#parameter#Left relation : AST#type_annotation#Left AST#primary_type#Left RelationType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string... | private getRelationLabel(relation: RelationType): string {
switch (relation) {
case RelationType.FAMILY:
return '家人';
case RelationType.FRIEND:
return '朋友';
case RelationType.COLLEAGUE:
return '同事';
case RelationType.OTHER:
return '其他';
default:
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L638-L651 | 4e813738767dfd9a4f340ce35d59a4cda58afa94 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FitForDarkMode/entry/src/main/ets/pages/FitDarkIcon.ets | arkts | ... | build() {
Scroll() {
Column() {
// ...
Stack({ alignContent: Alignment.TopStart }) {
Image($r('app.media.bell'))
.width('100%')
.borderRadius(12)
.objectFit(ImageFit.Cover)
// ...
}
// ...
}
}
// ...
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // ... AST... | build() {
Scroll() {
Column() {
Stack({ alignContent: Alignment.TopStart }) {
Image($r('app.media.bell'))
.width('100%')
.borderRadius(12)
.objectFit(ImageFit.Cover)
}
}
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FitForDarkMode/entry/src/main/ets/pages/FitDarkIcon.ets#L21-L38 | 3b62c4aa23c9fb377841f869da0cf74bc70e5da2 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildNotificationSettings | 通知设置 | @Builder
buildNotificationSettings() {
Column({ space: 16 }) {
Row() {
Text('🔔 通知提醒')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text('修改')
.fontSize(14)
.fontColor(this.COLOR... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildNotificationSettings 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#com... | @Builder
buildNotificationSettings() {
Column({ space: 16 }) {
Row() {
Text('🔔 通知提醒')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text('修改')
.fontSize(14)
.fontColor(this.COLOR... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3524-L3566 | ab14be89c2da2a81ea6090568ae2756bc7c020d4 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | get | 获取已经注册的所有路由表
@returns | public static get routerMap(): RouteItem[] {
let routerMap = ZRouter.getRouterMgr().routerMap
if (routerMap.length === 0) {
// 尝试同步获取,正常情况是不会执行到这里,在初始化时会在工作线程中完成
// 兜底操作
const routerMap = loadRouterMapFromRawFileSync(this.context)
ZRouter.getRouterMgr().routerMap = routerMap
return... | AST#method_declaration#Left public static get AST#ERROR#Left routerMap AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RouteItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { ... | public static get routerMap(): RouteItem[] {
let routerMap = ZRouter.getRouterMgr().routerMap
if (routerMap.length === 0) {
const routerMap = loadRouterMapFromRawFileSync(this.context)
ZRouter.getRouterMgr().routerMap = routerMap
return routerMap
}
return routerMap
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L66-L76 | e92688f396088d373ac0e11df56918823a2674ae | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DataTypeUtils.ets | arkts | Data type utils. | export default class DataTypeUtils {
/**
* return obj is null.
*
* @return boolean.
*/
static isNull(obj: Object): boolean {
return (typeof obj === 'undefined' || obj == null || obj === '');
}
/**
* return new deep copy object from obj.
*
* @return type in obj.
*/
static deepCopy(... | AST#export_declaration#Left export default AST#class_declaration#Left class DataTypeUtils AST#class_body#Left { /**
* return obj is null.
*
* @return boolean.
*/ AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left Object... | export default class DataTypeUtils {
static isNull(obj: Object): boolean {
return (typeof obj === 'undefined' || obj == null || obj === '');
}
static deepCopy(obj: number[]) {
let newObj: number[] = [];
for (let i = 0; i < obj.length; i++) {
newObj[i] = JSON.parse(JSON.stringify(obj[i]));... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DataTypeUtils.ets#L19-L38 | 2bb044d05475c66b2fd4904fa114a28b5a527d12 | gitee | |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/game/types/sys.ets | arkts | 效果脚本执行 | export interface THandlerEffectScriptResult {
msg: string
effect: string
value: number
levelUp: boolean
} | AST#export_declaration#Left export AST#interface_declaration#Left interface THandlerEffectScriptResult AST#object_type#Left { AST#type_member#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left effect : AST#type_ann... | export interface THandlerEffectScriptResult {
msg: string
effect: string
value: number
levelUp: boolean
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/types/sys.ets#L10-L15 | eb6a4bcd95c88bd8656269adfec1d046dbaf26e6 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/order/OrderNavigator.ets | arkts | @file 订单模块导航封装
@author Joker.X | export class OrderNavigator {
/**
* 跳转到订单列表
* @param {string} [tab] - Tab 标签
* @returns {void} 无返回值
*/
static toList(tab?: string): void {
if (tab) {
const params: OrderListParam = { tab };
navigateTo(OrderRoutes.List, params);
return;
}
navigateTo(OrderRoutes.List);
}
... | AST#export_declaration#Left export AST#class_declaration#Left class OrderNavigator AST#class_body#Left { /**
* 跳转到订单列表
* @param {string} [tab] - Tab 标签
* @returns {void} 无返回值
*/ AST#method_declaration#Left static toList AST#parameter_list#Left ( AST#parameter#Left tab ? : AST#type_annotation#Left AST#primar... | export class OrderNavigator {
static toList(tab?: string): void {
if (tab) {
const params: OrderListParam = { tab };
navigateTo(OrderRoutes.List, params);
return;
}
navigateTo(OrderRoutes.List);
}
static toConfirm(): void {
navigateTo(OrderRoutes.Confirm);
}
static... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderNavigator.ets#L10-L90 | 0d4f0b48125b19f4f894dfe85abc61e7a8979ad8 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语言枚举 | export enum GreetingLanguage {
ZH_CN = 'zh_CN', // 中文简体
EN_US = 'en_US' // 英文
} | AST#export_declaration#Left export AST#enum_declaration#Left enum GreetingLanguage AST#enum_body#Left { AST#enum_member#Left ZH_CN = AST#expression#Left 'zh_CN' AST#expression#Right AST#enum_member#Right , // 中文简体 AST#enum_member#Left EN_US = AST#expression#Left 'en_US' AST#expression#Right AST#enum_member#Right // 英文 ... | export enum GreetingLanguage {
ZH_CN = 'zh_CN',
EN_US = 'en_US'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L94-L97 | 73dda988477c65cc3e8a7aa0cc7a1428ae6d6c01 | github | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/DMChannel.ets | arkts | 应用ArkTS约束:移除动态mixin逻辑,改为显式接口实现 原TextBasedChannel.applyToClass逻辑需要转换为接口实现 | export default DMChannel; | AST#export_declaration#Left export default AST#expression#Left DMChannel AST#expression#Right ; AST#export_declaration#Right | export default DMChannel; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/DMChannel.ets#L127-L127 | cdffb324bc0ae5ca3294b019801b3db59ae13a6d | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/customComponent.d.ets | arkts | aboutToAppear | Life cycle for custom component | aboutToAppear(): void
aboutToDisappear(): void
onDidBuild(): void
onPageShow(): void
onPageHide(): void
onBackPress(): boolean
getUIContext(): UIContext | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Left AST#primary_type#Left void AST#primary_type#Right aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#primary_type#Left void AST#primary_type#Right onDidBuild AST#parame... | aboutToAppear(): void
aboutToDisappear(): void
onDidBuild(): void
onPageShow(): void
onPageHide(): void
onBackPress(): boolean
getUIContext(): UIContext | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/customComponent.d.ets#L218-L225 | e1a7b7e2cbd05851b067a838b609158bf448d864 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | digestSegment | 摘要,分段,同步
@param data 待摘要的数据
@param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
@param len 自定义的数据拆分长度
@returns | static async digestSegment(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
let md = cryptoFramework.createMd(algName);
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
for (let i = 0; i < messageData.length; i += len) {
let upda... | AST#method_declaration#Left static async digestSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#p... | static async digestSegment(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
let md = cryptoFramework.createMd(algName);
let messageData = CryptoHelper.strToUint8Array(data, 'utf-8');
for (let i = 0; i < messageData.length; i += len) {
let upda... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L529-L540 | 4d21feb1c1d55c9fbbc7770d2aab6877589842a2 | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | getAnimParamBuilder | 如果已经注册了路由动画,则获取动画参数构建器,没注册则返回空
@param modifier | public getAnimParamBuilder(component: object): NavAnimParamBuilder | undefined {
return NavAnimationStore.getInstance().getAnimParamBuilder(component)
} | AST#method_declaration#Left public getAnimParamBuilder AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary... | public getAnimParamBuilder(component: object): NavAnimParamBuilder | undefined {
return NavAnimationStore.getInstance().getAnimParamBuilder(component)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L94-L96 | 3865e95b65b0528a06d94af50949016f4f3b2e80 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/components/StickerComponent.ets | arkts | clearTimer | 清理定时器 | private clearTimer() {
if (this.timerId) {
clearTimeout(this.timerId)
this.timerId = 0
}
} | AST#method_declaration#Left private clearTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right A... | private clearTimer() {
if (this.timerId) {
clearTimeout(this.timerId)
this.timerId = 0
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/components/StickerComponent.ets#L75-L80 | 540de3bb2a4cda7280ac70dfdf50fad61fcee857 | github |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/pages/LoginPage.ets | arkts | switchToRegister | 切换到注册视图 | switchToRegister(): void {
this.isRegistering = true;
} | AST#method_declaration#Left switchToRegister AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#m... | switchToRegister(): void {
this.isRegistering = true;
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/LoginPage.ets#L120-L122 | 6de4547ab6614ebe1534ff2d3dca08e4da677475 | github |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Linear.ets | arkts | rowStyle | 自定义样式:row | @Styles rowStyle() {
.width('100%')
.height(50)
.border({ width: 1 })
.margin({ bottom: 10 })
} | AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right rowStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expre... | @Styles rowStyle() {
.width('100%')
.height(50)
.border({ width: 1 })
.margin({ bottom: 10 })
} | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Linear.ets#L41-L46 | e1bae79da69002cc5d1a135d0a3566c3169f3695 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/animation/ChartAnimator.ets | arkts | setPhaseX | Sets the X axis phase of the animation.
@param phase float value between 0 - 1 | public setPhaseX(phase: number) {
if (phase > 1) {
phase = 1;
} else if (phase < 0) {
phase = 0;
}
this.mPhaseX = phase;
} | AST#method_declaration#Left public setPhaseX AST#parameter_list#Left ( AST#parameter#Left phase : 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#ui_control_flow#Left AST#ui_if_stat... | public setPhaseX(phase: number) {
if (phase > 1) {
phase = 1;
} else if (phase < 0) {
phase = 0;
}
this.mPhaseX = phase;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/animation/ChartAnimator.ets#L253-L260 | f2f760da580f694b90a65da6226f0b94c9dc17ed | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/mock/MockData.ets | arkts | 功能图标网格数据 | export const GRID_ITEMS: MyGridItem[] = [
{ icon: $r('app.media.cube_animation_gallery_blur_filled'), title: '模块1' },
{ icon: $r('app.media.cube_animation_discover'), title: '模块2' },
{ icon: $r('app.media.cube_animation_favorite'), title: '模块3' },
{ icon: $r('app.media.cube_animation_gallery'), title: '模块4' },
... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GRID_ITEMS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MyGridItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expr... | export const GRID_ITEMS: MyGridItem[] = [
{ icon: $r('app.media.cube_animation_gallery_blur_filled'), title: '模块1' },
{ icon: $r('app.media.cube_animation_discover'), title: '模块2' },
{ icon: $r('app.media.cube_animation_favorite'), title: '模块3' },
{ icon: $r('app.media.cube_animation_gallery'), title: '模块4' },
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/mock/MockData.ets#L20-L29 | 6e1f8d674065b5dbf7789a34eb84a0473a9050fb | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/viewmodel/NetworkRequestViewModel.ets | arkts | requestGoodsDetail | 发起 GET 请求(商品详情) | requestGoodsDetail() {
RequestHelper.repository<Goods>(this.repository.getGoodsInfo("1"))
.start((): void => {
this.getLoading = true;
})
.execute()
.then((data: Goods): void => {
const goods: Goods = new Goods(data);
ToastUtils.showSuccess($r("app.string.demo_network... | AST#method_declaration#Left requestGoodsDetail AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left ... | requestGoodsDetail() {
RequestHelper.repository<Goods>(this.repository.getGoodsInfo("1"))
.start((): void => {
this.getLoading = true;
})
.execute()
.then((data: Goods): void => {
const goods: Goods = new Goods(data);
ToastUtils.showSuccess($r("app.string.demo_network... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/NetworkRequestViewModel.ets#L31-L44 | bba2717e0f009e68de694c3a9d646097ae69704e | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/init_process.ets | arkts | ensure_easylist_folder | Checks and ensures there is a /easylist directory in sandbox. | function ensure_easylist_folder(context: common.UIAbilityContext) {
let filesDir = context.filesDir;
try {
if (!fileIo.accessSync(filesDir + '/easylist')) {
fileIo.mkdirSync(filesDir + '/easylist', true);
}
} catch (e) {
console.error('[init][ensure_easylist_folder] Error: ' + e);
}
} | AST#function_declaration#Left function ensure_easylist_folder 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#parame... | function ensure_easylist_folder(context: common.UIAbilityContext) {
let filesDir = context.filesDir;
try {
if (!fileIo.accessSync(filesDir + '/easylist')) {
fileIo.mkdirSync(filesDir + '/easylist', true);
}
} catch (e) {
console.error('[init][ensure_easylist_folder] Error: ' + e);
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L150-L159 | 138b8fa252f730335995eb243c46f4962986dbb0 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/CommonModel.ets | arkts | Contact groups list. | export class ContactGroup {
title: Resource | string;
contact: ContactInfo[];
constructor(title: Resource | string, contact: ContactInfo[]) {
this.title = title;
this.contact = contact;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ContactGroup AST#class_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#t... | export class ContactGroup {
title: Resource | string;
contact: ContactInfo[];
constructor(title: Resource | string, contact: ContactInfo[]) {
this.title = title;
this.contact = contact;
}
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/CommonModel.ets#L45-L53 | 14a88be043da3d1071b69b4dad0c126494a4edd2 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | writeEasy | 将数据写入文件,并关闭文件。
@param path string 文件的应用沙箱路径或URI。
@param buffer ArrayBuffer|string 待写入文件的数据,可来自缓冲区或字符串。
@param append 是否追加,true-追加,false-不追加(直接覆盖)
@returns Promise对象。返回实际写入的数据长度,单位字节。 | static async writeEasy(path: string, buffer: ArrayBuffer | string, append: boolean = true): Promise<number> {
const file = FileUtil.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
const offset = append ? FileUtil.statSync(file.fd).size : 0
const options: WriteOptions = { offset: offset, encodin... | AST#method_declaration#Left static async writeEasy AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buffer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Le... | static async writeEasy(path: string, buffer: ArrayBuffer | string, append: boolean = true): Promise<number> {
const file = FileUtil.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
const offset = append ? FileUtil.statSync(file.fd).size : 0
const options: WriteOptions = { offset: offset, encodin... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L504-L512 | 2a28085cce43a4ead4d399370750ec3a23f6ce49 | gitee |
from-north-to-north/OpenHarmony_p7885 | f6ea526c039db535a7c958fa154ccfcb3668b37c | hap/easy_demo/rawfile/rawfile_api10/entry/src/main/ets/pages/Index.ets | arkts | read_rawfile | 用户获取resources/rawfile目录下对应的rawfile文件内容 | private async read_rawfile(file:string){
try {
let context = GlobalContext.getContext().getObject('this.context') as Context
context.resourceManager.getRawFileContent(file, (error: BusinessError, value: Uint8Array) => {
if (error != null) {
console.error("error is " + error);
}... | AST#method_declaration#Left private async read_rawfile AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement... | private async read_rawfile(file:string){
try {
let context = GlobalContext.getContext().getObject('this.context') as Context
context.resourceManager.getRawFileContent(file, (error: BusinessError, value: Uint8Array) => {
if (error != null) {
console.error("error is " + error);
}... | https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/rawfile/rawfile_api10/entry/src/main/ets/pages/Index.ets#L15-L32 | 3605a341d111ca379bdf2e24de58456f96861bd5 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ChatbotEngine.ets | arkts | 对话步骤接口 | export interface ConversationStep {
id: string;
type: StepType;
prompt: string;
validation?: ValidationRule;
nextStep?: string | ((input: string, context: Record<string, any>) => string);
actions?: StepAction[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ConversationStep AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Lef... | export interface ConversationStep {
id: string;
type: StepType;
prompt: string;
validation?: ValidationRule;
nextStep?: string | ((input: string, context: Record<string, any>) => string);
actions?: StepAction[];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L47-L54 | 2c5aedfe3b26a884525dcd65f4cbde366e64e3c8 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/repeat.d.ets | arkts | Define the options of repeat virtualScroll to implement reuse and lazy loading.
@interface VirtualScrollOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 20 | export interface VirtualScrollOptions {
/**
* Total data count.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 20
*/
totalCount?: number;
/**
* Reuse or not.
*
* @type { ?boolean }
* @default true
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since ... | AST#export_declaration#Left export AST#interface_declaration#Left interface VirtualScrollOptions AST#object_type#Left { /**
* Total data count.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 20
*/ AST#type_member#Left totalCount ? : AST#type_annotation#Left AST#primary_type... | export interface VirtualScrollOptions {
totalCount?: number;
reusable?: boolean;
onLazyLoading?: OnLazyLoadingFunc;
onTotalCount?: OnTotalCountFunc;
disableVirtualScroll?: boolean;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/repeat.d.ets#L120-L163 | cc2de4d579afae1e8372989aca2eabd4befa566c | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List/entry/src/main/ets/common/CommonConstants.ets | arkts | Magnification | export const MAGNIFICATION: number = 2; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MAGNIFICATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration... | export const MAGNIFICATION: number = 2; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L51-L51 | 60351cc98d32bd263d6e45d31da24148083b4d58 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/cs/src/main/ets/view/ChatPage.ets | arkts | ChatPage | @file 客服聊天页面视图
@author Joker.X | @ComponentV2
export struct ChatPage {
/**
* 客服聊天页面 ViewModel
*/
@Local
private vm: ChatViewModel = new ChatViewModel();
/**
* 构建客服聊天页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: "客服聊天",
viewModel: this.vm
}) {
this.ChatContent();
}
}
/**
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ChatPage AST#component_body#Left { /**
* 客服聊天页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left ChatViewMod... | @ComponentV2
export struct ChatPage {
@Local
private vm: ChatViewModel = new ChatViewModel();
build() {
AppNavDestination({
title: "客服聊天",
viewModel: this.vm
}) {
this.ChatContent();
}
}
@Builder
private ChatContent() {
Text("客服聊天页面内容视图")
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/cs/src/main/ets/view/ChatPage.ets#L8-L37 | 6b422dabed9fc213998083e6322e5715c2ae0f22 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets | arkts | parseImageQRCode | 解析图片二维码信息
@param canvasContext
@param imageSrc | async parseImageQRCode(imageSrc: string): Promise<DecodeResultAttribute> {
Logger.info(TAG, `parseImageQRCode start`);
let parseResult: DecodeResultAttribute = {
isSucess: false,
decodeResult: 'failed'
};
let width: number;
let height: number;
let pixelBytesNumber: number;
let ar... | AST#method_declaration#Left async parseImageQRCode AST#parameter_list#Left ( AST#parameter#Left imageSrc : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty... | async parseImageQRCode(imageSrc: string): Promise<DecodeResultAttribute> {
Logger.info(TAG, `parseImageQRCode start`);
let parseResult: DecodeResultAttribute = {
isSucess: false,
decodeResult: 'failed'
};
let width: number;
let height: number;
let pixelBytesNumber: number;
let ar... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets#L109-L180 | 0b7008d4cbb40d48db4a297bf625ec844c5c31b8 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BarDataSet.ets | arkts | calcStackSize | calculates the maximum stacksize that occurs in the Entries array of this
DataSet | private calcStackSize(yVals: JList<BarEntry>): void {
for (let i = 0; i < yVals.length(); i++) {
let vals: number[] | null = yVals.get(i).getYVals();
if (vals != null && vals.length > this.mStackSize)
this.mStackSize = vals.length;
}
} | AST#method_declaration#Left private calcStackSize AST#parameter_list#Left ( AST#parameter#Left yVals : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left BarEntry AST#primary_type#Right AST#type_annotation#Right > AST#type_... | private calcStackSize(yVals: JList<BarEntry>): void {
for (let i = 0; i < yVals.length(); i++) {
let vals: number[] | null = yVals.get(i).getYVals();
if (vals != null && vals.length > this.mStackSize)
this.mStackSize = vals.length;
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarDataSet.ets#L162-L171 | 9b8237a54fab1822b6c14c9b139ceec8d54e509e | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.