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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets | arkts | clearCache | Clear the cached data and reset the size of lruCache | public clearCache(): void {
this.lruCache.clear();
this.lruCache.updateCapacity(64);
} | AST#method_declaration#Left public clearCache 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#expres... | public clearCache(): void {
this.lruCache.clear();
this.lruCache.updateCapacity(64);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets#L56-L59 | a261a19986400e37d2f0fa01c571264bcde49472 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ResourceUtils.ets | arkts | _decimalToHexColor | 内部方法:将十进制的颜色值转换为十六进制颜色字符串[6](@ref)
@param decimal 十进制的颜色值(通常是ARGB格式的32位整数)
@returns 十六进制颜色字符串 | private static _decimalToHexColor(decimal: number): string {
// 提取ARGB分量
const alpha: number = (decimal >> 24) & 0xff;
const red: number = (decimal >> 16) & 0xff;
const green: number = (decimal >> 8) & 0xff;
const blue: number = decimal & 0xff;
// 格式化输出
if (alpha === 0xff) { // 完全不透明,省略Alph... | AST#method_declaration#Left private static _decimalToHexColor AST#parameter_list#Left ( AST#parameter#Left decimal : 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 stri... | private static _decimalToHexColor(decimal: number): string {
const alpha: number = (decimal >> 24) & 0xff;
const red: number = (decimal >> 16) & 0xff;
const green: number = (decimal >> 8) & 0xff;
const blue: number = decimal & 0xff;
if (alpha === 0xff) {
return `#${red.toString(16)... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ResourceUtils.ets#L56-L69 | 2126be736fa369f9090a5315fb975497d917b3cc | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuPreview.ets | arkts | bindContextMenuPreviewBuilder | 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 bindContextMenuPreviewBuilder(name: string, param: Object) {
bindContextMenuPreviewExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function bindContextMenuPreviewBuilder 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#parame... | @Builder
export function bindContextMenuPreviewBuilder(name: string, param: Object) {
bindContextMenuPreviewExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuPreview.ets#L16-L19 | cf925294d11880aae5d10a34775dde4b524127d5 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getUpdateTime | 获取应用包更新时间。
@returns | static getUpdateTime(): number {
return AppUtils.getBundleInfoSync().updateTime
} | AST#method_declaration#Left static getUpdateTime 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_exp... | static getUpdateTime(): number {
return AppUtils.getBundleInfoSync().updateTime
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L158-L160 | 2e9e6e63c4872274297842af87648e99161b92ca | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | setWindowBackgroundColor | 设置窗口的背景色。Stage模型下,该接口需要在loadContent()或setUIContent()调用生效后使用。
@param color 需要设置的背景色,为十六进制RGB或ARGB颜色,不区分大小写,例如#00FF00或#FF00FF00。
@param windowClass 不传该值,默认主窗口。
@returns | static setWindowBackgroundColor(color: string | ColorMetrics, windowClass: window.Window = AppUtil.getMainWindow()) {
try {
windowClass.setWindowBackgroundColor(color);
} catch (err) {
LogUtil.error(err);
}
} | AST#method_declaration#Left static setWindowBackgroundColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ColorMetrics AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST... | static setWindowBackgroundColor(color: string | ColorMetrics, windowClass: window.Window = AppUtil.getMainWindow()) {
try {
windowClass.setWindowBackgroundColor(color);
} catch (err) {
LogUtil.error(err);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L170-L176 | aca2793e2d6fb204a1f04199c4dbcb73816ffcd7 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/animation/ChartAnimator.ets | arkts | getPhaseY | Gets the Y axis phase of the animation.
@return float value of {@link #mPhaseY} | public getPhaseY(): number {
return this.mPhaseY;
} | AST#method_declaration#Left public getPhaseY 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_express... | public getPhaseY(): number {
return this.mPhaseY;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/animation/ChartAnimator.ets#L221-L223 | ecdb66b5ee2fa67d70b5a0b200e39bc8b1465d08 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/view/EntryPage.ets | arkts | aboutToDisappear | 释放入口资源
@returns {void} 无返回值 | aboutToDisappear(): void {
this.vm.aboutToDisappear();
} | 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | aboutToDisappear(): void {
this.vm.aboutToDisappear();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/view/EntryPage.ets#L31-L33 | b530013b583474a1b1d5bb46982b98cae89537e8 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_uicontext/ace_ets_module_uicontext_api13/entry/src/main/ets/MainAbility/common/Rect.ets | arkts | Copyright (c) 2023 iSoftStone Information Technology (Group) 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... | export default class RectValue {
public left: number = 0;
public top: number = 0;
public right: number = 0;
public bottom: number = 0;
} | AST#export_declaration#Left export default AST#class_declaration#Left class RectValue AST#class_body#Left { AST#property_declaration#Left public left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_decla... | export default class RectValue {
public left: number = 0;
public top: number = 0;
public right: number = 0;
public bottom: number = 0;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_uicontext/ace_ets_module_uicontext_api13/entry/src/main/ets/MainAbility/common/Rect.ets#L16-L21 | 31534186c58b81adf255e0308c85cb37d0b7489e | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | getDataSettings | 获取数据设置
@returns 数据设置 | async getDataSettings(): Promise<DataSettings> {
const settings = await this.getSettings();
return settings.data;
} | AST#method_declaration#Left async getDataSettings 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 DataSettings AST#primary_type#Right AST#type_annotation#Right > A... | async getDataSettings(): Promise<DataSettings> {
const settings = await this.getSettings();
return settings.data;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L267-L270 | a7458c442eaac03dfd1143229b7559fc017b5cc2 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinH.ets | arkts | SpinH | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinH {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 1;
@Local scale2: number = 1;
@Local scale3: number = 1;
@Local scale4: number = 1;
@Local scale5: number = 1;
@Local scale6: number = 1;
@Local scale7: number = 1;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinH AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinH {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 1;
@Local scale2: number = 1;
@Local scale3: number = 1;
@Local scale4: number = 1;
@Local scale5: number = 1;
@Local scale6: number = 1;
@Local scale7: number = 1;
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinH.ets#L26-L222 | df59d79c7158c8ca76820950503468395946068f | github |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/home/RefreshImage.ets | arkts | RefreshImage | @Entry | @Component
export default struct RefreshImage {
@State refreshText: string = '';
private dataNumbers: string[] = ['1'];
private dataStrings: string[] = ['我的评论'];
@State data: string[] = this.dataStrings;
private scroller: Scroller = new Scroller();
private refreshConfigurator: PullToRefreshConfigurator =... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct RefreshImage AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right refreshText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_an... | @Component
export default struct RefreshImage {
@State refreshText: string = '';
private dataNumbers: string[] = ['1'];
private dataStrings: string[] = ['我的评论'];
@State data: string[] = this.dataStrings;
private scroller: Scroller = new Scroller();
private refreshConfigurator: PullToRefreshConfigurator =... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/home/RefreshImage.ets#L32-L65 | a00bb3daf8f9ce78fd262dd8f9ba1d887f40efaa | github |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/pages/DeviceMonitoringPage.ets | arkts | handleSave | 保存逻辑 | async handleSave(item: DeviceItem, newVal: number) {
const isAuthPassed = await UserAuthUtil.startAuth(`验证管理员身份以修改${item.name}`);
if (!isAuthPassed) {
promptAction.showToast({ message: '操作已取消或验证失败' });
return;
}
try {
// 调用 Service 计算新状态
const newStatus = DeviceService.determine... | AST#method_declaration#Left async handleSave AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left DeviceItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newVal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | async handleSave(item: DeviceItem, newVal: number) {
const isAuthPassed = await UserAuthUtil.startAuth(`验证管理员身份以修改${item.name}`);
if (!isAuthPassed) {
promptAction.showToast({ message: '操作已取消或验证失败' });
return;
}
try {
const newStatus = DeviceService.determineStatus(item.value, ... | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/DeviceMonitoringPage.ets#L117-L157 | a677064baf068a05cc3a05afdcbdad5dceeba0df | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/transitionanimation/Index.ets | arkts | TransitionAnimationPage | 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 { TransitionAnimationPage } from './src/main/ets/components/pages/TransitionAnimationPage'; | AST#export_declaration#Left export { TransitionAnimationPage } from './src/main/ets/components/pages/TransitionAnimationPage' ; AST#export_declaration#Right | export { TransitionAnimationPage } from './src/main/ets/components/pages/TransitionAnimationPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/transitionanimation/Index.ets#L15-L15 | 4c972801c474e6c0a8df8d38d0824418a2a2e976 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | addContact | 添加联系人
@param contact 联系人实体 | async addContact(contact: ContactEntity): Promise<number> {
this.checkInitialization();
return await this.contactDAO.insertContact(contact);
} | AST#method_declaration#Left async addContact AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left ContactEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty... | async addContact(contact: ContactEntity): Promise<number> {
this.checkInitialization();
return await this.contactDAO.insertContact(contact);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L91-L94 | fa3becc3a9bf24f81b26a80db45e90c27d1eb8b9 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/model/base/BaseContentOptions.ets | arkts | TODO 自定义内容区弹出框,参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export interface BaseContentOptions extends DialogOptions {
primaryTitle?: ResourceStr; //弹出框标题。
secondaryTitle?: ResourceStr; //弹出框辅助文本。
localizedContentAreaPadding?: LocalizedPadding; //弹出框内容区内边距。
contentAreaPadding?: Padding; //弹出框内容区内边距。设置了localizedContentAreaPadding属性时该属性不生效。
onAction?: ActionStrCallBa... | AST#export_declaration#Left export AST#interface_declaration#Left interface BaseContentOptions AST#extends_clause#Left extends DialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left primaryTitle ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_an... | export interface BaseContentOptions extends DialogOptions {
primaryTitle?: ResourceStr;
secondaryTitle?: ResourceStr;
localizedContentAreaPadding?: LocalizedPadding;
contentAreaPadding?: Padding; 设置了localizedContentAreaPadding属性时该属性不生效。
onAction?: ActionStrCallBack;
contentBuilder?: () => void;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/base/BaseContentOptions.ets#L25-L36 | b18f6ecf05cc44c004a668cceb9e0410f3f90db8 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | buildContent | 构建页面内容 | @Builder
buildContent() {
Column() {
// 日历头部控制
this.buildCalendarHeader()
// 日历网格
this.buildCalendarGrid()
// 即将到来的生日列表
this.buildUpcomingBirthdays()
}
.width('100%')
.layoutWeight(1)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 日历头部控制 AST#ex... | @Builder
buildContent() {
Column() {
this.buildCalendarHeader()
this.buildCalendarGrid()
this.buildUpcomingBirthdays()
}
.width('100%')
.layoutWeight(1)
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L216-L230 | 14797024480bb4078fc017ef16d2aeb4177e0a27 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FoldableGuilde/entry/src/main/ets/modules/Crease.ets | arkts | aboutToAppear | Register for monitoring at startup | aboutToAppear() {
let callback: Callback<display.FoldStatus> = (data: display.FoldStatus) => {
console.info('Listening enabled. Data: ' + JSON.stringify(data));
// Get the folding crease area, the left and top attributes are the left and upper boundaries of the rectangular area, and the width and height... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < A... | aboutToAppear() {
let callback: Callback<display.FoldStatus> = (data: display.FoldStatus) => {
console.info('Listening enabled. Data: ' + JSON.stringify(data));
this.status = data.toString() + ' ' + display.getCurrentFoldCreaseRegion().creaseRects[0].left + ' ' +
display.getCurrentFoldCre... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/modules/Crease.ets#L24-L38 | 4551528a83f752d88fea9d004450f4ac35925e2f | gitee |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/pages/EntryPage.ets | arkts | onAccountsChange | 当账目数据发生变化时执行的回调函数 | private onAccountsChange() {
this.accountTable.getRdbStore(() => {
this.accountTable.query((result: Account[]) => {
// 按时间降序排序
this.accounts = result.sort((a, b) => b.date.getTime() - a.date.getTime());
});
});
} | AST#method_declaration#Left private onAccountsChange 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#member_expression#Left AST#expressi... | private onAccountsChange() {
this.accountTable.getRdbStore(() => {
this.accountTable.query((result: Account[]) => {
this.accounts = result.sort((a, b) => b.date.getTime() - a.date.getTime());
});
});
} | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/pages/EntryPage.ets#L45-L52 | 9b97191a88a61566102d8afb3b397bf12d6ffb11 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/AddListItem.ets | arkts | ToDoListItem | [End define_the_data_to_be_done] [Start build_the_overall_list_layout_and_list_items] | @Component
export struct ToDoListItem {
@Link isEditMode: boolean;
@Link selectedItems: ToDo[];
private toDoItem: ToDo = new ToDo('');
build() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
// [StartExclude build_the_overall_list_layout_and_list_items]
Text(t... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ToDoListItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isEditMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an... | @Component
export struct ToDoListItem {
@Link isEditMode: boolean;
@Link selectedItems: ToDo[];
private toDoItem: ToDo = new ToDo('');
build() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Text(this.toDoItem.name)
.fontSize(16)
.width('80%')... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/AddListItem.ets#L32-L63 | 556d07b6e37bb552cab2b9bca8d4ba56dc5e4bf9 | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/textInput/TextEditNodeController.ets | arkts | removeTextNode | 移除文本节点 (包含文本框和输入框节点)
@param uniqueId 唯一标识 | removeTextNode(uniqueId: number): void {
if (this.rootNode !== null && this.textRecords.length > 0) {
let idx = -1;
let data = this.textRecords.find((value: OperateRecord, index: number) => {
if (value.node?.getUniqueId() === uniqueId) {
idx = index;
return true;
} el... | AST#method_declaration#Left removeTextNode AST#parameter_list#Left ( AST#parameter#Left uniqueId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | removeTextNode(uniqueId: number): void {
if (this.rootNode !== null && this.textRecords.length > 0) {
let idx = -1;
let data = this.textRecords.find((value: OperateRecord, index: number) => {
if (value.node?.getUniqueId() === uniqueId) {
idx = index;
return true;
} el... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextEditNodeController.ets#L211-L226 | 0f23ee11009cd07716dd8e5d225379ab959c5e8d | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | convertToTree | 将分类列表转换为树形结构
@param {Category[]} categories - 原始分类列表
@returns {CategoryTree[]} 树形结构的分类列表
@example
const tree = this.convertToTree(list); | private convertToTree(categories: Category[]): CategoryTree[] {
if (!categories || categories.length === 0) {
return [];
}
const nestedTrees: CategoryTree[] = this.tryBuildTreeFromNested(categories);
if (nestedTrees.length > 0) {
return nestedTrees;
}
const sortedList: Category[] =... | AST#method_declaration#Left private convertToTree AST#parameter_list#Left ( AST#parameter#Left categories : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_anno... | private convertToTree(categories: Category[]): CategoryTree[] {
if (!categories || categories.length === 0) {
return [];
}
const nestedTrees: CategoryTree[] = this.tryBuildTreeFromNested(categories);
if (nestedTrees.length > 0) {
return nestedTrees;
}
const sortedList: Category[] =... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L199-L228 | f512af8e91c7114e5cb429e24abbd36e9dfdcea9 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets | arkts | imageRes | 弹窗图标
@param imageRes
@returns | imageRes(imageRes: ResourceStr) {
this.builderOptions.imageRes = imageRes
return this;
} | AST#method_declaration#Left imageRes AST#parameter_list#Left ( AST#parameter#Left imageRes : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#L... | imageRes(imageRes: ResourceStr) {
this.builderOptions.imageRes = imageRes
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets#L29-L32 | 63a18349836dd5796635215129a9bb806c370ab9 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsItemModel.ets | arkts | 新闻视频地址 | constructor(newsName: string, newsVideoSrc: Resource | string) {
this.newsName = newsName;
this.newsVideoSrc = newsVideoSrc;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left newsName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newsVideoSrc : AST#type_annotation#Left AST#union_type#Left AST#primary_typ... | constructor(newsName: string, newsVideoSrc: Resource | string) {
this.newsName = newsName;
this.newsVideoSrc = newsVideoSrc;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsItemModel.ets#L26-L29 | 9c06531eeea719af17570c81304634788a269644 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpdfviewer/src/main/ets/view/MyDataSource.ets | arkts | 每个tabs组件携带的data信息 | export interface ListObj {
index: number;
header: string | Resource;
comp: ESObject;
}; | AST#export_declaration#Left export AST#interface_declaration#Left interface ListObj AST#object_type#Left { AST#type_member#Left index : 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 header : AST#type_annotation#Left AS... | export interface ListObj {
index: number;
header: string | Resource;
comp: ESObject;
}; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpdfviewer/src/main/ets/view/MyDataSource.ets#L17-L21 | 5074a21e10c1be5abf8312ebf31394721d9207c5 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取首页数据
@param userId 用户ID
@returns 首页数据 - 返回HomePageData类型 | export function getHomePageData(userId: number): Promise<HomePageData> {
console.info(`正在请求首页数据,userId: ${userId}`);
try {
return request<HomePageData>(RequestMethod.GET, `/home/${userId}`);
} catch (error) {
console.error(`获取首页数据失败: ${(error instanceof Error ? error.message : String(error))}`);
throw... | AST#export_declaration#Left export AST#function_declaration#Left function getHomePageData AST#parameter_list#Left ( AST#parameter#Left userId : 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... | export function getHomePageData(userId: number): Promise<HomePageData> {
console.info(`正在请求首页数据,userId: ${userId}`);
try {
return request<HomePageData>(RequestMethod.GET, `/home/${userId}`);
} catch (error) {
console.error(`获取首页数据失败: ${(error instanceof Error ? error.message : String(error))}`);
throw... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L339-L347 | b3e57fa2aae6f9094287959cad1f35fba48c9632 | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | entry/src/main/ets/pages/demos/customContent/CustomContentBuilder.ets | arkts | 全局引导 | export class CustomContentDemoContentBuilder {
private static _WrappedBuilder?: WrappedBuilder<[]> = undefined;
static getBuilder() {
if (!CustomContentDemoContentBuilder._WrappedBuilder) {
CustomContentDemoContentBuilder._WrappedBuilder = wrapBuilder(buildCustomContent)
}
return CustomContentDem... | AST#export_declaration#Left export AST#class_declaration#Left class CustomContentDemoContentBuilder AST#class_body#Left { AST#property_declaration#Left private static _WrappedBuilder ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Lef... | export class CustomContentDemoContentBuilder {
private static _WrappedBuilder?: WrappedBuilder<[]> = undefined;
static getBuilder() {
if (!CustomContentDemoContentBuilder._WrappedBuilder) {
CustomContentDemoContentBuilder._WrappedBuilder = wrapBuilder(buildCustomContent)
}
return CustomContentDem... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/entry/src/main/ets/pages/demos/customContent/CustomContentBuilder.ets#L7-L16 | 66ef4310c88aef632deb8d764c4dde59554b55d6 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/page/Configure.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class Configure {
// 标题栏常规高度
public static readonly NORMAL_TITLE_HEIGHT: number = 80;
// 标题栏扩展高度
public static readonly EXPAND_TITLE_HEIGHT: number = 100;
// 扩展后标题继续下拉阈值
public static readonly CONTINUE_PULL_THRESHOLD: number = 90;
// 动效时长
public static readonly ANIMATION_DURATION: number = 120;
... | AST#export_declaration#Left export AST#class_declaration#Left class Configure AST#class_body#Left { // 标题栏常规高度 AST#property_declaration#Left public static readonly NORMAL_TITLE_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#ex... | export class Configure {
public static readonly NORMAL_TITLE_HEIGHT: number = 80;
public static readonly EXPAND_TITLE_HEIGHT: number = 100;
public static readonly CONTINUE_PULL_THRESHOLD: number = 90;
public static readonly ANIMATION_DURATION: number = 120;
public static readonly TITLE_SCALE_MA... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/page/Configure.ets#L16-L27 | 8b0be34265d3b39cc8b1c0d29ba7d44bb1ea75b9 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CustomAnimationTab/customanimationtab/src/main/ets/utils/CustomAnimationTab.ets | arkts | checkNotLegal | 检查输入参数合法性 | private checkNotLegal(): void {
if (this.tabsInfo === undefined || this.tabsInfo.length <= 0) {
this.tabsInfo = [
new TabInfo(CommonConstants.DEFAULT_TITLE1_TAB, wrapBuilder(baseBuilder), wrapBuilder(tabBar)),
new TabInfo(CommonConstants.DEFAULT_TITLE2_TAB, wrapBuilder(baseBuilder), wrapBuilde... | AST#method_declaration#Left private checkNotLegal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#bi... | private checkNotLegal(): void {
if (this.tabsInfo === undefined || this.tabsInfo.length <= 0) {
this.tabsInfo = [
new TabInfo(CommonConstants.DEFAULT_TITLE1_TAB, wrapBuilder(baseBuilder), wrapBuilder(tabBar)),
new TabInfo(CommonConstants.DEFAULT_TITLE2_TAB, wrapBuilder(baseBuilder), wrapBuilde... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/utils/CustomAnimationTab.ets#L243-L273 | 5ceb80c5fcade5024360fb1cc7b7548d0eb4e9bb | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/GreetingGenerationService.ets | arkts | personalizeTemplate | 个性化模板 | private personalizeTemplate(template: string, contact: Contact): string {
let result = template;
// 基本信息替换
result = result.replace(/{name}/g, contact.name);
result = result.replace(/{relation_name}/g, this.getRelationName(contact));
// 年龄相关
if (contact.birthday?.age) {
const age = contac... | AST#method_declaration#Left private personalizeTemplate AST#parameter_list#Left ( AST#parameter#Left template : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact... | private personalizeTemplate(template: string, contact: Contact): string {
let result = template;
result = result.replace(/{name}/g, contact.name);
result = result.replace(/{relation_name}/g, this.getRelationName(contact));
if (contact.birthday?.age) {
const age = contact.birthday.age;
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L445-L521 | 3d335ae2de5d7cfa9723bb6d81639f94f674f282 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/CaesarCipher.ets | arkts | 凯撒密码实现
凯撒密码是一种替换加密的技术,明文中的所有字母都在字母表上向后(或向前)按照一个固定数目进行偏移后被替换成密文。 | export class CaesarCipher {
/**
* 加密文本
* @param text 要加密的文本
* @param shift 偏移量
* @returns 加密后的文本
*/
static encrypt(text: string, shift: number): string {
if (!text) {
return '';
}
const normalizedShift = ((shift % 26) + 26) % 26; // 确保偏移量在0-25之间
let result = '';
for (let i... | AST#export_declaration#Left export AST#class_declaration#Left class CaesarCipher AST#class_body#Left { /**
* 加密文本
* @param text 要加密的文本
* @param shift 偏移量
* @returns 加密后的文本
*/ AST#method_declaration#Left static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primar... | export class CaesarCipher {
static encrypt(text: string, shift: number): string {
if (!text) {
return '';
}
const normalizedShift = ((shift % 26) + 26) % 26;
let result = '';
for (let i = 0; i < text.length; i++) {
const char = text[i];
if (char >= 'A' && char <= 'Z') {
... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/CaesarCipher.ets#L5-L46 | 35dad28d35d81a9f7af56300412f8afc62ae8734 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/SubscribeManager.ets | arkts | get | 是否有效 | get isActive(): boolean {
return this.calculateCurrentSubscriptionActive();
} | AST#method_declaration#Left get AST#ERROR#Left isActive AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expres... | get isActive(): boolean {
return this.calculateCurrentSubscriptionActive();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/SubscribeManager.ets#L38-L40 | 996e8e3f8f1ae19da86c693ae3b9db392f262bb8 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | joinEvent | 参加活动 | async joinEvent(eventId: string): Promise<boolean> {
try {
if (!this.currentUser) return false;
// TODO: 参加活动
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Event joined: ${eventId}`);
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG... | AST#method_declaration#Left async joinEvent AST#parameter_list#Left ( AST#parameter#Left eventId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | async joinEvent(eventId: string): Promise<boolean> {
try {
if (!this.currentUser) return false;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Event joined: ${eventId}`);
return true;
} 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#L562-L574 | 885b675e5e541d7a94c2a7f72ee370d324b47d1a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets | arkts | previewSnapshot | 滚动查看图片的组件。 | @Builder
previewSnapshot() {
Scroll(this.previewerScroller) {
Column() {
Image(this.mergedImage)
.objectFit(ImageFit.Auto)
.width(this.snapPopupWidth)
.borderRadius(Constants.BORDER_RADIUS)
.animation({
duration: Constants.ANIMATE_DURATION,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right previewSnapshot 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 Scroll ( AST#expression#Left AST#member_expression#Left AS... | @Builder
previewSnapshot() {
Scroll(this.previewerScroller) {
Column() {
Image(this.mergedImage)
.objectFit(ImageFit.Auto)
.width(this.snapPopupWidth)
.borderRadius(Constants.BORDER_RADIUS)
.animation({
duration: Constants.ANIMATE_DURATION,
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L152-L191 | 82d6f36bb0e0ebf85935c1a7e2196602b693eef2 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/crypto/ECDSAPage.ets | arkts | mock | 非对称密钥 | @MockSetup
mock() {
this.describe = new DescribeBean("ECDSA", "ECDSA工具类");
} | AST#method_declaration#Left AST#decorator#Left @ MockSetup AST#decorator#Right mock AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Ri... | @MockSetup
mock() {
this.describe = new DescribeBean("ECDSA", "ECDSA工具类");
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/crypto/ECDSAPage.ets#L24-L27 | c4d62ea878b04173df682f9da9266836902766ec | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets | arkts | getAllFootprints | 获取所有足迹记录,按浏览时间倒序
@returns {Promise<Footprint[]>} 足迹列表 | async getAllFootprints(): Promise<Footprint[]> {
const list: FootprintEntity[] = this.orm.query(FootprintEntity).find();
return list
.map((entity) => this.toModel(entity))
.sort((left, right) => (right.viewTime ?? 0) - (left.viewTime ?? 0));
} | AST#method_declaration#Left async getAllFootprints 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 Footprint [ ] AST#array_type#Right AST#prima... | async getAllFootprints(): Promise<Footprint[]> {
const list: FootprintEntity[] = this.orm.query(FootprintEntity).find();
return list
.map((entity) => this.toModel(entity))
.sort((left, right) => (right.viewTime ?? 0) - (left.viewTime ?? 0));
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L69-L74 | e25d326bb77d41ea51d363cf8b64a3cfa5310cc1 | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/DataModel.ets | arkts | totalCount | Get the length of the array. | public totalCount(): number {
return this.tabContent.length;
} | AST#method_declaration#Left public totalCount 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_expres... | public totalCount(): number {
return this.tabContent.length;
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/DataModel.ets#L55-L57 | 77a32943771f8dc65de8275427ba7583f21848f6 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/GridSample/entry/src/main/ets/common/bean/GridAreaContent.ets | arkts | Grid area content. | export class GridAreaContent {
/**
* Grid item data.
*/
gridItems: Array<GridItemData>;
/**
* Grid height.
*/
gridHeight: Resource;
} | AST#export_declaration#Left export AST#class_declaration#Left class GridAreaContent AST#class_body#Left { /**
* Grid item data.
*/ AST#property_declaration#Left gridItems : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_typ... | export class GridAreaContent {
gridItems: Array<GridItemData>;
gridHeight: Resource;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/GridSample/entry/src/main/ets/common/bean/GridAreaContent.ets#L6-L16 | a198544228749055fbfaea1ed899338c63fd2e2e | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/mine/mine.ets | arkts | getUserInfo | 获取用户信息(头像,会员等级,昵称) | async getUserInfo(){
let httpRequest = http.createHttp()
let encodeUserId = encodeURIComponent(this.userId)
let u = address.IP+`/me?userId=${encodeUserId}`
try {
let respond = await httpRequest.request(u,{
method:http.RequestMethod.GET,
header: {
"Content-Type": "applicat... | AST#method_declaration#Left async getUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#ex... | async getUserInfo(){
let httpRequest = http.createHttp()
let encodeUserId = encodeURIComponent(this.userId)
let u = address.IP+`/me?userId=${encodeUserId}`
try {
let respond = await httpRequest.request(u,{
method:http.RequestMethod.GET,
header: {
"Content-Type": "applicat... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/mine/mine.ets#L133-L159 | f71eba65a490ef841a524007916970699f20e24e | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Chip.d.ets | arkts | Defines the suffix icon option.
@interface SuffixIconOptions
@extends IconCommonOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Defines the suffix icon option.
@interface SuffixIconOptions
@extends IconCommonOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@... | export interface SuffixIconOptions extends IconCommonOptions {
/**
* Called when the suffix icon is clicked.
*
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Called when the suffix icon is clicked.
*
* @type { ?function }
* ... | AST#export_declaration#Left export AST#interface_declaration#Left interface SuffixIconOptions AST#extends_clause#Left extends IconCommonOptions AST#extends_clause#Right AST#object_type#Left { /**
* Called when the suffix icon is clicked.
*
* @type { ?function }
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | export interface SuffixIconOptions extends IconCommonOptions {
action?: () => void;
accessibilityText?: ResourceStr;
accessibilityDescription?: ResourceStr;
accessibilityLevel?: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L229-L283 | 2503227570da7c94915e6967dcfa2e5fd1ba933f | gitee | |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | loginFromLocal | 从本地获取登录信息并登录 | async loginFromLocal() {
try {
let result = await globalVM_WanDB.fetchLocalLoginInfo();
if (result !== null) {
// let id = result[0];
let login_info = result[1];
let user_info = result[2];
let cookie = result[3];
let password = result[4];
// let login_stat... | AST#method_declaration#Left async loginFromLocal AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#cal... | async loginFromLocal() {
try {
let result = await globalVM_WanDB.fetchLocalLoginInfo();
if (result !== null) {
let login_info = result[1];
let user_info = result[2];
let cookie = result[3];
let password = result[4];
let loginInfo = JSON.parse(log... | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L165-L188 | a701cc09f4c0968022f4496cab33f42e8522e3db | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | restartCustomScan | 重新启动扫码
@returns {void} | async restartCustomScan(): Promise<void> {
logger.info('restartCustomScan');
// 关闭存在的扫描结果对话框
this.closeScanResult();
// 根据窗口尺寸调整展示组件尺寸
await this.updateCameraCompSize();
// 调整相机surface尺寸
this.cameraCompSizeUpdateCb(this.cameraCompWidth,
this.cameraCompHeight,
this.cameraCompOffse... | AST#method_declaration#Left async restartCustomScan 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#typ... | async restartCustomScan(): Promise<void> {
logger.info('restartCustomScan');
this.closeScanResult();
await this.updateCameraCompSize();
this.cameraCompSizeUpdateCb(this.cameraCompWidth,
this.cameraCompHeight,
this.cameraCompOffsetX,
this.cameraCompOffsetY);
awai... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L374-L389 | de41c40dd9435ef0e473a7dea2ddc851f66be28c | gitee |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/InterviewRecordModel.ets | arkts | getDifficultyStars | 获取难度星级显示 | getDifficultyStars(): string {
return '★'.repeat(this.difficulty) + '☆'.repeat(5 - this.difficulty);
} | AST#method_declaration#Left getDifficultyStars AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_express... | getDifficultyStars(): string {
return '★'.repeat(this.difficulty) + '☆'.repeat(5 - this.difficulty);
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L161-L163 | 5b57cb7464748e520e498e937578fa88269044d4 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | goSettings | 跳转到设置页面 | async goSettings(): Promise<void> {
await this.push(RoutePaths.SETTINGS);
} | AST#method_declaration#Left async goSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async goSettings(): Promise<void> {
await this.push(RoutePaths.SETTINGS);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L264-L266 | 5dc35753ef41dd3501591af80ccdfd6514726686 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 数据配置接口 | export interface DataConfig {
autoBackup: AutoBackupConfig;
dataRetention: DataRetentionConfig;
syncConfig: SyncConfig;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DataConfig AST#object_type#Left { AST#type_member#Left autoBackup : AST#type_annotation#Left AST#primary_type#Left AutoBackupConfig AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left dataRetention : AS... | export interface DataConfig {
autoBackup: AutoBackupConfig;
dataRetention: DataRetentionConfig;
syncConfig: SyncConfig;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L417-L421 | f106b4979649fa89367f628bd30b185642c4ce8c | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SHA.ets | arkts | hmacSegmentSync | 消息认证码计算,分段,同步
@param data 传入的消息
@param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512)。
@param symKey 共享对称密钥。
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
@param len 自定义的数据拆分长度 | static hmacSegmentSync(data: string, algName: crypto.SHA = 'SHA256', symKey: cryptoFramework.SymKey = SHA.symKey,
resultCoding: crypto.BhCoding = 'hex', len: number = 120): string {
return CryptoUtil.hmacSegmentSync(data, algName, symKey, resultCoding, len);
} | AST#method_declaration#Left static hmacSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualified_ty... | static hmacSegmentSync(data: string, algName: crypto.SHA = 'SHA256', symKey: cryptoFramework.SymKey = SHA.symKey,
resultCoding: crypto.BhCoding = 'hex', len: number = 120): string {
return CryptoUtil.hmacSegmentSync(data, algName, symKey, resultCoding, len);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L128-L131 | 7e510dbb13eb521233b668165ef9c9fe55c65130 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Range.ets | arkts | Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Range {
public myfrom: number;
public to: number;
constructor(myfrom: number, to: number) {
this.myfrom = myfrom;
this.to = to;
}
/**
* Returns true if this range contains (if the value is in between) the given value, false if not.
*
* @param value
* @return
*/
public contains... | AST#export_declaration#Left export default AST#class_declaration#Left class Range AST#class_body#Left { AST#property_declaration#Left public myfrom : 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 publ... | export default class Range {
public myfrom: number;
public to: number;
constructor(myfrom: number, to: number) {
this.myfrom = myfrom;
this.to = to;
}
public contains(value: number): boolean {
if (value > this.myfrom && value <= this.to) {
return true;
} else {
return false;
}
}
public isLar... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Range.ets#L16-L46 | 62ecffdf2d8ee89a67ebd721ac535a84cf925777 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/RandomUtil.ets | arkts | randomLimit | 获得指定范围内的随机数 [0,limit)
@param limit 限制随机数的范围,不包括这个数
@return 随机数 | static randomLimit(limit: number): number {
return Math.floor(Math.random() * limit);
} | AST#method_declaration#Left static randomLimit AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | static randomLimit(limit: number): number {
return Math.floor(Math.random() * limit);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/RandomUtil.ets#L75-L77 | 003ede51cd6cca9e34546d2a7480170229f33cac | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/addDevice/utils/base64Util.ets | arkts | *
加密 base64encode(utf16to8(str))
解密 utf8to16(base64decode(str)) | export default class Base64 {
static base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1... | AST#export_declaration#Left export default AST#class_declaration#Left class Base64 AST#class_body#Left { AST#property_declaration#Left static base64EncodeChars = AST#expression#Left "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" AST#expression#Right ; AST#property_declaration#Right AST#property_decl... | export default class Base64 {
static base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/addDevice/utils/base64Util.ets#L20-L72 | c3de944bfb4e679b638095666a0a3a29c92e83ca | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/DateUtil.ets | arkts | TODO 日期工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class DateUtil {
/**
* 获取格式化日期,将传入的日期格式化为Date
* @param date
* @returns
*/
static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) { //无参数
date = new Date();
} else if (typeof date == "string") { //字符串日期
if (date.length == 0) {
... | AST#export_declaration#Left export AST#class_declaration#Left class DateUtil AST#class_body#Left { /**
* 获取格式化日期,将传入的日期格式化为Date
* @param date
* @returns
*/ AST#method_declaration#Left static getFormatDate AST#parameter_list#Left ( AST#parameter#Left date ? : AST#type_annotation#Left AST#union_type#Left AST#... | export class DateUtil {
static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) {
date = new Date();
} else if (typeof date == "string") {
if (date.length == 0) {
date = new Date();
} else {
if (date.toString().length == 10 ||... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/DateUtil.ets#L25-L481 | fad73d2e7199e88970675ec5e6892313d13ef22f | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/UserNoteUpdate.ets | arkts | Emitted whenever a note is updated.
@event Client#userNoteUpdate
@param {User} user The user the note belongs to
@param {string} oldNote The note content before the update
@param {string} newNote The note content after the update
应用ArkTS约束:使用export default代替module.exports | export default UserNoteUpdateAction; | AST#export_declaration#Left export default AST#expression#Left UserNoteUpdateAction AST#expression#Right ; AST#export_declaration#Right | export default UserNoteUpdateAction; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/UserNoteUpdate.ets#L36-L36 | 7a7527c94ce4f07ce4a94a158b284dbe0a1b324b | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocache/src/main/ets/model/VideoPlayerManager.ets | arkts | 播放管理 | export default class AvPlayManager {
private static instance: AvPlayManager | null = null;
private avPlayer: media.AVPlayer = {} as media.AVPlayer;
// 播放管理类
private surfaceID: string = '';
public static getInstance(): AvPlayManager {
if (!AvPlayManager.instance) {
AvPlayManager.instance = new AvPla... | AST#export_declaration#Left export default AST#ERROR#Left class AvPlayManager { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AvPlayManager AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#typ... | export default class AvPlayManager {
private static instance: AvPlayManager | null = null;
private avPlayer: media.AVPlayer = {} as media.AVPlayer;
private surfaceID: string = '';
public static getInstance(): AvPlayManager {
if (!AvPlayManager.instance) {
AvPlayManager.instance = new AvPlayManager... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/model/VideoPlayerManager.ets#L28-L106 | 73e277049f62bbf132fda06a3c84b45b659c8c95 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ibestui/src/main/ets/IBestUIInitializer.ets | arkts | initIBestUI | 初始化 IBest UI 组件库
@param {window.WindowStage} windowStage - 窗口阶段
@param {common.UIAbilityContext} context - UIAbility 上下文
@returns {void} 无返回值 | static initIBestUI(windowStage: window.WindowStage, context: common.UIAbilityContext): void {
IBestInit(windowStage, context);
IBestUIInitializer.setIBestUIBaseStyle();
} | AST#method_declaration#Left static initIBestUI AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context... | static initIBestUI(windowStage: window.WindowStage, context: common.UIAbilityContext): void {
IBestInit(windowStage, context);
IBestUIInitializer.setIBestUIBaseStyle();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ibestui/src/main/ets/IBestUIInitializer.ets#L16-L19 | 0ce58bee88e51f9433d7c8d388e33dc9d41ff5e0 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NumberUtil.ets | arkts | isSafeInteger | 检查值是否为安全整数
@param value
@returns | static isSafeInteger(value: Any): boolean {
return Number.isSafeInteger(value);
} | AST#method_declaration#Left static isSafeInteger AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty... | static isSafeInteger(value: Any): boolean {
return Number.isSafeInteger(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L62-L64 | f4ca98a20c3860b72c3ef2e7088d922c508cadd6 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/I18nManager.ets | arkts | cleanup | 清理资源 | async cleanup(): Promise<void> {
try {
this.translations.clear();
this.preferences = null;
this.context = null;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'I18nManager cleanup completed');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG... | AST#method_declaration#Left async cleanup 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_argument... | async cleanup(): Promise<void> {
try {
this.translations.clear();
this.preferences = null;
this.context = null;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'I18nManager cleanup completed');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L765-L776 | 51d82a1b9d2330bca590d1275318285b5e59e47e | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/OnDrawListener.ets | arkts | Listener for callbacks when drawing on the chart.
@author Philipp | 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-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/OnDrawListener.ets#L26-L26 | 7087b76dc2682d818f4bcfb333beea3a00a80ac8 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/theme/AppDimensions.ets | arkts | 应用尺寸规范 | export class AppDimensions {
// 间距
static readonly spaceXSmall: number = 4;
static readonly spaceSmall: number = 8;
static readonly spaceMedium: number = 12;
static readonly spaceLarge: number = 16;
static readonly spaceXLarge: number = 20;
static readonly spaceXXLarge: number = 24;
// 内边距
static r... | AST#export_declaration#Left export AST#class_declaration#Left class AppDimensions AST#class_body#Left { // 间距 AST#property_declaration#Left static readonly spaceXSmall : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4 AST#expression#Right ; ... | export class AppDimensions {
static readonly spaceXSmall: number = 4;
static readonly spaceSmall: number = 8;
static readonly spaceMedium: number = 12;
static readonly spaceLarge: number = 16;
static readonly spaceXLarge: number = 20;
static readonly spaceXXLarge: number = 24;
static readonly pad... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/theme/AppDimensions.ets#L4-L53 | 1546e729318047a285b5486e1e613b4ce80d1a1c | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | ItemInfo
@extends BaseItemInfo
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare class ItemInfo extends BaseItemInfo {
/**
* itemType. include CAMERA and THUMBNAIL.
*
* @type { ?ItemType }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
itemType?: ItemType;
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ItemInfo extends AST#type_annotation#Left AST#primary_type#Left BaseItemInfo AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* itemType. include CAMERA and THUMBNAIL.
*
* @type ... | export declare class ItemInfo extends BaseItemInfo {
itemType?: ItemType;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L658-L668 | 7eeb3c97516afb8582e8edf3845c9519a7372e24 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | animateY | Animates values along the Y axis.
@param durationMillis animation duration
@param easing EasingFunction | public animateY(durationMillis: number, easing: EasingFunction) {
let animatorY: ObjectAnimator = yAnimator(durationMillis, easing);
animatorY.addUpdateListener(mListener);
animatorY.start();
} | AST#method_declaration#Left public animateY AST#parameter_list#Left ( AST#parameter#Left durationMillis : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left easing : AST#type_annotation#Left AST#primary_type#Left EasingFunction... | public animateY(durationMillis: number, easing: EasingFunction) {
let animatorY: ObjectAnimator = yAnimator(durationMillis, easing);
animatorY.addUpdateListener(mListener);
animatorY.start();
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L140-L144 | a829eb83bdcd6eb99d18ac6731ec31f415b23715 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/StorageUtils.ets | arkts | putObject | 存储对象数据
@param key 存储键
@param value 存储值 | static async putObject<T>(key: string, value: T): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await StorageUtils.putString(key, jsonString);
} catch (error) {
console.error(`Failed to put object for key ${key}:`, error);
}
} | AST#method_declaration#Left static async putObject AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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#param... | static async putObject<T>(key: string, value: T): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await StorageUtils.putString(key, jsonString);
} catch (error) {
console.error(`Failed to put object for key ${key}:`, error);
}
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L150-L157 | 2ec12cb265211292f6477449bc3a667c834f4119 | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | sharedlibrary/Index.ets | arkts | add | 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 { add } from './src/main/ets/utils/Calc' | AST#export_declaration#Left export { add } from './src/main/ets/utils/Calc' AST#export_declaration#Right | export { add } from './src/main/ets/utils/Calc' | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/sharedlibrary/Index.ets#L15-L15 | 6e84d032fea57dfa73e99c1131f49c3cf8fb46e1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM2.ets | arkts | encrypt | 加密,异步
@param data 加密或者解密的数据。data不能为null。
@param pubKey 指定加密公钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合,默认SM2_256|SM3。
@returns | static async encrypt(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.encrypt(data, pubKey, null, transformation);
} | AST#method_declaration#Left static async encrypt 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 pubKey... | static async encrypt(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.encrypt(data, pubKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L40-L43 | 67c926923f9e16776165526a21b3c7e398a4cc38 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/attribute/ColumnAttribute.ets | arkts | 获取纵向末尾 + 水平居中的 Column 对齐修饰器
@returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器
@example
Column() { Text("Hi"); }.attributeModifier(columnEndCenter()); | export function columnEndCenter(): AttributeModifier<ColumnAttribute> {
return {
applyNormalAttribute: (instance: ColumnAttribute): void => {
instance.justifyContent(FlexAlign.End);
instance.alignItems(HorizontalAlign.Center);
}
};
} | AST#export_declaration#Left export AST#function_declaration#Left function columnEndCenter 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 ColumnAttribute... | export function columnEndCenter(): AttributeModifier<ColumnAttribute> {
return {
applyNormalAttribute: (instance: ColumnAttribute): void => {
instance.justifyContent(FlexAlign.End);
instance.alignItems(HorizontalAlign.Center);
}
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L117-L124 | b02fc7525b85c3fe529f09adf6ba94ac217d362b | github | |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/view/TopicDetailItemWidget.ets | arkts | pause | 暂停 | pause(): void {
if (this.playState !== PlayState.PAUSE) {
this.playState = PlayState.PAUSE;
}
this.videoController.pause();
} | AST#method_declaration#Left pause AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#... | pause(): void {
if (this.playState !== PlayState.PAUSE) {
this.playState = PlayState.PAUSE;
}
this.videoController.pause();
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/view/TopicDetailItemWidget.ets#L163-L168 | 596831fe4f99e54cc34a048100c983c3b618317d | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/ScatterDataSet.ets | arkts | getScatterShapeSize | @Override | public getScatterShapeSize(): number {
return this.mShapeSize;
} | AST#method_declaration#Left public getScatterShapeSize 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#memb... | public getScatterShapeSize(): number {
return this.mShapeSize;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L90-L92 | d7cd0fdcaf2140735b1b4a17d34c0b84065f02bb | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringDealUtility.ets | arkts | match | / 匹配正则表达式 | public static match(srcStr: string | null, reg: string): Array<string> {
const list: Array<string> = [];
if (srcStr !== null) {
const pattern: RegExp = new RegExp(reg, 'g');
let matcher: RegExpExecArray | null;
while ((matcher = pattern.exec(srcStr)) !== null) {
const start: number =... | AST#method_declaration#Left public static match AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , ... | public static match(srcStr: string | null, reg: string): Array<string> {
const list: Array<string> = [];
if (srcStr !== null) {
const pattern: RegExp = new RegExp(reg, 'g');
let matcher: RegExpExecArray | null;
while ((matcher = pattern.exec(srcStr)) !== null) {
const start: number =... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L16-L33 | e442c424fbefb4be797e452b8367adaf68d46cb7 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | getAllPathName | @deprecated
@see {ZRouter.getInstance().getAllPathName}
@returns | public static getAllPathName(): string[] {
return ZRouter.getRouterMgr().getAllPathName()
} | AST#method_declaration#Left public static getAllPathName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_sta... | public static getAllPathName(): string[] {
return ZRouter.getRouterMgr().getAllPathName()
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L505-L507 | 8a27f702f1fffc345d2d67e884902c13ede35612 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/SizeMode.ets | arkts | 背景条宽度模式 | export enum SizeMode {
// 标准宽度模式
Normal,
// 内边距模式
Padding
} | AST#export_declaration#Left export AST#enum_declaration#Left enum SizeMode AST#enum_body#Left { // 标准宽度模式 AST#enum_member#Left Normal AST#enum_member#Right , // 内边距模式 AST#enum_member#Left Padding AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right | export enum SizeMode {
Normal,
Padding
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/SizeMode.ets#L19-L24 | 3dcd3c9ffc1b7dce928b088463637912ed06fb94 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/Log.ets | arkts | showWarn | Outputs warning-level logs.
@param tag Identifies the log tag.
@param format Indicates the log format string.
@param args Indicates the log parameters.
@since 7 | static showWarn(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.WARN)) {
hilog.warn(DOMAIN, tag, format, args);
}
} | AST#method_declaration#Left static showWarn AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | static showWarn(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.WARN)) {
hilog.warn(DOMAIN, tag, format, args);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/Log.ets#L59-L63 | 6fd33cfe04197f27e6a68c0332f541a64a23f9a5 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets | arkts | createSqlObjForPlan | ====== 构建 SqlObj ====== | private createSqlObjForPlan(plan: DBPlan): SqlObj | null {
if (!plan.planId || !plan.planName) return null;
const sql = `REPLACE INTO ${Tables.Plan.name} (
${Tables.Plan.Col.planId},
${Tables.Plan.Col.planName},
${Tables.Plan.Col.bookId},
${Tables.Plan.Col.countPe... | AST#method_declaration#Left private createSqlObjForPlan AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left DBPlan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_typ... | private createSqlObjForPlan(plan: DBPlan): SqlObj | null {
if (!plan.planId || !plan.planName) return null;
const sql = `REPLACE INTO ${Tables.Plan.name} (
${Tables.Plan.Col.planId},
${Tables.Plan.Col.planName},
${Tables.Plan.Col.bookId},
${Tables.Plan.Col.countPe... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L357-L378 | a5f42371565f764425d231dca6a1a6ed2ee83a3f | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/CommonConstantsInfo.ets | arkts | Common constants 类的信息模块 | export default class CommonConstantsInfo {
dbName?: string = '';
tableName?: string = '';
columns?: Array<string> = [];
} | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstantsInfo AST#class_body#Left { AST#property_declaration#Left dbName ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#proper... | export default class CommonConstantsInfo {
dbName?: string = '';
tableName?: string = '';
columns?: Array<string> = [];
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/CommonConstantsInfo.ets#L5-L9 | bfd531be5838af5eee547bfb501c255fceddaa0a | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/ChartHighlighter.ets | arkts | getMinimumDistance | Returns the minimum distance from a touch value (in pixels) to the
closest value (in pixels) that is displayed in the chart.
@param closestValues
@param pos
@param axis
@return | protected getMinimumDistance(closestValues: JArrayList<Highlight>, pos: number, axis: AxisDependency): number {
var distance: number = Number.MAX_VALUE;
for (var i: number = 0; i < closestValues.size(); i++) {
var high: Highlight = closestValues.get(i);
if (high.getAxis() == ax... | AST#method_declaration#Left protected getMinimumDistance AST#parameter_list#Left ( AST#parameter#Left closestValues : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotat... | protected getMinimumDistance(closestValues: JArrayList<Highlight>, pos: number, axis: AxisDependency): number {
var distance: number = Number.MAX_VALUE;
for (var i: number = 0; i < closestValues.size(); i++) {
var high: Highlight = closestValues.get(i);
if (high.getAxis() == ax... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/ChartHighlighter.ets#L107-L122 | 5ecd28d6aed6879daea5a00b125f483ca427f8ca | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/common/Card.ets | arkts | CompletedRoutableCard | 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... | @Component
export struct CompletedRoutableCard {
@Prop
symbol: Resource = $r('sys.symbol.label');
@Prop
@Require
title: string;
@Prop
@Require
description: string;
build() {
Card({ verticalAlign: VerticalAlign.Top }) {
Button({ type: ButtonType.Circle }) {
SymbolGlyph(this.symbol)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CompletedRoutableCard AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right symbol : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#t... | @Component
export struct CompletedRoutableCard {
@Prop
symbol: Resource = $r('sys.symbol.label');
@Prop
@Require
title: string;
@Prop
@Require
description: string;
build() {
Card({ verticalAlign: VerticalAlign.Top }) {
Button({ type: ButtonType.Circle }) {
SymbolGlyph(this.symbol)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/common/Card.ets#L16-L48 | 5a7490a0cc9109a6bb148a03d7c3f620cd8cb4a2 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/control_flow/conditional_stmt/conditional_switch_002_F.ets | arkts | Introduction 条件语句-switch | export function conditional_switch_002_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
switch (2) {
case 2:
taint.Sink(clean)
}
} | AST#export_declaration#Left export AST#function_declaration#Left function conditional_switch_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stat... | export function conditional_switch_002_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
switch (2) {
case 2:
taint.Sink(clean)
}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/conditional_stmt/conditional_switch_002_F.ets#L6-L13 | 8876ec993d88e9e5b266300dc820cccbe6fd67a8 | github | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/AlphabetIndexerView.ets | arkts | AlphabetIndexerView | 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... | @Component
export struct AlphabetIndexerView {
@Link _position: Position;
private componentKey: string;
private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z']
build() {
AlphabetIndexer({ a... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AlphabetIndexerView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#... | @Component
export struct AlphabetIndexerView {
@Link _position: Position;
private componentKey: string;
private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z']
build() {
AlphabetIndexer({ a... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/AlphabetIndexerView.ets#L16-L39 | bcd842d85cd3380b768ad49edf902fbff2bea163 | gitee |
weiwei0928/Eyepetizer-harmony.git | fd5947c6f616c22d42256f36ba752093b782a910 | entry/src/main/ets/route/RoutePath.ets | arkts | 路由表管理 | export class RoutePath {
static readonly WebPage = "pages/mine/WebPage"
static readonly LoginPage = "pages/LoginPage"
static readonly SplashPage = "pages/SplashPage"
static readonly MainPage = "pages/MainPage"
static readonly SearchPage = "pages/SearchPage"
static readonly CategoryPage = "pages/CategoryPage... | AST#export_declaration#Left export AST#class_declaration#Left class RoutePath AST#class_body#Left { AST#property_declaration#Left static readonly WebPage = AST#expression#Left "pages/mine/WebPage" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly LoginPage = AST#expressi... | export class RoutePath {
static readonly WebPage = "pages/mine/WebPage"
static readonly LoginPage = "pages/LoginPage"
static readonly SplashPage = "pages/SplashPage"
static readonly MainPage = "pages/MainPage"
static readonly SearchPage = "pages/SearchPage"
static readonly CategoryPage = "pages/CategoryPage... | https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/route/RoutePath.ets#L4-L19 | 94f777e672de84f3ba59c70ef60098319342c6e0 | github | |
HunZiLei/ArkTS_PokePomodoro.git | 61a844a28808c014c39de7a868b0d331052d1bd4 | entry/src/main/ets/pages/customCpt/newsList.ets | arkts | ItemMorePic | 多个图片样式 | @Builder ItemMorePic(item: NewsData){
Column() {
Text(item.title)
.fontSize(14)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row({ space: 2 }) {
Image(item.thumbnail_pic_s)
.width(110)
.height(80)
.padding('1px')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ItemMorePic AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left NewsData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L... | @Builder ItemMorePic(item: NewsData){
Column() {
Text(item.title)
.fontSize(14)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row({ space: 2 }) {
Image(item.thumbnail_pic_s)
.width(110)
.height(80)
.padding('1px')
... | https://github.com/HunZiLei/ArkTS_PokePomodoro.git/blob/61a844a28808c014c39de7a868b0d331052d1bd4/entry/src/main/ets/pages/customCpt/newsList.ets#L45-L94 | 124d840d309d2861fc2da1ccdcad31238e606df4 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/toolbox/src/main/ets/pages/VisiableAnimation.ets | arkts | VisibleAnimation | 自定义动效参数集 | @Observed
export class VisibleAnimation extends CustomAnimation{
// 工具项可见属性
private visible_: Visibility;
constructor(visible: Visibility = Visibility.Hidden) {
super();
this.visible_ = visible;
}
get visible(): Visibility {
return this.visible_;
}
set visible(visible: Visibility) {
thi... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class VisibleAnimation extends AST#type_annotation#Left AST#primary_type#Left CustomAnimation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 工具项可见属性 AST#property_declaration#Left private visible_ : ... | @Observed
export class VisibleAnimation extends CustomAnimation{
private visible_: Visibility;
constructor(visible: Visibility = Visibility.Hidden) {
super();
this.visible_ = visible;
}
get visible(): Visibility {
return this.visible_;
}
set visible(visible: Visibility) {
this.visible_... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/pages/VisiableAnimation.ets#L21-L38 | 277c3cdd63b22ef9129474c158110e35ad781847 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.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 class NoteIdBean {
noteId: string;
constructor(noteId: string) {
this.noteId = noteId;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class NoteIdBean AST#class_body#Left { AST#property_declaration#Left noteId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor... | export class NoteIdBean {
noteId: string;
constructor(noteId: string) {
this.noteId = noteId;
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.ets#L16-L22 | 018f269df2908197e3b5208960c6b8635258ee66 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets | arkts | 计算工具类 | export default class GameUtils {
// 30,40,60 连续丢帧>=3帧 为一般卡顿
private static GENERAL_CATON_FLAG_LOW: number = 3;
// 30,40,60 连续丢帧>=6帧 为严重卡顿
private static CRITICAL_CATON_FLAG_LOW: number = 6;
// 30,40,60 连续丢帧>=9帧 为致命卡顿
private static FATAL_CATON_FLAG_LOW: number = 9;
// 90,120 连续丢帧>=4帧 为一般卡顿
private stati... | AST#export_declaration#Left export default AST#class_declaration#Left class GameUtils AST#class_body#Left { // 30,40,60 连续丢帧>=3帧 为一般卡顿 AST#property_declaration#Left private static GENERAL_CATON_FLAG_LOW : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expres... | export default class GameUtils {
private static GENERAL_CATON_FLAG_LOW: number = 3;
private static CRITICAL_CATON_FLAG_LOW: number = 6;
private static FATAL_CATON_FLAG_LOW: number = 9;
private static GENERAL_CATON_FLAG_HIGHT: number = 4;
private static CRITICAL_CATON_FLAG_HIGHT: number = 8;
... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets#L19-L217 | 3d807f3453759fc3e8d95ec72fae0b4347880007 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets | arkts | encodeCBC | 加密-CBC模式
@param str 待加密的字符串
@param aesKey SM4密钥
@param iv iv偏移量字符串
@returns | static async encodeCBC(str: string, sm4Key: string, iv: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128);
} | AST#method_declaration#Left static async encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async encodeCBC(str: string, sm4Key: string, iv: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets#L62-L64 | d49de69bfec7b5f5554be5045e3ad57880b559d7 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | XiaoyiAgentDemo/entry/src/main/ets/utils/audioplayer/BackgroundUtil.ets | arkts | startContinuousTask | Start background task.
@param context | public static startContinuousTask(context?: common.UIAbilityContext): void {
if (!context) {
Logger.error('this avPlayer: ', `context undefined`);
return
}
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: context.abilityInfo.bundleName,
abil... | AST#method_declaration#Left public static startContinuousTask 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#para... | public static startContinuousTask(context?: common.UIAbilityContext): void {
if (!context) {
Logger.error('this avPlayer: ', `context undefined`);
return
}
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: context.abilityInfo.bundleName,
abil... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/XiaoyiAgentDemo/entry/src/main/ets/utils/audioplayer/BackgroundUtil.ets#L27-L61 | 2f5e0e783a255b5a08532ed4ea8243c37d1b1cee | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/constants/DrmConstants.ets | arkts | Drm 常量 | export default class DrmConstants {
/**
* WisePlay MediaKeySystem的名称
*/
static readonly WISEPLAY_DRM_NAME: string = 'com.wiseplay.drm'
/**
* ClearPlay MediaKeySystem的名称
*/
static readonly CLEAR_PLAY_DRM_NAME: string = 'com.clearplay.drm'
} | AST#export_declaration#Left export default AST#class_declaration#Left class DrmConstants AST#class_body#Left { /**
* WisePlay MediaKeySystem的名称
*/ AST#property_declaration#Left static readonly WISEPLAY_DRM_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Righ... | export default class DrmConstants {
static readonly WISEPLAY_DRM_NAME: string = 'com.wiseplay.drm'
static readonly CLEAR_PLAY_DRM_NAME: string = 'com.clearplay.drm'
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/constants/DrmConstants.ets#L19-L28 | 198eadaf2fbdbf8c092320e9d010ef6176a3490e | gitee | |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/viewmodel/InterComData.ets | arkts | 视频 | export const LYLY_SNAP_VEDIO_TYPE = "1"
// 音频 | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left LYLY_SNAP_VEDIO_TYPE = AST#expression#Left "1" AST#expression#Right AST#variable_declarator#Right // 音频 AST#variable_declaration#Right AST#export_declaration#Right | export const LYLY_SNAP_VEDIO_TYPE = "1" | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/InterComData.ets#L163-L165 | 3d21b89f6a551335a71d2c2261273cd03782ce0c | github | |
zqf-dev/WAndroidHOS.git | e2e560a7c96110c43d13eb232826707601172b6d | entry/src/main/ets/request/Home.ets | arkts | 请求文章数据 | export function getArticle(page: number): Promise<Article> {
return new Promise((resolve: Function, reject: Function) => {
get(API.article + page + '/json').then((data: Response) => {
if (data.errorCode === API.SERVER_CODE_SUCCESS) {
resolve(data.data);
} else {
console.log('request fa... | AST#export_declaration#Left export AST#function_declaration#Left function getArticle AST#parameter_list#Left ( AST#parameter#Left page : 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#pr... | export function getArticle(page: number): Promise<Article> {
return new Promise((resolve: Function, reject: Function) => {
get(API.article + page + '/json').then((data: Response) => {
if (data.errorCode === API.SERVER_CODE_SUCCESS) {
resolve(data.data);
} else {
console.log('request fa... | https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/request/Home.ets#L31-L45 | 7b162d0a7a09f1aede0b6ca7c16972e85994b1e9 | github | |
sea5241/PictureSelector | 09bac407ebd61100d1ccbf6e6d3b6349cb0013d7 | selector/src/main/ets/utils/ResourceUtils.ets | arkts | 文字资源转字符串 | export function resourceToString(component?: Object, resource?: Resource): string {
return getContext(component).resourceManager.getStringSync(resource)
} | AST#export_declaration#Left export AST#function_declaration#Left function resourceToString 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 resource ? : AST#type_anno... | export function resourceToString(component?: Object, resource?: Resource): string {
return getContext(component).resourceManager.getStringSync(resource)
} | https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/utils/ResourceUtils.ets#L2-L4 | 7e86afe12095588648b8cfb1cd39c6dc0f49fc7d | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getAppInfoSync | 获取应用程序的配置信息
@returns | static getAppInfoSync(): bundleManager.ApplicationInfo {
return AppUtils.getBundleInfoSync().appInfo
} | AST#method_declaration#Left static getAppInfoSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . ApplicationInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#stateme... | static getAppInfoSync(): bundleManager.ApplicationInfo {
return AppUtils.getBundleInfoSync().appInfo
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L97-L99 | 98e2422ed59e295ffca502896150938d120bf75a | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/PhoneUtil.ets | arkts | isMobileTw | 验证是否为手机号码(台湾)
@param content 台湾手机号码 | static isMobileTw(content: string): OutDTO<string> {
if (content == null || content == '') {
// 提供null的字符串为不匹配
return OutDTO.Error("验证手机号不能为空");
}
if (new RegExp(Const.MOBILE_TW).test(content)) {
return OutDTO.OK("手机号为中国台湾号码")
} else {
return OutDTO.Error("手机号非中国台湾号码,请检查")
}
... | AST#method_declaration#Left static isMobileTw AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | static isMobileTw(content: string): OutDTO<string> {
if (content == null || content == '') {
return OutDTO.Error("验证手机号不能为空");
}
if (new RegExp(Const.MOBILE_TW).test(content)) {
return OutDTO.OK("手机号为中国台湾号码")
} else {
return OutDTO.Error("手机号非中国台湾号码,请检查")
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/PhoneUtil.ets#L66-L76 | a4d0f7c8a43d77fd2112c028dffde33ae2a97d08 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | isSameDay | 判断是否为同一天
@param date1 日期1
@param date2 日期2
@returns 是否为同一天 | static isSameDay(date1: Date, date2: Date): boolean {
return date1.getFullYear() === date2.getFullYear() &&
date1.getMonth() === date2.getMonth() &&
date1.getDate() === date2.getDate();
} | AST#method_declaration#Left static isSameDay AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Rig... | static isSameDay(date1: Date, date2: Date): boolean {
return date1.getFullYear() === date2.getFullYear() &&
date1.getMonth() === date2.getMonth() &&
date1.getDate() === date2.getDate();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L118-L122 | 5d7f796720556892b52a48dba6056ed9f1df0508 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | repeat | 将字符串重复指定次数
@param str 要重复的字符串
@param n 重复的次数
@returns | static repeat(str: string = '', n: number = 1): string {
return str.repeat(n);
} | AST#method_declaration#Left static repeat AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left n : AST#type_annotation#Left AST#prim... | static repeat(str: string = '', n: number = 1): string {
return str.repeat(n);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L176-L178 | 6932d0ee416ad52c85b713765866037aabe0c6f3 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/accessibility/AccessibilityService.ets | arkts | updateSettings | 更新设置 | async updateSettings(newSettings: Partial<AccessibilitySettings>): Promise<void> {
try {
this.settings = this.mergeSettings(this.settings, newSettings);
await this.saveSettings();
await this.applySettings();
this.emitEvent('settingsChanged', { settings: this.settings });
... | AST#method_declaration#Left async updateSettings AST#parameter_list#Left ( AST#parameter#Left newSettings : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AccessibilitySettings AST#primary_type#Right AST#type_annotati... | async updateSettings(newSettings: Partial<AccessibilitySettings>): Promise<void> {
try {
this.settings = this.mergeSettings(this.settings, newSettings);
await this.saveSettings();
await this.applySettings();
this.emitEvent('settingsChanged', { settings: this.settings });
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L223-L237 | ea380018c53f4f99adda34ab6b50c0d1062c55e2 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/VisionEffect/entry/src/main/ets/pages/common/Index.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface Route {
name: string;
label: ResourceStr;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Route AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left label : AST#type_annotation#Left AST#pr... | export interface Route {
name: string;
label: ResourceStr;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/VisionEffect/entry/src/main/ets/pages/common/Index.ets#L16-L19 | 05223b265e8f2a211742c89df77b0e085ab14395 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationManager.ets | arkts | sendBirthdayNotification | 发送生日提醒通知 | async sendBirthdayNotification(contact: Contact, daysUntil: number): Promise<void> {
if (!this.settings?.notification.enabled || !this.shouldSendNotification()) {
return;
}
try {
const config = await this.createBirthdayNotificationConfig(contact, daysUntil);
await this.publishNotification... | AST#method_declaration#Left async sendBirthdayNotification AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left daysUntil : AST#type_annotation#Left AST#primary_type#Left nu... | async sendBirthdayNotification(contact: Contact, daysUntil: number): Promise<void> {
if (!this.settings?.notification.enabled || !this.shouldSendNotification()) {
return;
}
try {
const config = await this.createBirthdayNotificationConfig(contact, daysUntil);
await this.publishNotification... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L152-L167 | 85cac78d4324df5769fd1903c92ce786bca5b40e | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets | arkts | AddressInfo | 地址信息类 | @Observed
export class AddressInfo {
// 省id。对应address.json中第一级的code
provinceId: string;
// 市id。对应address.json中第二级的code
cityId: string;
// 区id。对应address.json中第三级的code
regionId: string;
// 省名。对应address.json中第一级的name
province: string;
// 市名。对应address.json中第二级的name
city: string;
// 区名。对应address.json中第... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class AddressInfo AST#class_body#Left { // 省id。对应address.json中第一级的code AST#property_declaration#Left provinceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#pr... | @Observed
export class AddressInfo {
provinceId: string;
cityId: string;
regionId: string;
province: string;
city: string;
region: string;
constructor(province: string = '', city: string = '', region: string = '', provinceId: string = '',
cityId: string = '', regionId: string = '') ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L592-L616 | 662f95a1766496b4ea9b76720c87a018f89101b8 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/WeatherManager.ets | arkts | clearCache | 清除缓存 | clearCache(): void {
this.cachedWeatherData = null;
this.lastUpdateTime = 0;
console.log('[WeatherManager] 缓存已清除');
} | AST#method_declaration#Left clearCache AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_... | clearCache(): void {
this.cachedWeatherData = null;
this.lastUpdateTime = 0;
console.log('[WeatherManager] 缓存已清除');
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/WeatherManager.ets#L187-L191 | ed1b4dda6e208eaf134f029a8a8e32b0aada6b2d | github |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/StateManager.ets | arkts | 状态--初始状态
@since 2022-06-10 | export class Init extends BaseState {
constructor() {
super();
this.actionSet.push(UpdateAction.CHECK_NEW_VERSION);
}
async notify(): Promise<void> {
await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll();
}
} | AST#export_declaration#Left export AST#class_declaration#Left class Init extends AST#type_annotation#Left AST#primary_type#Left BaseState AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_sta... | export class Init extends BaseState {
constructor() {
super();
this.actionSet.push(UpdateAction.CHECK_NEW_VERSION);
}
async notify(): Promise<void> {
await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll();
}
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L260-L269 | e5d4cf177cb58e5c60dc34fee4db0207864b1a4d | gitee | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/EpisodeDetailPage.ets | arkts | addToQueue | 添加到待听队列 | async addToQueue() {
if (this.episode) {
console.info(`[EpisodeDetailPage] Add to queue: ${this.episode.title}`);
try {
await this.dbService.addToQueue(this.episode.id);
UIUtils.showToast(new ToastOptions('已添加到待听队列', 2000));
} catch (error) {
console.error('Add to queue fai... | AST#method_declaration#Left async addToQueue AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episode AST#member_expression#Right AST#expression#Rig... | async addToQueue() {
if (this.episode) {
console.info(`[EpisodeDetailPage] Add to queue: ${this.episode.title}`);
try {
await this.dbService.addToQueue(this.episode.id);
UIUtils.showToast(new ToastOptions('已添加到待听队列', 2000));
} catch (error) {
console.error('Add to queue fai... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/EpisodeDetailPage.ets#L99-L110 | 412a94d5e1090727b8e27165d6abaf29ce0622b1 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
RowEndTop() { Text("Hi"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.End,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
... | 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 RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#L... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.End,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1004-L1019 | fc9077906a3ee5e4d8addc84f4af60ca7a9eaead | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/TabContentTouchHotZone/casesfeature/tabcontentoverflow/src/main/ets/mainpage/TabContentOverFlow.ets | arkts | TabContentOverFlowComponent | 功能描述: 本示例实现了tabContent内容可以在tabBar上显示并且tabBar可以响应滑动事件的功能。
推荐场景: 小视频播放场景
核心组件:
1. Tabs
实现步骤:
1. 创建Tabs组件,将barHeight设置为0。
2. 创建自定义tabBar组件。
3. 将TabContent的内容分为上下两部分,上半部高度为100% - 60vp,存放video组件,下部分高度为60vp,存放进度条,设置滑动手势响应事件。
4. 将Tabs组件的zIndex属性设置为2,tabContent的视图就可以堆叠在自定义tabBar之上。
5. 再设置hitTestBehavior属性使被覆盖的自定义的tabBar可以响应... | @Component
export struct TabContentOverFlowComponent {
@State tabArray: string[] = ['app.string.tabcontentoverflow_homepage', 'app.string.tabcontentoverflow_video', 'app.string.tabcontentoverflow_mall', 'app.string.tabcontentoverflow_mine'];
@State imageArray: string[] = ['app.media.tabcontentoverflow_homepage', 'a... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TabContentOverFlowComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right tabArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [... | @Component
export struct TabContentOverFlowComponent {
@State tabArray: string[] = ['app.string.tabcontentoverflow_homepage', 'app.string.tabcontentoverflow_video', 'app.string.tabcontentoverflow_mall', 'app.string.tabcontentoverflow_mine'];
@State imageArray: string[] = ['app.media.tabcontentoverflow_homepage', 'a... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/TabContentTouchHotZone/casesfeature/tabcontentoverflow/src/main/ets/mainpage/TabContentOverFlow.ets#L38-L398 | 6b830e8ee1e044b85eb760e5329228383854cfb2 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Scroll.ets | arkts | 构建带小内边距的垂直滚动布局
@returns {void} 无返回值 | build(): void {
VerticalScroll({
scroller: this.scroller,
fillMaxSize: this.fillMaxSize,
fillMaxWidth: this.fillMaxWidth,
widthValue: this.widthValue,
heightValue: this.heightValue,
scrollBarState: this.scrollBarState,
paddingValue: $r("app.float.space_padding_small"),
... | 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 VerticalScroll ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expr... | build(): void {
VerticalScroll({
scroller: this.scroller,
fillMaxSize: this.fillMaxSize,
fillMaxWidth: this.fillMaxWidth,
widthValue: this.widthValue,
heightValue: this.heightValue,
scrollBarState: this.scrollBarState,
paddingValue: $r("app.float.space_padding_small"),
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Scroll.ets#L157-L168 | ba21e1b4a85e7d50cf2bef3bba824966ba4c1efa | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | onSaveSuccess | 保存成功处理
@returns {void} 无返回值 | private onSaveSuccess(): void {
const result: RefreshResult = { refresh: true };
navigateBackWithResult(result);
} | AST#method_declaration#Left private onSaveSuccess AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left res... | private onSaveSuccess(): void {
const result: RefreshResult = { refresh: true };
navigateBackWithResult(result);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L400-L403 | f81e7a06f9618962fb5c65967c6c4d4991c27b2b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.