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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/select/Cascade.ets | arkts | cityTxtColor | 省市区list样式 | @Extend(Text)
function cityTxtColor() {
.fontSize(UiConst.FONT_16)
.textAlign(TextAlign.Start)
.padding({ top: UiConst.NUMBER_3, bottom: UiConst.NUMBER_3 })
// .backgroundColor("#f7f8fa")
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function cityTxtColor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#mem... | @Extend(Text)
function cityTxtColor() {
.fontSize(UiConst.FONT_16)
.textAlign(TextAlign.Start)
.padding({ top: UiConst.NUMBER_3, bottom: UiConst.NUMBER_3 })
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L48-L54 | d89d3061750b57e78a748fc3f5b4c2f3cb29dc14 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets | arkts | ScrollableComponentPageBuilder | 功能说明:本示例以List组件为例,实现可滚动组件截图、拼接生成长截图功能
推荐场景:可滚动组件需要长截图整个页面、截图至当前位置的场景
核心组件:
1. snapShot - 一键截图,无论滑动到任何为止,均将整个页面截图
2. snapShotToOffset - 滚动截图,实现方式与Web组件截图相同,截图至当前滑到的位置
实现步骤:
1. 滚动截图:实现方式与Web组件截图相同
2. 一键截图:创建截图函数,执行循环滚动截图并拼接
3. 截图后预览:截图后弹出预览窗口,可以滚动查看完整的截图,并保存图片到用户相册中 | @Builder
export function ScrollableComponentPageBuilder(name: string, param: Object) {
ScrollableComponentSnapshotPage()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ScrollableComponentPageBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#param... | @Builder
export function ScrollableComponentPageBuilder(name: string, param: Object) {
ScrollableComponentSnapshotPage()
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets#L43-L46 | d9e8b33cea1252a53ffbb9687871aa9b93e35f5a | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppDataSecurity/entry/src/main/ets/pages/Index.ets | arkts | getEl2Path | [Start get_el2_path] | getEl2Path(): void {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
context.area = contextConstant.AreaMode.EL2;
let filePath = context.filesDir + '/health_data.txt';
this.message = filePath;
} | AST#method_declaration#Left getEl2Path 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 let AST#variable_declarator#Left context = AST#ex... | getEl2Path(): void {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
context.area = contextConstant.AreaMode.EL2;
let filePath = context.filesDir + '/health_data.txt';
this.message = filePath;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppDataSecurity/entry/src/main/ets/pages/Index.ets#L68-L73 | 74a4c016e4186663ae41085e3d15759f1c30eaa9 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/common/component/TitleBar.ets | arkts | TitleBarView | @author open_9527
@date 2025/5/19
@desc 描述信息 | @ComponentV2
export struct TitleBarView {
@Builder
private emptyBuilder() {
}
@Param config: TitleBarConfig = new TitleBarConfig()
//自定义状态栏标部分
@BuilderParam public customStatusBarBuilder?: () => void = this.emptyBuilder
//自定义整个标题栏部分
@BuilderParam public customContentBuilder?: () => void = this.emptyBui... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TitleBarView AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private emptyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body... | @ComponentV2
export struct TitleBarView {
@Builder
private emptyBuilder() {
}
@Param config: TitleBarConfig = new TitleBarConfig()
@BuilderParam public customStatusBarBuilder?: () => void = this.emptyBuilder
@BuilderParam public customContentBuilder?: () => void = this.emptyBuilder
@BuilderParam... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/common/component/TitleBar.ets#L13-L155 | c922f58710effb0e0c7ce21318f386bcb85d11be | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/base/IModalDialogOptions.ets | arkts | 弹窗基础参数 | export interface IModalDialogOptions extends IBaseDialogOptions {
/**
* 弹窗样式
*/
style?: IModalDialogStyle
/**
* 弹窗标题
*/
title?: ResourceStr; //弹框标题
// /**
// * 操作回调˝
// */
// onAction?: ActionCallback | ActionStrCallback | ActionValueCallback | ActionDateCallback; //按钮的Callback事件。
/**
... | AST#export_declaration#Left export AST#interface_declaration#Left interface IModalDialogOptions AST#extends_clause#Left extends IBaseDialogOptions AST#extends_clause#Right AST#object_type#Left { /**
* 弹窗样式
*/ AST#type_member#Left style ? : AST#type_annotation#Left AST#primary_type#Left IModalDialogStyle AST#prima... | export interface IModalDialogOptions extends IBaseDialogOptions {
style?: IModalDialogStyle
title?: ResourceStr;
theme?: Theme | CustomTheme;
themeColorMode?: ThemeColorMode;
backgroundImage?: ResourceStr
backgroundImageSize?: ImageSize
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/base/IModalDialogOptions.ets#L8-L58 | 1549a0be33512c82fae64a05b7b21c81482b42c8 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/BarLineScatterCandleBubbleRenderer.ets | arkts | Created by Philipp Jahoda on 09/06/16. | export default abstract class BarLineScatterCandleBubbleRenderer extends DataRenderer {
/**
* buffer for storing the current minimum and maximum visible x
*/
protected mXBounds: XBounds;
constructor(animator: ChartAnimator, viewPortHandler: ViewPortHandler) {
super(animator, viewPortHandler);
this.... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class BarLineScatterCandleBubbleRenderer extends AST#type_annotation#Left AST#primary_type#Left DataRenderer AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* buffer for storing the current minimum and maximum v... | export default abstract class BarLineScatterCandleBubbleRenderer extends DataRenderer {
protected mXBounds: XBounds;
constructor(animator: ChartAnimator, viewPortHandler: ViewPortHandler) {
super(animator, viewPortHandler);
this.mXBounds = new XBounds(this.mAnimator);
}
protected shouldDrawValue... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/BarLineScatterCandleBubbleRenderer.ets#L76-L117 | 2dc91ca858744d38245eca0aab40b27948f3d358 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets | arkts | setAvSessionPlayState | [End launch] [Start update_is_play] | public setAvSessionPlayState(playbackState: avSession.AVPlaybackState): void {
if (this.avSession) {
this.avSession.setAVPlaybackState(playbackState, (err: BusinessError) => {
if (err) {
Logger.error(TAG, `SetAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`);
... | AST#method_declaration#Left public setAvSessionPlayState AST#parameter_list#Left ( AST#parameter#Left playbackState : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left avSession . AVPlaybackState AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#par... | public setAvSessionPlayState(playbackState: avSession.AVPlaybackState): void {
if (this.avSession) {
this.avSession.setAVPlaybackState(playbackState, (err: BusinessError) => {
if (err) {
Logger.error(TAG, `SetAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`);
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets#L147-L157 | 4af889972440d5b71f1344a2482b0b8d17645d1f | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets | arkts | getHighlightCircleStrokeAlpha | @Override | public getHighlightCircleStrokeAlpha(): number {
return this.mHighlightCircleStrokeAlpha;
} | AST#method_declaration#Left public getHighlightCircleStrokeAlpha AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Lef... | public getHighlightCircleStrokeAlpha(): number {
return this.mHighlightCircleStrokeAlpha;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets#L77-L79 | ee2ba11f84e40e610fe1aa2004fbb16bc70416c3 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/extension_actions.ets | arkts | Uninstalls an extension.
@param id The ID of extension.
@returns True if success. | export function uninstall_extension(id: string) {
console.log(`[uninstall_extension] Try to uninstall extension id=${id}`);
let path = path_of_extension(id);
if (path) {
let exts = AppStorage.get('bunch_of_extensions') as bunch_of_extensions;
for (let index = 0; index < exts.extensions.length; index++) {... | AST#export_declaration#Left export AST#function_declaration#Left function uninstall_extension AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left {... | export function uninstall_extension(id: string) {
console.log(`[uninstall_extension] Try to uninstall extension id=${id}`);
let path = path_of_extension(id);
if (path) {
let exts = AppStorage.get('bunch_of_extensions') as bunch_of_extensions;
for (let index = 0; index < exts.extensions.length; index++) {... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L157-L183 | db469e543f5c4692397d1f98f29e25d8ce902392 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/collapsemenu/Index.ets | arkts | CollapseMenu | 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 { CollapseMenu } from './src/main/ets/view/CollapseMenu'; | AST#export_declaration#Left export { CollapseMenu } from './src/main/ets/view/CollapseMenu' ; AST#export_declaration#Right | export { CollapseMenu } from './src/main/ets/view/CollapseMenu'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/collapsemenu/Index.ets#L15-L15 | 64d2413ba3a1472528110e772edd4a9059944f91 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets | arkts | handleExceedingSize | 处理字符数超过指定字符长度的情况,末尾添加“...全文”
@param {MyCustomSpan} span - 自定义文本片段,包含文本类型和内容
@param {number} charCount - 当前已拼接的字符长度
@param {MutableStyledString[]} styledStrings - 生成的属性字符串数组 | handleExceedingSize(span: MyCustomSpan, charCount: number, styledStrings: MutableStyledString[]) {
const ELLIPSIS: string = '...';
const FULL_TEXT: string = '全文';
// 检查文本片段的类型,决定如何处理超出部分
if (span.type === MyCustomSpanType.Normal) {
// 如果是普通文本,则截断并拼接 ...全文
styledStrings.push(new MutableStyled... | AST#method_declaration#Left handleExceedingSize AST#parameter_list#Left ( AST#parameter#Left span : AST#type_annotation#Left AST#primary_type#Left MyCustomSpan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left charCount : AST#type_annotation#Left AST#primary_type#Left number AST#... | handleExceedingSize(span: MyCustomSpan, charCount: number, styledStrings: MutableStyledString[]) {
const ELLIPSIS: string = '...';
const FULL_TEXT: string = '全文';
if (span.type === MyCustomSpanType.Normal) {
styledStrings.push(new MutableStyledString(`${span.content.substring(0,
th... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets#L110-L169 | 86d75035dab4f3efa8065d39525a972c0e109548 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/ApiService.ets | arkts | API服务类
封装了与后端服务器通信的方法 | export class ApiService {
private static readonly apiBaseUrl: string = 'http://192.168.12.85:3001'//wifi
/**
* 用户登录
* @param username 用户名
* @param password 密码
* @returns Promise with API response
*/
static async login(username: string, password: string): Promise<ApiResponse> {
let httpRequest ... | AST#export_declaration#Left export AST#class_declaration#Left class ApiService AST#ERROR#Left { AST#property_declaration#Left private static readonly apiBaseUrl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'http://192.168.12.85:3001' AST#... | export class ApiService {
private static readonly apiBaseUrl: string = 'http://192.168.12.85:3001'
static async login(username: string, password: string): Promise<ApiResponse> {
let httpRequest = http.createHttp()
try {
let requestData: LoginRequest = {
username: username,
... | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/ApiService.ets#L138-L316 | cddc2e65e91ff5cf7199fd1774c3af8ede2d4f1b | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/attribute/ColumnAttribute.ets | arkts | 获取纵向两端分布 + 水平起始的 Column 对齐修饰器
@returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器
@example
Column() { Text("A"); Text("B"); }.attributeModifier(columnSpaceBetweenStart()); | export function columnSpaceBetweenStart(): AttributeModifier<ColumnAttribute> {
return {
applyNormalAttribute: (instance: ColumnAttribute): void => {
instance.justifyContent(FlexAlign.SpaceBetween);
instance.alignItems(HorizontalAlign.Start);
}
};
} | AST#export_declaration#Left export AST#function_declaration#Left function columnSpaceBetweenStart AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnA... | export function columnSpaceBetweenStart(): AttributeModifier<ColumnAttribute> {
return {
applyNormalAttribute: (instance: ColumnAttribute): void => {
instance.justifyContent(FlexAlign.SpaceBetween);
instance.alignItems(HorizontalAlign.Start);
}
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L132-L139 | e91120e2c6fd152fc1ec005e6533cf3955137177 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/model/Util.ets | arkts | 图标和文字描述 | export class IconAndDescription {
icon: Resource;
description: string | Resource;
constructor(icon: Resource, description: string | Resource) {
this.icon = icon;
this.description = description
}
} | AST#export_declaration#Left export AST#class_declaration#Left class IconAndDescription AST#class_body#Left { AST#property_declaration#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left descri... | export class IconAndDescription {
icon: Resource;
description: string | Resource;
constructor(icon: Resource, description: string | Resource) {
this.icon = icon;
this.description = description
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/model/Util.ets#L17-L25 | 5cf105acbd13dd4c61118fc0c8e44858c8945c8e | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/musicBank.ets | arkts | itemui | *************************************具体音乐**********************************// | @Builder
itemui(item:musicBank){
Column({space:1}){
Image(item.img).width(180)
.height(250)
.borderRadius(12)
.padding(5)
Column(){
Row(){
Text(item.name).fontSize(15)
.fontWeight(5)
}.width('100%').justifyContent(FlexAlign.Start)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemui AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left musicBank AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left ... | @Builder
itemui(item:musicBank){
Column({space:1}){
Image(item.img).width(180)
.height(250)
.borderRadius(12)
.padding(5)
Column(){
Row(){
Text(item.name).fontSize(15)
.fontWeight(5)
}.width('100%').justifyContent(FlexAlign.Start)
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/musicBank.ets#L41-L67 | 63d8fefb4e88d6e4ca9cdb638f395b8724f2cf27 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationRequestUtil.ets | arkts | initWantAgentNotificationRequest | init wantAgent NotificationRequest
@param notificationContent
@param notificationWantAgent
@return return the created NotificationRequest | initWantAgentNotificationRequest(notificationContent: notification.NotificationContent, notificationWantAgent: WantAgent): notification.NotificationRequest {
return {
slotType: notification.SlotType.CONTENT_INFORMATION,
id: 1, // 通知id,默认为1
content: notificationContent,
wantAgent: notificatio... | AST#method_declaration#Left initWantAgentNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#paramete... | initWantAgentNotificationRequest(notificationContent: notification.NotificationContent, notificationWantAgent: WantAgent): notification.NotificationRequest {
return {
slotType: notification.SlotType.CONTENT_INFORMATION,
id: 1,
content: notificationContent,
wantAgent: notificationWantAgent
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationRequestUtil.ets#L41-L48 | 6e3c4873e59aeff9d252f48be3947d5231f40954 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/address/AddressActionButton.ets | arkts | 构建地址操作按钮
@returns {void} 无返回值 | build(): void {
Row() {
CommonIcon({
icon: this.iconResId,
iconSize: this.iconSize,
tintColor: this.iconColor
});
}
.width(this.buttonSize)
.height(this.buttonSize)
.backgroundColor(this.bgColor)
.borderRadius(this.buttonSize / 2)
.justifyContent(FlexAlign... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left... | build(): void {
Row() {
CommonIcon({
icon: this.iconResId,
iconSize: this.iconSize,
tintColor: this.iconColor
});
}
.width(this.buttonSize)
.height(this.buttonSize)
.backgroundColor(this.bgColor)
.borderRadius(this.buttonSize / 2)
.justifyContent(FlexAlign... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/address/AddressActionButton.ets#L46-L61 | b2ef72227674b2cf56fd7989a612cad3297a8bea | github | |
Leeson-Wong/ark-layer.git | 9efa3553414a6b1eee890e3858c8cdcb308535d7 | core/PhaseExample.ets | arkts | 示例 3: 混合使用预定义和自定义阶段 | export async function example3_MixedPhases() {
console.log('========== Example 3: Mixed Predefined and Custom Phases ==========')
// 定义多个自定义阶段
const CACHED_PHASE = createPhase({
name: 'CACHED',
priority: 35,
waitForComplete: false,
description: '缓存服务阶段'
})
const REPORT_PHASE = createPhase({
... | AST#export_declaration#Left export AST#function_declaration#Left async function example3_MixedPhases 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#Lef... | export async function example3_MixedPhases() {
console.log('========== Example 3: Mixed Predefined and Custom Phases ==========')
const CACHED_PHASE = createPhase({
name: 'CACHED',
priority: 35,
waitForComplete: false,
description: '缓存服务阶段'
})
const REPORT_PHASE = createPhase({
name: 'R... | https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseExample.ets#L258-L305 | 520ff8bbf0a9cce6e203eeb3920e3ceecf496e14 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets | arkts | setAvoidArea | [End set_stage1] Get status bar height and indicator height. | public static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea): void {
const uiContext: UIContext = AppStorage.get<UIContext>('uiContext')!;
if (type === window.AvoidAreaType.TYPE_SYSTEM) {
AppStorage.setOrCreate('statusBarHeight', uiContext?.px2vp(area.topRect.height));
} else {
... | AST#method_declaration#Left public static setAvoidArea AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . AvoidAreaType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left area... | public static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea): void {
const uiContext: UIContext = AppStorage.get<UIContext>('uiContext')!;
if (type === window.AvoidAreaType.TYPE_SYSTEM) {
AppStorage.setOrCreate('statusBarHeight', uiContext?.px2vp(area.topRect.height));
} else {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets#L74-L81 | 0f4c19768ca560736cb9d9f207321f50bc6ef7f9 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Vibrator/Vibrator.ets | arkts | vibrate | 基础振动(时间模式)
@param duration 振动时长(ms),默认25ms
@param usage 使用场景,默认'touch'(触觉反馈) | vibrate(duration: number = 25, usage: vibrator.Usage = 'touch'): void {
try {
vibrator.startVibration(
{ type: 'time', duration },
{ id: 0, usage },
(error: BusinessError) => {
if (error) {
console.error(`振动失败 code:${error.code}`);
}
}
);
... | AST#method_declaration#Left vibrate AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 25 AST#expression#Right AST#parameter#Right , AST#parameter#Left usage : AST#type_annotation#Left AST#p... | vibrate(duration: number = 25, usage: vibrator.Usage = 'touch'): void {
try {
vibrator.startVibration(
{ type: 'time', duration },
{ id: 0, usage },
(error: BusinessError) => {
if (error) {
console.error(`振动失败 code:${error.code}`);
}
}
);
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Vibrator/Vibrator.ets#L29-L43 | fc62e206e55c93ce2e461c65ebd9fd395ddfb578 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/AccountManager/AppAccountManager/entry/src/main/ets/model/AccountData.ets | arkts | getFromStorage | static instance: AccountData = null
public static getInstance() {
if (this.instance === null) {
this.instance = new AccountData()
}
return this.instance
} | async getFromStorage(context: common.Context, url: string) {
let name = url
Logger.info(TAG, `Name is ${name}`)
try {
storage = await preferences.getPreferences(context, `${name}`)
} catch (err) {
Logger.error(`getStorage failed, code is ${err?.code}, message is ${err?.message}`)
}
i... | AST#method_declaration#Left async getFromStorage AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left url : AST#typ... | async getFromStorage(context: common.Context, url: string) {
let name = url
Logger.info(TAG, `Name is ${name}`)
try {
storage = await preferences.getPreferences(context, `${name}`)
} catch (err) {
Logger.error(`getStorage failed, code is ${err?.code}, message is ${err?.message}`)
}
i... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/AccountManager/AppAccountManager/entry/src/main/ets/model/AccountData.ets#L36-L47 | fd18da2321791dd4ca7d7821b66448afa798cee2 | gitee |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/commons/utils/Logger.ets | arkts | console.info() class 多写 | export let logger = new Logger(0x0001, 'INTERVIEW', '%{public}s: %{public}s')
// export let logger2 = new Logger(0x0002, 'ZHIBO', '%{public}s: %{public}s')
// logger.info('姓名', '张三')
// logger.error('年龄', '19')
// 方法封装在实例上 而不是类上
// Logger.info()
// Logger.error() | AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left logger = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Logger AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( A... | export let logger = new Logger(0x0001, 'INTERVIEW', '%{public}s: %{public}s') | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/Logger.ets#L35-L45 | 56d1f5c793a38ade6a26f42e69637a8b78335de1 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MusicHome-master/products/phone/src/main/ets/viewmodel/IndexItem.ets | arkts | Home page list information. | export default class IndexItem {
/**
* List item name.
*/
title: ResourceStr;
/**
* List item description.
*/
description: ResourceStr;
/**
* Button text information.
*/
button: ResourceStr;
/**
* Background image information.
*/
icon: Resource;
/**
* Jumping path inform... | AST#export_declaration#Left export default AST#class_declaration#Left class IndexItem AST#class_body#Left { /**
* List item name.
*/ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /*... | export default class IndexItem {
title: ResourceStr;
description: ResourceStr;
button: ResourceStr;
icon: Resource;
url: string;
constructor(title: ResourceStr, description: ResourceStr, button: ResourceStr, icon: Resource, url: string) {
this.title = title;
this.description = de... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/products/phone/src/main/ets/viewmodel/IndexItem.ets#L19-L52 | 5956f78e24ef50d88fa29928c7b92e9ff59f4adc | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getAliveUnits | 获取活跃单元(包含未删除单词的单元) | getAliveUnits(): Unit[] {
return this.units.filter(unit => unit.aliveWords.length > 0);
} | AST#method_declaration#Left getAliveUnits AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Unit [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left retur... | getAliveUnits(): Unit[] {
return this.units.filter(unit => unit.aliveWords.length > 0);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L342-L344 | ea26e4d74ac1f4411040673e541635d8c364c51d | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ImageEditTaskPool/entry/src/main/ets/utils/EncodeUtil.ets | arkts | Pack the image.
@param pixelMap. | export async function encode(component: Object, pixelMap: PixelMap) {
hilog.info(0x0000, TAG, '%{public}s', `component is ${component}`);
const newPixelMap = pixelMap;
// Packing image.
const imagePackerApi = image.createImagePacker();
const packOptions: image.PackingOption = {
format: 'image/jpeg',
q... | AST#export_declaration#Left export AST#function_declaration#Left async function encode AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pixelMap : AST#type_annotation#L... | export async function encode(component: Object, pixelMap: PixelMap) {
hilog.info(0x0000, TAG, '%{public}s', `component is ${component}`);
const newPixelMap = pixelMap;
const imagePackerApi = image.createImagePacker();
const packOptions: image.PackingOption = {
format: 'image/jpeg',
quality: 100
}
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/utils/EncodeUtil.ets#L31-L62 | 71378e7bf69445403ffc984ba1843af4eeaf1f07 | gitee | |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/pages/Index.ets | arkts | loadWeatherData | 加载天气数据(使用新的HttpUtil) | async loadWeatherData() {
this.isLoading = true;
try {
console.log('开始获取天气数据,城市ID:', this.cityId);
// 使用新的HttpUtil获取天气数据
const weatherData = await HttpUtil.getWeatherByCityId(this.cityId);
if (weatherData && weatherData.code === '200') {
console.log('天气数据获取成功:', weatherData);
... | AST#method_declaration#Left async loadWeatherData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#m... | async loadWeatherData() {
this.isLoading = true;
try {
console.log('开始获取天气数据,城市ID:', this.cityId);
const weatherData = await HttpUtil.getWeatherByCityId(this.cityId);
if (weatherData && weatherData.code === '200') {
console.log('天气数据获取成功:', weatherData);
thi... | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/pages/Index.ets#L46-L91 | eaac13813c9c4822a367158d8e4e5934c09c2f0c | github |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | common/src/main/ets/database/DistributedDB.ets | arkts | getAllSurveys | 获取所有问卷数据(不包含问卷中的问题数据) | async getAllSurveys(): Promise<Survey[]> {
if (!this.rdbStore) {
Logger.info('[getAllSurveys]', 'getAllSurveys() has no callback!');
return [];
}
try {
const predicates: relationalStore.RdbPredicates =
new relationalStore.RdbPredicates('surveys');
const columns: string[] =
... | AST#method_declaration#Left async getAllSurveys 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 Survey [ ] AST#array_type#Right AST#primary_typ... | async getAllSurveys(): Promise<Survey[]> {
if (!this.rdbStore) {
Logger.info('[getAllSurveys]', 'getAllSurveys() has no callback!');
return [];
}
try {
const predicates: relationalStore.RdbPredicates =
new relationalStore.RdbPredicates('surveys');
const columns: string[] =
... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/database/DistributedDB.ets#L80-L114 | 428754e7aceff804b6aceaa4b8edc4956e496f7f | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onConnectRemoteService | 连接远端Service | async function onConnectRemoteService(deviceId) {
onDisconnectService()
// 连接成功的回调
async function onConnectCallback(element, remote) {
mRemote = remote;
}
// Service异常死亡的回调
function onDisconnectCallback(element) {
}
// 连接失败的回调
function onFailedCallback(code) {
prompt.showToast({
message... | AST#function_declaration#Left async function onConnectRemoteService AST#parameter_list#Left ( AST#parameter#Left deviceId AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onDisconne... | async function onConnectRemoteService(deviceId) {
onDisconnectService()
async function onConnectCallback(element, remote) {
mRemote = remote;
}
function onDisconnectCallback(element) {
}
function onFailedCallback(code) {
prompt.showToast({
message: "onConnectRemoteService onFailed: "... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L107-L136 | 611ac31610a170cb43e72717b09034e488f874e1 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | 通知类型枚举 | export enum NotificationType {
LIKE = 'like',
COMMENT = 'comment',
FOLLOW = 'follow',
MENTION = 'mention',
BIRTHDAY = 'birthday',
EVENT = 'event',
SYSTEM = 'system'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum NotificationType AST#enum_body#Left { AST#enum_member#Left LIKE = AST#expression#Left 'like' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left COMMENT = AST#expression#Left 'comment' AST#expression#Right AST#enum_member#Right , AST#enum_m... | export enum NotificationType {
LIKE = 'like',
COMMENT = 'comment',
FOLLOW = 'follow',
MENTION = 'mention',
BIRTHDAY = 'birthday',
EVENT = 'event',
SYSTEM = 'system'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L174-L182 | 13a9a5a66e0401768ff27a2929773dfe91d6eea8 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/view/CartPage.ets | arkts | CartContent | 购物车页面内容视图
@returns {void} 无返回值 | @Builder
private CartContent() {
if (this.vm.isEmpty) {
EmptyCart();
} else {
List({ space: 12 }) {
// 空的 ListItem 用于分隔购物车商品和底部栏
ListItem() {
}
ForEach(this.vm.cartList, (cart: Cart) => {
ListItem() {
OrderGoodsCard({
data: cart,... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CartContent 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#member_expr... | @Builder
private CartContent() {
if (this.vm.isEmpty) {
EmptyCart();
} else {
List({ space: 12 }) {
ListItem() {
}
ForEach(this.vm.cartList, (cart: Cart) => {
ListItem() {
OrderGoodsCard({
data: cart,
onGoodsClick:... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CartPage.ets#L96-L135 | 1fcbbe7cc6f7b5c8e695545fd21a2dbdf8fbda8e | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/ArkTSComponents/entry/src/main/ets/view/Setting.ets | arkts | Setting | Setting tab content | @Component
export default struct Setting {
@Builder settingCell(item: ItemData) {
Row() {
Row({ space: CommonConstants.COMMON_SPACE }) {
Image(item.img)
.width($r('app.float.setting_size'))
.height($r('app.float.setting_size'))
Text(item.title)
.fontSize($r('app... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Setting AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right settingCell AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#prima... | @Component
export default struct Setting {
@Builder settingCell(item: ItemData) {
Row() {
Row({ space: CommonConstants.COMMON_SPACE }) {
Image(item.img)
.width($r('app.float.setting_size'))
.height($r('app.float.setting_size'))
Text(item.title)
.fontSize($r('app... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ArkTSComponents/entry/src/main/ets/view/Setting.ets#L23-L118 | 9b14d0c129950a140e07cc642a61001b471d09d4 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | getCurrentLocationEasy | 获取当前位置,通过callback方式异步返回结果。
@param callBack
@returns 失败返回错误码,成功返回0。 | static async getCurrentLocationEasy(): Promise<geoLocationManager.Location> {
return LocationUtil.getCurrentLocation();
} | AST#method_declaration#Left static async getCurrentLocationEasy 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 geoLocationManager . Locati... | static async getCurrentLocationEasy(): Promise<geoLocationManager.Location> {
return LocationUtil.getCurrentLocation();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L59-L61 | 9aa48d38e399685f724392b9c50c76369ccea953 | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/view/BackContainer.ets | arkts | 定义组件的渲染函数 | build() {
Row() {
// 创建返回按钮
Button() {
// 设置按钮的图像,如果未设置 backImgRes,则使用默认图像 "app.media.ic_public_back"
Image(this.backImgRes == null ? $r('app.media.ic_public_back') : this.backImgRes).objectFit(ImageFit.Fill)
}
// 设置按钮的背景颜色为透明
.backgroundColor($r('app.color.trans_parent... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 创建返回按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) AST#container_content_body#Left { // ... | build() {
Row() {
Button() {
Image(this.backImgRes == null ? $r('app.media.ic_public_back') : this.backImgRes).objectFit(ImageFit.Fill)
}
.backgroundColor($r('app.color.trans_parent'))
.width(DimensionUtil.getVp($r('app.float.title_button_size')))
... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/BackContainer.ets#L22-L63 | 1f4c5a05174a0a5cb0020e361a8809f9ee56bbdb | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/TCPBaseTLSClient/entry/src/main/ets/pages/Index.ets | arkts | sendMsg2Server | 发送消息到服务端 | sendMsg2Server() {
this.tlsSocket?.send(this.sendMsg + "\r\n")
.then(async () => {
this.msgHistory += "我:" + this.sendMsg + "\r\n"
})
.catch((err: BusinessError) => {
this.msgHistory += `发送失败:错误码 ${err.code}, 错误信息 ${JSON.stringify(err)}\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() {
this.tlsSocket?.send(this.sendMsg + "\r\n")
.then(async () => {
this.msgHistory += "我:" + this.sendMsg + "\r\n"
})
.catch((err: BusinessError) => {
this.msgHistory += `发送失败:错误码 ${err.code}, 错误信息 ${JSON.stringify(err)}\r\n`;
})
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/TCPBaseTLSClient/entry/src/main/ets/pages/Index.ets#L135-L143 | a6c204160de6258947dbb64cab5e5e7be31f9202 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | can_save_history | Checks if this url can be saved to history. meow:// pages are not allowed.
@param url The url.
@returns True if can. | private can_save_history(url: string) {
if (url.substring(0, 7) == 'meow://') {
return false;
}
return true;
} | AST#method_declaration#Left private can_save_history AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Lef... | private can_save_history(url: string) {
if (url.substring(0, 7) == 'meow://') {
return false;
}
return true;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L1037-L1042 | 757d21b29d7b15ffce226c992c45eac1b5041d54 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/pages/Login.ets | arkts | handleLogin | 登录 | async handleLogin(): Promise<void> {
if (!this.username || !this.password) {
this.errorMessage = '请输入用户名和密码';
return;
}
this.loading = true;
this.errorMessage = '';
try {
const success = await AuthService.login({
username: this.username,
password: this.password
... | AST#method_declaration#Left async handleLogin 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_argu... | async handleLogin(): Promise<void> {
if (!this.username || !this.password) {
this.errorMessage = '请输入用户名和密码';
return;
}
this.loading = true;
this.errorMessage = '';
try {
const success = await AuthService.login({
username: this.username,
password: this.password
... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/pages/Login.ets#L28-L55 | 204f84777140dc1b37c95b4ad2a580113d4c290c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | calculateLunarBirthdayInfo | 计算农历生日信息
@param birthYear 出生年份(农历)
@param birthMonth 出生月份(农历)
@param birthDay 出生日期(农历)
@param isLeapMonth 是否闰月
@returns 农历生日信息 | async calculateLunarBirthdayInfo(
birthYear: number,
birthMonth: number,
birthDay: number,
isLeapMonth: boolean
): Promise<LunarBirthdayInfo | null> {
try {
const currentYear = new Date().getFullYear();
const nextYear = currentYear + 1;
// 获取今年的农历生日对应公历日期
const currentYear... | AST#method_declaration#Left async calculateLunarBirthdayInfo AST#parameter_list#Left ( AST#parameter#Left birthYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left birthMonth : AST#type_annotation#Left AST#primary_type#Lef... | async calculateLunarBirthdayInfo(
birthYear: number,
birthMonth: number,
birthDay: number,
isLeapMonth: boolean
): Promise<LunarBirthdayInfo | null> {
try {
const currentYear = new Date().getFullYear();
const nextYear = currentYear + 1;
const currentYearDate = LunarUtils.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L215-L288 | 45f1b1a3de47c3cae288a7acf7921626feaf07ba | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/SettingsTypes.ets | arkts | 新增SettingsService需要的接口定义 通知设置接口 | export interface NotificationSettings {
enabled: boolean;
methods: NotificationMethod[];
sound: boolean;
vibration: boolean;
showPreview: boolean;
quietHours: QuietHoursConfig;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationSettings AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left methods : AST#type_a... | export interface NotificationSettings {
enabled: boolean;
methods: NotificationMethod[];
sound: boolean;
vibration: boolean;
showPreview: boolean;
quietHours: QuietHoursConfig;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L512-L519 | 9dd870c25299d6b7c45aaf449572c164762171aa | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets | arkts | notifyDataReload | Notify the controller of the data reload | notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
});
} | AST#method_declaration#Left notifyDataReload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
});
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L32-L36 | 6734a99e447eeb272c7117e4eb68ff5ac3788b83 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/IValueFormatter.ets | arkts | Interface that allows custom formatting of all values inside the chart before they are
being drawn to the screen. Simply create your own formatting class and let
it implement IValueFormatter. Then override the getFormattedValue(...) method
and return whatever you want.
@author Philipp Jahoda | 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/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/IValueFormatter.ets#L26-L26 | deca09161d139a17b00fe0ed03bfe3f33b0e1bce | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | autoCancel | 是否自动取消
@description 默认为true
@param autoCancel
@returns | autoCancel(autoCancel: boolean) {
this.builderOptions.autoCancel = autoCancel;
return this;
} | AST#method_declaration#Left autoCancel AST#parameter_list#Left ( AST#parameter#Left autoCancel : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#L... | autoCancel(autoCancel: boolean) {
this.builderOptions.autoCancel = autoCancel;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L110-L113 | 058b3a9c80d6ab2aa165b14adf560d8659e60d33 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/ComponentBase.ets | arkts | setYOffset | Sets the used y-axis offset for the labels on this axis. For the legend,
higher offset means the legend as a whole will be placed further away
from the top.
@param yOffset | public setYOffset(yOffset: number): void {
this.mYOffset = Utils.handleDataValues(yOffset);
} | AST#method_declaration#Left public setYOffset AST#parameter_list#Left ( AST#parameter#Left yOffset : 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_typ... | public setYOffset(yOffset: number): void {
this.mYOffset = Utils.handleDataValues(yOffset);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L90-L92 | d57e75aae432299d8aa21189793a912d56bf5ea6 | gitee |
conrad_sheeran/TickAuth | 8ef852e12999d15cf70394cdab82d08ac5843143 | features/steam/src/main/ets/model/SteamTOTPModel.ets | arkts | Copyright (c) 2024 Yang He
TickAuth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be... | export class SecretClass {
alias: string = "";
secret: string = "";
digit: number = 6;
timeStep: number = 30;
algorithm: string = "SHA1";
constructor(alias: string, secret: string, digit: number, timeStep: number, algorithm: string ) {
this.alias = alias;
this.secret = secret;
this.digit = digi... | AST#export_declaration#Left export AST#class_declaration#Left class SecretClass AST#class_body#Left { AST#property_declaration#Left alias : 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_declaration#Righ... | export class SecretClass {
alias: string = "";
secret: string = "";
digit: number = 6;
timeStep: number = 30;
algorithm: string = "SHA1";
constructor(alias: string, secret: string, digit: number, timeStep: number, algorithm: string ) {
this.alias = alias;
this.secret = secret;
this.digit = digi... | https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/steam/src/main/ets/model/SteamTOTPModel.ets#L35-L49 | 513e1dcd43fabe05ce679622555ac20ca96e5d00 | gitee | |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | clearUnread | 清空未读消息 | static async clearUnread(myId: string, friendId: string): Promise<ResponseDao<null>> {
try {
const params: ClearUnreadParams = { myId, friendId };
const response: AxiosResponse<ResponseDao<null>> = await axios.post(
`${BASE_URL}/ddchat/friend/clearUnread`,
params,
{
he... | AST#method_declaration#Left static async clearUnread AST#parameter_list#Left ( AST#parameter#Left myId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left friendId : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | static async clearUnread(myId: string, friendId: string): Promise<ResponseDao<null>> {
try {
const params: ClearUnreadParams = { myId, friendId };
const response: AxiosResponse<ResponseDao<null>> = await axios.post(
`${BASE_URL}/ddchat/friend/clearUnread`,
params,
{
he... | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L494-L510 | 8ad95ed8e067b09584d4ae4099c5ba070b5c6b3c | github |
xixi-cquer/BiJiDaiBan.git | 206dc33a837acbe6fc837feff848427e83946534 | entry/src/main/ets/viewmodel/DataModel.ets | arkts | getData | Get the data. | getData(): Array<Array<string>> {
function ascend(x,y){
return x[1] - y[1]; //按照数组的第4个值升序排列
}
this.tasks=this.tasks.sort(ascend);
return this.tasks;
} | AST#method_declaration#Left getData AST#parameter_list#Left ( ) AST#parameter_list#Right : 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 AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AS... | getData(): Array<Array<string>> {
function ascend(x,y){
return x[1] - y[1];
}
this.tasks=this.tasks.sort(ascend);
return this.tasks;
} | https://github.com/xixi-cquer/BiJiDaiBan.git/blob/206dc33a837acbe6fc837feff848427e83946534/entry/src/main/ets/viewmodel/DataModel.ets#L30-L36 | 078ff818785d459a439cda3713c5b49e8b12b998 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/empty/EmptyNetwork.ets | arkts | 构建网络缺省页视图
@returns {void} 无返回值 | build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_network"),
actionText: this.actionText,
onAction: this.onAction
});
} | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Empty ( AST#component_parameters#Left { AST#component_parameter#Left description : AST#expression#Left AST#member_expression... | build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_network"),
actionText: this.actionText,
onAction: this.onAction
});
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/EmptyNetwork.ets#L29-L36 | 308e5a9592a1deb440d33e1b1b8c23c5e4fdece5 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | generateSymKey | 生成对称密钥
@param symAlgName 秘钥规格
@returns 指定秘钥规格的对称密钥 | static async generateSymKey(symAlgName: string): Promise<string> {
// 创建对称密钥生成器
let symKeyGenerator = crypto.createSymKeyGenerator(symAlgName);
// 通过非对称密钥生成器,随机生成非对称密钥
let promiseSymKey = await symKeyGenerator.generateSymKey();
//转换成可以读懂的字符串
return StrAndUintUtil.unitArray2String(promiseSymKey.g... | AST#method_declaration#Left static async generateSymKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gen... | static async generateSymKey(symAlgName: string): Promise<string> {
let symKeyGenerator = crypto.createSymKeyGenerator(symAlgName);
let promiseSymKey = await symKeyGenerator.generateSymKey();
return StrAndUintUtil.unitArray2String(promiseSymKey.getEncoded().data);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L87-L94 | 74409b0a0333800308270a650260b6515be26073 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | [EndExclude appear_router] | aboutToAppear(): void {
// [StartExclude appear_router]
let intervalId = setInterval(() => {
if (this.timer === 1) {
let uiContext = this.getUIContext();
let router = uiContext.getRouter();
router.pushUrl({ url: 'pages/OnIdlePage' });
router.clear();
clearInterval(i... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // [StartExclude appear_router] AST#statement#Left AST#variable_declaration#Left let AST#variab... | aboutToAppear(): void {
let intervalId = setInterval(() => {
if (this.timer === 1) {
let uiContext = this.getUIContext();
let router = uiContext.getRouter();
router.pushUrl({ url: 'pages/OnIdlePage' });
router.clear();
clearInterval(intervalId)
} else {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/entry/src/main/ets/pages/Index.ets#L28-L49 | f32cad69afd9d9249c8d0b61ecdec533e0cf73c5 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | NativeAPI/XComponent/entry/src/main/ets/common/CommonConstants.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class CommonConstants {
/**
* Height and width is 100%.
* */
static readonly FULL_PARENT: string = '100%';
/**
* Font weight.
*/
static readonly FONT_WEIGHT: number = 500;
/**
* TextInput layout weight.
*/
static readonly LAYOUT_WEIGHT: number = 1;
/**
* XComponent i... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Height and width is 100%.
* */ AST#property_declaration#Left static readonly FULL_PARENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ... | export default class CommonConstants {
static readonly FULL_PARENT: string = '100%';
static readonly FONT_WEIGHT: number = 500;
static readonly LAYOUT_WEIGHT: number = 1;
static readonly XCOMPONENT_ID: string = 'xcomponentId';
static readonly XCOMPONENT_TYPE: string = 'surface';
stati... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NativeAPI/XComponent/entry/src/main/ets/common/CommonConstants.ets#L16-L56 | 192dbe4743b850c023f2bf0b726882f50f6a60d6 | 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 | decryptCBCSync | 解密(CBC模式),同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|CBC|PKCS7、AES192|CBC|PKCS7、AES128|CBC|PKCS7)。
@returns | static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): cryptoFramework.DataBlob {
return DES.decryptSync(data, symKey, params, '3DES192|CBC|PKCS7');
} | AST#method_declaration#Left static decryptCBCSync 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 symKe... | static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): cryptoFramework.DataBlob {
return DES.decryptSync(data, symKey, params, '3DES192|CBC|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#L110-L113 | 08df4e6559752d41ab0475fc09a5a7ee5b23df8c | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeTopBar.ets | arkts | titleBuilder | 标题区域构建
@returns {void} 无返回值 | @Builder
private titleBuilder() {
Row() {
Image($r("app.media.ic_search"))
.fillColor($r("app.color.text_tertiary"))
.attributeModifier(size(18));
SpaceHorizontalSmall();
Text($r("app.string.search_goods"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("a... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private titleBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_u... | @Builder
private titleBuilder() {
Row() {
Image($r("app.media.ic_search"))
.fillColor($r("app.color.text_tertiary"))
.attributeModifier(size(18));
SpaceHorizontalSmall();
Text($r("app.string.search_goods"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("a... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeTopBar.ets#L49-L72 | 56510d0bc87af495d2a07d63628a6a5c908144a9 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | Defines Gesture interface.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export declare class Gesture {
/**
* Set gesture's tag.
*
* @param { string } tag
* @returns { this }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*
*/
tag(tag: string): this;
/**
* Input source type for ges... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class Gesture AST#class_body#Left { /**
* Set gesture's tag.
*
* @param { string } tag
* @returns { this }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice... | export declare class Gesture {
tag(tag: string): this;
allowedTypes(types: Array<SourceTool>): this;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L327-L352 | a99434318091a37c9fa3b38993f54a19a61a409a | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | setDataWant | 将Want数据写入系统剪贴板,使用Promise异步回调。
@param want Want内容
@returns | static async setDataWant(want: Want): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_WANT, want);
} | AST#method_declaration#Left static async setDataWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | static async setDataWant(want: Want): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_WANT, want);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L221-L223 | 2779ed60dfac346fa79538eb30fd2ebf3dce516f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/MonthDataSource.ets | arkts | unregisterDataChangeListener | 为对应的LazyForEach组件在数据源处去除listener监听。
@param {DataChangeListener} listener - 监听对象。 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/MonthDataSource.ets#L106-L111 | 90585e777a5a9317829277b1ce97b4163e571dc6 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/TabContentTouchHotZone/casesfeature/tabcontentoverflow/src/main/ets/mainpage/TabContentOverFlow.ets | arkts | aboutToDisappear | 退出案例时设置状态栏颜色,避免影响其他案例。 | aboutToDisappear(): void {
setStatusBar(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
} | AST#method_declaration#Left aboutToDisappear 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 setStatusBar ( AST#expression#Left AST#member_e... | aboutToDisappear(): void {
setStatusBar(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/TabContentTouchHotZone/casesfeature/tabcontentoverflow/src/main/ets/mainpage/TabContentOverFlow.ets#L65-L67 | f3545330cbfa2742af6664d8a615d22000e15a71 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | getSpaceBottom | Returns the bottom axis space in percent of the full range. Default 10f
@return | public getSpaceBottom(): number {
return this.mSpacePercentBottom;
} | AST#method_declaration#Left public getSpaceBottom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_ex... | public getSpaceBottom(): number {
return this.mSpacePercentBottom;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L299-L301 | 87186ebf0f5d7959f083f5eaa55f0c83ffbcb1f8 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | 缓存统计信息 | export interface CacheStats {
years: number;
totalMappings: number;
memoryUsage: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CacheStats AST#object_type#Left { AST#type_member#Left years : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalMappings : AST#type_annotati... | export interface CacheStats {
years: number;
totalMappings: number;
memoryUsage: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L39-L43 | 6d94213136579e9edaceed707541628a3c49c494 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/VirtualEconomyService.ets | arkts | 商店接口 | export interface VirtualShop {
categories: ShopCategory[];
featuredItems: VirtualItem[];
dailyDeals: VirtualItem[];
specialOffers: SpecialOffer[];
lastRefresh: string;
nextRefresh: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface VirtualShop AST#object_type#Left { AST#type_member#Left categories : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ShopCategory [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right... | export interface VirtualShop {
categories: ShopCategory[];
featuredItems: VirtualItem[];
dailyDeals: VirtualItem[];
specialOffers: SpecialOffer[];
lastRefresh: string;
nextRefresh: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L189-L196 | 0d52f2d9c367488165386f95a0ab4f2a7ca92d77 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | offLocationEnabledChange | 取消订阅位置服务状态变化
@param callback 需要取消订阅的回调函数。该回调函数需要与on接口传入的回调函数保持一致。若无此参数,则取消当前类型的所有订阅。 | static offLocationEnabledChange(callback?: Callback<boolean>) {
if (callback) {
geoLocationManager.off('locationEnabledChange', callback);
} else {
geoLocationManager.off('locationEnabledChange');
}
} | AST#method_declaration#Left static offLocationEnabledChange AST#parameter_list#Left ( AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#... | static offLocationEnabledChange(callback?: Callback<boolean>) {
if (callback) {
geoLocationManager.off('locationEnabledChange', callback);
} else {
geoLocationManager.off('locationEnabledChange');
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L183-L189 | 4629298ebc4d93dd8ab0f1b5ee035e1a99be5b14 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DataManagement/CrossAppDataShare/common/index.ets | arkts | TABLE_NAME | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export {
TABLE_NAME,
STORE_CONFIG,
SQL_CREATE_TABLE,
BASE_URI,
COLUMNS,
OPERATE_STATUS,
SYNC_STATE
} from './src/main/ets/utils/Consts' | AST#export_declaration#Left export { TABLE_NAME , STORE_CONFIG , SQL_CREATE_TABLE , BASE_URI , COLUMNS , OPERATE_STATUS , SYNC_STATE } from './src/main/ets/utils/Consts' AST#export_declaration#Right | export {
TABLE_NAME,
STORE_CONFIG,
SQL_CREATE_TABLE,
BASE_URI,
COLUMNS,
OPERATE_STATUS,
SYNC_STATE
} from './src/main/ets/utils/Consts' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DataManagement/CrossAppDataShare/common/index.ets#L16-L24 | 862b5ad070f8cb0a037ad4aa9536995724fbc27f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/BottomModal.ets | arkts | BottomModal | @file 底部弹出层 Modal 组件
基于鸿蒙官方 bindSheet API 实现的半模态弹窗组件。
提供统一的样式和行为,支持自定义背景色、圆角、内边距等。
@param visible 是否显示弹窗
@param title 标题文本(可选)
@param onDismiss 关闭回调
@param detents 高度档位,默认 [SheetSize.FIT_CONTENT, SheetSize.FIT_CONTENT]
@param dragBar 是否显示拖动条,默认 true
@param showClose 是否显示关闭按钮,默认 true
@param containerColor 容器背景色,默认白色
@... | @ComponentV2
export struct BottomModal {
/**
* 是否显示弹窗
*/
@Param
@Require
visible: boolean = false;
/**
* 标题
*/
@Param
title?: string | Resource = undefined;
/**
* 关闭回调
*/
@Param
onDismiss: () => void = () => {
};
/**
* 高度档位
*/
@Param
detents: [SheetSize | Length, (She... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct BottomModal AST#component_body#Left { /**
* 是否显示弹窗
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right visible : AST#type_annotation... | @ComponentV2
export struct BottomModal {
@Param
@Require
visible: boolean = false;
@Param
title?: string | Resource = undefined;
@Param
onDismiss: () => void = () => {
};
@Param
detents: [SheetSize | Length, (SheetSize | Length)?, (SheetSize | Length)?] =
[SheetSize.FIT_CONTENT, Shee... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/BottomModal.ets#L21-L122 | 94b03fb51cc6ce15b43b06853688ab58c56cf670 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/SecondaryLinkExample.ets | arkts | contentListItemBuilder | 右侧内容视图 | @Builder
contentListItemBuilder(item: CustomDataType, index: number) {
ListItem() {
Row() {
Text()
.aspectRatio(1)
.height('100%')
.backgroundColor('#ffe5e5e5')
.borderRadius(15)
Column() {
Text(item.desc + index)
Text(item.tag)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right contentListItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type... | @Builder
contentListItemBuilder(item: CustomDataType, index: number) {
ListItem() {
Row() {
Text()
.aspectRatio(1)
.height('100%')
.backgroundColor('#ffe5e5e5')
.borderRadius(15)
Column() {
Text(item.desc + index)
Text(item.tag)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/SecondaryLinkExample.ets#L203-L235 | d92067195af355b5c577570f78c02cab67c5ce61 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/Component_Redundancy_Refresh_Optimization/entry/src/main/ets/segment/segment1.ets | arkts | isRenderSpecialImage | Default transparency | private isRenderSpecialImage(): number {
// Image transparency increases by 0.1 each time it is rendered, cycling between 0 and 1.
this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange;
return this.opacityNum;
} | AST#method_declaration#Left private isRenderSpecialImage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // Image transparency increases by 0.1 each time it is rendered, cycling betwe... | private isRenderSpecialImage(): number {
this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange;
return this.opacityNum;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Redundancy_Refresh_Optimization/entry/src/main/ets/segment/segment1.ets#L84-L88 | bcc419f90cf4ae84a99cbcdf4c877826ea1d92fe | gitee |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/common/conts.ets | arkts | 5s | export const ATL1_AUTH_TIMEOUT = 90*1000; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ATL1_AUTH_TIMEOUT = AST#expression#Left AST#binary_expression#Left AST#expression#Left 90 AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable... | export const ATL1_AUTH_TIMEOUT = 90*1000; | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/common/conts.ets#L22-L22 | b04bf6f20e9b96ade711b4e127db2d7676a3e537 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/NDKAppFileSample/entry/src/main/ets/entryability/EntryAbility.ets | arkts | 应用的编码 | export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(DOMAIN, 'testTag', `%{public}s`, 'Ability onCreate');
}
onDestroy(): void {
hilog.info(DOMAIN, 'testTag', `%{public}s`, 'Ability onDestroy');
}
onWindowStageCreate(... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#ty... | export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(DOMAIN, 'testTag', `%{public}s`, 'Ability onCreate');
}
onDestroy(): void {
hilog.info(DOMAIN, 'testTag', `%{public}s`, 'Ability onDestroy');
}
onWindowStageCreate(... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/NDKAppFileSample/entry/src/main/ets/entryability/EntryAbility.ets#L22-L58 | 374ff452b2f16a77402be779abede266071f8b05 | gitee | |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/utils/StorageUtils.ets | arkts | delete | 删除值
@param key
@param preferenceName
@returns | static async delete(key: string, preferenceName: string = defaultPreferenceName) {
let preferences = await this.getPreferences(preferenceName)
return await preferences.delete(key)
} | AST#method_declaration#Left static async delete AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | static async delete(key: string, preferenceName: string = defaultPreferenceName) {
let preferences = await this.getPreferences(preferenceName)
return await preferences.delete(key)
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/utils/StorageUtils.ets#L51-L54 | 6786ea1ac115708d49e733c5d3f5e358d264b7e4 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/AccessPermission/entry/src/main/ets/common/util/PermissionUtil.ets | arkts | applyPermission | Applying for Permissions.
@returns Permission application result. | async applyPermission() {
let atManager = abilityAccessCtrl.createAtManager();
let data = await atManager.requestPermissionsFromUser(getContext(this), [CommonConstants.PERMISSION]);
let grantStatus: Array<number> = data.authResults;
let length: number = grantStatus.length;
if (length === 0) {
... | AST#method_declaration#Left async applyPermission AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left atManager = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#... | async applyPermission() {
let atManager = abilityAccessCtrl.createAtManager();
let data = await atManager.requestPermissionsFromUser(getContext(this), [CommonConstants.PERMISSION]);
let grantStatus: Array<number> = data.authResults;
let length: number = grantStatus.length;
if (length === 0) {
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/AccessPermission/entry/src/main/ets/common/util/PermissionUtil.ets#L32-L41 | 2f6fe031bc3725c0516b1a919878e5008e677583 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/networks/Http.ets | arkts | _isSucceed | 判断请求是否成功(根据业务状态码) | private static _isSucceed(code?: number): boolean {
//return code >= 200 && code < 300;
return HttpUtils.Functions.succeed(code)
} | AST#method_declaration#Left private static _isSucceed AST#parameter_list#Left ( AST#parameter#Left code ? : 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#p... | private static _isSucceed(code?: number): boolean {
return HttpUtils.Functions.succeed(code)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Http.ets#L239-L242 | 9d0accf8b0954ba76e29562a2c233c8e28a0a51c | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets | arkts | createOrder | 创建订单
@param {CreateOrderRequest} params - 创建订单参数
@returns {Promise<NetworkResponse<Order>>} 创建成功的订单信息 | async createOrder(params: CreateOrderRequest): Promise<NetworkResponse<Order>> {
const resp: AxiosResponse<NetworkResponse<Order>> =
await NetworkClient.http.post("order/info/create", params);
return resp.data;
} | AST#method_declaration#Left async createOrder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateOrderRequest 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... | async createOrder(params: CreateOrderRequest): Promise<NetworkResponse<Order>> {
const resp: AxiosResponse<NetworkResponse<Order>> =
await NetworkClient.http.post("order/info/create", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L71-L75 | 5991eacf80cfccd7443e5cbbcaffc7403b84b7d5 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | checkInitialized | 检查是否已初始化 | private checkInitialized(): void {
if (!this.initialized || !this.store) {
throw new Error('DatabaseService not initialized. Call initialize() first.');
}
} | AST#method_declaration#Left private checkInitialized AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_express... | private checkInitialized(): void {
if (!this.initialized || !this.store) {
throw new Error('DatabaseService not initialized. Call initialize() first.');
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L198-L202 | 672d1a52087396d4e2f5aa05bb89d854bc28d288 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.DialogV2.d.ets | arkts | Defines PopoverDialogV2 Options
@interface PopoverDialogV2Options
@extends CustomPopupOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export declare interface PopoverDialogV2Options extends CustomPopupOptions {
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface PopoverDialogV2Options AST#extends_clause#Left extends CustomPopupOptions AST#extends_clause#Right AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Righ... | export declare interface PopoverDialogV2Options extends CustomPopupOptions {
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L790-L791 | c7200a105a5b471fc9b8bc33023386ecc99e3dc7 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listslidetohistory/src/main/ets/model/BasicDataSource.ets | arkts | IDataSource处理数据监听的基本实现 | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = [];
public abstract totalCount(): number;
public abstract getData(index: number): T | void;
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0... | AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declarat... | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = [];
public abstract totalCount(): number;
public abstract getData(index: number): T | void;
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/src/main/ets/model/BasicDataSource.ets#L20-L69 | d9369c02492d6edfec932712f9dba40ad9e6b613 | gitee | |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | taoyao/src/main/ets/shijing/taoyao/picker/media/MediaBuilder.ets | arkts | setMediaMineType | 可选择的媒体文件类型,图片类型、视频类型、图片和视频类型、动态照片类型
@param mediaMineType
@returns | public setMediaMineType(mediaMineType: MediaMimeType): MediaBuilder {
this._mediaMineType = mediaMineType
return this
} | AST#method_declaration#Left public setMediaMineType AST#parameter_list#Left ( AST#parameter#Left mediaMineType : AST#type_annotation#Left AST#primary_type#Left MediaMimeType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left M... | public setMediaMineType(mediaMineType: MediaMimeType): MediaBuilder {
this._mediaMineType = mediaMineType
return this
} | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/picker/media/MediaBuilder.ets#L29-L32 | 8288b08010b5b9b783c68829bdc07f577e3c876e | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment5.ets | arkts | [StartExclude Case5] | build() {
Column() {
}
} | 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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#... | build() {
Column() {
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment5.ets#L68-L71 | fe625be53f65fb3c4a019776d217fd16d638a261 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/accessibility/AccessibilityService.ets | arkts | getSettings | 获取当前设置 | getSettings(): AccessibilitySettings {
return this.deepCopySettings(this.settings);
} | AST#method_declaration#Left getSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AccessibilitySettings 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... | getSettings(): AccessibilitySettings {
return this.deepCopySettings(this.settings);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L216-L218 | 5154ecbc8a292b65eeca486ff03f2ac26a461c5f | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/utils/DateUtils.ets | arkts | 获取本月的第一天的日期 | export function getFirstDateOfThisMonth(date: Date | number): Date {
// 如果输入的日期是数字,将其转换为日期对象
if (typeof date === 'number') {
date = new Date(date)
}
// 返回本月的第一天的日期
return new Date(date.getFullYear(), date.getMonth())
} | AST#export_declaration#Left export AST#function_declaration#Left function getFirstDateOfThisMonth AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right ... | export function getFirstDateOfThisMonth(date: Date | number): Date {
if (typeof date === 'number') {
date = new Date(date)
}
return new Date(date.getFullYear(), date.getMonth())
} | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L96-L103 | 445a552dc0e4b26653b5bdcd5fae750e676d282c | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/Logger.ets | arkts | warn | warn级别日志【入参为两个字符串,第一个为提示消息,第二个为错误原因】
@param args 错误信息 | static warn(...args: string[]): void {
hilog.warn(Logger.domain, Logger.prefix, Logger.format, args);
} | AST#method_declaration#Left static warn AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AS... | static warn(...args: string[]): void {
hilog.warn(Logger.domain, Logger.prefix, Logger.format, args);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Logger.ets#L139-L141 | 44c6e700c8cf9478f428f718b633ef95b3c61f5a | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/setting/AdviceView.ets | arkts | uploadImage | 上传图片到服务器 | private async uploadImage(adviceStr: string) {
if (this.pickedUri) {
let ext = PathUtility.getExtension(this.pickedUri)
let fileName = `${UserManager.shared.userId}_${this.getDateNowString()}.${ext}`
CosDownloaderAdviceData.shared.uploadUserData(this.pickedUri, fileName, (progress: number) ... | AST#method_declaration#Left private async uploadImage AST#parameter_list#Left ( AST#parameter#Left adviceStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statem... | private async uploadImage(adviceStr: string) {
if (this.pickedUri) {
let ext = PathUtility.getExtension(this.pickedUri)
let fileName = `${UserManager.shared.userId}_${this.getDateNowString()}.${ext}`
CosDownloaderAdviceData.shared.uploadUserData(this.pickedUri, fileName, (progress: number) ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/setting/AdviceView.ets#L214-L233 | 790a94e026f04c1a77f346024885b84a6c9c03e1 | github |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | 100ms list space | export const LIST_ITEM_SPACE: number = 2; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left LIST_ITEM_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarati... | export const LIST_ITEM_SPACE: number = 2; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L105-L105 | 2a6665d13b2986235bd2188b247d2f2e160975f0 | github | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/constant/StopWatchConstants.ets | arkts | 秒表常量类。 | export class StopWatchConstants {
/**
* 秒表格式。
*/
static readonly TIMER_FORMAT: string = 'mm:ss.SS';
/**
* 秒表字符串。
*/
static readonly STOP_WATCH: string = '秒表';
/**
* 标记项高度。
*/
static readonly FLAG_ITEM_HEIGHT = 35;
} | AST#export_declaration#Left export AST#class_declaration#Left class StopWatchConstants AST#class_body#Left { /**
* 秒表格式。
*/ AST#property_declaration#Left static readonly TIMER_FORMAT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'mm:... | export class StopWatchConstants {
static readonly TIMER_FORMAT: string = 'mm:ss.SS';
static readonly STOP_WATCH: string = '秒表';
static readonly FLAG_ITEM_HEIGHT = 35;
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/constant/StopWatchConstants.ets#L4-L17 | 61dd44ee54b9765264cc14ef23473a0cedd4ac86 | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/dialog/SelectDialog.ets | arkts | initBase | ------------------------- 保护、私有方法 protected | private methods ------------------------- | private initBase(options: ISelectDialogOptions): ISelectDialogOptions {
if (options.confirm) {
options.confirm = this.initButton(options, options.confirm, false, 0) as ButtonOptions
}
if (options.radioContent?.length && options.actionCancel) {
options.radioContent = options.radioContent.map(item... | AST#method_declaration#Left private initBase AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ISelectDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ISelect... | private initBase(options: ISelectDialogOptions): ISelectDialogOptions {
if (options.confirm) {
options.confirm = this.initButton(options, options.confirm, false, 0) as ButtonOptions
}
if (options.radioContent?.length && options.actionCancel) {
options.radioContent = options.radioContent.map(item... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/SelectDialog.ets#L22-L32 | 0a527165fe86fa30db9c9670f41d6c3cecfb70b4 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets | arkts | toSecondAbilityIndex | Navigate to the Index Page of SecondAbility.
@param context Context of EntryAbility. | toSecondAbilityIndex(context: common.UIAbilityContext) {
let want: Want = {
'deviceId': '',
'bundleName': CommonConstants.BUNDLE_NAME,
'abilityName': CommonConstants.SECOND_ABILITY_NAME,
'moduleName': CommonConstants.DEVICE_MODULE_NAME,
'parameters': {
src: textMessage,
... | AST#method_declaration#Left toSecondAbilityIndex AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Righ... | toSecondAbilityIndex(context: common.UIAbilityContext) {
let want: Want = {
'deviceId': '',
'bundleName': CommonConstants.BUNDLE_NAME,
'abilityName': CommonConstants.SECOND_ABILITY_NAME,
'moduleName': CommonConstants.DEVICE_MODULE_NAME,
'parameters': {
src: textMessage,
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets#L51-L67 | d09d1766b7eed579da14214be64cfc6938d830f5 | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 注册信息接口 | export interface RegisterInfo {
email: string;
nickname: string;
gender: string;
password1: string;
password2: string;
avatar:string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RegisterInfo AST#object_type#Left { AST#type_member#Left email : 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 nickname : AST#type_annotation#... | export interface RegisterInfo {
email: string;
nickname: string;
gender: string;
password1: string;
password2: string;
avatar:string
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L63-L70 | dcedcf4152dfbac4a7fb04a910030df549b4db06 | github | |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/common/helper/kvManagerHelper.ets | arkts | 键值数据库管理类 | export type kvValueType = boolean | string | number | Uint8Array; | AST#export_declaration#Left export AST#type_declaration#Left type kvValueType = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Uint8Array... | export type kvValueType = boolean | string | number | Uint8Array; | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/helper/kvManagerHelper.ets#L7-L7 | 8a44e93c58660dad7d9bb1cc57329d7132a2ac3a | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/TextAreaDialogView.ets | arkts | TextAreaDialogView | TextArea文本输入 | @ComponentV2
export struct TextAreaDialogView {
private controller: TextInputController = new TextInputController()
@Require @Param options: ITextAreaOptions;
@Local customOptions: IBaseContentOptions | undefined = undefined;
@Local modifier: TextAreaInputFilterModifier = new TextAreaInputFilterModifier();
@L... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TextAreaDialogView AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left TextInputController AST#primary_type#Right AST#type_annotation#Right = A... | @ComponentV2
export struct TextAreaDialogView {
private controller: TextInputController = new TextInputController()
@Require @Param options: ITextAreaOptions;
@Local customOptions: IBaseContentOptions | undefined = undefined;
@Local modifier: TextAreaInputFilterModifier = new TextAreaInputFilterModifier();
@L... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/TextAreaDialogView.ets#L10-L101 | a9fd4dbe33b0463366f3977bbded0ed878939bc9 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/LoginSample/entry/src/main/ets/common/bean/ListItemData.ets | arkts | Basic list item data bean. | export class ListItemData {
/**
* Indicates list item title.
*/
title: Resource;
/**
* Indicates list item summary.
*/
summary: Resource;
} | AST#export_declaration#Left export AST#class_declaration#Left class ListItemData AST#class_body#Left { /**
* Indicates list item title.
*/ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right... | export class ListItemData {
title: Resource;
summary: Resource;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/LoginSample/entry/src/main/ets/common/bean/ListItemData.ets#L4-L14 | 8b4d6773548deb936ca84818466f00846bd33dae | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppTheme.ets | arkts | 主题接口 | export interface Theme {
color: ColorPalette
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Theme AST#object_type#Left { AST#type_member#Left color : AST#type_annotation#Left AST#primary_type#Left ColorPalette AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AST#interface_declaration#Right... | export interface Theme {
color: ColorPalette
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppTheme.ets#L3-L5 | 1511237731ff2d23a94dd4ef0a3b199d9b1a0484 | github | |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/common/PreferencesUtil.ets | arkts | getBoolean | 读取布尔值数据
@param context 应用上下文
@param key 键
@param defaultValue 默认值
@returns 布尔值 | static async getBoolean(context: common.UIAbilityContext, key: string,
defaultValue: boolean = false): Promise<boolean> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
return await dataPreferences.get(key, defaultValue) as boolean;
} catch (error) {
console.e... | AST#method_declaration#Left static async getBoolean AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left k... | static async getBoolean(context: common.UIAbilityContext, key: string,
defaultValue: boolean = false): Promise<boolean> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
return await dataPreferences.get(key, defaultValue) as boolean;
} catch (error) {
console.e... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/PreferencesUtil.ets#L121-L130 | 451af6ed87defe70f52fe82b1be6c63b9dfdf5fc | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBarV2.d.ets | arkts | ToolBarV2ItemText | Declare type ToolBarV2ItemText
@class ToolBarV2ItemText
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @ObservedV2
export declare class ToolBarV2ItemText {
/**
* Define text content.
*
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace
text: ResourceStr;
/**
* Define text fontColor.
*
* @type { ?ColorMetric... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class ToolBarV2ItemText AST#class_body#Left { /**
* Define text content.
*
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @at... | @ObservedV2
export declare class ToolBarV2ItemText {
@Trace
text: ResourceStr;
@Trace
color?: ColorMetrics;
@Trace
activatedColor?: ColorMetrics;
constructor(options: ToolBarV2ItemTextOptions);
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L147-L192 | ea243703199f1f2b64291fe49da7509842bc4be2 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/AcademyManager.ets | arkts | practiceMethod | 实践方法论 | practiceMethod(methodId: string): void {
const progress = this.learningProgress.get(methodId);
if (!progress) return;
const updatedProgress: LearningProgress = {
methodId: progress.methodId,
methodName: progress.methodName,
status: progress.status,
progress: progress.progress,
... | AST#method_declaration#Left practiceMethod AST#parameter_list#Left ( AST#parameter#Left methodId : 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#... | practiceMethod(methodId: string): void {
const progress = this.learningProgress.get(methodId);
if (!progress) return;
const updatedProgress: LearningProgress = {
methodId: progress.methodId,
methodName: progress.methodName,
status: progress.status,
progress: progress.progress,
... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/AcademyManager.ets#L233-L251 | b60b401d0e843a1fd40a8815f76aaa41191c3975 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | 完整农历系统设计.ets | arkts | getDayOffset | 计算日期偏移 | private static getDayOffset(date: Date): number {
const base = new Date(1900, 0, 1);
return Math.floor((date.getTime() - base.getTime()) / (1000 * 60 * 60 * 24));
} | AST#method_declaration#Left private static getDayOffset AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#prim... | private static getDayOffset(date: Date): number {
const base = new Date(1900, 0, 1);
return Math.floor((date.getTime() - base.getTime()) / (1000 * 60 * 60 * 24));
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L439-L442 | 3ebc754783dfaaad23110a259280e71d4e19da51 | github |
gracienewd/openharmony-App-YunmoAi.git | 181952ab00aab5025a81b7b3a6b88d2a5258c76a | entry/src/main/ets/common/utils/AssetUtils.ets | arkts | 基于 @ohos.security.asset 的封装。可以保证『重装/删除应用而不丢失数据』。
@author Tanranran
@date 2024/5/14 22:14
@description
关键资产存储服务提供了用户短敏感数据的安全存储及管理能力。
其中,短敏感数据可以是密码类(账号/密码)、Token类(应用凭据)、其他关键明文(如银行卡号)等长度较短的用户敏感数据。
可在应用卸载时保留数据。需要权限: ohos.permission.STORE_PERSISTENT_DATA。
更多API可参考https://developer.huawei.com/consumer/cn/doc/harmonyos-refere... | export class AssetStore {
/**
* 新增数据
* 添加成功,会通过 AppStorage 传值值变更,外部可通过 @StorageProp(key) value: string 观察值变化。
* @param key 要添加的索引
* @param value 要添加的值
* @param isPersistent 在应用卸载时是否需要保留关键资产,默认为 true
* @returns Promise<AssetStoreResult> 表示添加操作的异步结果
*/
public static async set(k... | AST#export_declaration#Left export AST#class_declaration#Left class AssetStore AST#class_body#Left { /**
* 新增数据
* 添加成功,会通过 AppStorage 传值值变更,外部可通过 @StorageProp(key) value: string 观察值变化。
* @param key 要添加的索引
* @param value 要添加的值
* @param isPersistent 在应用卸载时是否需要保留关键资产,默认为 true
* @return... | export class AssetStore {
public static async set(key: string, value: string, isPersistent: boolean = true): Promise<AssetStoreResult> {
let attr: asset.AssetMap = new Map();
if (canIUse("SystemCapability.Security.Asset")) {
attr.set(asset.Tag.ALIAS, AssetStore.stringToArray(key));
... | https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/utils/AssetUtils.ets#L53-L278 | 223e2cced080ce476f3c7df2c09192844754fb21 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/ArrayUtil.ets | arkts | isEmpty | 集合是否为空集合,空为true否则false
@param array
@returns | static isEmpty<T>(array: T[]): boolean {
return array == null || array.length == 0;
} | AST#method_declaration#Left static isEmpty AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right A... | static isEmpty<T>(array: T[]): boolean {
return array == null || array.length == 0;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/ArrayUtil.ets#L50-L52 | 98c11c5074a9496fbb6554411479c45d42607442 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/VoiceChannel.ets | arkts | 应用约束1: 显式参数类型 | constructor(guild: Guild, data: VoiceChannelData) {
super(guild, data);
this.setup(data);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left guild : AST#type_annotation#Left AST#primary_type#Left Guild AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left VoiceChannelData AST#prim... | constructor(guild: Guild, data: VoiceChannelData) {
super(guild, data);
this.setup(data);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/VoiceChannel.ets#L26-L29 | 0d4ebc1004d61cfc4953fa5a12d35d4a230f2c78 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets | arkts | remove | Delete the cache corresponding to the key | public remove(key: string): void {
this.lruCache.remove(key);
} | AST#method_declaration#Left public remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ... | public remove(key: string): void {
this.lruCache.remove(key);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets#L41-L43 | 2d0d3f1e366b22b5cc2bb6876c752a965f32ef09 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkWebrenderingframework/entry/src/main/ets/pages/proxy.ets | arkts | call | [Start listener] Execute channel call | call(channelType: string, objectJson: string): any {
let fun = this.channelListeners.get(channelType);
if (!fun) {
return undefined;
}
let result :string= fun(JSON.parse(objectJson));
return JSON.stringify(result);
} | AST#method_declaration#Left call AST#parameter_list#Left ( AST#parameter#Left channelType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left objectJson : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | call(channelType: string, objectJson: string): any {
let fun = this.channelListeners.get(channelType);
if (!fun) {
return undefined;
}
let result :string= fun(JSON.parse(objectJson));
return JSON.stringify(result);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkWebrenderingframework/entry/src/main/ets/pages/proxy.ets#L83-L90 | 7297f8d28e4871f2ff376181d7bc1bab325fea4d | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/customMenu.ets | arkts | subMenuOne | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function subMenuOne() {
Menu() {
MenuItem({ content: '菜单选项1', labelInfo: 'Ctrl+C' })
MenuItem({ content: '菜单选项2', labelInfo: 'Ctrl+C' })
MenuItem({ content: '菜单选项3', labelInfo: 'Ctrl+C' })
MenuItem({ content: '菜单选项4', labelInfo: 'Ctrl+V' })
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function subMenuOne 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 Menu ( ) AST#container_content_body#L... | @Builder
export function subMenuOne() {
Menu() {
MenuItem({ content: '菜单选项1', labelInfo: 'Ctrl+C' })
MenuItem({ content: '菜单选项2', labelInfo: 'Ctrl+C' })
MenuItem({ content: '菜单选项3', labelInfo: 'Ctrl+C' })
MenuItem({ content: '菜单选项4', labelInfo: 'Ctrl+V' })
}
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/customMenu.ets#L16-L24 | d1f953cd1ef4ccfe11fdd700ae6f9fceec283c09 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | saveCurrentUser | 保存当前用户 | private async saveCurrentUser(): Promise<void> {
try {
if (this.currentUser) {
await this.preferences?.put(StorageKeys.CURRENT_USER, JSON.stringify(this.currentUser));
await this.preferences?.flush();
}
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP... | AST#method_declaration#Left private async saveCurrentUser 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 > A... | private async saveCurrentUser(): Promise<void> {
try {
if (this.currentUser) {
await this.preferences?.put(StorageKeys.CURRENT_USER, JSON.stringify(this.currentUser));
await this.preferences?.flush();
}
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L664-L674 | 128ed7b956a1ad419115fd446823c6fc941c4e0b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/nativeembed/src/main/ets/model/GoodsModel.ets | arkts | 设置项的数据类 | export class ProductDataModel {
id: number;
uri: ResourceStr;
title: ResourceStr;
price: ResourceStr;
constructor(id: number, uri: ResourceStr, title: ResourceStr, price: ResourceStr) {
this.id = id;
this.uri = uri;
this.title = title;
this.price = price;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ProductDataModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left uri : AST#ty... | export class ProductDataModel {
id: number;
uri: ResourceStr;
title: ResourceStr;
price: ResourceStr;
constructor(id: number, uri: ResourceStr, title: ResourceStr, price: ResourceStr) {
this.id = id;
this.uri = uri;
this.title = title;
this.price = price;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeembed/src/main/ets/model/GoodsModel.ets#L17-L29 | 1c3643c516730cdd492a5cb181fb4726c6cf7af3 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/ImageUtil.ets | arkts | base64ToPixelMap | 图片base64字符串转PixelMap
@param base64 图片base64字符串
@returns 转换后的结果 | static async base64ToPixelMap(base64: string): Promise<OutDTO<image.PixelMap>> {
//将原始图片base64字符串转变为通过base64字符串
const base64Str = StrUtil.replace(base64, new RegExp('data:image/\\w+;base64,'), '');
//将通用base64字符串转变为arrayBuffer
let arrayBuffer = Base64Util.decodeSync(base64Str).buffer;
//将arrayBuffer... | AST#method_declaration#Left static async base64ToPixelMap AST#parameter_list#Left ( AST#parameter#Left base64 : 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 base64ToPixelMap(base64: string): Promise<OutDTO<image.PixelMap>> {
const base64Str = StrUtil.replace(base64, new RegExp('data:image/\\w+;base64,'), '');
let arrayBuffer = Base64Util.decodeSync(base64Str).buffer;
let imageSource = image.createImageSource(arrayBuffer);
let opt... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L96-L108 | 6dbf09266ced892cad07b841d146860cfe71ac66 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.