nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
触摸类型枚举
export enum TouchType { TAP = 'tap', DOUBLE_TAP = 'double_tap', LONG_PRESS = 'long_press', PINCH = 'pinch', PAN = 'pan' }
AST#export_declaration#Left export AST#enum_declaration#Left enum TouchType AST#enum_body#Left { AST#enum_member#Left TAP = AST#expression#Left 'tap' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DOUBLE_TAP = AST#expression#Left 'double_tap' AST#expression#Right AST#enum_member#Right , AST#enum_memb...
export enum TouchType { TAP = 'tap', DOUBLE_TAP = 'double_tap', LONG_PRESS = 'long_press', PINCH = 'pinch', PAN = 'pan' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L208-L214
27538b87a360c44bd695ad0eeddd0aeb5a39b7ba
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
getSignalType
查询当前网络是3G/4G/5G SignalInformation.signalType表示蜂窝网络的类型 未知(值为0) 2G:GSM(值为1)、CDMA(值为2) 3G:WCDMA(值为3)、TDSCDMA(值为4) 4G:LTE(值为5) 5G:NR(值为6) @returns 指定SIM卡槽对应的注册网络信号强度信息列表
async getSignalType(): Promise<radio.SignalInformation[]> { let slotId: number = await radio.getPrimarySlotId(); let data: radio.SignalInformation[] = radio.getSignalInformationSync(slotId); // signalType代表网络类型NetworkType let signalType = data[0].signalType; logger.info('getSignalType:' + JSON.strin...
AST#method_declaration#Left async getSignalType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left radio . SignalInformation AST#qualified_typ...
async getSignalType(): Promise<radio.SignalInformation[]> { let slotId: number = await radio.getPrimarySlotId(); let data: radio.SignalInformation[] = radio.getSignalInformationSync(slotId); let signalType = data[0].signalType; logger.info('getSignalType:' + JSON.stringify(data)); return data; ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets#L207-L214
47bf3e0c7b54958b8382c685cac320eb655d24de
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Image/entry/src/main/ets/pages/example/ImageExample023.ets
arkts
getPixmapFromMedia
辅助方法:从资源获取PixelMap
private async getPixmapFromMedia(resource: Resource): Promise<image.PixelMap | undefined> { const unit8Array = await this.getUIContext().getHostContext()?.resourceManager.getMediaContent({ bundleName: resource.bundleName, moduleName: resource.moduleName, id: resource.id }); if (!unit8Array...
AST#method_declaration#Left private async getPixmapFromMedia AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS...
private async getPixmapFromMedia(resource: Resource): Promise<image.PixelMap | undefined> { const unit8Array = await this.getUIContext().getHostContext()?.resourceManager.getMediaContent({ bundleName: resource.bundleName, moduleName: resource.moduleName, id: resource.id }); if (!unit8Array...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Image/entry/src/main/ets/pages/example/ImageExample023.ets#L69-L84
61ec0a087d3fcf56d975867d735da2a54c7ed92d
gitee
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/TaoYao.ets
arkts
桃夭是一个权限请求框架,封装了权限请求逻辑,采用链式调用的方式请求权限,极大的简化了权限请求的代码
export class TaoYao { /** * 直接在UIExtensionAbility中申请权限 * * @param uiAbility * @returns */ static with(extensionAbility: UIExtensionAbility): IAccessControl; /** * 在UI中向用户申请授权 * * @param context * @returns */ static with(context: common.UIAbilityContext): IAccessControl; /** ...
AST#export_declaration#Left export AST#class_declaration#Left class TaoYao AST#class_body#Left { /** * 直接在UIExtensionAbility中申请权限 * * @param uiAbility * @returns */ AST#method_declaration#Left static with AST#parameter_list#Left ( AST#parameter#Left extensionAbility : AST#type_annotation#Left AST#primary...
export class TaoYao { static with(extensionAbility: UIExtensionAbility): IAccessControl; static with(context: common.UIAbilityContext): IAccessControl; static with(uiAbility: UIAbility): IAccessControl; static with(context: common.UIAbilityContext | UIAbility | UIExtensionAbility): IAccessControl { ...
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L17-L162
9dc31394e6240e07d10ae6f2798d2e7fd8e36ea3
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets
arkts
Created by huminghua on 2017/10/31.
export class StringDealUtilityForBaseWord { ///查找英文单字 static matchEnWords(srcStr: string | null): Array<string> { const RegEnword = "([A-Za-z']+)"; return StringDealUtilityForBaseWord.matchRegex(srcStr, RegEnword); } ///匹配正则表达式 static matchRegex(srcStr: string | null, reg: string): Array<string> { ...
AST#export_declaration#Left export AST#class_declaration#Left class StringDealUtilityForBaseWord AST#class_body#Left { ///查找英文单字 AST#method_declaration#Left static matchEnWords AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_typ...
export class StringDealUtilityForBaseWord { static matchEnWords(srcStr: string | null): Array<string> { const RegEnword = "([A-Za-z']+)"; return StringDealUtilityForBaseWord.matchRegex(srcStr, RegEnword); } static matchRegex(srcStr: string | null, reg: string): Array<string> { const list: Arra...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets#L10-L155
9695ad995f5f7cbb87f9f2d9c774883a3fc8ca12
github
J-Design/ArkUI_Component
d7ecc33451ec5ebdb01da02616e1b83ecc3bfc66
entry/src/main/ets/component/list/ListTitle.ets
arkts
ListTitle
@author 鼓捣JIA @date 2023/12/15 22:04
@Component export default struct ListTitle{ @Prop title : string build(){ Row(){ Rect() .width(4) .height(16) .radius(2) .fill($r('app.color.brand')) .margin({right:8}) Text(this.title) .fontColor($r('app.color.font_normal')) .fontSize(16) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct ListTitle AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_ann...
@Component export default struct ListTitle{ @Prop title : string build(){ Row(){ Rect() .width(4) .height(16) .radius(2) .fill($r('app.color.brand')) .margin({right:8}) Text(this.title) .fontColor($r('app.color.font_normal')) .fontSize(16) ...
https://github.com/J-Design/ArkUI_Component/blob/d7ecc33451ec5ebdb01da02616e1b83ecc3bfc66/entry/src/main/ets/component/list/ListTitle.ets#L6-L27
145f4030a35eed2fac2cfa4ff59acba2ff6a12f9
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Player/CAudioPlayer.ets
arkts
私有构造函数(单例模式)
private constructor() {}
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right
private constructor() {}
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/CAudioPlayer.ets#L28-L28
847c2b5840cef7eb8d201a61cc2ad0fb30cc8277
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/view/StatisticalCardComponent.ets
arkts
构建组件
build() { // 使用Column布局,嵌套Row布局来展示统计信息 Column() { // 第一行,展示今日支出、收入、结余 // Row() { // // Column() { // // Text('日消费') // // .fontSize($r('app.float.font_size_M')); // // Text(this.dayPay.toString()) // // .fontSize($r('app.float.font_size_MP')) ...
AST#build_method#Left build ( ) AST#build_body#Left { // 使用Column布局,嵌套Row布局来展示统计信息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 第一行,展示今日支出、收入、结余 // Row() { // // Column() { // // Text('日消费') // // .fontSize($r('app.float.f...
build() { Column() { Text('日收入') .fontSize($r('app.float.font_size_M')) .textAlign(TextAlign.Start); Text(this.dayEarn.toString()) Text...
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/StatisticalCardComponent.ets#L28-L102
4cfba4145bcae02ea7cade9aba152d631dd5e769
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/utils/Logger.ets
arkts
debug
输出调试日志 @param message 日志信息
public static debug(message: string): void { console.debug(`[${Logger.TAG}] ${message}`); }
AST#method_declaration#Left public static debug AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t...
public static debug(message: string): void { console.debug(`[${Logger.TAG}] ${message}`); }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/utils/Logger.ets#L35-L37
754ed4a67411552c033628558a1bf1c944b20c3d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
buildCustomizationSection
构建个性化设置
@Builder buildCustomizationSection() { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('个性化设置') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) // 视觉效果开关 Column({ space: UIC...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCustomizationSection 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 Card ( ) AST#container_content_body#Left { AST#a...
@Builder buildCustomizationSection() { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('个性化设置') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) Column({ space: UIConstants....
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L508-L623
9cca4b725b2f92d5f5ff1614bd67100b4978d1cc
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/utils/FileUtil.ets
arkts
* 功能:读取文件内容并写入到另一个文件 参数 1:获取上下文 参数 2:创建目标文件的名称 参数 3:源文件 uri 参数 4:回调函数根据目标文件 uri进行后续操作
export async function readWriteFile(context: common.UIAbilityContext, fileName: string, sourceUri: string, callback: Function = () => { }): Promise<void> { try { let filesDir = context.filesDir; let destPath = `${filesDir}/${fileName}`; // 打开源文件 let sourceFile = fs.openSync(sourceUri, fs.OpenMode...
AST#export_declaration#Left export AST#function_declaration#Left async function readWriteFile 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 ...
export async function readWriteFile(context: common.UIAbilityContext, fileName: string, sourceUri: string, callback: Function = () => { }): Promise<void> { try { let filesDir = context.filesDir; let destPath = `${filesDir}/${fileName}`; let sourceFile = fs.openSync(sourceUri, fs.OpenMode.READ_ON...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/FileUtil.ets#L41-L80
c7ed2a8cd33de7567ee1b453db5ba43e9700f2e3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets
arkts
getChartPoints
Get chart points. @param {DataRdb.RdbStore} rdbStore RDB database. @return Return the steps value of the last three days.
async getChartPoints(rdbStore: DataRdb.RdbStore) { let chartPoints = await DatabaseUtils.getLastThreeDaysValue(rdbStore).catch((error: Error) => { Logger.error(CommonConstants.TAG_CHART, 'getLastThreeDaysValue error ' + JSON.stringify(error)); }); return chartPoints; }
AST#method_declaration#Left async getChartPoints AST#parameter_list#Left ( AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DataRdb . RdbStore AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#...
async getChartPoints(rdbStore: DataRdb.RdbStore) { let chartPoints = await DatabaseUtils.getLastThreeDaysValue(rdbStore).catch((error: Error) => { Logger.error(CommonConstants.TAG_CHART, 'getLastThreeDaysValue error ' + JSON.stringify(error)); }); return chartPoints; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets#L35-L40
c82f54b22a2a28874b201e08b4be2f6ab7388905
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
validator/acts_validator/entry/src/main/ets/pages/Wifi/WifiScan.ets
arkts
addListener
监听wifi的变化
addListener() { // 连接状态改变时,修改连接信息 wifi.on('wifiConnectionChange', async state => { Logger.info(TAG, `wifiConnectionChange: ${state}`) await this.getLinkedInfo() }) // wifi状态改变时,先清空wifi列表,然后判断是否是开启状态,如果是就扫描 wifi.on('wifiStateChange', state => { Logger.info(TAG, `wifiStateLisener sta...
AST#method_declaration#Left addListener 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 wifi AST#expression#Right . on AST...
addListener() { wifi.on('wifiConnectionChange', async state => { Logger.info(TAG, `wifiConnectionChange: ${state}`) await this.getLinkedInfo() }) wifi.on('wifiStateChange', state => { Logger.info(TAG, `wifiStateLisener state: ${state}`) AppStorage.SetOrCreate('wifiList', []...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Wifi/WifiScan.ets#L99-L113
eb6febd1bebff82e6d7dcc6066dfb0b9482ba76a
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/DefaultValueFormatter.ets
arkts
Default formatter used for formatting values inside the chart. Uses a DecimalFormat with pre-calculated number of digits (depending on max and min value). @author Philipp Jahoda
export default class DefaultValueFormatter implements IValueFormatter { /** * DecimalFormat for formatting */ //protected mFormat:DecimalFormat; protected mDecimalDigits: number; /** * Constructor that specifies to how many digits the value should be * formatted. * * @pa...
AST#export_declaration#Left export default AST#class_declaration#Left class DefaultValueFormatter AST#implements_clause#Left implements IValueFormatter AST#implements_clause#Right AST#class_body#Left { /** * DecimalFormat for formatting */ //protected mFormat:DecimalFormat; AST#property_declaration#Left prot...
export default class DefaultValueFormatter implements IValueFormatter { protected mDecimalDigits: number; constructor(digits: number) { this.setup(digits); } public setup(digits: number): void { this.mDecimalDigits = digits; var b: string = ''; for ...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/DefaultValueFormatter.ets#L26-L79
7235c6117721c93a0e68ed4b549b10fa5915e5ce
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/IMClientManager.ets
arkts
TODO: 默认地址是官方演示服务,需要改成连接您自已的服务端 const IM_SERVER_URL: string = 'wss://192.168.0.117:3000/websocket';// TODO: 使用TLS/SSL加密请用wss开头(服务端也必须启用TLS/SSL加密哦) MobileIMSDK的管理类。 @author Jack Jiang(http://www.52im.net/thread-2792-1-1.html)
export default class IMClientManager { /** 本类的全局单例 */ private static instance: IMClientManager; /** MobileIMSDK是否已被初始化. true表示已初化完成,否则未初始化. */ private init: boolean = false; /** application对象引用(暂时没用到,先留着吧) */ private application?: common.ApplicationContext; /** 聊天消息的缓存数据提供者对象(集中管理所有的聊天消息和指令,消息的UI层显示将通...
AST#export_declaration#Left export default AST#class_declaration#Left class IMClientManager AST#class_body#Left { /** 本类的全局单例 */ AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left IMClientManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declarat...
export default class IMClientManager { private static instance: IMClientManager; private init: boolean = false; private application?: common.ApplicationContext; private messageProvider: MessagesProvider = new MessagesProvider(); static getInstance(): IMClientManager { if (!IMClientMana...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/IMClientManager.ets#L29-L308
479556b56b9444983a4701122b40fdfeb4f39b1e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/refreshtimeline/src/main/ets/view/RefreshTimeLine.ets
arkts
RefreshTimeLine
实现步骤: 1. 下拉刷新效果:通过 PullToRefresh 组件实现,通过onAreaChange接口计算图片下拉高度。 2. 时间轴效果:时间轴部分:通过设置Column的bordier属性,只设置左边框实现。时间轴节点:样式通过设置borderRadius属性实现,位置通过设置margin的top实现偏移显示。
@Component export struct RefreshTimeLine { // PullToRefresh组件必需参数 @State data: string[] = []; // 定义Scroller对象,Scroller组件所需参数 private scroller: Scroller = new Scroller(); // 控制图片下拉变化的高度 @State refreshPullDownHeight: number = 0; // 图片初始高度以及控制图片上拉变化的高度 @State imgMarginTop: number = -100; // 下拉刷新组件配置对象 ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RefreshTimeLine AST#component_body#Left { // PullToRefresh组件必需参数 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left s...
@Component export struct RefreshTimeLine { @State data: string[] = []; private scroller: Scroller = new Scroller(); @State refreshPullDownHeight: number = 0; @State imgMarginTop: number = -100; private pullToRefreshConfigurator: PullToRefreshConfigurator = new PullToRefreshConfigurator(); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/refreshtimeline/src/main/ets/view/RefreshTimeLine.ets#L33-L209
da6f18b216e79d13af74dc1fc5de1ef93b31c4f0
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets
arkts
secondToTime
Seconds converted to HH:mm:ss. @param seconds Maximum video duration (seconds). @return Time after conversion.
secondToTime(seconds: number): string { let hourUnit = CommonConstants.TIME_UNIT * CommonConstants.TIME_UNIT; let hour = Math.floor(seconds / hourUnit); let minute = Math.floor((seconds - hour * hourUnit) / CommonConstants.TIME_UNIT); let second = seconds - hour * hourUnit - minute * CommonConstants.TIM...
AST#method_declaration#Left secondToTime AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
secondToTime(seconds: number): string { let hourUnit = CommonConstants.TIME_UNIT * CommonConstants.TIME_UNIT; let hour = Math.floor(seconds / hourUnit); let minute = Math.floor((seconds - hour * hourUnit) / CommonConstants.TIME_UNIT); let second = seconds - hour * hourUnit - minute * CommonConstants.TIM...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets#L25-L39
56235754ac83de93f184aed90b8c6346e39d4527
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/SecondaryLinkExample.ets
arkts
tagListItemBuilder
左侧类别视图
@Builder tagListItemBuilder(item: string, index: number) { ListItem() { Text(item) .width('100%') .height(ComponentStyle.TAG_TEXT_HEIGHT) .textAlign(TextAlign.Center) .onTouch((event: TouchEvent) => { if (event.type === TouchType.Down) { this.isClickTagL...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tagListItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#...
@Builder tagListItemBuilder(item: string, index: number) { ListItem() { Text(item) .width('100%') .height(ComponentStyle.TAG_TEXT_HEIGHT) .textAlign(TextAlign.Center) .onTouch((event: TouchEvent) => { if (event.type === TouchType.Down) { this.isClickTagL...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/SecondaryLinkExample.ets#L240-L261
7f1900378f4d9c48a4132251939c32a638e339b9
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
getOrderPage
获取订单分页列表 @param {OrderPageRequest} params - 分页查询参数 @returns {Promise<NetworkResponse<NetworkPageData<Order>>>} 订单分页数据
async getOrderPage(params: OrderPageRequest): Promise<NetworkResponse<NetworkPageData<Order>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<Order>>> = await NetworkClient.http.post("order/info/page", params); return resp.data; }
AST#method_declaration#Left async getOrderPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left OrderPageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
async getOrderPage(params: OrderPageRequest): Promise<NetworkResponse<NetworkPageData<Order>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<Order>>> = await NetworkClient.http.post("order/info/page", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L60-L64
6db4ed6964841ee15eada2e53ebe5c7a042fa0bc
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/BannerRepository.ets
arkts
@file 轮播图仓库,负责轮播图数据获取 @author Joker.X
export class BannerRepository { /** * 轮播图网络数据源 */ private networkDataSource: BannerNetworkDataSource; /** * 构造函数 * @param networkDataSource 可选的数据源实例,便于单元测试注入 */ constructor(networkDataSource?: BannerNetworkDataSource) { this.networkDataSource = networkDataSource ?? new BannerNetworkDataSourc...
AST#export_declaration#Left export AST#class_declaration#Left class BannerRepository AST#class_body#Left { /** * 轮播图网络数据源 */ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left BannerNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#prope...
export class BannerRepository { private networkDataSource: BannerNetworkDataSource; constructor(networkDataSource?: BannerNetworkDataSource) { this.networkDataSource = networkDataSource ?? new BannerNetworkDataSourceImpl(); } async getBannerList(params: Record<string, Unknown>): Promise<NetworkRe...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/BannerRepository.ets#L8-L30
dc7530c89e11dbc915bda48b5c63d20ad8a629fa
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/viewmodel/AddressItem.ets
arkts
Landmark location.
export class Location { positionX: number; positionY: number; oriPositionX: number; oriPositionY: number; constructor(positionX: number, positionY: number) { this.positionX = positionX; this.positionY = positionY; this.oriPositionX = positionX; this.oriPositionY = positionY; } }
AST#export_declaration#Left export AST#class_declaration#Left class Location AST#class_body#Left { AST#property_declaration#Left positionX : 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 positionY : A...
export class Location { positionX: number; positionY: number; oriPositionX: number; oriPositionY: number; constructor(positionX: number, positionY: number) { this.positionX = positionX; this.positionY = positionY; this.oriPositionX = positionX; this.oriPositionY = positionY; } }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/AddressItem.ets#L30-L42
fd22f51f9e54aaad60ca60725b4233778fee84bc
github
Jolin-Kan/HarmonyOS-App.git
5b2c84ed90d89d721bc107f2100a64d0203a6e72
entry/src/main/components/ComponentTypeA.ets
arkts
ComponentTypeA
import http from '@ohos.net.http';
@Component export struct ComponentTypeA { private on: string = '#EFEDEE' private off: string = '#AFAFAE' public name: string = '' public data: string = '' @Prop isOn: boolean = false public url:string = ''; // private src:string = `"app.media.${this.name}"` private toggleState() { this.isOn = !this...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ComponentTypeA AST#component_body#Left { AST#property_declaration#Left private on : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#EFEDEE...
@Component export struct ComponentTypeA { private on: string = '#EFEDEE' private off: string = '#AFAFAE' public name: string = '' public data: string = '' @Prop isOn: boolean = false public url:string = ''; private toggleState() { this.isOn = !this.isOn; } build() { Flex({ direction: Flex...
https://github.com/Jolin-Kan/HarmonyOS-App.git/blob/5b2c84ed90d89d721bc107f2100a64d0203a6e72/entry/src/main/components/ComponentTypeA.ets#L2-L37
b43e31d822cb3544599b92e316596b1f06f12238
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
getDateRange
获取日期范围内的所有日期 @param startDate 开始日期 @param endDate 结束日期 @returns 日期数组
static getDateRange(startDate: string | Date, endDate: string | Date): Date[] { const start = typeof startDate === 'string' ? new Date(startDate) : startDate; const end = typeof endDate === 'string' ? new Date(endDate) : endDate; const dates: Date[] = []; if (start > end) { return dates; ...
AST#method_declaration#Left static getDateRange AST#parameter_list#Left ( AST#parameter#Left startDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right...
static getDateRange(startDate: string | Date, endDate: string | Date): Date[] { const start = typeof startDate === 'string' ? new Date(startDate) : startDate; const end = typeof endDate === 'string' ? new Date(endDate) : endDate; const dates: Date[] = []; if (start > end) { return dates; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L374-L390
7f738ed0236769c2c887f5c11a6ec3c80907087c
github
peng-boy/arkTs.git
68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0
products/default/src/main/ets/components/media/Basic.ets
arkts
changeOrientation
改变设备横竖屏状态函数
private changeOrientation(isLandscape: boolean) { // 获取UIAbility实例的上下文信息 let context:common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; // 调用该接口手动改变设备横竖屏状态 window.getLastWindow(context).then((lastWindow) => { lastWindow.setPreferredOrientation(isLandscape ? ...
AST#method_declaration#Left private changeOrientation AST#parameter_list#Left ( AST#parameter#Left isLandscape : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 获取UIAbility实例的上下文信息 AST#st...
private changeOrientation(isLandscape: boolean) { let context:common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; window.getLastWindow(context).then((lastWindow) => { lastWindow.setPreferredOrientation(isLandscape ? window.Orientation.LANDSCAPE : window.Ori...
https://github.com/peng-boy/arkTs.git/blob/68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0/products/default/src/main/ets/components/media/Basic.ets#L41-L48
2ed1b1e3392e9700f40822d75cf9f1a0b1b8c58c
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
playNextEpisode
播放下一个单集
async playNextEpisode() { try { // 如果队列为空,提示用户 if (this.queueEpisodes.length === 0) { UIUtils.showToast(new ToastOptions('队列为空,请添加单集到队列', 2000)); return; } // 获取队列的第一个单集 const nextEpisode = this.queueEpisodes[0]; console.info(`[MainPage] Playing next episode: ${n...
AST#method_declaration#Left async playNextEpisode 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expre...
async playNextEpisode() { try { if (this.queueEpisodes.length === 0) { UIUtils.showToast(new ToastOptions('队列为空,请添加单集到队列', 2000)); return; } const nextEpisode = this.queueEpisodes[0]; console.info(`[MainPage] Playing next episode: ${nextEpisode.title}`); ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L385-L411
c5aca7ee7fd8bd217afb19d8d90b3cb94f96e781
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bridges/DMPContainerBridgesModule+Image.ets
arkts
chooseImage
sourceType:album 相册 camera 相机 sizeType:original 原图 compressed 压缩 count:9 1次选择的图片个数,默认1,范围:【1-9】
chooseImage(data: DMPMap, callback: DMPBridgeCallback) { const sourceType: [string] = data.get('sourceType'); const sizeType: [string] = data.get('sizeType'); const count: number = data.get('count'); if ('album' == sourceType?.[0]) { let path = DMPContextUtils.getUIAbilityContext().cacheDir + '/ch...
AST#method_declaration#Left chooseImage AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left DMPMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left DMPBridgeCallback AST#prim...
chooseImage(data: DMPMap, callback: DMPBridgeCallback) { const sourceType: [string] = data.get('sourceType'); const sizeType: [string] = data.get('sizeType'); const count: number = data.get('count'); if ('album' == sourceType?.[0]) { let path = DMPContextUtils.getUIAbilityContext().cacheDir + '/ch...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/DMPContainerBridgesModule+Image.ets#L49-L94
7566ca1a5c4eade96dcc60e98f52eaace8f1fb0d
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/lazyForEach.d.ets
arkts
All data operation type @typedef { DataAddOperation | DataDeleteOperation | DataChangeOperation | DataMoveOperation | DataExchangeOperation | DataReloadOperation } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export type DataOperation = DataAddOperation | DataDeleteOperation | DataChangeOperation | DataMoveOperation | DataExchangeOperation | DataReloadOperation;
AST#export_declaration#Left export AST#type_declaration#Left type DataOperation = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DataAddOperation AST#primary_type#Right | AST#primary_type#Left DataDeleteOperation AST#primary_type#Right | AST#primary_type#Left DataChangeOperation AST#primary_type#Rig...
export type DataOperation = DataAddOperation | DataDeleteOperation | DataChangeOperation | DataMoveOperation | DataExchangeOperation | DataReloadOperation;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L445-L446
3bccb2e3a38f4669c6bb2820a68aedb725dee61b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/model/BookChapter.ets
arkts
@author 2008 @datetime 2024/8/25 0:11 @className: BookChapter
export class BookChapter { url:string = '' // 章节地址 title:string = '' // 章节标题 isVolume:boolean = false // 是否是卷名 baseUrl:string = '' // 用来拼接相对url bookUrl:string = '' // 书籍地址 index:number = 0 // 章节序号 isVip:boolean = false // 是否VIP isPay:boolean = false // 是否已购买 resourceUrl?:string // 音频真实URL tag?:strin...
AST#export_declaration#Left export AST#class_declaration#Left class BookChapter AST#class_body#Left { AST#property_declaration#Left url AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right // 章节地址 title : st...
export class BookChapter { url:string = '' title:string = '' isVolume:boolean = false baseUrl:string = '' bookUrl:string = '' index:number = 0 isVip:boolean = false isPay:boolean = false resourceUrl?:string tag?:string start:number = 0 end:number = 0 startFragmentId:string = '' ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/model/BookChapter.ets#L6-L22
b9a7513a466ef2d4af6b128beccfb0ac162b5f6e
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
getPosition
public getXCenterOffset(): number { return this.xCenterOffset; } public setXCenterOffset(xCenterOffset: number): void { this.xCenterOffset = xCenterOffset; } returns the position of the x-labels
public getPosition(): XAxisPosition { return this.mPosition; }
AST#method_declaration#Left public getPosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left XAxisPosition AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#membe...
public getPosition(): XAxisPosition { return this.mPosition; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L103-L105
c8b75bdf34f982142c9ed3387c9c855c08dcd815
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/Index.ets
arkts
buildBirthdayCard
构建生日卡片
@Builder buildBirthdayCard(contact: Contact, isToday: boolean) { Row({ space: 12 }) { // 头像 Image(contact.avatar || $r('app.media.ic_avatar_default')) .width(40) .height(40) .borderRadius(20) .objectFit(ImageFit.Cover) // 信息 Column({ space: 4 }) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayCard 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 isToday : AST#type_annota...
@Builder buildBirthdayCard(contact: Contact, isToday: boolean) { Row({ space: 12 }) { Image(contact.avatar || $r('app.media.ic_avatar_default')) .width(40) .height(40) .borderRadius(20) .objectFit(ImageFit.Cover) Column({ space: 4 }) { Text(...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L284-L335
ae34f26d2036a8e207636dde33427353563ebc28
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SimpleChatList/entry/src/main/ets/pages/PullUpLoading.ets
arkts
refreshBuilder
[Start PullToRefresh]
@Builder refreshBuilder() { Stack({ alignContent: Alignment.Bottom }) { if (this.refreshState != RefreshStatus.Inactive && this.refreshState != RefreshStatus.Done) { Progress({ value: this.refreshOffset, total: 64, type: ProgressType.Ring }) .width(32) .height(32) .styl...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right refreshBuilder 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 Stack ( AST#component_parameters#Left { AST#component_param...
@Builder refreshBuilder() { Stack({ alignContent: Alignment.Bottom }) { if (this.refreshState != RefreshStatus.Inactive && this.refreshState != RefreshStatus.Done) { Progress({ value: this.refreshOffset, total: 64, type: ProgressType.Ring }) .width(32) .height(32) .styl...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/PullUpLoading.ets#L25-L38
3607b1c80ce6ce2b06460c3bc9173dfc2a73a013
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets
arkts
sendMsg2Server
发送消息
sendMsg2Server() { if (!this.sendMsg.trim()) { return; } workerPort.postMessage({ type: 'sendMessage', message: this.sendMsg }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsTwoWayMessage = e.data; if (response.type === 'sendMessageSuccess') { this.msgHisto...
AST#method_declaration#Left sendMsg2Server AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi...
sendMsg2Server() { if (!this.sendMsg.trim()) { return; } workerPort.postMessage({ type: 'sendMessage', message: this.sendMsg }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsTwoWayMessage = e.data; if (response.type === 'sendMessageSuccess') { this.msgHisto...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets#L234-L247
c8c5d3d918fe4e90cb34f5e231dcefe310ad7fca
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/pojo/TabItem.ets
arkts
tab item数据类
export class TabItem { index: number title: string constructor
AST#export_declaration#Left export AST#ERROR#Left class TabItem { index : number title : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class TabItem { index: number title: string constructor
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/pojo/TabItem.ets#L4-L7
ed3422143ee8c7a471d9a98a27111a021d242e15
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/TextToSpeechService.ets
arkts
TTS状态枚举
export enum TTSState { IDLE = 'idle', SPEAKING = 'speaking', PAUSED = 'paused', ERROR = 'error' }
AST#export_declaration#Left export AST#enum_declaration#Left enum TTSState AST#enum_body#Left { AST#enum_member#Left IDLE = AST#expression#Left 'idle' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SPEAKING = AST#expression#Left 'speaking' AST#expression#Right AST#enum_member#Right , AST#enum_member#...
export enum TTSState { IDLE = 'idle', SPEAKING = 'speaking', PAUSED = 'paused', ERROR = 'error' }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L13-L18
f142adefd474b5a5b4c3147796763515a8493232
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
get
是否从购物车来的 @returns {boolean} 是否从购物车来
get isFromCart(): boolean { return this.cachedCarts !== null && this.cachedCarts.length > 0; }
AST#method_declaration#Left get AST#ERROR#Left isFromCart 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#expr...
get isFromCart(): boolean { return this.cachedCarts !== null && this.cachedCarts.length > 0; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L188-L190
4a4ffe5b9a826cddc4033091def2d60dcc98aa69
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getBirthdayCountdown
获取生日倒计时天数 @param birthdayThisYear 今年的生日日期 @returns 倒计时天数
static getBirthdayCountdown(birthdayThisYear: Date): number { const today = DateUtils.getToday(); let countdown = DateUtils.daysBetween(today, birthdayThisYear); // 如果今年生日已过,计算到明年生日的天数 if (countdown < 0) { const nextYear = new Date(birthdayThisYear); nextYear.setFullYear(nextYear.getFul...
AST#method_declaration#Left static getBirthdayCountdown AST#parameter_list#Left ( AST#parameter#Left birthdayThisYear : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left num...
static getBirthdayCountdown(birthdayThisYear: Date): number { const today = DateUtils.getToday(); let countdown = DateUtils.daysBetween(today, birthdayThisYear); if (countdown < 0) { const nextYear = new Date(birthdayThisYear); nextYear.setFullYear(nextYear.getFullYear() + 1); co...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L251-L263
8a429f696cbe3b088a8876af35a0e41eaa993bb7
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets
arkts
waiting
用于异步等待
async function waiting(times: number): Promise<void> { // 返回一个 Promise,表示等待 times 毫秒 return new Promise<void>(resolve => setTimeout(resolve, times)); }
AST#function_declaration#Left async function waiting AST#parameter_list#Left ( AST#parameter#Left times : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ...
async function waiting(times: number): Promise<void> { return new Promise<void>(resolve => setTimeout(resolve, times)); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L41-L44
6b01f606752e676084f6c931a243af01f2c02d4c
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets
arkts
onClick
view 调用 点击事件 此事件分发单击、双击事件 @param event
public onClick(event: ClickEvent) { let currnetTime = new Date().getTime(); let spaceTime = currnetTime - this.firstClickTime; this.firstClickTime = currnetTime; if (spaceTime < 300) { /** * 双击放大事件 */ this.centerX = event.x; ...
AST#method_declaration#Left public onClick AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration...
public onClick(event: ClickEvent) { let currnetTime = new Date().getTime(); let spaceTime = currnetTime - this.firstClickTime; this.firstClickTime = currnetTime; if (spaceTime < 300) { this.centerX = event.x; this.centerY = event.y; this....
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets#L115-L131
06a0d8ad32a63d583a198398d91067b63e3c4254
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/LunarTypes.ets
arkts
日期详细信息
export interface DateDetail { // 公历日期 gregorianDate: Date; // 农历信息 lunarDate: LunarDate; // 节日列表 festivals: Festival[]; // 二十四节气 solarTerm?: SolarTerm; // 星期几 weekday: string; // 是否工作日 isWorkday: boolean; // 生日列表 birthdays: Contact[]; // 纪念日列表 anniversaries: Anniversary[]; // 待办事项 to...
AST#export_declaration#Left export AST#interface_declaration#Left interface DateDetail AST#object_type#Left { // 公历日期 AST#type_member#Left gregorianDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 农历信息 AST#type_member#Left lunarDate :...
export interface DateDetail { gregorianDate: Date; lunarDate: LunarDate; festivals: Festival[]; solarTerm?: SolarTerm; weekday: string; isWorkday: boolean; birthdays: Contact[]; anniversaries: Anniversary[]; todos: TodoItem[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/LunarTypes.ets#L63-L82
39c754ebd2aae03cbe9307d189bf3fad14393849
github
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
common/src/main/ets/default/uicomponents/FormManagerDialog.ets
arkts
FormManagerDialog
Form manager view Component (pad adaptation).
@CustomDialog export struct FormManagerDialog { @StorageLink('formMgrItem') formItem: Array<CardItemInfo> = []; @State mAllowUpdate: boolean = false; private mSwiperController: SwiperController = new SwiperController() private mFormModel: FormModel = FormModel.getInstance(); private mSwiperIndex: number = 0; ...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct FormManagerDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'formMgrItem' AST#expression#Right ) AST#decorator#Right formItem : AST#type_annotati...
@CustomDialog export struct FormManagerDialog { @StorageLink('formMgrItem') formItem: Array<CardItemInfo> = []; @State mAllowUpdate: boolean = false; private mSwiperController: SwiperController = new SwiperController() private mFormModel: FormModel = FormModel.getInstance(); private mSwiperIndex: number = 0; ...
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/common/src/main/ets/default/uicomponents/FormManagerDialog.ets#L25-L240
5945518e67174b932325a58850b7a33cd83d240d
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/Helper.ets
arkts
parseTimestamp
格式化字符串时间戳。 @param value @param defaultValue @returns
private static parseTimestamp(value: string): number | string { try { let parsedValue = parseFloat(value); if (isNaN(parsedValue)) { return value; } if (parsedValue.toString().length != value.length) { return value; } if (parsedValue.toString().length == 10) { ...
AST#method_declaration#Left private static parseTimestamp AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_...
private static parseTimestamp(value: string): number | string { try { let parsedValue = parseFloat(value); if (isNaN(parsedValue)) { return value; } if (parsedValue.toString().length != value.length) { return value; } if (parsedValue.toString().length == 10) { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L392-L408
b74e4e85e5540a7688957618fe2c5f7d821e9a30
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/ActionSheetDialogView.ets
arkts
footBuilder
底部按钮
@Builder footBuilder() { if (this.options.style?.isSeparateBottom) { Text(this.options.cancelText) .fontSize(this.fontSize) .fontColor(this.options.style?.cancelFontColor ?? $r('sys.color.ohos_id_picker_button_text_color')) .fontWeight(this.options.style?.cancelFontWeight ?? FontWeig...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right footBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#L...
@Builder footBuilder() { if (this.options.style?.isSeparateBottom) { Text(this.options.cancelText) .fontSize(this.fontSize) .fontColor(this.options.style?.cancelFontColor ?? $r('sys.color.ohos_id_picker_button_text_color')) .fontWeight(this.options.style?.cancelFontWeight ?? FontWeig...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/ActionSheetDialogView.ets#L164-L189
5c8af0f78f97c053940a0ccb954eb833293b9ae5
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/mine/index.ets
arkts
MineTabContent
Mine 模块导出文件
export { MineTabContent } from './MineTabContent';
AST#export_declaration#Left export { MineTabContent } from './MineTabContent' ; AST#export_declaration#Right
export { MineTabContent } from './MineTabContent';
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/mine/index.ets#L5-L5
43adac972b9829d3ae476c0de38edfe817097fa8
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets
arkts
Reload
重新加载数据
public Reload(): void { this.dataArray.splice(1, 1); this.dataArray.splice(3, 2); this.notifyDataReload(); }
AST#method_declaration#Left public Reload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
public Reload(): void { this.dataArray.splice(1, 1); this.dataArray.splice(3, 2); this.notifyDataReload(); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets#L122-L126
09a8d43034b6125d902d81967d4ccc2526d92dae
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/TitleBar.ets
arkts
TitleBar
Copyright (c) 2022-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,...
@Component export struct TitleBar { build() { Column() { Image($r('app.media.icon_logo')).width(184).height(48) }.width('16%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { ...
@Component export struct TitleBar { build() { Column() { Image($r('app.media.icon_logo')).width(184).height(48) }.width('16%') } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/TitleBar.ets#L16-L23
f15869e3d47dd7056d64cfcdb047a1ec1ba5b434
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
fill
日期不足两位补充0 @param value-数据值
fill(value: number): string { let maxNumber = 9; return (value > maxNumber ? '' : '0') + value; }
AST#method_declaration#Left fill AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#t...
fill(value: number): string { let maxNumber = 9; return (value > maxNumber ? '' : '0') + value; }
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets#L41-L44
b702f6c9ba791202e7f558cf629c5a045cb1d89f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/StatusBarUtils.ets
arkts
setDarkContent
便捷方法
static async setDarkContent(): Promise<void> { await StatusBarUtil.setStatusBarContentColor('#000000'); }
AST#method_declaration#Left static async setDarkContent 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...
static async setDarkContent(): Promise<void> { await StatusBarUtil.setStatusBarContentColor('#000000'); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/StatusBarUtils.ets#L94-L96
10bcd26994878e0b239feafa7d698597a4370f81
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/cart.ets
arkts
Cart
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 Cart { @State flag: boolean = true @State value: number = 1 @Prop ratio: number build() { Column() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { Image('/resources/homeImg/imgLoads/product004.png') .wid...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Cart AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right flag : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Righ...
@Component export struct Cart { @State flag: boolean = true @State value: number = 1 @Prop ratio: number build() { Column() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { Image('/resources/homeImg/imgLoads/product004.png') .wid...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/cart.ets#L16-L93
5a1fa897dbb579d2ae6620b507eef81d20b03905
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
loadGoodsSpecs
加载商品规格
loadGoodsSpecs() { // 如果 ui 状态为成功,则不重复加载 if (this.specUiState === BaseNetWorkUiState.SUCCESS) { return; } const params: GoodsIdRequest = new GoodsIdRequest(); params.goodsId = this.goodsId; RequestHelper.repository <GoodsSpec[]>(this.goodsRepository.getGoodsSpecList(params)) .toast(...
AST#method_declaration#Left loadGoodsSpecs AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 如果 ui 状态为成功,则不重复加载 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expr...
loadGoodsSpecs() { if (this.specUiState === BaseNetWorkUiState.SUCCESS) { return; } const params: GoodsIdRequest = new GoodsIdRequest(); params.goodsId = this.goodsId; RequestHelper.repository <GoodsSpec[]>(this.goodsRepository.getGoodsSpecList(params)) .toast(false) .start((...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L76-L97
ac0cdd33ccf128b35d73f4e42cb643f7d242e2a1
github
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/models/StringUtils.ets
arkts
string2Uint8Array1
string转Uint8Array @param value @returns
string2Uint8Array1(value: string): Uint8Array { if (!value) return null; // let textEncoder = new util.TextEncoder(); //获取点流并发出 UTF-8 字节流 TextEncoder 的所有实例仅支持 UTF-8 编码 return textEncoder.encodeInto(value) }
AST#method_declaration#Left string2Uint8Array1 AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primar...
string2Uint8Array1(value: string): Uint8Array { if (!value) return null; let textEncoder = new util.TextEncoder(); 获取点流并发出 UTF-8 字节流 TextEncoder 的所有实例仅支持 UTF-8 编码 return textEncoder.encodeInto(value) }
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/models/StringUtils.ets#L9-L15
73e680aa3b960d4e0b3359e7c9ee44851ebb83db
github
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/home/media/MediaViewModel.ets
arkts
MediaViewModel
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/13 21:56 @Version V1.0 @Description
@Observed export class MediaViewModel extends ListViewModel { loadData(type: LoadType): Promise<void> { return this.repository.getLibraryList() .then((items) => { this.dataSource.initData(items) }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class MediaViewModel extends AST#type_annotation#Left AST#primary_type#Left ListViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left loadData AST#parameter_list#Left ( A...
@Observed export class MediaViewModel extends ListViewModel { loadData(type: LoadType): Promise<void> { return this.repository.getLibraryList() .then((items) => { this.dataSource.initData(items) }) } }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/home/media/MediaViewModel.ets#L10-L20
5031c2c248811a7e00d6f5c2396a7b314e155ead
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarSolarMappingService.ets
arkts
getCacheStats
获取缓存统计信息
getCacheStats(): CacheStats { let totalMappings = 0; for (const yearData of this.mappingCache.values()) { totalMappings += yearData.mappings.size + yearData.solarToLunar.size; } const stats: CacheStats = { years: this.mappingCache.size, totalMappings, memoryUsage: `${Math.round(...
AST#method_declaration#Left getCacheStats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CacheStats AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left totalMa...
getCacheStats(): CacheStats { let totalMappings = 0; for (const yearData of this.mappingCache.values()) { totalMappings += yearData.mappings.size + yearData.solarToLunar.size; } const stats: CacheStats = { years: this.mappingCache.size, totalMappings, memoryUsage: `${Math.round(...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L312-L325
54d7c5c6adfbd5fc326e27edb41b141042b6a0e0
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/XorCipher.ets
arkts
encrypt
使用密钥对文本进行XOR加密/解密 @param text 要加密/解密的文本 @param key 密钥 @returns 加密/解密后的文本
static encrypt(text: string, key: string): string { if (!text || !key) { return ''; } let result = ''; for (let i = 0; i < text.length; i++) { const charCode = text.charCodeAt(i); const keyCharCode = key.charCodeAt(i % key.length); result += String.fromCharCode(charCode ^ keyCha...
AST#method_declaration#Left static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ...
static encrypt(text: string, key: string): string { if (!text || !key) { return ''; } let result = ''; for (let i = 0; i < text.length; i++) { const charCode = text.charCodeAt(i); const keyCharCode = key.charCodeAt(i % key.length); result += String.fromCharCode(charCode ^ keyCha...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/XorCipher.ets#L12-L24
d7dcaa8c28da2419b3a30159edcc857a8254e673
github
wenqi1/MallHomepage.git
a09765bee60b214f73b875570f8721a004d0bc3b
entry/src/main/ets/components/Home.ets
arkts
ClassifyTitle
分类栏
@Builder ClassifyTitle() { List({space: MainPageConstants.VP_12}) { ForEach(classifyTitle, (item: Resource, index: number) => { ListItem() { Text(item) .fontSize(MainPageConstants.FONT_SIZE_16) .opacity(this.classifyIndex === index ? MainPageConstants.FULL_OPACITY : M...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ClassifyTitle 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 List ( AST#component_parameters#Left { AST#component_paramet...
@Builder ClassifyTitle() { List({space: MainPageConstants.VP_12}) { ForEach(classifyTitle, (item: Resource, index: number) => { ListItem() { Text(item) .fontSize(MainPageConstants.FONT_SIZE_16) .opacity(this.classifyIndex === index ? MainPageConstants.FULL_OPACITY : M...
https://github.com/wenqi1/MallHomepage.git/blob/a09765bee60b214f73b875570f8721a004d0bc3b/entry/src/main/ets/components/Home.ets#L46-L64
364efe22ddb18a7e525abf0369c7c74900333128
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/ImageKnifeDispatcher.ets
arkts
getAndShowImage
获取和显示图片
getAndShowImage(currentRequest: ImageKnifeRequest, imageSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource,isAnimator?: boolean): void { LogUtil.log('getAndShowImage.start:' + currentRequest.componentId + ',srcType:' + requestSource + ',version:' + currentRequest.componentVersion) let m...
AST#method_declaration#Left getAndShowImage AST#parameter_list#Left ( AST#parameter#Left currentRequest : AST#type_annotation#Left AST#primary_type#Left ImageKnifeRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageSrc : AST#type_annotation#Left AST#union_type#Left AST...
getAndShowImage(currentRequest: ImageKnifeRequest, imageSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource,isAnimator?: boolean): void { LogUtil.log('getAndShowImage.start:' + currentRequest.componentId + ',srcType:' + requestSource + ',version:' + currentRequest.componentVersion) let m...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnifeDispatcher.ets#L192-L327
f43a01ea1a24ddaf523ddf9a6e832458fa196b57
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
onPinchUpdate
Pinch update. @param scale
onPinchUpdate(scale: number): void { Logger.debug(TAG, `onPinchUpdate: scale[${scale}]`); if (this.state === CropTouchState.IMAGE_SCALE) { let factor = scale / this.scale; if (!this.cropShow.couldEnlargeImage()) { factor = factor > CommonConstants.BASE_SCALE_VALUE ? CommonConstants.BASE_SCAL...
AST#method_declaration#Left onPinchUpdate AST#parameter_list#Left ( AST#parameter#Left scale : 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#Righ...
onPinchUpdate(scale: number): void { Logger.debug(TAG, `onPinchUpdate: scale[${scale}]`); if (this.state === CropTouchState.IMAGE_SCALE) { let factor = scale / this.scale; if (!this.cropShow.couldEnlargeImage()) { factor = factor > CommonConstants.BASE_SCALE_VALUE ? CommonConstants.BASE_SCAL...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L290-L303
723ff3f2dfc74ad7fb41e1974ca101d3ff173228
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
createUnitFromWord
从单词创建单元对象
private createUnitFromWord(word: WordUser): Unit { const unit = new Unit(); unit.unitId = word.unitId || 0; unit.unitNo = word.unitNo || 0; unit.unitName = word.unitName || ''; unit.partId = word.partId || 0; unit.words = []; return unit; }
AST#method_declaration#Left private createUnitFromWord AST#parameter_list#Left ( AST#parameter#Left word : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Unit AST#pri...
private createUnitFromWord(word: WordUser): Unit { const unit = new Unit(); unit.unitId = word.unitId || 0; unit.unitNo = word.unitNo || 0; unit.unitName = word.unitName || ''; unit.partId = word.partId || 0; unit.words = []; return unit; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L254-L262
c49f7f2403451f7e8dcf38d9d04e016c753e8c51
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
getTextArea
显示多行文本输入弹框 @returns
static getTextArea(uiContext?: UIContext): TextAreaBuilderProxy { return new TextAreaBuilderProxy(uiContext) }
AST#method_declaration#Left static getTextArea AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TextAreaBuil...
static getTextArea(uiContext?: UIContext): TextAreaBuilderProxy { return new TextAreaBuilderProxy(uiContext) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L122-L124
db2a6b6f8e09c50991b5e73e2e2246a743e4226b
github
HunZiLei/ArkTS_PokePomodoro.git
61a844a28808c014c39de7a868b0d331052d1bd4
entry/src/main/ets/pages/Index.ets
arkts
TabBuilder_string
底边栏
@Builder TabBuilder(title: Resource, targetIndex: number, selectedImg: Resource, normalImg: Resource) { Column() { Image(this.currentIndex === targetIndex ? selectedImg : normalImg) .size({ width: 25, height: 25 }) .fillColor(this.currentIndex === targetIndex ? '#47DEA9' : '#6B6B6B') Tex...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AST#ERROR#Left TabBuilder AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetIndex : AST#...
@Builder TabBuilder(title: Resource, targetIndex: number, selectedImg: Resource, normalImg: Resource) { Column() { Image(this.currentIndex === targetIndex ? selectedImg : normalImg) .size({ width: 25, height: 25 }) .fillColor(this.currentIndex === targetIndex ? '#47DEA9' : '#6B6B6B') Tex...
https://github.com/HunZiLei/ArkTS_PokePomodoro.git/blob/61a844a28808c014c39de7a868b0d331052d1bd4/entry/src/main/ets/pages/Index.ets#L18-L69
42c23b09173be75ec4608118a46c4ce877577f1a
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
处理图片URL,转换为当前环境可访问的URL @param url 后端返回的URL @returns 处理后可访问的URL
export function processImageUrl(url: string): string { if (!url) return ''; // 如果是相对路径(不包含http或https),则添加BASE_URL if (!url.startsWith('http://') && !url.startsWith('https://')) { return `${BASE_URL}/${url}`; } // 如果包含localhost,替换为当前环境URL if (url.includes('localhost')) { // 提取相对路径 const url...
AST#export_declaration#Left export AST#function_declaration#Left function processImageUrl AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AS...
export function processImageUrl(url: string): string { if (!url) return ''; if (!url.startsWith('http://') && !url.startsWith('https://')) { return `${BASE_URL}/${url}`; } if (url.includes('localhost')) { const urlParts = url.split('/api/'); if (urlParts.length > 1) { return `...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L78-L96
bbf0482aac0c548f999c63821d2f13798722a2ae
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets
arkts
readFileAsUint8Array
/将下载文件读取为data
readFileAsUint8Array(filePath: string, callback: (data: Uint8Array | null, error: string | null) => void): void { // fs.open(filePath, fs.OpenMode.READ_ONLY, (err, file) => { // if (err) { // callback(null, `打开文件失败: ${err.message}`); // return; // } // // const arrayBuffer = ne...
AST#method_declaration#Left readFileAsUint8Array AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#paramete...
readFileAsUint8Array(filePath: string, callback: (data: Uint8Array | null, error: string | null) => void): void { const arrayBuffer = new ArrayBuffer(1024 * 1024); fs.read(file.fd, arrayBuffer, (readErr, bytesRead) => { fs.close(file.fd); if (readErr) { ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets#L163-L181
b65088a377f7381f8b5d61149c5ef2f5a2cdc193
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
checkLevelUp
检查等级提升
private async checkLevelUp(): Promise<boolean> { if (!this.userGameData) return false; const currentLevel = this.userGameData.level; const newLevel = this.calculateUserLevel(this.userGameData.experience); if (newLevel.level > currentLevel.level) { this.userGameData.level = newLevel; ...
AST#method_declaration#Left private async checkLevelUp 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 boolean AST#primary_type#Right AST#type_annotation#Right > A...
private async checkLevelUp(): Promise<boolean> { if (!this.userGameData) return false; const currentLevel = this.userGameData.level; const newLevel = this.calculateUserLevel(this.userGameData.experience); if (newLevel.level > currentLevel.level) { this.userGameData.level = newLevel; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L668-L684
c158a227d53c8e0bc7d6dea1602f931c119f67cb
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
common/src/main/ets/util/UpdateUtils.ets
arkts
export
接口工具 @since 2022-06-06
export namespace UpdateUtils { /** * 获取changelog信息 * * @param componentDescriptions 新版本更新日志集合 * @param componentId 组件id * @return changelog */ export
AST#export_declaration#Left export AST#ERROR#Left namespace UpdateUtils AST#ERROR#Right { /** * 获取changelog信息 * * @param componentDescriptions 新版本更新日志集合 * @param componentId 组件id * @return changelog */ export AST#export_declaration#Right
export namespace UpdateUtils { export
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/util/UpdateUtils.ets#L29-L37
3382fb7eeb16b6ad0c3dce425f290aeebbe688a8
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/model/UserInformation.ets
arkts
UserInformation
User信息,包括图标、名字、最后消息、是否可见
@Observed export class UserInformation { icon: ResourceStr = ''; name: ResourceStr = ''; lastMsg: ResourceStr = ''; visible: boolean = true; constructor(icon: ResourceStr = '', name: ResourceStr = '', lastMsg: ResourceStr = '', visible: boolean = true) { this.icon = icon; this.name = name; this.l...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class UserInformation AST#class_body#Left { AST#property_declaration#Left icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#express...
@Observed export class UserInformation { icon: ResourceStr = ''; name: ResourceStr = ''; lastMsg: ResourceStr = ''; visible: boolean = true; constructor(icon: ResourceStr = '', name: ResourceStr = '', lastMsg: ResourceStr = '', visible: boolean = true) { this.icon = icon; this.name = name; this.l...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/model/UserInformation.ets#L19-L32
0414422fb8448519a6915a752881787fc3e59791
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderListViewModel.ets
arkts
convertOrderGoodsToCart
将订单商品转换为购物车列表 @param {Order} order - 订单信息 @returns {Cart[]} 购物车列表
private convertOrderGoodsToCart(order: Order): Cart[] { const goodsList: OrderGoods[] = order.goodsList ?? []; if (goodsList.length === 0) { return []; } const groupedMap = new Map<number, OrderGoods[]>(); for (const goods of goodsList) { const exists = groupedMap.get(goods.goodsId); ...
AST#method_declaration#Left private convertOrderGoodsToCart AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array...
private convertOrderGoodsToCart(order: Order): Cart[] { const goodsList: OrderGoods[] = order.goodsList ?? []; if (goodsList.length === 0) { return []; } const groupedMap = new Map<number, OrderGoods[]>(); for (const goods of goodsList) { const exists = groupedMap.get(goods.goodsId); ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderListViewModel.ets#L178-L222
ad6ab3bd47dd3099d1641846096b0f08798502bc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets
arkts
NodeController的子类MyNodeController
export class MyNodeController extends NodeController { private rootNode: FrameNode | null = null; // 根节点 rootRenderNode: RenderNode | null = null; // 从NodeController根节点获取的RenderNode,用于添加和删除新创建的MyRenderNode实例 // MyNodeController实例绑定的NodeContainer创建时触发,创建根节点rootNode并将其挂载至NodeContainer makeNode(uiContext: UIConte...
AST#export_declaration#Left export AST#class_declaration#Left class MyNodeController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootNode : AST#type_annotation#Left AST#union_type#Left ...
export class MyNodeController extends NodeController { private rootNode: FrameNode | null = null; rootRenderNode: RenderNode | null = null; makeNode(uiContext: UIContext): FrameNode { this.rootNode = new FrameNode(uiContext); if (this.rootNode !== null) { this.rootRenderNode = this.rootNode.ge...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L60-L107
2a25e9a1cdc06e16ffab5cf2d9b2f89b25d3f37b
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/plan.ets
arkts
todaySport
今日运动
@Builder todaySport(){ Scroll() { Column({space:15}) { this.day() Text("今日运动") .fontSize(20) .fontWeight(700) ForEach(this.planCard,(planCardMes:courseInfoType)=>{ this.sport(planCardMes) }) Text('——————我是有底线的———————') .font...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right todaySport 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#container_content_body#Left { AST#arkts_ui_eleme...
@Builder todaySport(){ Scroll() { Column({space:15}) { this.day() Text("今日运动") .fontSize(20) .fontWeight(700) ForEach(this.planCard,(planCardMes:courseInfoType)=>{ this.sport(planCardMes) }) Text('——————我是有底线的———————') .font...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L285-L306
23f573a5e621ad1e8f15b6496a46d6b0420f8a5c
github
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets
arkts
Enumerates storage filter mode. @enum { number } @syscap SystemCapability.Graphics.Drawing @since 12
export enum FilterMode { /** * Single sample point (nearest neighbor). * @syscap SystemCapability.Graphics.Drawing * @since 12 */ FILTER_MODE_NEAREST = 0, /** * Interpolate between 2x2 sample points (bilinear interpolation). * @syscap SystemCapability.Graphics.Drawing * @...
AST#export_declaration#Left export AST#enum_declaration#Left enum FilterMode AST#enum_body#Left { /** * Single sample point (nearest neighbor). * @syscap SystemCapability.Graphics.Drawing * @since 12 */ AST#enum_member#Left FILTER_MODE_NEAREST = AST#expression#Left 0 AST#expression#Right AST#enum_me...
export enum FilterMode { FILTER_MODE_NEAREST = 0, FILTER_MODE_LINEAR = 1, }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L284-L298
3af7392c7a0a472fdb990df8f980d9ad32982f01
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/UserState.ets
arkts
logout
用户登出,清空状态 @returns {void} 无返回值 @example getUserState().logout();
logout(): void { this.auth = new Auth(); this.userInfo = new User(); new TokenStoreRepository().clearToken(); PersistenceV2.remove(USER_STATE_KEY); }
AST#method_declaration#Left logout 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_expr...
logout(): void { this.auth = new Auth(); this.userInfo = new User(); new TokenStoreRepository().clearToken(); PersistenceV2.remove(USER_STATE_KEY); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L81-L86
54bc6f82e8bbe272d62b745ffa08331b5b373e52
github
westinyang/f-oh
0b3022f69a2b7f8331b92ed18851050c1639f2c9
entry/src/main/ets/components/Settings.ets
arkts
SettingRow
Copyright (C) 2023 westinyang https://gitee.com/ohos-dev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distr...
@Component export struct SettingRow { icon?: string | PixelMap | Resource title: string|Resource info?: string | Resource clickHandler?: (event?: ClickEvent) => void showRightArrow?: boolean = true build() { Row() { Image(this.icon).width(26).height(26).borderRadius(13).margin({ left: 14 }) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SettingRow AST#component_body#Left { AST#property_declaration#Left icon ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left PixelMap AST#primary...
@Component export struct SettingRow { icon?: string | PixelMap | Resource title: string|Resource info?: string | Resource clickHandler?: (event?: ClickEvent) => void showRightArrow?: boolean = true build() { Row() { Image(this.icon).width(26).height(26).borderRadius(13).margin({ left: 14 }) ...
https://github.com/westinyang/f-oh/blob/0b3022f69a2b7f8331b92ed18851050c1639f2c9/entry/src/main/ets/components/Settings.ets#L18-L44
c429c04129b37065f8aab9ab6d91a799a8ffdbb7
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
Default capsule bar height for capsule-shape components, like a capsule button. @returns 35
export function capsule_bar_height() { return 35; }
AST#export_declaration#Left export AST#function_declaration#Left function capsule_bar_height AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 35 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } ...
export function capsule_bar_height() { return 35; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L49-L51
5b637c5d6be47e03cee37b7891b50df410fea8f3
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_json/src/main/ets/json/JSONObject.ets
arkts
toJSONString
Object对象换为json字符串 @param object object对象 @returns JSON字符串
public static toJSONString(object: Object): string { if (object instanceof Map) { let map = new HashMap<string, JSONValue>(); (object as Map<string, JSONValue>).forEach((val, key) => { map.set(key, val); }) //获取key迭代器 let iter: IterableIterator<string> = map.keys(); retur...
AST#method_declaration#Left public static toJSONString AST#parameter_list#Left ( AST#parameter#Left object : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#p...
public static toJSONString(object: Object): string { if (object instanceof Map) { let map = new HashMap<string, JSONValue>(); (object as Map<string, JSONValue>).forEach((val, key) => { map.set(key, val); }) let iter: IterableIterator<string> = map.keys(); return new JSON...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONObject.ets#L116-L142
778faf21c88328b955c932c6232ff41a61bf92b5
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
close
Close database connection
async close(): Promise<void> { try { if (this.rdbStore) { await this.rdbStore.close(); this.rdbStore = null; console.info('[RdbHelper] Database closed'); } } catch (error) { const err = error as BusinessError; console.error(`[RdbHelper] Failed to close database: $...
AST#method_declaration#Left async close 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_arguments#...
async close(): Promise<void> { try { if (this.rdbStore) { await this.rdbStore.close(); this.rdbStore = null; console.info('[RdbHelper] Database closed'); } } catch (error) { const err = error as BusinessError; console.error(`[RdbHelper] Failed to close database: $...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L627-L638
4bb1a37892af6dcfbb119864f53c3f41f16f6ffc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
isShowChange
监听isShow值,自动化测试用例中使用
isShowChange() { emitter.emit({ eventId: 0, priority: 0 }, { data: { isShow: this.isShow } }) }
AST#method_declaration#Left isShowChange 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 emitter AST#expression#Right . emit AST#member_expr...
isShowChange() { emitter.emit({ eventId: 0, priority: 0 }, { data: { isShow: this.isShow } }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L93-L99
b5633177b47d18241b111dc9f0f1c09a9f749790
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
showToast
显示吐司 @param message 吐司内容 @param options
static showToast(message: string | Resource, options?: ToastOptions) { options = options ?? {}; options.message = message; ActionParameter.initToastDefault(options); ActionBaseCore.getInstance().showToast(options); }
AST#method_declaration#Left static showToast AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ...
static showToast(message: string | Resource, options?: ToastOptions) { options = options ?? {}; options.message = message; ActionParameter.initToastDefault(options); ActionBaseCore.getInstance().showToast(options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L394-L399
aa53d483916190d64383f03e5219eebc87d7aaa4
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets
arkts
@Author csx @DateTime 2024/3/18 10:15:03 @TODO SM4Sync SM4同步操作类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class SM4Sync { /** * 生成SM4的对称密钥 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns SM4密钥 */ static generateSM4Key(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('SM4_128', resultCoding); } /** * 加密-ECB模式 * @param s...
AST#export_declaration#Left export AST#class_declaration#Left class SM4Sync AST#class_body#Left { /** * 生成SM4的对称密钥 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns SM4密钥 */ AST#method_declaration#Left static generateSM4Key AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#t...
export class SM4Sync { static generateSM4Key(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('SM4_128', resultCoding); } static encodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): s...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets#L26-L90
b5162d6cc756675fe1c7778ec27693cc09f00c80
gitee
from-north-to-north/OpenHarmony_p7885
f6ea526c039db535a7c958fa154ccfcb3668b37c
hap/easy_demo/window_demo/window_demo1/entry/src/main/ets/entryability/EntryAbility.ets
arkts
getWindowAvoidArea
获取系统状态栏,导航栏高度 @param context @returns
async function getWindowAvoidArea(context: common.UIAbilityContext) { try { const mainWindow = await window.getLastWindow(context); const avoidAreaType = window.AvoidAreaType.TYPE_SYSTEM; // 系统默认区域,包括状态栏,导航栏 const avoidArea = mainWindow.getWindowAvoidArea(avoidAreaType); console.log('getWindowAvoidAre...
AST#function_declaration#Left async function getWindowAvoidArea 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...
async function getWindowAvoidArea(context: common.UIAbilityContext) { try { const mainWindow = await window.getLastWindow(context); const avoidAreaType = window.AvoidAreaType.TYPE_SYSTEM; const avoidArea = mainWindow.getWindowAvoidArea(avoidAreaType); console.log('getWindowAvoidArea success',JSON.str...
https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/window_demo/window_demo1/entry/src/main/ets/entryability/EntryAbility.ets#L14-L23
0d65e84b78dff5adebfe82ad693585081388c324
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
toGoodsDetail
跳转商品详情页面(再次购买) @param {number} goodsId - 商品 ID @returns {void} 无返回值
toGoodsDetail(goodsId: number): void { if (!goodsId) { return; } this.hideRebuyModal(); GoodsNavigator.toDetail(goodsId); }
AST#method_declaration#Left toGoodsDetail AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Ri...
toGoodsDetail(goodsId: number): void { if (!goodsId) { return; } this.hideRebuyModal(); GoodsNavigator.toDetail(goodsId); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L179-L185
15e6c5582123a6805bf58e5a24ee93a971767f86
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
Q1/grammar/entry/src/main/ets/pages/LifeCycle1.ets
arkts
onBackPress
页面返回
onBackPress() { console.log('入口组件1....onBackPress') }
AST#method_declaration#Left onBackPress 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 console AST#expression#Right . log AST#member_expres...
onBackPress() { console.log('入口组件1....onBackPress') }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/grammar/entry/src/main/ets/pages/LifeCycle1.ets#L53-L55
38a16c89301bd3c5f4e3f8e5f4b7e0e7eb1024ac
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Box.ets
arkts
contains
判断Box数组中是否包含某个Box @param boxes - Box数组 @param box - 要查找的Box
static contains(boxes: Box[], box: Box): boolean { return boxes.some(b => b.equals(box)); }
AST#method_declaration#Left static contains AST#parameter_list#Left ( AST#parameter#Left boxes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left box : AST#type_annotation#Left AST#pr...
static contains(boxes: Box[], box: Box): boolean { return boxes.some(b => b.equals(box)); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L154-L156
3985a236f19c718bf533749255b7f67116164ddb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets
arkts
initColor
设置子窗口蒙层颜色
initColor() { try { // 获取指定resource对象对应的字符串 this.maskColor = context.resourceManager.getStringSync($r('app.string.custom_dialog_mask_color').id); console.log("getStringSync: " + this.maskColor) } catch (err) { console.error(`getStringSync failed, code is ${err.code}, message is ${err.mes...
AST#method_declaration#Left initColor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 获取指定resource对象对应的字符串 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#m...
initColor() { try { this.maskColor = context.resourceManager.getStringSync($r('app.string.custom_dialog_mask_color').id); console.log("getStringSync: " + this.maskColor) } catch (err) { console.error(`getStringSync failed, code is ${err.code}, message is ${err.message}`); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets#L122-L130
d0499b410c8f6944b89d3a7d80c63ba4cacb51ff
gitee
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/utils.ets
arkts
获得用户存档数据
export const getData = (cb: (data?: TArchiveFile) => void) => { const archiveData = core.getWorldData() console.warn('获得用户数据: ', JSON.stringify(archiveData)) cb ? cb(archiveData) : false; } // 恢复用户道具
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left getData = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left cb : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data ? : AST#type_annot...
export const getData = (cb: (data?: TArchiveFile) => void) => { const archiveData = core.getWorldData() console.warn('获得用户数据: ', JSON.stringify(archiveData)) cb ? cb(archiveData) : false; }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/utils.ets#L114-L120
bb7e97a81c7e8040f1877f5be2e5ca0f7c096199
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
digest
摘要,异步 @param data 待摘要的数据 @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。 @param resultCoding 摘要的编码方式(base64/hex) @returns
static async digest(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { let md = cryptoFramework.createMd(algName); //数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制 await md.update({ data: CryptoHelper.strToUint8Array(data, 'utf-8') }); let dataBlob = await md.digest(); ...
AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
static async digest(data: string, algName: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> { let md = cryptoFramework.createMd(algName); await md.update({ data: CryptoHelper.strToUint8Array(data, 'utf-8') }); let dataBlob = await md.digest(); let result = CryptoHelper.uint8ArrayToSt...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L495-L502
4aff30e20a0e10315b1a3bcadcd685faf13354e9
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
entry/src/main/ets/pages/LiveEnterPage.ets
arkts
onVHNetworkDisconnect
消息服务链接已断开 @param im im @param error 错误
onVHNetworkDisconnect(code: number, message: string): void { }
AST#method_declaration#Left onVHNetworkDisconnect AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
onVHNetworkDisconnect(code: number, message: string): void { }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/entry/src/main/ets/pages/LiveEnterPage.ets#L147-L149
fc75e2029dd3d13cc0d207fd8df9c5722d571b70
gitee
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/CityWeather.ets
arkts
loadUserInfo
加载用户信息
private async loadUserInfo() { try { const currentAccount = this.getCurrentAccount(); if (!currentAccount) return; let httpRequest = http.createHttp(); let response = await httpRequest.request(`${Config.API.USER_INFO}/${currentAccount}`, { method: http.RequestMethod.GET, hea...
AST#method_declaration#Left private async loadUserInfo 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 const AST#variable_declarator#Left currentAccount = AST#express...
private async loadUserInfo() { try { const currentAccount = this.getCurrentAccount(); if (!currentAccount) return; let httpRequest = http.createHttp(); let response = await httpRequest.request(`${Config.API.USER_INFO}/${currentAccount}`, { method: http.RequestMethod.GET, hea...
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/CityWeather.ets#L114-L135
597edf18ccb552273239696fa8f44f21dba368ee
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
getDataStr
读取系统剪贴板里的字符串(),使用Promise异步回调。 @returns
static async getDataStr(): Promise<string> { if (PasteboardUtil.hasDataSync()) { let pasteData = await PasteboardUtil.getData(); let mimeType = pasteData.getPrimaryMimeType(); if (mimeType === pasteboard.MIMETYPE_TEXT_PLAIN) { return pasteData.getPrimaryText(); } else if (mimeType ==...
AST#method_declaration#Left static async getDataStr 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 string AST#primary_type#Right AST#type_annotation#Right > AST#t...
static async getDataStr(): Promise<string> { if (PasteboardUtil.hasDataSync()) { let pasteData = await PasteboardUtil.getData(); let mimeType = pasteData.getPrimaryMimeType(); if (mimeType === pasteboard.MIMETYPE_TEXT_PLAIN) { return pasteData.getPrimaryText(); } else if (mimeType ==...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L294-L307
6895cfd2fe4bf3ac2fbebb74b96c8f7061f9e88f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
@Author csx @DateTime 2024/3/18 10:39:03 @TODO ASN1Util SM2ASN.1工具类
export class ASN1Util { static readonly BOOLEAN: string = "01"; static readonly INTEGER: string = "02"; static readonly BIT_STRING: string = "03"; static readonly OCTEN_STRING: string = "04"; static readonly NULL: string = "05"; static readonly REAL: string = "09"; static readonly ENUMERATED: string = "0a...
AST#export_declaration#Left export AST#class_declaration#Left class ASN1Util AST#class_body#Left { AST#property_declaration#Left static readonly BOOLEAN : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "01" AST#expression#Right ; AST#property...
export class ASN1Util { static readonly BOOLEAN: string = "01"; static readonly INTEGER: string = "02"; static readonly BIT_STRING: string = "03"; static readonly OCTEN_STRING: string = "04"; static readonly NULL: string = "05"; static readonly REAL: string = "09"; static readonly ENUMERATED: string = "0a...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L25-L35
9a2578de71b739f2a2e1845e564ae178408ec4aa
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets
arkts
@param context Context object, used to pass frame callbacks to the next frame @param preBuildData A data list for pre created components, used to confirm the quantity and related information of pre created components, which can be modified or set to a fixed value according to business needs
constructor(context: UIContext, preBuildData: ViewItem[]) { super(); this.uiContext = context; this.viewItems = preBuildData; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left preBuildData : AST#type_annotation#Left AST#primary_type#Left AST#array_t...
constructor(context: UIContext, preBuildData: ViewItem[]) { super(); this.uiContext = context; this.viewItems = preBuildData; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets#L38-L42
eddb58130111c869c3919b68b3a7a9a62210f56e
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/auth/RegisterPage.ets
arkts
handleRegister
处理注册
async handleRegister() { if (!this.validateForm()) { return; } try { this.isLoading = true; // 调用注册API const result = await UserSession.getInstance().register( this.username, this.password, this.nickname, this.email || undefined, th...
AST#method_declaration#Left async handleRegister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#e...
async handleRegister() { if (!this.validateForm()) { return; } try { this.isLoading = true; const result = await UserSession.getInstance().register( this.username, this.password, this.nickname, this.email || undefined, this.phone |...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/auth/RegisterPage.ets#L138-L184
b13194ab9f5c786edbbaa78f2efaeaf64d5e0eac
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
setXOffset
Sets the used x-axis offset for the labels on this axis. @param xOffset
public setXOffset(xOffset: number): void { this.mXOffset = Utils.convertDpToPixel(xOffset); }
AST#method_declaration#Left public setXOffset AST#parameter_list#Left ( AST#parameter#Left xOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
public setXOffset(xOffset: number): void { this.mXOffset = Utils.convertDpToPixel(xOffset); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L70-L72
9b56e652ef4b03134156cb843be6bac008987a7b
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/@olxbr_gitlab-node-sdk/0.2.3/package/index.ets
arkts
HelloWorldNPM
根据约束10:显式指定返回类型
function HelloWorldNPM(): string { return "Hello World NPM"; }
AST#function_declaration#Left function HelloWorldNPM AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left "Hello Wor...
function HelloWorldNPM(): string { return "Hello World NPM"; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/@olxbr_gitlab-node-sdk/0.2.3/package/index.ets#L7-L9
a1720b9aa05b48d0b69c1c644364257d02a5ed75
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/NetworkClient.ets
arkts
getAxios
获取 Axios 实例
public getAxios(): AxiosInstance { return this.axiosInstance; }
AST#method_declaration#Left public getAxios AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AxiosInstance 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_e...
public getAxios(): AxiosInstance { return this.axiosInstance; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/NetworkClient.ets#L43-L45
916bb4ffebbd1a89ed4848865f75f5508525d966
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
startBLEScanInner
扫描蓝牙设备
private startBLEScanInner(): boolean { try { this.mAvailableDevices = []; if (this.mConnectBluetoothDevice.connectionState === ConnectionState.STATE_CONNECTED) { this.mAvailableDevices.push(this.mConnectBluetoothDevice); } AppStorage.setOrCreate('availableDevices', this.mAvailableDev...
AST#method_declaration#Left private startBLEScanInner 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#try_statement#Left try AST#block_statement#Left { AST#sta...
private startBLEScanInner(): boolean { try { this.mAvailableDevices = []; if (this.mConnectBluetoothDevice.connectionState === ConnectionState.STATE_CONNECTED) { this.mAvailableDevices.push(this.mConnectBluetoothDevice); } AppStorage.setOrCreate('availableDevices', this.mAvailableDev...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L355-L374
ff279e90f3b17421293dc24504d3b89f2f5452ee
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MainPage.ets
arkts
MainContent
主页面内容视图,包含可左右滑动的页面与底部 Lottie 导航 @returns {void} 无返回值
@Builder private MainContent() { Tabs({ index: this.vm.currentPageIndex, barPosition: this.breakpointState.isLG() ? BarPosition.Start : BarPosition.End }) { TabContent() { HomePage(); }.tabBar(this.tabBarItem(0)); TabContent() { CategoryPage(); }.tabBar(thi...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private MainContent 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 Tabs ( AST#component_parameters#Left { AST#component_p...
@Builder private MainContent() { Tabs({ index: this.vm.currentPageIndex, barPosition: this.breakpointState.isLG() ? BarPosition.Start : BarPosition.End }) { TabContent() { HomePage(); }.tabBar(this.tabBarItem(0)); TabContent() { CategoryPage(); }.tabBar(thi...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MainPage.ets#L53-L89
c488e41f97e4870c1386fa64210a137a1eb33711
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/ListDataSource.ets
arkts
deleteItem
在指定索引位置删除一个元素
public deleteItem(index: number): void { this.list.splice(index, 1); this.notifyDataDelete(index); }
AST#method_declaration#Left public deleteItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#...
public deleteItem(index: number): void { this.list.splice(index, 1); this.notifyDataDelete(index); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/ListDataSource.ets#L53-L56
256931f18a03a9db1313edcac49c1f72bdfc979b
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
渲染布局 @returns {void} 无返回值 @example RowSpaceAroundCenter() { Text("A"); Text("B"); Text("C"); }
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceAround, alignItems: VerticalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginVa...
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.SpaceAround, alignItems: VerticalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginVa...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L524-L539
79c961c750517c3a3cec3d0f65e258569e687c10
github
huazheleyoushang/harmony_template.git
9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8
entry/src/main/ets/viewmodel/HomeViewModel.ets
arkts
Home view model, providing page display data.
export class HomeViewModel { settingArr: Array<SettingData> = []; initSettingData(): Array<SettingData> { if (this.settingArr.length === 0) { this.settingArr = new Array(); let settingData = new SettingData(); settingData.settingName = $r('app.string.home_display_and_brightness'); setti...
AST#export_declaration#Left export AST#class_declaration#Left class HomeViewModel AST#class_body#Left { AST#property_declaration#Left settingArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SettingData AST#primary_t...
export class HomeViewModel { settingArr: Array<SettingData> = []; initSettingData(): Array<SettingData> { if (this.settingArr.length === 0) { this.settingArr = new Array(); let settingData = new SettingData(); settingData.settingName = $r('app.string.home_display_and_brightness'); setti...
https://github.com/huazheleyoushang/harmony_template.git/blob/9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8/entry/src/main/ets/viewmodel/HomeViewModel.ets#L21-L58
0466be42c89f1d60a9ef413876ddacb15b17a123
github
knight6236/Pomodoro-Timer.git
7810017895bdfaad31cb5b664edd08a712272080
entry/src/main/ets/pages/Index.ets
arkts
DeleteButton
添加删除按钮构建器
@Builder DeleteButton(task: Task) { Button() { Text('删除') .fontSize(16) .fontColor(Color.White) } .width(80) .height('100%') .backgroundColor(Color.Red) .onClick(() => { this.showDeleteConfirm(task); }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeleteButton AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left...
@Builder DeleteButton(task: Task) { Button() { Text('删除') .fontSize(16) .fontColor(Color.White) } .width(80) .height('100%') .backgroundColor(Color.Red) .onClick(() => { this.showDeleteConfirm(task); }) }
https://github.com/knight6236/Pomodoro-Timer.git/blob/7810017895bdfaad31cb5b664edd08a712272080/entry/src/main/ets/pages/Index.ets#L403-L416
7fee2e20d4ed0825a9ae6e8a5823253ea865bcd6
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Spacer.ets
arkts
SpaceHorizontalSmall
创建一个小水平间距(8vp) @returns {void} 无返回值
@Builder export function SpaceHorizontalSmall(): void { Blank().width($r("app.float.space_horizontal_small")); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceHorizontalSmall 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#ark...
@Builder export function SpaceHorizontalSmall(): void { Blank().width($r("app.float.space_horizontal_small")); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L100-L103
624444ebdae658e9a5f2018c060532b88662e6e1
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/TransitionAnimation/animation/src/main/ets/components/mainpage/Show.ets
arkts
Show
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...
@Component export struct Show { @State scale1: number = 1 @State opacity1: number = 1 @State active: boolean = false private select: number = 1 pageTransition() { if (this.select === 1) { PageTransitionEnter({ duration: 1200, curve: Curve.Ease }) .scale({ x: 0, y: 0 }) .translate({ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Show AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right scale1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Rig...
@Component export struct Show { @State scale1: number = 1 @State opacity1: number = 1 @State active: boolean = false private select: number = 1 pageTransition() { if (this.select === 1) { PageTransitionEnter({ duration: 1200, curve: Curve.Ease }) .scale({ x: 0, y: 0 }) .translate({ ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/TransitionAnimation/animation/src/main/ets/components/mainpage/Show.ets#L16-L31
ae7ab11de0020f2ea7da3bf688c04c3a0f3bace5
gitee