nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/components/common/LoadingView.ets | arkts | LoadingButton | 按钮加载状态组件 | @Component
export struct LoadingButton {
@Prop text: string = '确定';
@Prop loadingText: string = '处理中...';
@Prop loading: boolean = false;
@Prop disabled: boolean = false;
@Prop type: ButtonType = ButtonType.Capsule;
@Prop backgroundColorStr: string = '#007AFF';
@Prop fontColorStr: string = '#ffffff';
@P... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingButton AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati... | @Component
export struct LoadingButton {
@Prop text: string = '确定';
@Prop loadingText: string = '处理中...';
@Prop loading: boolean = false;
@Prop disabled: boolean = false;
@Prop type: ButtonType = ButtonType.Capsule;
@Prop backgroundColorStr: string = '#007AFF';
@Prop fontColorStr: string = '#ffffff';
@P... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/LoadingView.ets#L94-L133 | d4d8f42d0f807b0a73afdada7dcd82107e30a4be | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api11/entry/src/main/ets/MainAbility/common/Log.ets | arkts | showInfo | print info level log
@param {string} tag - Page or class tag
@param {string} log - Log needs to be printed | static showInfo(tag: string, log: string) {
console.info(`${TAG} tag: ${tag} --> ${log}`);
} | AST#method_declaration#Left static showInfo 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#Left log : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | static showInfo(tag: string, log: string) {
console.info(`${TAG} tag: ${tag} --> ${log}`);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api11/entry/src/main/ets/MainAbility/common/Log.ets#L28-L30 | ae69610223c70ce8662acdf36207ad120ce517a1 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets | arkts | encryptECB | 加密(ECB模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@returns | static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> {
return DES.encrypt(data, symKey, null, '3DES192|ECB|PKCS7');
} | AST#method_declaration#Left static async encryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym... | static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> {
return DES.encrypt(data, symKey, null, '3DES192|ECB|PKCS7');
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets#L32-L34 | 8bb0a34faf9fefedd4914420acd74e76e35e8bac | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecomment/src/main/ets/components/view/ImageCommentView.ets | arkts | publishComment | 发布评论 | publishComment(): void {
const comment: Comment =
new Comment("Kevin", this.textInComment, $r("app.media.icon_comment_icon_main"), this.imageInComment,
this.getCurrentDate());
this.commentList.addDataFirst(comment);
this.scroller.scrollToIndex(0, true, ScrollAlign.START);
} | AST#method_declaration#Left publishComment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left comment : ... | publishComment(): void {
const comment: Comment =
new Comment("Kevin", this.textInComment, $r("app.media.icon_comment_icon_main"), this.imageInComment,
this.getCurrentDate());
this.commentList.addDataFirst(comment);
this.scroller.scrollToIndex(0, true, ScrollAlign.START);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/view/ImageCommentView.ets#L83-L89 | ed3b48e424ca0a52bd0ab44d559caa740636d6e8 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/pages/LoginPage.ets | arkts | doLogin | 执行登录 | async doLogin() {
if (this.isLoading) return;
this.isLoading = true;
try {
Logger.info(`正在登录: ${this.account}`);
let request: LoginRequest = {
username: this.account,
password: this.password
};
let response = await HttpUtils.post<LoginData>(ApiConstants.LOGIN_... | AST#method_declaration#Left async doLogin AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member_expression#Right AST#expression#Righ... | async doLogin() {
if (this.isLoading) return;
this.isLoading = true;
try {
Logger.info(`正在登录: ${this.account}`);
let request: LoginRequest = {
username: this.account,
password: this.password
};
let response = await HttpUtils.post<LoginData>(ApiConstants.LOGIN_... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/LoginPage.ets#L99-L148 | 4a96e3bdaf5e80051a3ffb886877c7ca3015af83 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/ArrayUtil.ets | arkts | append | 将新元素添加到已有数组中 添加新元素会生成一个新的数组,不影响原数组
@param source
@param item
@returns | static append<T>(source: T[], item: T | T[]): T[] {
if (Array.isArray(item)) {
return [...source, ...item];
} else {
return [...source, item];
}
} | AST#method_declaration#Left static append AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right A... | static append<T>(source: T[], item: T | T[]): T[] {
if (Array.isArray(item)) {
return [...source, ...item];
} else {
return [...source, item];
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/ArrayUtil.ets#L84-L90 | 4d723a63876ef95f7937db3b4e5a8b8bc4d6fb46 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/analytics/AnalyticsPage.ets | arkts | onRefresh | 刷新数据 | onRefresh() {
this.loadStatisticsData();
} | AST#method_declaration#Left onRefresh AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadStatisticsData AST#mem... | onRefresh() {
this.loadStatisticsData();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L41-L43 | 09c9ba99e929185273fb13f53a3c91b99faa74c0 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/viewmodel/NavigationViewModel.ets | arkts | shouldShowResult | 是否展示结果区域
@returns {boolean} 是否展示 | shouldShowResult(): boolean {
return this.hasResultTitle() || this.hasResultDesc();
} | AST#method_declaration#Left shouldShowResult 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#call_expressi... | shouldShowResult(): boolean {
return this.hasResultTitle() || this.hasResultDesc();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/NavigationViewModel.ets#L81-L83 | e1c2ccd573300f7ab649abe6ad5192d79f994cb7 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ImageUtils.ets | arkts | 图片转换为PixelMap对象
@param icon 图片地址,模拟数据存放于rawfile文件夹中
@returns 图片转换的PixelMap对象 | export async function image2PixelMap(icon: string): Promise<image.PixelMap> {
// 读取rawfile文件夹下的文件
const rawFileDescriptor: resourceManager.RawFileDescriptor = resourceMgs.getRawFdSync(icon);
const imageSource: image.ImageSource = image.createImageSource(rawFileDescriptor);
// 通过ImageSource对象创建PixelMap对象,使用BGRA_... | AST#export_declaration#Left export AST#function_declaration#Left async function image2PixelMap AST#parameter_list#Left ( AST#parameter#Left icon : 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#L... | export async function image2PixelMap(icon: string): Promise<image.PixelMap> {
const rawFileDescriptor: resourceManager.RawFileDescriptor = resourceMgs.getRawFdSync(icon);
const imageSource: image.ImageSource = image.createImageSource(rawFileDescriptor);
const pixelMap: Promise<PixelMap> = imageSource.create... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ImageUtils.ets#L29-L41 | f13531bb397dbd8b13416b053abdc0f2d0086dc7 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/common/RefreshComponent.ets | arkts | RefreshComponent | @author 2008
@datetime 2024/6/26 23:55
@className: RefreshComponent
公用下拉刷新消息 | @Component
export default struct RefreshComponent{
@Prop RefreshingTitle:string = '松开刷新'
build() {
Row() {
if (this.RefreshingTitle !== '松开刷新') {
LoadingProgress().height(30)
}
Text(this.RefreshingTitle).fontSize(16).margin({ left: 20 })
}
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct RefreshComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right RefreshingTitle : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | @Component
export default struct RefreshComponent{
@Prop RefreshingTitle:string = '松开刷新'
build() {
Row() {
if (this.RefreshingTitle !== '松开刷新') {
LoadingProgress().height(30)
}
Text(this.RefreshingTitle).fontSize(16).margin({ left: 20 })
}
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/common/RefreshComponent.ets#L7-L18 | 70d23cd06179b4aac22fc95ddd73a46991ee2aee | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tcp/TcpDemo/entry/src/main/ets/pages/Index.ets | arkts | sendMsg2Server | 发送消息到服务端 | sendMsg2Server() {
tcpSocket.send({ data: this.sendMsg + "\r\n" })
.then(async () => {
this.msgHistory += "我:" + this.sendMsg + await getCurrentTimeString() + "\r\n"
})
.catch((e) => {
this.msgHistory += '发送失败' + e.message + "\r\n";
})
} | AST#method_declaration#Left sendMsg2Server 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 AST#... | sendMsg2Server() {
tcpSocket.send({ data: this.sendMsg + "\r\n" })
.then(async () => {
this.msgHistory += "我:" + this.sendMsg + await getCurrentTimeString() + "\r\n"
})
.catch((e) => {
this.msgHistory += '发送失败' + e.message + "\r\n";
})
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/TcpDemo/entry/src/main/ets/pages/Index.ets#L156-L164 | 15172de789741b7d828e702a4f4459f824be6b96 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/model/MustLearnPoetryModel.ets | arkts | 必学古诗 数据模型 | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/model/MustLearnPoetryModel.ets#L2-L2 | b930b96a1518c4f94cadf3c25a830300903c55f4 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/main/sub/report/SubReportView.ets | arkts | ======================= Color ======================= | export class ColorTestInfo {
static readonly Correct : string = "#F6687C";
static readonly Wrong : string = "#629DEC";
static readonly Still : string = "#41C5EE";
} | AST#export_declaration#Left export AST#class_declaration#Left class ColorTestInfo AST#class_body#Left { AST#property_declaration#Left static readonly Correct : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "#F6687C" AST#expression#Right ; AS... | export class ColorTestInfo {
static readonly Correct : string = "#F6687C";
static readonly Wrong : string = "#629DEC";
static readonly Still : string = "#41C5EE";
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/SubReportView.ets#L12-L16 | 9a2aef41e7d7dc26320804f677e387e97bcd2a5e | github | |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | setData | 整体替换数据源 | setData(newData: Array<T>) {
this.dataSource = newData;
this.reloadData(); //通知所有监听器数据已完全替换
} | AST#method_declaration#Left setData AST#parameter_list#Left ( AST#parameter#Left newData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST... | setData(newData: Array<T>) {
this.dataSource = newData;
this.reloadData();
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L29-L32 | 2428b2473ef6cb5264b899f2413ae5fc16a59d90 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets | arkts | unregisterDataChangeListener | Remove the listener from the data source for the corresponding LazyForEach component. | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos: number = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos: number = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets#L37-L42 | 0e91972d92be7cd25515eaf124323a279b884927 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/model/TextModel.ets | arkts | 定义Span类型的枚举 | export enum MyCustomSpanType {
Normal, // 普通文本,不含任何特殊格式或标记
Mention, // @提及
Hashtag, // 话题标签
VideoLink, // 视频链接
DetailLink // 正文详情
} | AST#export_declaration#Left export AST#enum_declaration#Left enum MyCustomSpanType AST#enum_body#Left { AST#enum_member#Left Normal AST#enum_member#Right , // 普通文本,不含任何特殊格式或标记 AST#enum_member#Left Mention AST#enum_member#Right , // @提及 AST#enum_member#Left Hashtag AST#enum_member#Right , // 话题标签 AST#enum_member#Left Vi... | export enum MyCustomSpanType {
Normal,
Mention,
Hashtag,
VideoLink,
DetailLink
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/model/TextModel.ets#L61-L67 | e8285b4f741e608fa3ddd73f8cbee2e08d9d3c24 | gitee | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | example/BasicUsage.ets | arkts | cut | 视频裁剪 | cut(): void {
const cmd = FFmpegFactory.cut('/input.mp4', '/clip.mp4', '00:01:00', '30');
this.run(cmd);
} | AST#method_declaration#Left cut AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cmd = AST#expression#... | cut(): void {
const cmd = FFmpegFactory.cut('/input.mp4', '/clip.mp4', '00:01:00', '30');
this.run(cmd);
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L27-L30 | 6449e9a409675351ba49a2f12a17b881b0e0bd6f | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/AVTranscoder/AsyncTranscoder/entry/src/main/ets/util/SendableObject.ets | arkts | SendableObject | 发送的参数必须加上@Sendable标注 | @Sendable
export class SendableObject {
constructor(sendableContext: sendableContextManager.SendableContext, data: string = '') {
this.sendableContext = sendableContext;
this.data = data;
}
private sendableContext: sendableContextManager.SendableContext;
private data: string;
public getSendableCon... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class SendableObject AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left sendableContext : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left sen... | @Sendable
export class SendableObject {
constructor(sendableContext: sendableContextManager.SendableContext, data: string = '') {
this.sendableContext = sendableContext;
this.data = data;
}
private sendableContext: sendableContextManager.SendableContext;
private data: string;
public getSendableCon... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVTranscoder/AsyncTranscoder/entry/src/main/ets/util/SendableObject.ets#L19-L39 | 523bd1e0e18f219642afaf9fa4942341a255ddf8 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets | arkts | getInstance | 获取对象函数 | public static getInstance() {
if (!ChatConfig._instance) {
ChatConfig._instance = new ChatConfig();
}
return ChatConfig._instance
} | AST#method_declaration#Left public static getInstance 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 AST#unary_expression#Left ! AST#expression#Left ChatConfig... | public static getInstance() {
if (!ChatConfig._instance) {
ChatConfig._instance = new ChatConfig();
}
return ChatConfig._instance
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets#L15-L20 | d7f5b816ff389acc2d4c317b3e8b44186ff19ef7 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/PureTabsExt/entry/src/main/ets/view/InTabComponent.ets | arkts | InTabComponent | [Start tabs_bar_translate] | @Component
export default struct InTabComponent {
// [StartExclude tabs_bar_translate]
@State private tabItems: string[] = [];
isFadingEdge:boolean = true;
isSetTabBarTranslateAndOpacity:boolean = true;
private contents = [1,2,3,4,5,6,7];
// [EndExclude tabs_bar_translate]
private subController: TabsContr... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct InTabComponent AST#component_body#Left { // [StartExclude tabs_bar_translate] AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private tabItems : AST#type_annotation#Left AST#primar... | @Component
export default struct InTabComponent {
@State private tabItems: string[] = [];
isFadingEdge:boolean = true;
isSetTabBarTranslateAndOpacity:boolean = true;
private contents = [1,2,3,4,5,6,7];
private subController: TabsController = new TabsController();
onDidBuild(): void {
if (this.isS... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/view/InTabComponent.ets#L20-L141 | 7bbdcaaf21bd9df04cdfb00df0443a63f93a478a | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets | arkts | MyRenderNode类,初始化画笔和绘制路径 | export class MyRenderNode extends RenderNode {
path: drawing.Path = new drawing.Path(); // 新建路径对象,用于绘制手指移动轨迹
penColor: common2D.Color = {
alpha: 0xFF,
red: 0x00,
green: 0x00,
blue: 0x00
}; // 画笔颜色,默认为黑色
// 创建节点时设置画笔颜色
constructor(penColor: common2D.Color) {
super();
this.penColor = pe... | AST#export_declaration#Left export AST#class_declaration#Left class MyRenderNode extends AST#type_annotation#Left AST#primary_type#Left RenderNode AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left path : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type... | export class MyRenderNode extends RenderNode {
path: drawing.Path = new drawing.Path();
penColor: common2D.Color = {
alpha: 0xFF,
red: 0x00,
green: 0x00,
blue: 0x00
};
constructor(penColor: common2D.Color) {
super();
this.penColor = penColor;
}
draw(context: DrawContext): v... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L23-L55 | 4b32ad4c00ca34cee974ac879e2de0eeb73c712d | gitee | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/pages/Index.ets | arkts | getSBMainItemNum | 刷新侧边栏主列表 item 的数量 | private getSBMainItemNum(): void {
for (let i = 0; i < 5; i++) {
const list: SideBarListModel = this.sideBarMainList[i];
let count: number = 0;
// 全部问卷
if (i === 0) {
this.surveys.map((survey: Survey) => {
if (!survey.deleted) {
count = count + 1;
}
... | AST#method_declaration#Left private getSBMainItemNum AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AS... | private getSBMainItemNum(): void {
for (let i = 0; i < 5; i++) {
const list: SideBarListModel = this.sideBarMainList[i];
let count: number = 0;
if (i === 0) {
this.surveys.map((survey: Survey) => {
if (!survey.deleted) {
count = count + 1;
}
}... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L564-L615 | 0e3cf3ef7019fd24aa5bc9fe2a72cd5efb30ddbd | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/viewmodel/PointStyle.ets | arkts | Chart point style entity class. | export default class PointStyle {
/**
* The shape of the point.
*/
shape: string = '';
/**
* Fill color.
*/
fillColor: string = '';
/**
* Border color.
*/
strokeColor: string = '';
/**
* Size of high bright spots.
*/
size: number = 0;
} | AST#export_declaration#Left export default AST#class_declaration#Left class PointStyle AST#class_body#Left { /**
* The shape of the point.
*/ AST#property_declaration#Left shape : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#ex... | export default class PointStyle {
shape: string = '';
fillColor: string = '';
strokeColor: string = '';
size: number = 0;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/viewmodel/PointStyle.ets#L19-L36 | 4b3e39387729649e0bd3fe88de7cd94f191c9295 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | MemoryDetection/entry/src/main/ets/pages/MemoryLeakDetection2.ets | arkts | [Start resource_leak_advise1_positive] | export default class test {
private timer: number | null = null; // 正确声明类属性
onInit() {
this.timer = setInterval(() => {
this.updateData(); // 通过this调用类方法
}, 1000);
}
private updateData() {
// 定时任务具体逻辑
}
onDestroy() {
if (this.timer !== null) {
clearInterval(this.timer); // 清理定... | AST#export_declaration#Left export default AST#class_declaration#Left class test AST#class_body#Left { AST#property_declaration#Left private timer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right A... | export default class test {
private timer: number | null = null;
onInit() {
this.timer = setInterval(() => {
this.updateData();
}, 1000);
}
private updateData() {
}
onDestroy() {
if (this.timer !== null) {
clearInterval(this.timer);
this.timer = null;
}
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/MemoryDetection/entry/src/main/ets/pages/MemoryLeakDetection2.ets#L16-L35 | fe51f75e337dbec00f038e00d049e7733427adde | gitee | |
IceTeacher/DrawingBook.git | c101a1b904388fcfa72de1ff402307bb9036b68b | entry/src/main/ets/pages/BookDetailPage.ets | arkts | getBookDetail | 获取书籍推荐列表 | async getBookDetail() {
let params: ESObject = router.getParams() as ESObject;
let httpObject = http.createHttp();
let url = "https://van.mama.cn/hb/api/goods/getGoodsDetail?goods_id=" + params.id
this.more = params.id
let res = await httpObject.request(url)
res = JSON.parse(res["result"] as str... | AST#method_declaration#Left async getBookDetail AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Ri... | async getBookDetail() {
let params: ESObject = router.getParams() as ESObject;
let httpObject = http.createHttp();
let url = "https://van.mama.cn/hb/api/goods/getGoodsDetail?goods_id=" + params.id
this.more = params.id
let res = await httpObject.request(url)
res = JSON.parse(res["result"] as str... | https://github.com/IceTeacher/DrawingBook.git/blob/c101a1b904388fcfa72de1ff402307bb9036b68b/entry/src/main/ets/pages/BookDetailPage.ets#L54-L63 | 50c9c3af31025fcce8273147348cb301ea3ca895 | github |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/textInput/TextInputComponent.ets | arkts | TextInputComponent | 文本框组件,根据手指点击位置插入的文本框组件 | @ComponentV2
export struct TextInputComponent {
@Param @Require item: TextInputData;
private touchPoint: common2D.Point = { x: 0, y: 0 };
build() {
RelativeContainer() {
// 文本
this.builderTextBox(this.item);
// 左上角的移除按钮
this.builderRemoveIcon(this.item);
// 右下角调整按钮
this.bu... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TextInputComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right item : AST#type_annotation#Left AST#primary_... | @ComponentV2
export struct TextInputComponent {
@Param @Require item: TextInputData;
private touchPoint: common2D.Point = { x: 0, y: 0 };
build() {
RelativeContainer() {
this.builderTextBox(this.item);
this.builderRemoveIcon(this.item);
this.builderAdjustIcon(this.item)... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextInputComponent.ets#L52-L263 | 769ac05a976a49a5a8b1db7fb90fc23cea085444 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/ScanUtils.ets | arkts | startScanForResult | 调用默认界面扫码,使用Promise方式异步返回解码结果。
@param options
scanTypes 设置扫码类型,默认扫码ALL(全部码类型)。
enableMultiMode 是否开启多码识别,默认false。true:多码识别、false:单码识别。
enableAlbum 是否开启相册,默认true。true-开启相册扫码、false-关闭相册扫码。
@returns ScanResult 扫码结果:
scanType 码类型。
originalValue 码识别内容结果。
scanCodeRect 码识别位置信息。 | static startScanForResult(context: Context = getContext(), options: scanBarcode.ScanOptions = {
scanTypes: [scanCore.ScanType.ALL],
enableMultiMode: true,
enableAlbum: false
}): Promise<scanBarcode.ScanResult> {
return scanBarcode.startScanForResult(getContext(context), options) //启动扫码,拉起扫码界面
} | AST#method_declaration#Left static startScanForResult AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argu... | static startScanForResult(context: Context = getContext(), options: scanBarcode.ScanOptions = {
scanTypes: [scanCore.ScanType.ALL],
enableMultiMode: true,
enableAlbum: false
}): Promise<scanBarcode.ScanResult> {
return scanBarcode.startScanForResult(getContext(context), options)
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ScanUtils.ets#L19-L25 | 504c6c0957ccc3af2e1eef6f5df047a3fda286f4 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/goods/OrderGoodsCard.ets | arkts | OrderGoodsCard | @file 订单商品卡片组件
@author Joker.X | @ComponentV2
export struct OrderGoodsCard {
/**
* 购物车数据
*/
@Param
data: Cart = new Cart();
/**
* 正在删除的规格ID集合
*/
@Param
deletingSpecIds: Set<number> = new Set();
/**
* 商品点击回调
*/
@Param
onGoodsClick: (goodsId: number) => void = () => {
};
/**
* 规格点击回调
*/
@Param
onSpecClic... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderGoodsCard AST#component_body#Left { /**
* 购物车数据
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right data : AST#type_annotation#Left AST#primary_type#Left Cart AST#primary_type#... | @ComponentV2
export struct OrderGoodsCard {
@Param
data: Cart = new Cart();
@Param
deletingSpecIds: Set<number> = new Set();
@Param
onGoodsClick: (goodsId: number) => void = () => {
};
@Param
onSpecClick: (specId: number) => void = () => {
};
@Param
onQuantityChanged: (specId: num... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/goods/OrderGoodsCard.ets#L11-L113 | d8c6c21e59d77c90cd17e68e88f8fb2f44c7bda1 | github |
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git | 3b5fa45c650dcae2773a19f122161935e0c0e2bc | entry/src/main/ets/pages/customScan/pages/ScanPage.ets | arkts | this | Initialize XComponentSize based on the window size. | this.setDisplay(); | AST#method_declaration#Left this AST#ERROR#Left . setDisplay AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right | this.setDisplay(); | https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/pages/customScan/pages/ScanPage.ets#L140-L140 | d5a849371ce716c086f7daeca648e462ab8bdaf6 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onBackground | 应用进入后台时调用
暂停应用状态、注销路由
@returns {void} 无返回值 | onBackground(): void {
} | AST#method_declaration#Left onBackground 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#builder_function_body#Right AST#method_declaration#Right | onBackground(): void {
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/entryability/EntryAbility.ets#L81-L82 | 73693aa071bf1656c865f0518e1ce5d5c9ded125 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/component/PhoneInputField.ets | arkts | PhoneInputField | @file 手机号输入组件
@author Joker.X | @ComponentV2
export struct PhoneInputField {
/**
* 手机号
*/
@Param
phone: string = "";
/**
* 占位提示
*/
@Param
placeholder: ResourceStr = $r("app.string.phone_hint");
/**
* 手机号变更回调
*/
@Param
onPhoneChange: (value: string) => void = () => {
};
/**
* 输入框聚焦状态
*/
@Local
private ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct PhoneInputField AST#component_body#Left { /**
* 手机号
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ... | @ComponentV2
export struct PhoneInputField {
@Param
phone: string = "";
@Param
placeholder: ResourceStr = $r("app.string.phone_hint");
@Param
onPhoneChange: (value: string) => void = () => {
};
@Local
private isFocused: boolean = false;
build(): void {
ColumnStart({ widthValue: P... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/PhoneInputField.ets#L9-L70 | a65cd1338db2f3925ecaf43884df54f1d96d0144 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | getCustomBalance | 获取结余 | public getCustomBalance(): string {
let dayInfo = this.customDayInfo;
if (dayInfo) {
let res: number = dayInfo.income - dayInfo.expense;
return res.toString();
}
return '0';
} | AST#method_declaration#Left public getCustomBalance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left d... | public getCustomBalance(): string {
let dayInfo = this.customDayInfo;
if (dayInfo) {
let res: number = dayInfo.income - dayInfo.expense;
return res.toString();
}
return '0';
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L502-L511 | dfbdb1415f164eca5df8a13dcbb91719aa441d02 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets | arkts | verify | 对数据进行验签,异步
@param dataBlob 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、、等)。
@returns | static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): Promise<boolean> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
let res = await verifier.verify(dataBlob, signDataBlob);... | AST#method_declaration#Left static async verify AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sig... | static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): Promise<boolean> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
let res = await verifier.verify(dataBlob, signDataBlob);... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets#L320-L326 | 92c3da5389269c43c936e6f4783277c523314741 | github |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/globals/event.ets | arkts | queryUserOrders | UserOrder | public async queryUserOrders() {
logger.info('AppEvent.queryUserOrders is called')
const newOrders = await UserDatabaser.queryUserOrders()
await store.storeOrders(newOrders)
return newOrders
} | AST#method_declaration#Left public async queryUserOrders 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#... | public async queryUserOrders() {
logger.info('AppEvent.queryUserOrders is called')
const newOrders = await UserDatabaser.queryUserOrders()
await store.storeOrders(newOrders)
return newOrders
} | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/globals/event.ets#L88-L93 | fdbfdeb98441cae9b22b79f5fd8fa6303ca03fec | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets | arkts | onCastPlayError | 投屏操作失败。
@param state:VHCastPlayState。执行相关操作失败。包括开播、暂停、设置进度 | onCastPlayError(state: VHCastPickerState) {
this.getUIContext().getPromptAction().showToast({
message: '投屏异常' + state.toString(),
duration: 4000,
showMode: promptAction.ToastShowMode.DEFAULT,
bottom: 80
});
} | AST#method_declaration#Left onCastPlayError AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left VHCastPickerState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left... | onCastPlayError(state: VHCastPickerState) {
this.getUIContext().getPromptAction().showToast({
message: '投屏异常' + state.toString(),
duration: 4000,
showMode: promptAction.ToastShowMode.DEFAULT,
bottom: 80
});
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L368-L375 | 7ea12b234e3a0d3cb61c5d8da1a889bbcc75d108 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ObjectUtil.ets | arkts | objToClass | 该方法已废弃,建议使用 plainToClass。 | static objToClass<T extends Object>(clazz: Constructor<T>, obj: Object): T {
return ObjectUtil.plainToClass(clazz,obj);;
} | AST#method_declaration#Left static objToClass AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left clazz : AST#... | static objToClass<T extends Object>(clazz: Constructor<T>, obj: Object): T {
return ObjectUtil.plainToClass(clazz,obj);;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L213-L215 | 7d9fefba99fca834141ceffa134924de16b49c86 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/MD5.ets | arkts | hmacSegmentSync | 消息认证码计算,分段,同步
@param data 传入的消息
@param symKey 共享对称密钥。
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
@param len 自定义的数据拆分长度 | static hmacSegmentSync(data: string, symKey: cryptoFramework.SymKey = MD5.symKey,
resultCoding: crypto.BhCoding = 'hex', len: number = 128): string {
return CryptoUtil.hmacSegmentSync(data, 'MD5', symKey, resultCoding, len);
} | AST#method_declaration#Left static hmacSegmentSync 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 symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_typ... | static hmacSegmentSync(data: string, symKey: cryptoFramework.SymKey = MD5.symKey,
resultCoding: crypto.BhCoding = 'hex', len: number = 128): string {
return CryptoUtil.hmacSegmentSync(data, 'MD5', symKey, resultCoding, len);
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/MD5.ets#L117-L120 | 7bf852ffb0c3f7b954cccaa2bb7efaca55cb27e1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | closeDatabase | 关闭数据库连接 | async closeDatabase(): Promise<void> {
if (this.isInitialized) {
await this.dbManager.closeDatabase();
this.isInitialized = false;
console.info('[DatabaseService] Database service closed');
}
} | AST#method_declaration#Left async closeDatabase AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async closeDatabase(): Promise<void> {
if (this.isInitialized) {
await this.dbManager.closeDatabase();
this.isInitialized = false;
console.info('[DatabaseService] Database service closed');
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L314-L320 | d969de8dc27e99d7191f28692d288e3a31227ecd | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/greeting/GreetingService.ets | arkts | getGreetingById | 根据ID获取祝福语
@param greetingId 祝福语ID
@returns 祝福语信息 | async getGreetingById(greetingId: string): Promise<Greeting | null> {
try {
const dbData = await this.databaseService.queryFirst(
StorageConstants.TABLE_GREETINGS,
'id = ?',
[greetingId]
);
if (!dbData) {
return null;
}
return this.dbDataToGreeting(dbD... | AST#method_declaration#Left async getGreetingById AST#parameter_list#Left ( AST#parameter#Left greetingId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | async getGreetingById(greetingId: string): Promise<Greeting | null> {
try {
const dbData = await this.databaseService.queryFirst(
StorageConstants.TABLE_GREETINGS,
'id = ?',
[greetingId]
);
if (!dbData) {
return null;
}
return this.dbDataToGreeting(dbD... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/greeting/GreetingService.ets#L204-L221 | 272947bf3d3a89cacaa602a72c6e85c7a69cef7e | github |
J-Design/ArkUI_Component | d7ecc33451ec5ebdb01da02616e1b83ecc3bfc66 | entry/src/main/ets/bean/common/ValueObject.ets | arkts | @author 王洪贺
@date 2024/1/31 15:51
自定义选择组件接收的参数模型 | export default class ValueObject {
value: string = ''
} | AST#export_declaration#Left export default AST#class_declaration#Left class ValueObject AST#class_body#Left { AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#property_declarati... | export default class ValueObject {
value: string = ''
} | https://github.com/J-Design/ArkUI_Component/blob/d7ecc33451ec5ebdb01da02616e1b83ecc3bfc66/entry/src/main/ets/bean/common/ValueObject.ets#L8-L10 | ace0808fb641cf9c196a511360fa47b9187e494b | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/dialogv2/source/dialogv2.ets | arkts | getCheckTipsAccessibilityText | 获取checkTips无障碍文本
@param resource 资源
@param selected select state
@returns string | function getCheckTipsAccessibilityText(resource: ResourceStr | null | undefined, selected?: boolean): string {
try {
// 'sys.string.slider_accessibility_selected'
let selectText: string = getContext().resourceManager.getStringSync(125833934);
// 'sys.string.slider_accessibility_unselected'
let unselec... | AST#function_declaration#Left function getCheckTipsAccessibilityText AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primary_type#Left undefined AST#pri... | function getCheckTipsAccessibilityText(resource: ResourceStr | null | undefined, selected?: boolean): string {
try {
let selectText: string = getContext().resourceManager.getStringSync(125833934);
let unselectText: string = getContext().resourceManager.getStringSync(125833935);
let checkBox... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1713-L1735 | f6f3465ef175f5475c6bd0733d30e708dd979bee | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2.ets | arkts | convertSM2PubKey | 将服务器端生成的16进制的长度为130位的04开头的C1C3C2格式的SM2公钥转换为前端所需的ASN.1格式公钥字符串
@param pubKey 04开头的16进制的130位的公钥字符串
@returns 转换后的公钥字符串 | static async convertSM2PubKey(pubKey: string): Promise<OutDTO<string>> {
if (pubKey.length != 130) {
return OutDTO.Error('服务器端SM2公钥长度不正确~');
}
//截取x参数
let px = pubKey.substring(2, 66);
//截取y参数
let py = pubKey.substring(66);
//转16进制放入对应的位置 04+x+y
let pk: cryptoFramework.Point = {
... | AST#method_declaration#Left static async convertSM2PubKey AST#parameter_list#Left ( AST#parameter#Left pubKey : 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#gener... | static async convertSM2PubKey(pubKey: string): Promise<OutDTO<string>> {
if (pubKey.length != 130) {
return OutDTO.Error('服务器端SM2公钥长度不正确~');
}
let px = pubKey.substring(2, 66);
let py = pubKey.substring(66);
let pk: cryptoFramework.Point = {
x: BigInt("0x" + px),
y: ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2.ets#L81-L108 | 7fac061b7f2990c233ea73daf484cb8c62430a33 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/VirtualEconomyService.ets | arkts | initialize | 初始化虚拟经济服务 | async initialize(context: Context): Promise<void> {
try {
this.context = context;
this.preferences = await preferences.getPreferences(context, StorageKeys.ECONOMY_PREFS);
// 加载用户钱包
await this.loadUserWallet();
// 初始化商店
await this.initializeShop();
hilog... | AST#method_declaration#Left async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | async initialize(context: Context): Promise<void> {
try {
this.context = context;
this.preferences = await preferences.getPreferences(context, StorageKeys.ECONOMY_PREFS);
await this.loadUserWallet();
await this.initializeShop();
hilog.info(LogConstant... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L230-L247 | b5b28d2feea223a3c30724ad82c8d2cb9d9ab960 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | isLunarLeapYear | 判断是否为农历闰年
@param year 农历年份
@returns 是否为闰年 | isLunarLeapYear(year: number): boolean {
return LunarUtils.isLunarLeapYear(year);
} | AST#method_declaration#Left isLunarLeapYear 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 boolean AST#primary_type#... | isLunarLeapYear(year: number): boolean {
return LunarUtils.isLunarLeapYear(year);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L529-L531 | feee42431610cb66615c26701db30d7ea8525cf2 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | getDefaultNet | 获取默认激活的数据网络
@returns | static getDefaultNet(): Promise<connection.NetHandle> {
return connection.getDefaultNet();
} | AST#method_declaration#Left static getDefaultNet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_type#... | static getDefaultNet(): Promise<connection.NetHandle> {
return connection.getDefaultNet();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L68-L70 | 0b488ae72aa0a0470c42360697343906fcb78d44 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | toOrderCommentForGoods | 跳转订单评价页面(指定商品)
@param {number} goodsId - 商品 ID
@returns {void} 无返回值 | toOrderCommentForGoods(goodsId: number): void {
const orderId: number = this.data?.id ?? 0;
if (!orderId || !goodsId) {
return;
}
this.hideCommentModal();
OrderNavigator.toComment(orderId, goodsId);
} | AST#method_declaration#Left toOrderCommentForGoods 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_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | toOrderCommentForGoods(goodsId: number): void {
const orderId: number = this.data?.id ?? 0;
if (!orderId || !goodsId) {
return;
}
this.hideCommentModal();
OrderNavigator.toComment(orderId, goodsId);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L192-L199 | 48f4428b521e6b2d01c9323d9d5a9d475b059272 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/mapthumbtack/src/main/ets/model/CommonConstants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class ThumbTackCommonConstants {
static readonly ICON_WIDTH_HEIGHT_RATIO: number = 0.625;
static readonly TACK_HAT_HEIGHT_RATIO: number = 1;
static readonly TACK_HAT_ANIMATION_HEIGHT_RATIO: number = 0.3;
static readonly TACK_HAT_BRIM_WIDTH_RATIO: number = 0.35;
static readonly ICON_UP_LAYER_RING_Z_IDX:... | AST#export_declaration#Left export AST#class_declaration#Left class ThumbTackCommonConstants AST#class_body#Left { AST#property_declaration#Left static readonly ICON_WIDTH_HEIGHT_RATIO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.625 AS... | export class ThumbTackCommonConstants {
static readonly ICON_WIDTH_HEIGHT_RATIO: number = 0.625;
static readonly TACK_HAT_HEIGHT_RATIO: number = 1;
static readonly TACK_HAT_ANIMATION_HEIGHT_RATIO: number = 0.3;
static readonly TACK_HAT_BRIM_WIDTH_RATIO: number = 0.35;
static readonly ICON_UP_LAYER_RING_Z_IDX:... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mapthumbtack/src/main/ets/model/CommonConstants.ets#L16-L31 | fbab4111cac46b716f4e271c865899caad2179ee | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/faceandfingerprintunlocking/src/main/ets/common/CommonContants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class CommonConstants {
// 100%
static readonly FULL_PERCENT = "100%";
// 指纹
static readonly FINGER:string = "finger";
// 人脸
static readonly FACE:string = "face";
// 箭头
static readonly ARROW:string = "arrow";
// switch模式
static readonly SWITCH:string = "switch";
// 指纹登录
static readonly FI... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // 100% AST#property_declaration#Left static readonly FULL_PERCENT = AST#expression#Left "100%" AST#expression#Right ; AST#property_declaration#Right // 指纹 AST#property_declaration#Left static readonly FINGER : AST... | export class CommonConstants {
static readonly FULL_PERCENT = "100%";
static readonly FINGER:string = "finger";
static readonly FACE:string = "face";
static readonly ARROW:string = "arrow";
static readonly SWITCH:string = "switch";
登录
static readonly FINGER_PRINT:string = "指纹登录";
stati... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/faceandfingerprintunlocking/src/main/ets/common/CommonContants.ets#L16-L40 | 6ace8fdcdf7a7d297c8bb01c54fac4b59df111fa | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationManager.ets | arkts | generateScheduleSuggestions | 生成日程提醒建议 | private async generateScheduleSuggestions(): Promise<SmartSuggestion[]> {
const suggestions: SmartSuggestion[] = [];
const upcomingBirthdays = await this.getUpcomingBirthdays();
for (const item of upcomingBirthdays) {
if (item.daysUntil === 1) {
suggestions.push({
id: `schedule_${it... | AST#method_declaration#Left private async generateScheduleSuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SmartSuggestion [ ] AST#a... | private async generateScheduleSuggestions(): Promise<SmartSuggestion[]> {
const suggestions: SmartSuggestion[] = [];
const upcomingBirthdays = await this.getUpcomingBirthdays();
for (const item of upcomingBirthdays) {
if (item.daysUntil === 1) {
suggestions.push({
id: `schedule_${it... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L435-L459 | f6c79e17a613f5254559013855099b6d5852ead8 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogHelper.ets | arkts | showActionSheetDialog | 显示动作面板(IOS风格) | static showActionSheetDialog(options: BottomSheetOptions): string {
ActionParameter.initBaseDefault(options);
ActionParameter.initBottomSheetDefault(options, false);
const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ActionSheetDialogBuilder), options);
return dialogId;
} | AST#method_declaration#Left static showActionSheetDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BottomSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Le... | static showActionSheetDialog(options: BottomSheetOptions): string {
ActionParameter.initBaseDefault(options);
ActionParameter.initBottomSheetDefault(options, false);
const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ActionSheetDialogBuilder), options);
return dialogId;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L245-L250 | dcbc8370e8f82456f581e9c4c50b75b16d5a1baa | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | 卡片一镜到底转场动画管理器 | export class NavSharedCardAnimMgr {
private _navBgColor: ResourceColor | undefined = undefined
private _isAdaptImmersive: boolean = false
/**
* 注册卡片一镜到底转场动画
* @param component
* @param ctx
* @returns
*/
public registerSharedCardAnimParam(component: object, ctx: NavDestinationContext): NavAnimPar... | AST#export_declaration#Left export AST#class_declaration#Left class NavSharedCardAnimMgr AST#class_body#Left { AST#property_declaration#Left private _navBgColor : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Ri... | export class NavSharedCardAnimMgr {
private _navBgColor: ResourceColor | undefined = undefined
private _isAdaptImmersive: boolean = false
public registerSharedCardAnimParam(component: object, ctx: NavDestinationContext): NavAnimParamBuilder {
return NavAnimationStore.getInstance()
.buildSharedCardAn... | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L142-L241 | e64f84837da64086266a5c39009a2180d1503ecd | gitee | |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/common/contants/CommonConstants.ets | arkts | Time scale modes | export enum ScaleMode {
MODE_HOUR = 1, // each small tick = 10 minutes, show hour labels
MODE_MINUTE = 2, // each big tick = 1 minute, show minute labels
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ScaleMode AST#enum_body#Left { AST#enum_member#Left MODE_HOUR = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , // each small tick = 10 minutes, show hour labels AST#enum_member#Left MODE_MINUTE = AST#expression#Left 2 AST#expression#R... | export enum ScaleMode {
MODE_HOUR = 1,
MODE_MINUTE = 2,
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/contants/CommonConstants.ets#L17-L20 | bbc185e14fbe339b0a975f486d5950288b0d86cb | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | 任务难度枚举 | export enum TaskDifficulty {
EASY = 'easy',
MEDIUM = 'medium',
HARD = 'hard'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum TaskDifficulty AST#enum_body#Left { AST#enum_member#Left EASY = AST#expression#Left 'easy' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MEDIUM = AST#expression#Left 'medium' AST#expression#Right AST#enum_member#Right , AST#enum_membe... | export enum TaskDifficulty {
EASY = 'easy',
MEDIUM = 'medium',
HARD = 'hard'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L162-L166 | 39a2e2a3aee2b9fcafcc717bfd759544c2df6049 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderConfirmPage.ets | arkts | PriceValue | 价格值(使用 IBestPrice 组件)
@param {number} price 价格(单位:分)
@returns {void} 无返回值 | @Builder
private PriceValue(price: number) {
IBestPrice({
value: price,
integerFontSize: 14,
decimalFontSize: 12,
symbolFontSize: 12
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PriceValue AST#parameter_list#Left ( AST#parameter#Left price : 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_... | @Builder
private PriceValue(price: number) {
IBestPrice({
value: price,
integerFontSize: 14,
decimalFontSize: 12,
symbolFontSize: 12
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderConfirmPage.ets#L200-L208 | c63633686bb9f34e31d295bb22b774e116eb213f | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | sign | 对数据进行签名,异步
@param dataBlob 待签名数据
@param priKey 私钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
@returns | static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): Promise<cryptoFramework.DataBlob> {
let signer = cryptoFramework.createSign(algName);
await signer.init(priKey);
let signData = await signer.sign(dataBlob);
return signData;
} | AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKe... | static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string): Promise<cryptoFramework.DataBlob> {
let signer = cryptoFramework.createSign(algName);
await signer.init(priKey);
let signData = await signer.sign(dataBlob);
return signData;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L290-L295 | a9deb670b46cad53efafd0d83c356b78bb17624f | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/expression/conditional_expression/conditional_expression_001_T.ets | arkts | Introduction 条件表达式 | export function conditional_expression_001_T(taint_src : string) {
let t = true ? taint_src : "_";
taint.Sink(t);
} | AST#export_declaration#Left export AST#function_declaration#Left function conditional_expression_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_... | export function conditional_expression_001_T(taint_src : string) {
let t = true ? taint_src : "_";
taint.Sink(t);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/conditional_expression/conditional_expression_001_T.ets#L6-L9 | b39f9153be73dd6419309d286b0fb3bd3e6aab32 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | onFixedRatioChange | Fix ratio canvas refresh.
@param ratio | onFixedRatioChange(ratio: CropRatioType): void {
Logger.debug(TAG, `onFixedRatioChange: ratio[${ratio}]`);
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
this.cropShow.enlargeCropArea();
}
this.cropRatio = ratio;
this.cropShow.setRatio(ratio);
this.endImageDrag();
this.re... | AST#method_declaration#Left onFixedRatioChange AST#parameter_list#Left ( AST#parameter#Left ratio : AST#type_annotation#Left AST#primary_type#Left CropRatioType 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#prima... | onFixedRatioChange(ratio: CropRatioType): void {
Logger.debug(TAG, `onFixedRatioChange: ratio[${ratio}]`);
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
this.cropShow.enlargeCropArea();
}
this.cropRatio = ratio;
this.cropShow.setRatio(ratio);
this.endImageDrag();
this.re... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L195-L205 | 0638c9ad6dd1f4cb35da960ece0728d611b404f3 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets | arkts | checkOffsetXY | Check whether the offset exceeds the area. | private checkOffsetXY() {
this.offsetXLeft = this.offsetXLeft < this.blackAreaWidth ? this.blackAreaWidth : this.offsetXLeft;
this.offsetXRight = this.offsetXRight > this.screenWidth - this.blackAreaWidth ?
this.screenWidth - this.blackAreaWidth : this.offsetXRight;
this.offsetYTop = this.offsetYTop <... | AST#method_declaration#Left private checkOffsetXY 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 . offsetXLeft AST#member_expre... | private checkOffsetXY() {
this.offsetXLeft = this.offsetXLeft < this.blackAreaWidth ? this.blackAreaWidth : this.offsetXLeft;
this.offsetXRight = this.offsetXRight > this.screenWidth - this.blackAreaWidth ?
this.screenWidth - this.blackAreaWidth : this.offsetXRight;
this.offsetYTop = this.offsetYTop <... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets#L136-L143 | 23ee7d69de3f2dd47aa91717f25cdf9876201f2b | gitee |
softfatgay/harmony-netease.git | 5f3d226b72ba8579cacfbd229e4eb0054d63abef | entry/src/main/ets/base/Api.ets | arkts | / kingkong | export const GOOD_DETAIL = baseUrl + '/item/detail.json'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GOOD_DETAIL = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/item/detail.json' AST#expression#Right AST#binary_expression#Right AST#expression#Righ... | export const GOOD_DETAIL = baseUrl + '/item/detail.json'; | https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L34-L34 | 5adf6fb8a20b4712ce3c30af5f65b58fa3cee9b2 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets | arkts | onMessage | 订阅消息
@param callback | public onMessage(callback: (data: string) => void): void {
this.mSocket?.setOnMessageReceivedListener((buffer: ArrayBuffer) => {
// 获取数据 解析
let data = this.decodeMsg(buffer);
callback(data);
});
} | AST#method_declaration#Left public onMessage AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left 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#Ri... | public onMessage(callback: (data: string) => void): void {
this.mSocket?.setOnMessageReceivedListener((buffer: ArrayBuffer) => {
let data = this.decodeMsg(buffer);
callback(data);
});
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets#L58-L64 | 83ea12b881b44591e10558d9d7c438b3a432b176 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationContentUtil.ets | arkts | initNotificationLongTextContent | init longText notification content
@param basicContent
@param notificationLongText
@param notificationBriefText
@param notificationExpandedTitle
@return return the created NotificationContent | initNotificationLongTextContent(basicContent: notification.NotificationBasicContent, notificationLongText: string, notificationBriefText: string, notificationExpandedTitle: string) {
let result: NotificationContentUtilResultType = {
contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, // 通知内容... | AST#method_declaration#Left initNotificationLongTextContent AST#parameter_list#Left ( AST#parameter#Left basicContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationBasicContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#R... | initNotificationLongTextContent(basicContent: notification.NotificationBasicContent, notificationLongText: string, notificationBriefText: string, notificationExpandedTitle: string) {
let result: NotificationContentUtilResultType = {
contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationContentUtil.ets#L50-L63 | 78b9ffc6af4be7df7a07fcb1c5a6188a3f005a96 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets | arkts | showToastMessage | Popup window prompt message.
@param message Prompt message. | showToastMessage(message: Resource) {
promptAction.showToast({
message: message,
duration: CommonConstants.DURATION
});
} | AST#method_declaration#Left showToastMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#e... | showToastMessage(message: Resource) {
promptAction.showToast({
message: message,
duration: CommonConstants.DURATION
});
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L141-L146 | 32faf31fa4f5766d8a3294feda52fc8c5ab6b754 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineRadarDataSet.ets | arkts | setFillDrawable | Sets the drawable to be used to fill the area below the line.
@param drawable
@TargetApi(18) | public setFillDrawable(drawable: Object /*Drawable*/): void {
this.mFillDrawable = drawable;
} | AST#method_declaration#Left public setFillDrawable AST#parameter_list#Left ( AST#parameter#Left drawable : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right /*Drawable*/ ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v... | public setFillDrawable(drawable: Object ): void {
this.mFillDrawable = drawable;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineRadarDataSet.ets#L96-L98 | d422937dd4fd6345cdd668697e746715990d3bf5 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets | arkts | selectCert | 选择客户端证书文件 | selectCert() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
certFileUri = result[0]
this.msgHistory += "select file: " + certFileUri + "\r\n";
this.certCanLoad = true
}
}).catch((e) => {
th... | AST#method_declaration#Left selectCert AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expres... | selectCert() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
certFileUri = result[0]
this.msgHistory += "select file: " + certFileUri + "\r\n";
this.certCanLoad = true
}
}).catch((e) => {
th... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L281-L292 | 86b425c9750da32a7346657e67602faea9a323b0 | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkUICalculator/entry/src/main/ets/Calculator.ets | arkts | 计算器计算逻辑 | export class Calculator {
/**
* 计算
* @param input 例:input = '1.1-10%+2×3÷4'
*/
public static calculate(input: string): string {
// 先将百分数转为小数,
input = input.replace(RegExp(`(((\\d*\\.\\d*)|(\\d+))%)`, 'g'), s => String(Number(s.replace(/%/, '')) / 100)) // input = '1.1-0.1+2×3÷4'
// 要将input分割为... | AST#export_declaration#Left export AST#class_declaration#Left class Calculator AST#class_body#Left { /**
* 计算
* @param input 例:input = '1.1-10%+2×3÷4'
*/ AST#method_declaration#Left public static calculate AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left stri... | export class Calculator {
public static calculate(input: string): string {
input = input.replace(RegExp(`(((\\d*\\.\\d*)|(\\d+))%)`, 'g'), s => String(Number(s.replace(/%/, '')) / 100))
let splitIndex = [0]
for (let i = 1;i < input.length; i++) {
if (input[i].match(RegExp('(\\+|-|×|÷)... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUICalculator/entry/src/main/ets/Calculator.ets#L4-L84 | 76f0e4a5fc7fcb43978e07af72a914d78c7b7317 | gitee | |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Tables/AccountingInfoApi.ets | arkts | query | 查询某天的记账记录 | query(date: string, callback: Function): void {
let predicates = new dataRdb.RdbPredicates(Const.ACCOUNTING_INFO.tableName);
predicates.equalTo('date', date);
RdbUtils.query(predicates).then(resultSet => {
let count = resultSet.rowCount;
if (count <= 0) {
const result: AccountingInfo[] =... | AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right ... | query(date: string, callback: Function): void {
let predicates = new dataRdb.RdbPredicates(Const.ACCOUNTING_INFO.tableName);
predicates.equalTo('date', date);
RdbUtils.query(predicates).then(resultSet => {
let count = resultSet.rowCount;
if (count <= 0) {
const result: AccountingInfo[] =... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Tables/AccountingInfoApi.ets#L65-L92 | c3f8d10952a6c9a36fe216fcb0494a7fc58a2e27 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/CanvasGetResult.ets | arkts | [Start arkts_graphics_draw_indirect_canvas_api] 1. 自定义RenderNode | export class MyRenderNodeIndirectDisplay extends RenderNode {
private pixelMap: image.PixelMap | null = null;
setPixelMap(pixelMap: image.PixelMap) {
this.pixelMap = pixelMap;
}
async draw(context: DrawContext) {
const canvas = context.canvas;
if (this.pixelMap != null) {
// 4.1 利用3中创建的PixelM... | AST#export_declaration#Left export AST#class_declaration#Left class MyRenderNodeIndirectDisplay extends AST#type_annotation#Left AST#primary_type#Left RenderNode AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private pixelMap : AST#type_annotation#Left AST#union_typ... | export class MyRenderNodeIndirectDisplay extends RenderNode {
private pixelMap: image.PixelMap | null = null;
setPixelMap(pixelMap: image.PixelMap) {
this.pixelMap = pixelMap;
}
async draw(context: DrawContext) {
const canvas = context.canvas;
if (this.pixelMap != null) {
const canvas_... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/CanvasGetResult.ets#L69-L91 | f7227d5b701b2ae476f6700c1456940c24b38f93 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | updateContactName | 更新联系人
@param {string} value - 联系人
@returns {void} 无返回值 | updateContactName(value: string): void {
this.contactName = value;
} | AST#method_declaration#Left updateContactName AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | updateContactName(value: string): void {
this.contactName = value;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L164-L166 | 48d48a727c8e2d75f4af4ee17a307b76007379e9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/design/DesignSystem.ets | arkts | getStateColor | 获取状态颜色 | static getStateColor(state: 'default' | 'hover' | 'pressed' | 'focused' | 'disabled', baseColor: string): string {
switch (state) {
case 'hover':
return this.withOpacity(baseColor, 0.08);
case 'pressed':
return this.withOpacity(baseColor, 0.12);
case 'focused':
return this.... | AST#method_declaration#Left static getStateColor AST#parameter_list#Left ( AST#parameter#Left state AST#parameter#Right AST#ERROR#Left : 'default' | 'hover' | 'pressed' | 'focused' | 'disabled' AST#ERROR#Right , AST#parameter#Left baseColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right ... | static getStateColor(state: 'default' | 'hover' | 'pressed' | 'focused' | 'disabled', baseColor: string): string {
switch (state) {
case 'hover':
return this.withOpacity(baseColor, 0.08);
case 'pressed':
return this.withOpacity(baseColor, 0.12);
case 'focused':
return this.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/design/DesignSystem.ets#L213-L225 | b513b52084d4ed8a6aa485a3374b95887aa63892 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | JSCrash/entry/src/main/ets/pages/utils.ets | arkts | isLoggable | Checks whether logs of the specified tag, and level can be printed.
@param tag Identifies the log tag.
@param level log level
@since 7 | private static isLoggable(tag: string, level: hilog.LogLevel): boolean {
return hilog.isLoggable(DOMAIN, tag, level);
} | AST#method_declaration#Left private static isLoggable 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#Left level : AST#type_annotation#Left AST#primary_type#Left AST#qualified_ty... | private static isLoggable(tag: string, level: hilog.LogLevel): boolean {
return hilog.isLoggable(DOMAIN, tag, level);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L91-L93 | 7cc30580f445e060526179b21fc3cfa5489b819c | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets | arkts | rectToPixelPhase | Transform a rectangle with all matrices with potential animation phases.
@param r
@param phaseY | public rectToPixelPhase(r: MyRect, phaseY: number) {
// multiply the height of the rect with the phase
r.top *= phaseY;
r.bottom *= phaseY;
this.mMatrixValueToPx.mapRect(r);
this.mViewPortHandler.getMatrixTouch().mapRect(r);
this.mMatrixOffset.mapRect(r);
} | AST#method_declaration#Left public rectToPixelPhase AST#parameter_list#Left ( AST#parameter#Left r : AST#type_annotation#Left AST#primary_type#Left MyRect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | public rectToPixelPhase(r: MyRect, phaseY: number) {
r.top *= phaseY;
r.bottom *= phaseY;
this.mMatrixValueToPx.mapRect(r);
this.mViewPortHandler.getMatrixTouch().mapRect(r);
this.mMatrixOffset.mapRect(r);
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L290-L298 | af4a47a7481109eeded9e7a035b5f94dcc33bbd0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets | arkts | selectPhotoFromAlbum | 拉起图库选择图片 | async selectPhotoFromAlbum() {
// TODO 知识点:拉起图库选择要压缩的图片。使用photoAccessHelper.PhotoViewPicker创建图库选择器实例photoViewPicker,调用photoViewPicker.select()接口拉起图库界面进行图片选择。图片选择成功后,返回photoSelectResult结果集。从photoSelectResult.photoUris中获取返回图库选择后的媒体文件的uri数组,从而获取图片大小,并在页面上显示选择的图片。
// 创建图库选项实例
const photoSelectOptions = new phot... | AST#method_declaration#Left async selectPhotoFromAlbum AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // TODO 知识点:拉起图库选择要压缩的图片。使用photoAccessHelper.PhotoViewPicker创建图库选择器实例photoViewPicker,调用photoViewPicker.select()接口拉起图库界面进行图片选择。图片选择成功后,返回photoSelectResult结果集。从photoSelectResult.photoUris... | async selectPhotoFromAlbum() {
const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
const photoViewPicker = new photoAccessHelper.PhotoViewPic... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L398-L430 | 467bc5047c6866ba9d543732a2789a7d6ef3d63b | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets | arkts | @memo | export function hookDataPanelContentModifier(
receiver: ArkDataPanelComponent, value?: ContentModifier<DataPanelConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const dataPanelBuilder = (parentNode: KPointer, config: DataPanelConfiguration): KPoi... | AST#export_declaration#Left export AST#function_declaration#Left function hookDataPanelContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkDataPanelComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left va... | export function hookDataPanelContentModifier(
receiver: ArkDataPanelComponent, value?: ContentModifier<DataPanelConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const dataPanelBuilder = (parentNode: KPointer, config: DataPanelConfiguration): KPoi... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L98-L111 | b89df6957267ce51abe4a4b041f14368d2e65ebd | gitee | |
HunZiLei/ArkTS_PokePomodoro.git | 61a844a28808c014c39de7a868b0d331052d1bd4 | entry/src/main/ets/components/IndexTabPages/TaskList.ets | arkts | submitNewTask | 数据库操作封装 | submitNewTask(taskData: TaskData) {
this.taskTable.insertData(taskData, (id: number) => {
taskData.id = id
taskData.setDDLState()
this.tasks.push(taskData)
})
} | AST#method_declaration#Left submitNewTask AST#parameter_list#Left ( AST#parameter#Left taskData : AST#type_annotation#Left AST#primary_type#Left TaskData 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#exp... | submitNewTask(taskData: TaskData) {
this.taskTable.insertData(taskData, (id: number) => {
taskData.id = id
taskData.setDDLState()
this.tasks.push(taskData)
})
} | https://github.com/HunZiLei/ArkTS_PokePomodoro.git/blob/61a844a28808c014c39de7a868b0d331052d1bd4/entry/src/main/ets/components/IndexTabPages/TaskList.ets#L103-L109 | 92b3b64360e982eb3814cd91c95feb696625d193 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/PlayerSettingBuilder.ets | arkts | 操作项点击处理 | build() {
Column() {
ForEach(this.actionItems, (actionItem: ActionItem, index: number) => {
this.createActionItem(actionItem, this.onClickItem)
if (index < this.actionItems.length - 1) {
this.createDivider()
}
})
}.sectionStyle()
} | 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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST... | build() {
Column() {
ForEach(this.actionItems, (actionItem: ActionItem, index: number) => {
this.createActionItem(actionItem, this.onClickItem)
if (index < this.actionItems.length - 1) {
this.createDivider()
}
})
}.sectionStyle()
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/PlayerSettingBuilder.ets#L30-L39 | 0984713e871aad3551bc9c6c54ed3913d6ea1ccc | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets | arkts | requestRepository | 请求商品详情页面数据
@returns {Promise<NetworkResponse<GoodsDetail>>} 商品详情 | protected requestRepository(): Promise<NetworkResponse<GoodsDetail>> {
return this.pageRepository.getGoodsDetail(this.goodsId);
} | AST#method_declaration#Left protected requestRepository AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Le... | protected requestRepository(): Promise<NetworkResponse<GoodsDetail>> {
return this.pageRepository.getGoodsDetail(this.goodsId);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L69-L71 | 1e2eb7648e777b47332a1e86db3be02a2e093929 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | getMockNotifications | 获取模拟通知数据 | private getMockNotifications(limit: number): Notification[] {
const notifications: Notification[] = [];
for (let i = 0; i < limit; i++) {
notifications.push({
id: `notification_${i}`,
userId: this.currentUser?.id || 'user_1',
type: i % 3 === 0 ? NotificationType.LIKE : i % 3 === 1... | AST#method_declaration#Left private getMockNotifications AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_t... | private getMockNotifications(limit: number): Notification[] {
const notifications: Notification[] = [];
for (let i = 0; i < limit; i++) {
notifications.push({
id: `notification_${i}`,
userId: this.currentUser?.id || 'user_1',
type: i % 3 === 0 ? NotificationType.LIKE : i % 3 === 1... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L836-L853 | 1dfbf07aaff003fd30a46c965934f77d9e1d6d0a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Audio/entry/src/main/ets/pages/Karaoke.ets | arkts | setVolume | Set audio loopback volume | async setVolume(newVolume: number) {
this.volume = newVolume;
if (this.audioLoopback !== undefined) {
try {
await this.audioLoopback.setVolume(this.volume);
Logger.info(`Invoke setVolume ${this.volume} succeeded.`);
} catch (err) {
Logger.error(`Invoke setVolume failed, code ... | AST#method_declaration#Left async setVolume AST#parameter_list#Left ( AST#parameter#Left newVolume : 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#statement#Left AST#expression_statemen... | async setVolume(newVolume: number) {
this.volume = newVolume;
if (this.audioLoopback !== undefined) {
try {
await this.audioLoopback.setVolume(this.volume);
Logger.info(`Invoke setVolume ${this.volume} succeeded.`);
} catch (err) {
Logger.error(`Invoke setVolume failed, code ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Audio/entry/src/main/ets/pages/Karaoke.ets#L134-L146 | 5f1a546812162cdffde529205f3af40e0c887002 | gitee |
GikkiAres/todolist.git | 3a7571832fd2985ffc1a4eb4673b370ef715fe8e | entry/src/main/ets/pages/ToDoListPage.ets | arkts | goupStyle | 内容文本 | @Extend(Button)
function goupStyle(isSelected:boolean) {
.fontSize(16)
.fontWeight(400)
.width(150)
.height(50)
.backgroundColor(isSelected?"#2c6ccc":Color.White)
.borderColor(isSelected?Color.Transparent:Color.Gray)
.fontColor(isSelected?Color.White:Color.Black)
.borderRadius(5)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Button AST#expression#Right ) AST#decorator#Right function goupStyle AST#parameter_list#Left ( AST#parameter#Left isSelected : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right... | @Extend(Button)
function goupStyle(isSelected:boolean) {
.fontSize(16)
.fontWeight(400)
.width(150)
.height(50)
.backgroundColor(isSelected?"#2c6ccc":Color.White)
.borderColor(isSelected?Color.Transparent:Color.Gray)
.fontColor(isSelected?Color.White:Color.Black)
.borderRadius(5)
} | https://github.com/GikkiAres/todolist.git/blob/3a7571832fd2985ffc1a4eb4673b370ef715fe8e/entry/src/main/ets/pages/ToDoListPage.ets#L177-L187 | bb43c2e627de77c81f5a2d34cb390885c057223d | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/order/OrderParam.ets | arkts | @file 订单模块导航参数定义
@author Joker.X
订单列表参数 | export interface OrderListParam {
/**
* Tab 标签(可选)
*/
tab?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface OrderListParam AST#object_type#Left { /**
* Tab 标签(可选)
*/ AST#type_member#Left tab ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right ... | export interface OrderListParam {
tab?: string;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderParam.ets#L11-L16 | c1dc39ed12fa990925ea11024ffdfc10227f3c43 | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | entry/src/main/ets/pages/demos/guide/GuideBuilder.ets | arkts | 全局引导 | export class GuideDemoContentBuilder {
private static _WrappedBuilder?: WrappedBuilder<[IGuideContentParams]> = undefined;
static getBuilder() {
if (!GuideDemoContentBuilder._WrappedBuilder) {
GuideDemoContentBuilder._WrappedBuilder = wrapBuilder(buildGuideDemoContent)
}
return GuideDemoContentBu... | AST#export_declaration#Left export AST#class_declaration#Left class GuideDemoContentBuilder AST#class_body#Left { AST#property_declaration#Left private static _WrappedBuilder ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#pr... | export class GuideDemoContentBuilder {
private static _WrappedBuilder?: WrappedBuilder<[IGuideContentParams]> = undefined;
static getBuilder() {
if (!GuideDemoContentBuilder._WrappedBuilder) {
GuideDemoContentBuilder._WrappedBuilder = wrapBuilder(buildGuideDemoContent)
}
return GuideDemoContentBu... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/entry/src/main/ets/pages/demos/guide/GuideBuilder.ets#L46-L55 | 2405fe7e1e5341279632809f699f7a5ca443ecdc | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/Tcp2OneWayTls.ets | arkts | upgradeToTLSSocket | 将 TCP Socket 升级为 TLS Socket | upgradeToTLSSocket() {
workerPort.postMessage({
type: 'upgradeToTLS',
serverIp: this.serverIp,
serverPort: this.serverPort,
ca: this.ca
});
workerPort.onmessage = (e: MessageEvents) => {
const response: TlsOneWayMessage = e.data;
if (response.type === 'tlsConnectSuccess'... | AST#method_declaration#Left upgradeToTLSSocket 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 workerPort AST#expression#Right . postMessage... | upgradeToTLSSocket() {
workerPort.postMessage({
type: 'upgradeToTLS',
serverIp: this.serverIp,
serverPort: this.serverPort,
ca: this.ca
});
workerPort.onmessage = (e: MessageEvents) => {
const response: TlsOneWayMessage = e.data;
if (response.type === 'tlsConnectSuccess'... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/Tcp2OneWayTls.ets#L245-L262 | 94be51be7c3a4e1ceca693dab33a35bddd9afb32 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider21.ets | arkts | buildSlider21 | Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 l... | @Builder function buildSlider21(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildSlider21 AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left SliderConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li... | @Builder function buildSlider21(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider21.ets#L16-L67 | 4a3e38bb9360096920a10b7a328193b26e551577 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/pages/WidgetCard2x4.ets | arkts | buildFooter | 构建底部 | @Builder
buildFooter() {
Row() {
// 统计信息
if (this.widgetData.hasData) {
Row({ space: 16 }) {
if (this.widgetData.todayCount > 0) {
this.buildStatItem('今天', this.widgetData.todayCount, '#FF5722')
}
if (this.widgetData.weekCount > 0) {
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFooter AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 统计信息 AST#ui_contr... | @Builder
buildFooter() {
Row() {
if (this.widgetData.hasData) {
Row({ space: 16 }) {
if (this.widgetData.todayCount > 0) {
this.buildStatItem('今天', this.widgetData.todayCount, '#FF5722')
}
if (this.widgetData.weekCount > 0) {
th... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L200-L226 | 5c824b256fd37110c606afbbf73c50d57220b62a | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/auth/AuthNavigator.ets | arkts | toAccountLogin | 跳转到账号密码登录
@returns {void} 无返回值 | static toAccountLogin(): void {
navigateTo(AuthRoutes.AccountLogin);
} | AST#method_declaration#Left static toAccountLogin AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#membe... | static toAccountLogin(): void {
navigateTo(AuthRoutes.AccountLogin);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/auth/AuthNavigator.ets#L21-L23 | 335ead05d22b5cc9c7e52afb2b687c71e6113f98 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogBuilder.ets | arkts | TextAreaDialogBuilder | TextArea文本输入弹窗view (内部使用系统自定义内容弹窗)
@param options | @Builder
export function TextAreaDialogBuilder(options: ITextAreaOptions) {
TextAreaDialogView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TextAreaDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ITextAreaOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p... | @Builder
export function TextAreaDialogBuilder(options: ITextAreaOptions) {
TextAreaDialogView({ options: options });
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L233-L236 | 7ae154b1693ad60164c15799a0a0a00f28325350 | github |
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | requestInvalidate | /** * 内部方法:由AxisRender设置刷新回调 * @internal 开发者不应调用此方法 _setInvalidateCallback(callback: () => void): void { this._invalidateCallback = callback; }
子类调用此方法请求刷新
protected: 只有子类可以调用 | protected requestInvalidate(): void {
const callback = decoratorInvalidateMap.get(this);
if (callback) {
callback();
}
} | AST#method_declaration#Left protected requestInvalidate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Le... | protected requestInvalidate(): void {
const callback = decoratorInvalidateMap.get(this);
if (callback) {
callback();
}
} | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L158-L163 | a080509ca2ef54618f47d34b811853450b8be0f7 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/detail/DetailCardsView.ets | arkts | actionInfo | /actions | actionInfo(){
this.isShowInfoView = true
} | AST#method_declaration#Left actionInfo 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 . isShowInfoView AST#member_expression#Ri... | actionInfo(){
this.isShowInfoView = true
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/detail/DetailCardsView.ets#L539-L541 | 185b6bdfc08c12a999075c379696e6a25d3eb8d2 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/cart/CartLocalDataSource.ets | arkts | @file 购物车本地数据源接口
@author Joker.X | export interface CartLocalDataSource {
/**
* 添加商品到购物车
* @param {Cart} cart 购物车商品
* @returns {Promise<void>} Promise<void>
*/
addToCart(cart: Cart): Promise<void>;
/**
* 更新购物车中的商品
* @param {Cart} cart 购物车商品
* @returns {Promise<void>} Promise<void>
*/
updateCart(cart: Cart): Promise<void>... | AST#export_declaration#Left export AST#interface_declaration#Left interface CartLocalDataSource AST#object_type#Left { /**
* 添加商品到购物车
* @param {Cart} cart 购物车商品
* @returns {Promise<void>} Promise<void>
*/ AST#type_member#Left addToCart AST#parameter_list#Left ( AST#parameter#Left cart : AST#type_annotation#... | export interface CartLocalDataSource {
addToCart(cart: Cart): Promise<void>;
updateCart(cart: Cart): Promise<void>;
updateCartSpecCount(goodsId: number, specId: number, count: number): Promise<void>;
removeFromCart(goodsId: number): Promise<void>;
removeSpecFromCart(goodsId: number, specId:... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSource.ets#L7-L70 | 0f3df6cbb211670d39dc518fce64f33710cf6bef | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | getOrientation | 获取设备当前显示的方向
Orientation:
PORTRAIT 0 表示设备当前以竖屏方式显示。
LANDSCAPE 1 表示设备当前以横屏方式显示。
PORTRAIT_INVERTED 2 表示设备当前以反向竖屏方式显示。
LANDSCAPE_INVERTED 3 表示设备当前以反向横屏方式显示。
@returns | static getOrientation(): display.Orientation {
return DisplayUtil.getDefaultDisplaySync().orientation;
} | AST#method_declaration#Left static getOrientation AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Orientation AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AS... | static getOrientation(): display.Orientation {
return DisplayUtil.getDefaultDisplaySync().orientation;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L85-L87 | f84387f1507980925ea68c759d6abda25070716b | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/RadarChartModel.ets | arkts | setWebAlpha | Sets the transparency (alpha) value for all web lines, default: 150, 255
= 100% opaque, 0 = 100% transparent
@param alpha | public setWebAlpha(alpha: number): void {
this.mWebAlpha = alpha;
} | AST#method_declaration#Left public setWebAlpha AST#parameter_list#Left ( AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type... | public setWebAlpha(alpha: number): void {
this.mWebAlpha = alpha;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L261-L263 | 21cf72723d4b01f1fc3f7324fe3040e73f75a199 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/Base64Util.ets | arkts | decodeSync | 将字符串转换为Uint8Array数组-同步
@param string 待转换的字符串
@returns 转码后的Uint8Array数组 | static decodeSync(str: string, options?: util.Type): Uint8Array {
let base64 = new util.Base64Helper();
let result = base64.decodeSync(str, options);
return result;
} | AST#method_declaration#Left static decodeSync 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 options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#L... | static decodeSync(str: string, options?: util.Type): Uint8Array {
let base64 = new util.Base64Helper();
let result = base64.decodeSync(str, options);
return result;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Base64Util.ets#L62-L66 | f73b1a5531890ecc499a62f224a8086f1d8ca7c5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dealstridesolution/src/main/ets/components/MainPage.ets | arkts | aboutToAppear | 构建Tabs组件的控制器 | async aboutToAppear(): Promise<void> {
let result =
await PermissionUtils.checkPermission(getContext(this) as common.UIAbilityContext, ['ohos.permission.CAMERA'])
if (result) {
CameraServiceCrop.initCamera(this.cameraDeviceIndex);
} else {
promptAction.showDialog({
title: $r('app.s... | AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async aboutToAppear(): Promise<void> {
let result =
await PermissionUtils.checkPermission(getContext(this) as common.UIAbilityContext, ['ohos.permission.CAMERA'])
if (result) {
CameraServiceCrop.initCamera(this.cameraDeviceIndex);
} else {
promptAction.showDialog({
title: $r('app.s... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/components/MainPage.ets#L86-L97 | 7b79cb679d49a0110bb0d51cfcdef2845c7e8673 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isUint16Array | 检查是否为Uint16Array数组类型。
@param value
@returns | static isUint16Array(value: Object): boolean {
return new util.types().isUint16Array(value);
} | AST#method_declaration#Left static isUint16Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | static isUint16Array(value: Object): boolean {
return new util.types().isUint16Array(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L182-L184 | f2a4edbc7b3dbd6fd10ec1c965e7a184d489d0c5 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/EntryOhos.ets | arkts | setX | Sets the x-value of this Entry object.
@param x | public setX(x: number): void {
this.x = x;
} | AST#method_declaration#Left public setX AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#... | public setX(x: number): void {
this.x = x;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/EntryOhos.ets#L47-L49 | 3540fa06524fa128c3a9582d3320a86d8813a816 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuild.ets | arkts | setup | 添加类型注解(约束1) | setup(data: PartialGuildData): void {
this.id = data.id;
this.name = data.name;
this.icon = data.icon ?? null;
this.splash = data.splash ?? null;
} | AST#method_declaration#Left setup AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left PartialGuildData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig... | setup(data: PartialGuildData): void {
this.id = data.id;
this.name = data.name;
this.icon = data.icon ?? null;
this.splash = data.splash ?? null;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuild.ets#L23-L28 | 38e5222e5c9fdc4c2639337c0b41483489ced378 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/device/OnMouse.ets | arkts | Mouse | [Start listen_response_mouse_event] | @Entry
@Component
export struct Mouse {
@State buttonText: string = '';
@State columnText: string = '';
@State hoverText: string = 'Not Hover';
@State color: Color = Color.Gray;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button(this.hoverText)
.wi... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Mouse AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right buttonText : AST#type_annotation#Left AST#primary_type#Left s... | @Entry
@Component
export struct Mouse {
@State buttonText: string = '';
@State columnText: string = '';
@State hoverText: string = 'Not Hover';
@State color: Color = Color.Gray;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button(this.hoverText)
.wi... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/device/OnMouse.ets#L17-L80 | aead51d62de4d05ff060039e9e7d98e10889a06f | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/menu/VHCustomMenu.ets | arkts | VHCustomMenu | 自定义菜单 | @Component
export struct VHCustomMenu{
@Require webinars: VHWebinarData;
@Require menu_id: string;
@State componentList: VHMenuInfoItem[] = [];
@State subjectList: VHSubjectInfo[] = [];
@State webinarList: VHWebinarDetail[] = [];
@State topListDetails: VHInviteTopListDetails[] = [];
@State currentInviterD... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VHCustomMenu AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right webinars : AST#type_annotation#Left AST#primary_type#Left VHWebinarData AST#primary_type#Right AST#... | @Component
export struct VHCustomMenu{
@Require webinars: VHWebinarData;
@Require menu_id: string;
@State componentList: VHMenuInfoItem[] = [];
@State subjectList: VHSubjectInfo[] = [];
@State webinarList: VHWebinarDetail[] = [];
@State topListDetails: VHInviteTopListDetails[] = [];
@State currentInviterD... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/menu/VHCustomMenu.ets#L32-L96 | 61d4ae78432a342bccbcf380f044cd7931876762 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/web/WebSearchService.ets | arkts | 搜索平台选项 | export interface SearchPlatformOption {
id: string;
name: string;
icon: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SearchPlatformOption 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 name : AST#type_annotation... | export interface SearchPlatformOption {
id: string;
name: string;
icon: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/web/WebSearchService.ets#L19-L23 | 6bb86fe9131049f9d9de35996a5b9357ff39bfab | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/lazyForEach.d.ets | arkts | Defines exchange operation.
@interface DataExchangeOperation
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface DataExchangeOperation {
/**
* How to operate exchange data.
*
* @type { DataOperationType.EXCHANGE }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
type: DataOperationType;
/**
* Index of exchange dat... | AST#export_declaration#Left export AST#interface_declaration#Left interface DataExchangeOperation AST#object_type#Left { /**
* How to operate exchange data.
*
* @type { DataOperationType.EXCHANGE }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since ... | export interface DataExchangeOperation {
type: DataOperationType;
index: ExchangeIndex;
key?: ExchangeKey;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L380-L411 | 7cfe3bb6c930e3acc688d5fb1a1c633d41f0718b | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.