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
seasonZhu/HarmonyStudy.git
b55e58c962e9b39d5211337590bdd45f2c2349b3
entry/src/main/ets/utils/Immersion.ets
arkts
https://juejin.cn/post/7377202850378596364 封装开启/关闭沉浸式模式类
export class Immersion { onOrOff = false // 获取当前窗口对象,并返出 async fullScreen() { const lastWindow = await window.getLastWindow(getContext()) return lastWindow }
AST#export_declaration#Left export AST#class_declaration#Left class Immersion AST#class_body#Left { AST#property_declaration#Left onOrOff = AST#ERROR#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#boolean_li...
export class Immersion { onOrOff = false async fullScreen() { const lastWindow = await window.getLastWindow(getContext()) return lastWindow }
https://github.com/seasonZhu/HarmonyStudy.git/blob/b55e58c962e9b39d5211337590bdd45f2c2349b3/entry/src/main/ets/utils/Immersion.ets#L5-L13
2c2a10388d5333dff746490388e5c8442bf2eb70
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/utils.ets
arkts
创建用户属性
export function createPlayerAttrs(): TPersonAttr { const attr: TPersonAttr = { strength: Math.floor(Math.random() * 1e10 % 5) + 1, strong: Math.floor(Math.random() * 1e10 % 5) + 1, intellect: Math.floor(Math.random() * 1e10 % 5) + 1, luck: Math.floor(Math.random() * 1e10 % 3) + 1, } return attr }
AST#export_declaration#Left export AST#function_declaration#Left function createPlayerAttrs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TPersonAttr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declar...
export function createPlayerAttrs(): TPersonAttr { const attr: TPersonAttr = { strength: Math.floor(Math.random() * 1e10 % 5) + 1, strong: Math.floor(Math.random() * 1e10 % 5) + 1, intellect: Math.floor(Math.random() * 1e10 % 5) + 1, luck: Math.floor(Math.random() * 1e10 % 3) + 1, } return attr }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/utils.ets#L127-L135
90b03ffa182a5b2da1427c5ee4e6aee74582679e
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets
arkts
showLoadingText
/ 加载中 - 系统样式
public static showLoadingText(loadingText = '加载中...') { JhProgressHUD._showToast(loadingText, _ToastType.loading) }
AST#method_declaration#Left public static showLoadingText AST#parameter_list#Left ( AST#parameter#Left loadingText = AST#expression#Left '加载中...' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Lef...
public static showLoadingText(loadingText = '加载中...') { JhProgressHUD._showToast(loadingText, _ToastType.loading) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L69-L71
9eb41917adefe3ea0f98e656ccd6a4bfed51a9c6
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUICalculator/entry/src/main/ets/Calculator.ets
arkts
calculate
计算 @param input 例:input = '1.1-10%+2×3÷4'
public static calculate(input: string): string { // 先将百分数转为小数, input = input.replace(RegExp(`(((\\d*\\.\\d*)|(\\d+))%)`, 'g'), s => String(Number(s.replace(/%/, '')) / 100)) // input = '1.1-0.1+2×3÷4' // 要将input分割为数与运算符,分割节点的索引储存在splitIndex let splitIndex = [0] for (let i = 1;i < input.length; i++) ...
AST#method_declaration#Left public static calculate AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
public static calculate(input: string): string { input = input.replace(RegExp(`(((\\d*\\.\\d*)|(\\d+))%)`, 'g'), s => String(Number(s.replace(/%/, '')) / 100)) let splitIndex = [0] for (let i = 1;i < input.length; i++) { if (input[i].match(RegExp('(\\+|-|×|÷)')) != null) { splitInde...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUICalculator/entry/src/main/ets/Calculator.ets#L10-L30
55f155d8165dc1e6705f19972ec8a335efebfad9
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/index.ets
arkts
ImageKnifeComponent
Copyright (C) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { ImageKnifeComponent } from './src/main/ets/components/ImageKnifeComponent'
AST#export_declaration#Left export { ImageKnifeComponent } from './src/main/ets/components/ImageKnifeComponent' AST#export_declaration#Right
export { ImageKnifeComponent } from './src/main/ets/components/ImageKnifeComponent'
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/index.ets#L15-L15
91783940be4496995f7cdcad7b26d1dcff2fc2e8
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets
arkts
release
停止并且释放资源
static async release() { SpeechRecognizerManager.cancel() SpeechRecognizerManager.shutDown() }
AST#method_declaration#Left static async release 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 SpeechRecognizerManager AST#expression#Righ...
static async release() { SpeechRecognizerManager.cancel() SpeechRecognizerManager.shutDown() }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets#L129-L133
ee8db6679d2e436e08b26ccf1a85709ca0b2d1e4
gitee
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/DB/DistributedUtil.ets
arkts
deleteStoreData
删除指定键值的数据
async deleteStoreData(key: string) { if (!kvStore) { return; } try { kvStore.delete(key, (err) => { if (err !== undefined) { console.error(`Failed to delete data. Code:${err.code},message:${err.message}`); return; } console.info('Succeeded in deleting...
AST#method_declaration#Left async deleteStoreData AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left i...
async deleteStoreData(key: string) { if (!kvStore) { return; } try { kvStore.delete(key, (err) => { if (err !== undefined) { console.error(`Failed to delete data. Code:${err.code},message:${err.message}`); return; } console.info('Succeeded in deleting...
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/DB/DistributedUtil.ets#L63-L79
e8946d17db6d0d350fe0a5cdf804c3479243b620
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/flow_sensitive/normal_stmt/assign_expression_001_T.ets
arkts
Introduction 流敏感-常规语句-赋值表达式
export function assign_expression_001_T(taint_src : string) { let result = taint_src taint.Sink(result) }
AST#export_declaration#Left export AST#function_declaration#Left function assign_expression_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_state...
export function assign_expression_001_T(taint_src : string) { let result = taint_src taint.Sink(result) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/flow_sensitive/normal_stmt/assign_expression_001_T.ets#L6-L9
93c6aaff595fc44376fc4be7fe33a6e7463ed184
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/features/musicComment/src/main/ets/viewmodel/CommentViewModel.ets
arkts
getNewComment
Obtain the latest comment data. @returns Comment array.
getNewComment(): Comment[] { let commentList: Comment[] = []; commentList.push( new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar9'))); commentList.push(new Comment('139******92', '最爱的歌之一啦,超好听', '2021年9月4日', $r('app.media.ic_avatar10'))); commentList.push(new Com...
AST#method_declaration#Left getNewComment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef...
getNewComment(): Comment[] { let commentList: Comment[] = []; commentList.push( new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar9'))); commentList.push(new Comment('139******92', '最爱的歌之一啦,超好听', '2021年9月4日', $r('app.media.ic_avatar10'))); commentList.push(new Com...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/musicComment/src/main/ets/viewmodel/CommentViewModel.ets#L52-L60
4d461d11e878c0bf1636ff108cd8ee63e41012da
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
save
/============================PlanManager 中的Extension============================ / 保存到db
async save(): Promise<void> { await PlanManager.save(this); }
AST#method_declaration#Left async save 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#R...
async save(): Promise<void> { await PlanManager.save(this); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L474-L476
cdbdcde5c525dc365dc6ddd6dc26eef164fe0ad8
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/AlarmClock/AlarmList.ets
arkts
构建页面内容
build() { // 列表视图,包含闹钟项列表 List({ scroller: this.scroller, space: DimensionUtil.getVp($r('app.float.alarm_list_space')) }) { ForEach(this.alarmItems, (item: AlarmItem) => { ListItem() { // 闹钟项列表项 AlarmListItem({ alarmItem: item }); }.onClick(() => { // 点击闹钟项后导航...
AST#build_method#Left build ( ) AST#build_body#Left { // 列表视图,包含闹钟项列表 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#R...
build() { List({ scroller: this.scroller, space: DimensionUtil.getVp($r('app.float.alarm_list_space')) }) { ForEach(this.alarmItems, (item: AlarmItem) => { ListItem() { AlarmListItem({ alarmItem: item }); }.onClick(() => { router.pushUrl({ url: 'p...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/AlarmClock/AlarmList.ets#L16-L36
d6aaebe738bba6e7fa38c32e74f11bbc3d57e9c7
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/TabContentTouchHotZone/casesfeature/tabcontentoverflow/src/main/ets/view/Side.ets
arkts
Side
展示视频播放界面右侧用户头像、视频评论数量、收藏数量、分享数量、作者是否被用户关注等信息
@Component export struct Side { private head: Resource = $r('app.media.tabcontentoverflow_head_image'); // 头像 @State likeCount: number = 1234; // 点赞数量 @State commentCount: number = 2234; // 评论数量 @State favoriteCount: number = 3234; // 收藏数量 @State isFocus: boolean = false; // 是否关注 @State isLike: boolean = fa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Side AST#component_body#Left { AST#property_declaration#Left private head : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_e...
@Component export struct Side { private head: Resource = $r('app.media.tabcontentoverflow_head_image'); @State likeCount: number = 1234; @State commentCount: number = 2234; @State favoriteCount: number = 3234; @State isFocus: boolean = false; @State isLike: boolean = false; @State isFavorite: boolea...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/TabContentTouchHotZone/casesfeature/tabcontentoverflow/src/main/ets/view/Side.ets#L20-L203
4a8fc9bb7311d7793ef90ff6b781f27a1d8e337b
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.app.d.ets
arkts
getInfo
Obtains the declared information in the config.json file of an application. @returns { AppResponse } @syscap SystemCapability.ArkUI.ArkUI.Lite @since 3 Obtains the declared information in the config.json file of an application. It will return null when used in StageModel. @returns { AppResponse } @syscap SystemCapa...
static getInfo(): AppResponse;
AST#method_declaration#Left static getInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppResponse AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static getInfo(): AppResponse;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.app.d.ets#L254-L254
0c9be8e7af2a40275e4e0b774094bd2c6e36ec81
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/util/TextInputUtils.ets
arkts
计算基于中心的旋转角度,即手势从一个点拖动到另一个点时基于中心的旋转角度 @param center 中心点 @param oldAxis 老坐标 @param newAxis 新坐标 @returns 基于给定中心的旋转角度
export function getRotationAngle(center: Point, oldAxis: Point, newAxis: Point): number { const vecC2Old: Point = { x: oldAxis.x - center.x, y: oldAxis.y - center.y }; const vecC2New: Point = { x: newAxis.x - center.x, y: newAxis.y - center.y }; const angleOld = Math.atan2(vecC2Old.y, vecC2Old.x); const angleN...
AST#export_declaration#Left export AST#function_declaration#Left function getRotationAngle AST#parameter_list#Left ( AST#parameter#Left center : AST#type_annotation#Left AST#primary_type#Left Point AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left oldAxis : AST#type_annotation#Le...
export function getRotationAngle(center: Point, oldAxis: Point, newAxis: Point): number { const vecC2Old: Point = { x: oldAxis.x - center.x, y: oldAxis.y - center.y }; const vecC2New: Point = { x: newAxis.x - center.x, y: newAxis.y - center.y }; const angleOld = Math.atan2(vecC2Old.y, vecC2Old.x); const angleN...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/util/TextInputUtils.ets#L27-L45
335295b72823cd292e1d3e6a57bdb73a5afdec94
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/ConfigService.ets
arkts
destroy
销毁服务
async destroy(): Promise<void> { try { if (this.dataPreferences) { await this.dataPreferences.flush(); } this.dataPreferences = null; this.context = null; ConfigService.instance = null; console.info('[ConfigService] 配置服务已销毁'); } catch (error) { console.error('[...
AST#method_declaration#Left async destroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argument...
async destroy(): Promise<void> { try { if (this.dataPreferences) { await this.dataPreferences.flush(); } this.dataPreferences = null; this.context = null; ConfigService.instance = null; console.info('[ConfigService] 配置服务已销毁'); } catch (error) { console.error('[...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/ConfigService.ets#L273-L286
703e9de2bdb3d0e5f490fd727265a8585ae03cd0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/view/Side.ets
arkts
changeLikeCount
点击点赞按钮的回调函数
private changeLikeCount(isAdd: boolean) { let likeCountNum = Number(this.likeCount); if (isAdd) { likeCountNum++; } else { likeCountNum--; } this.likeCount = '' + likeCountNum; animateTo({ duration: 200, curve: Curve.EaseInOut }, () => { this.isLike = !this.isLike; }) }
AST#method_declaration#Left private changeLikeCount AST#parameter_list#Left ( AST#parameter#Left isAdd : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_decla...
private changeLikeCount(isAdd: boolean) { let likeCountNum = Number(this.likeCount); if (isAdd) { likeCountNum++; } else { likeCountNum--; } this.likeCount = '' + likeCountNum; animateTo({ duration: 200, curve: Curve.EaseInOut }, () => { this.isLike = !this.isLike; }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/view/Side.ets#L45-L56
1c4ed814ebacb95c65686007fd88f7b13dcfb621
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets
arkts
ListItemCard
列表卡片 @param {number} index - 序号 @returns {void} 无返回值
@Builder private ListItemCard(index: number): void { Column() { this.CardTitle($r("app.string.demo_screen_adapt_list_item_format", index)); SpaceVerticalSmall(); this.CardDesc($r("app.string.demo_screen_adapt_list_desc")); } .width(P100) .padding($r("app.float.space_padding_medium"...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ListItemCard 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_annotati...
@Builder private ListItemCard(index: number): void { Column() { this.CardTitle($r("app.string.demo_screen_adapt_list_item_format", index)); SpaceVerticalSmall(); this.CardDesc($r("app.string.demo_screen_adapt_list_desc")); } .width(P100) .padding($r("app.float.space_padding_medium"...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L165-L178
b4bdf6badc95722cbcbca569a21ae183c4f0522c
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
logRequest
打印请求日志 @param {InternalAxiosRequestConfig} config - 请求配置 @returns {void} 无返回值
function logRequest(config: InternalAxiosRequestConfig): void { const method: string = normalizeMethod(config.method); const url: string = buildRequestUrl(config); const params: string = safeStringify(config.params as Unknown, true); const data: string = safeStringify(config.data as Unknown, true); logInfoLin...
AST#function_declaration#Left function logRequest AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left InternalAxiosRequestConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Le...
function logRequest(config: InternalAxiosRequestConfig): void { const method: string = normalizeMethod(config.method); const url: string = buildRequestUrl(config); const params: string = safeStringify(config.params as Unknown, true); const data: string = safeStringify(config.data as Unknown, true); logInfoLin...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L48-L60
5aa6bb37bffd20f723267eae1e4f0a8ce45de7c8
github
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/Auth.ets
arkts
checkAuth2
传入回调函数,满足条件时执行被传入的回调函数
checkAuth2(callback:()=>void){ const user = this.getUser() if (user.token) { callback() }else { router.pushUrl({ url:'pages/LoginPage' }) } }
AST#method_declaration#Left checkAuth2 AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left 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#function_type#Ri...
checkAuth2(callback:()=>void){ const user = this.getUser() if (user.token) { callback() }else { router.pushUrl({ url:'pages/LoginPage' }) } }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/Auth.ets#L45-L54
c3c7740e121c066496d0f59b053b5584c76ac717
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/DynamicUtil.ets
arkts
hmac
消息认证码计算 @param str 计算字符串 @param symAlgName 秘钥规格 @returns
static async hmac(str: string, symAlgName: string): Promise<OutDTO<string>> { //创建消息认证码计算器 let mac = crypto.createMac(symAlgName); let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer); let updateLength = 200; // 默认以200字节为单位进行分段update let symKeyGenerator = crypto.createSymKeyGenerator('...
AST#method_declaration#Left static async hmac AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
static async hmac(str: string, symAlgName: string): Promise<OutDTO<string>> { let mac = crypto.createMac(symAlgName); let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer); let updateLength = 200; let symKeyGenerator = crypto.createSymKeyGenerator('AES256'); let symKey = awai...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/DynamicUtil.ets#L81-L99
5bd42d1eaa16ca551487f1267cb73fd49e75cfc7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
setFontSize
设置字体大小
async setFontSize(sizeType: FontSizeType): Promise<void> { try { if (!this.currentTheme) return; const sizeMultipliers = { [FontSizeType.SMALL]: 0.9, [FontSizeType.NORMAL]: 1.0, [FontSizeType.LARGE]: 1.1, [FontSizeType.EXTRA_LARGE]: 1.2 }; const oldFont = { ...
AST#method_declaration#Left async setFontSize AST#parameter_list#Left ( AST#parameter#Left sizeType : AST#type_annotation#Left AST#primary_type#Left FontSizeType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t...
async setFontSize(sizeType: FontSizeType): Promise<void> { try { if (!this.currentTheme) return; const sizeMultipliers = { [FontSizeType.SMALL]: 0.9, [FontSizeType.NORMAL]: 1.0, [FontSizeType.LARGE]: 1.1, [FontSizeType.EXTRA_LARGE]: 1.2 }; const oldFont = { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L309-L337
60669ebf22b6916d66582c5989f5c1e60e606198
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
DISPOSE
Dispose all nodes. USE THIS ONLY WHEN WINDOW IS ABOUT TO DESTROY!
DISPOSE() { for (let index = 0; index < this.NodeControllers.length; index++) { this.NodeControllers[index]?.detachWeb(); this.NodeControllers[index]?.dispose(); } }
AST#method_declaration#Left DISPOSE AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variab...
DISPOSE() { for (let index = 0; index < this.NodeControllers.length; index++) { this.NodeControllers[index]?.detachWeb(); this.NodeControllers[index]?.dispose(); } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L149-L154
a1405307f50b14619b201fec10491b61730cc442
gitee
Classaspen/ArkTS_PasswordManagement.git
66aea6e4f8ee3a78e5029c63186dba70707ca2d9
entry/src/main/ets/components/database/Database.ets
arkts
printoutdb
查询并输出整个表的数据
async printoutdb(table: string) { if (this.store) { let predicates = new relationalStore.RdbPredicates(table); this.store.query(predicates, [], (err, resultSet) => { if (err) { console.error('查询失败:', err); return; } let allData: Array<Record<string, Object>> ...
AST#method_declaration#Left async printoutdb AST#parameter_list#Left ( AST#parameter#Left table : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if (...
async printoutdb(table: string) { if (this.store) { let predicates = new relationalStore.RdbPredicates(table); this.store.query(predicates, [], (err, resultSet) => { if (err) { console.error('查询失败:', err); return; } let allData: Array<Record<string, Object>> ...
https://github.com/Classaspen/ArkTS_PasswordManagement.git/blob/66aea6e4f8ee3a78e5029c63186dba70707ca2d9/entry/src/main/ets/components/database/Database.ets#L267-L290
1dcdd46f0cc3fe2141998b79c8c03a37b1be428b
github
ericple/oh-bill
058af8872c927b9730467798549539e586e275fe
entry/src/main/ets/components/BalanceList.ets
arkts
calculateTotalIncomeBalance = (source: string) => { const billingInfo = JSON.parse(source); this.totalBalance = 0.00; this.totalIncome = 0.00; billingInfo.forEach(dayInfo => { dayInfo.forEach(info => { if (info.direction == "in") { this.totalIncome += parseFloat(info.amount); } else { this.totalBalance += parseFloat(in...
build() { Column() { if (this.currentBillingInfo.length == 0) { Row() { Text($r("app.string.no_record")) .fontColor(Color.Black) .fontSize(16) .fontWeight(FontWeight.Medium) }.height('100%') } else { List() { ForEach(Billing...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expre...
build() { Column() { if (this.currentBillingInfo.length == 0) { Row() { Text($r("app.string.no_record")) .fontColor(Color.Black) .fontSize(16) .fontWeight(FontWeight.Medium) }.height('100%') } else { List() { ForEach(Billing...
https://github.com/ericple/oh-bill/blob/058af8872c927b9730467798549539e586e275fe/entry/src/main/ets/components/BalanceList.ets#L61-L120
7775be84d55c073d03205f335bd7ab4de0094864
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/EditSchedule.ets
arkts
aboutToAppear
初始化被编辑的日程、文件夹、日程记录、各按钮显示的文字等数据。
public aboutToAppear(): void { if (router.getParams()?.['schedule']) { this.schedule = router.getParams()['schedule']; } if (router.getParams()?.['folder']) { this.folder = router.getParams()['folder']; } else { this.isSearch = true; } this.scheduleTable.getRdbStore(); this...
AST#method_declaration#Left public aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#sub...
public aboutToAppear(): void { if (router.getParams()?.['schedule']) { this.schedule = router.getParams()['schedule']; } if (router.getParams()?.['folder']) { this.folder = router.getParams()['folder']; } else { this.isSearch = true; } this.scheduleTable.getRdbStore(); this...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/EditSchedule.ets#L143-L163
69b2f649133eb16c28685cd4ffcf00cb0fd547d0
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/auth/RegisterPage.ets
arkts
validateForm
验证表单
validateForm(): boolean { let isValid = true; // 验证用户名 if (!this.username.trim()) { this.usernameError = '请输入用户名'; isValid = false; } else if (this.username.length < 3) { this.usernameError = '用户名长度不能少于3位'; isValid = false; } else if (this.usernameError) { // 如果已有错...
AST#method_declaration#Left validateForm 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#variable_declaration#Left let AST#variable_declarator#Left isValid = A...
validateForm(): boolean { let isValid = true; if (!this.username.trim()) { this.usernameError = '请输入用户名'; isValid = false; } else if (this.username.length < 3) { this.usernameError = '用户名长度不能少于3位'; isValid = false; } else if (this.usernameError) { isValid =...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/auth/RegisterPage.ets#L73-L135
bfe0465df3d4ee503dedec2d5798ac70a32c4922
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/component/HomeTopBar.ets
arkts
leftBuilder
左侧图标构建 @returns {void} 无返回值
@Builder private leftBuilder() { Image($r("app.media.ic_logo")) .attributeModifier(size(34)) .onClick((): void => this.onLeftTap()); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private leftBuilder 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 Image ( AST#expression#Left AST#resource_expression#Le...
@Builder private leftBuilder() { Image($r("app.media.ic_logo")) .attributeModifier(size(34)) .onClick((): void => this.onLeftTap()); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeTopBar.ets#L78-L83
11f42042b4521a69110d2a5090697615611cc096
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CustomAnimationTab/customanimationtab/src/main/ets/common/CommonConstants.ets
arkts
内置默认属性值 @since 1.0
export class CommonConstants { // 默认背景条伸缩比例 public static readonly DEFAULT_INDICATOR_EXPAND = 1.5; // 默认动画时长 public static readonly DEFAULT_ANIMATION_DURATION = 240; // 默认页签项宽度(单位: px) public static readonly DEFAULT_LIST_ITEM_WIDTH = 90; // 默认页签条到达边界后继续移动的偏移相对于手滑偏移的比例 public static readonly DEFAULT_LIST...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // 默认背景条伸缩比例 AST#property_declaration#Left public static readonly DEFAULT_INDICATOR_EXPAND = AST#expression#Left 1.5 AST#expression#Right ; AST#property_declaration#Right // 默认动画时长 AST#property_declaration#Left pub...
export class CommonConstants { public static readonly DEFAULT_INDICATOR_EXPAND = 1.5; public static readonly DEFAULT_ANIMATION_DURATION = 240; public static readonly DEFAULT_LIST_ITEM_WIDTH = 90; public static readonly DEFAULT_LIST_RELATIVE_RATIO = 0.25; public static readonly DEFAULT_TAB_SPRIN...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/common/CommonConstants.ets#L21-L76
fe1762eeb407ee5105dade1b73a40ce245689d1f
gitee
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
arkts
showCityConfirmDialog
显示确认弹窗
private showCityConfirmDialog(cityName: string) { this.selectedCity = cityName; this.showConfirmDialog = true; // 不要关闭搜索页面,保持当前状态 }
AST#method_declaration#Left private showCityConfirmDialog AST#parameter_list#Left ( AST#parameter#Left cityName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statemen...
private showCityConfirmDialog(cityName: string) { this.selectedCity = cityName; this.showConfirmDialog = true; }
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L356-L360
fd0995181f2de7ff4ec7861682f11dec3be52f4e
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/KvUtil.ets
arkts
@Author csx @DateTime 2024/8/6 11:08:24 @TODO KvUtil 数据持久化工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Feftool
export class KvUtil { /** * 管理数据库对象 */ private kvManager: distributedKVStore.KVManager | null = null; /** * 数据库实例 */ private kvStore: distributedKVStore.SingleKVStore | null = null; /** * 构造函数 * @param ctx */ constructor(ctx: common.Context) { this.init(ctx); } /** * 初始化 ...
AST#export_declaration#Left export AST#class_declaration#Left class KvUtil AST#class_body#Left { /** * 管理数据库对象 */ AST#property_declaration#Left private kvManager : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left distributedKVStore . KVManager AST#qualified_type#Right AST...
export class KvUtil { private kvManager: distributedKVStore.KVManager | null = null; private kvStore: distributedKVStore.SingleKVStore | null = null; constructor(ctx: common.Context) { this.init(ctx); } async init(ctx: common.Context) { let bundleInfo: bundleManager.BundleInfo = ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/KvUtil.ets#L27-L148
2b2386783cb17668a30b8ea60c395f7b68ce7c1f
gitee
openharmony-sig/ohos_axios
75d72897982ea6e10fa99c62c62a65425af0a568
entry/src/main/ets/pages/Index.ets
arkts
request
request请求
request() { this.clear() this.showUrl = this.getUrl; this.startTime = new Date().getTime(); axios.request<InfoModel, AxiosResponse<InfoModel>, IdModel>({ url: this.getUrl, method: 'get', connectTimeout: this.connectTimeout, readTimeout: this.readTimeout, maxBodyLength: thi...
AST#method_declaration#Left request AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clear AST#member_expression#...
request() { this.clear() this.showUrl = this.getUrl; this.startTime = new Date().getTime(); axios.request<InfoModel, AxiosResponse<InfoModel>, IdModel>({ url: this.getUrl, method: 'get', connectTimeout: this.connectTimeout, readTimeout: this.readTimeout, maxBodyLength: thi...
https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/pages/Index.ets#L398-L419
9fb566e945b5d510bc97c42e28cab2544ef2be3b
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_platform/ace_ets_module_platform_api11/entry/src/main/ets/MainAbility/pages/XComponent/Log.ets
arkts
showError
print error level log @param {string} tag - Page or class tag @param {string} log - Log needs to be printed
static showError(tag: string, log: undefined|null|string|number) { console.error(`${TAG} tag: ${tag} --> ${log}`); }
AST#method_declaration#Left static showError AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left undefin...
static showError(tag: string, log: undefined|null|string|number) { console.error(`${TAG} tag: ${tag} --> ${log}`); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_platform/ace_ets_module_platform_api11/entry/src/main/ets/MainAbility/pages/XComponent/Log.ets#L48-L50
3ad11befbe6d7da2e57726ea942cf3b82faccccb
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_json/src/main/ets/json/JSONArray.ets
arkts
if
判断是否是json数组
if (JSONUtil.isJSONArray(replaceStr)) { //转换成jsonArray let res = JSONArray.parse(replaceStr); //返回结果 let list = new Array<T>(); //递归 res.forEach(item => { if (item instanceof HashMap) { let tmp = item as HashMap<string, JSONValue>; let jsonObj = new JSONOb...
AST#method_declaration#Left if AST#ERROR#Left ( JSONUtil . isJSONArray AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left replaceStr AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left ) AST#ERROR#Right AST#block_statement#Left { //转换成jsonArray AST#statement#Left AST#variable_declaration#Left let AS...
if (JSONUtil.isJSONArray(replaceStr)) { let res = JSONArray.parse(replaceStr); let list = new Array<T>(); res.forEach(item => { if (item instanceof HashMap) { let tmp = item as HashMap<string, JSONValue>; let jsonObj = new JSONObject(); tmp.fo...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONArray.ets#L69-L92
4e0d09059c3a74dedf2b75c9d24021d4da56a776
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LanguageSettingsPage.ets
arkts
loadLanguageData
私有方法 加载语言数据
private async loadLanguageData(): Promise<void> { try { this.isLoading = true; this.currentLanguage = this.i18nManager.getCurrentLanguage(); this.supportedLanguages = this.i18nManager.getSupportedLanguages(); this.config = this.i18nManager.getConfig(); // 获取推荐语言 thi...
AST#method_declaration#Left private async loadLanguageData 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 > ...
private async loadLanguageData(): Promise<void> { try { this.isLoading = true; this.currentLanguage = this.i18nManager.getCurrentLanguage(); this.supportedLanguages = this.i18nManager.getSupportedLanguages(); this.config = this.i18nManager.getConfig(); this.detecte...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L537-L555
a042f9a39c488fefd88a03d047ba42e4aa6b3537
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/base/IBasePickerOptions.ets
arkts
弹窗Picker参数
export interface IBasePickerOptions extends IBaseDialogOptions { /** * 弹框样式 */ style?: IPickerDialogStyle; /** * 弹框标题 */ title?: ResourceStr; /** * 弹框左侧按钮。 */ primaryButton?: ButtonOptions | ResourceStr | CustomButtonOptions; /** *弹框右侧按钮。 */ secondaryButton?: ButtonOptions | R...
AST#export_declaration#Left export AST#interface_declaration#Left interface IBasePickerOptions AST#extends_clause#Left extends IBaseDialogOptions AST#extends_clause#Right AST#object_type#Left { /** * 弹框样式 */ AST#type_member#Left style ? : AST#type_annotation#Left AST#primary_type#Left IPickerDialogStyle AST#prima...
export interface IBasePickerOptions extends IBaseDialogOptions { style?: IPickerDialogStyle; title?: ResourceStr; primaryButton?: ButtonOptions | ResourceStr | CustomButtonOptions; secondaryButton?: ButtonOptions | ResourceStr | CustomButtonOptions; canLoop?: boolean; bottomCheck?: IC...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/base/IBasePickerOptions.ets#L11-L41
164bec25f366e208193ff34d1128dbce1c3742a1
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
appendMemPiece
MARK: - Operation in memo / 在内存中添加piece
appendMemPiece(piece: Piece): void { this.pieces.push(piece); }
AST#method_declaration#Left appendMemPiece AST#parameter_list#Left ( AST#parameter#Left piece : AST#type_annotation#Left AST#primary_type#Left Piece 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...
appendMemPiece(piece: Piece): void { this.pieces.push(piece); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L179-L181
d027547829b9402bc1e2d55dcfd65fa763397878
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserChannelOverride.ets
arkts
其他需要映射的属性...
constructor(data: Object) { // 应用约束1: 禁止any类型,使用具体类型Object this.patch(data); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left data : 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#block_statement#Left { // 应用约束1: 禁止any类型,使用具体类型Object AST#statement#L...
constructor(data: Object) { this.patch(data); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserChannelOverride.ets#L14-L16
46ef5901689519bd5e308d4d4ed338c8e4d8afd9
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
entry/src/main/ets/pages/Index.ets
arkts
mediaPicker
图片、视频选择器,拉起系统图库不需要申请存储权限,只能获取选中的图片、视频
mediaPicker() { TaoYao.with(this.context) .media() .onSuccess((uris) => { uris.forEach((uri) => { console.log("yunfei", uri) }) }) .onError((err) => { console.log(err.stack) }) .select(new MediaBuilder() // 选择媒体文件的最大数目 .setMaxSele...
AST#method_declaration#Left mediaPicker AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#mem...
mediaPicker() { TaoYao.with(this.context) .media() .onSuccess((uris) => { uris.forEach((uri) => { console.log("yunfei", uri) }) }) .onError((err) => { console.log(err.stack) }) .select(new MediaBuilder() .setMaxSelectNumber(10) ...
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/entry/src/main/ets/pages/Index.ets#L189-L206
db406e8f6291b3f31b7a2336bfde719279b920d6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
parseResult
解析网络监听结果,用于打印日志 @param data 网络监听结果 @returns 解析后的结果数据
parseResult(data: emitter.EventData): string { if (data.data) { if (!data.data.eventName) { logger.info("parseResult data.data.eventName is undefined.") return ""; } } else { logger.info("parseResult data.data is undefined.") return ""; } let result = ""; let ...
AST#method_declaration#Left parseResult AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left emitter . EventData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left :...
parseResult(data: emitter.EventData): string { if (data.data) { if (!data.data.eventName) { logger.info("parseResult data.data.eventName is undefined.") return ""; } } else { logger.info("parseResult data.data is undefined.") return ""; } let result = ""; let ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L353-L367
ac7b14038200d283fc17622cb54e688c6c73ada9
gitee
DEMON-coding/HarmonyOs-Clock-Demo.git
f3c71a3d5ac478d463dfed068b89582104d2f9f6
entry/src/main/ets/common/utils/NotificationUtil.ets
arkts
发布文字通知 @param id 通知ID(建议唯一) @param title 通知标题 @param text 通知内容
export function publishSimpleNotification(id: number, title: string, text: string) { // 确保添加通知槽 notificationManager.addSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION) .then(() => { console.info('addSlot success'); // 发送通知 let notificationRequest: notificationManager.NotificationReques...
AST#export_declaration#Left export AST#function_declaration#Left function publishSimpleNotification AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotatio...
export function publishSimpleNotification(id: number, title: string, text: string) { notificationManager.addSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION) .then(() => { console.info('addSlot success'); let notificationRequest: notificationManager.NotificationRequest = { id:...
https://github.com/DEMON-coding/HarmonyOs-Clock-Demo.git/blob/f3c71a3d5ac478d463dfed068b89582104d2f9f6/entry/src/main/ets/common/utils/NotificationUtil.ets#L23-L53
aaaad48ee174f9e39ffd97a97a97a4e4e35a1052
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/model/PositionModel.ets
arkts
PositionModel
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Observed export class PositionModel { x: number; y: number; constructor(x: number = 0, y: number = 0) { this.x = x; this.y = y; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class PositionModel AST#class_body#Left { AST#property_declaration#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_...
@Observed export class PositionModel { x: number; y: number; constructor(x: number = 0, y: number = 0) { this.x = x; this.y = y; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/model/PositionModel.ets#L16-L25
f201558edd8a2a9d24910a8c88fbdd726659eb4f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
generateSM2Key
生成SM2的非对称密钥 @returns SM2密钥{publicKey:公钥,privateKey:私钥}
static async generateSM2Key(): Promise<OutDTO<CryptoKey>> { return CryptoUtil.generateCryptoKey('SM2_256'); }
AST#method_declaration#Left static async generateSM2Key AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#...
static async generateSM2Key(): Promise<OutDTO<CryptoKey>> { return CryptoUtil.generateCryptoKey('SM2_256'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2.ets#L32-L34
4e1cce296fa72617f8932e09fba63d9d35ca80f1
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/AppUtility.ets
arkts
getClippedStringWithoutKindFrom
/ clip cn string, only get translation
static getClippedStringWithoutKindFrom(srcText: string): string { let str: string = srcText; const kind: string | null = AppUtility.getKindFrom(srcText); if (kind !== null) { const indexNoFound: number = -1; const index: number = str.indexOf(kind); if (index !== indexNoFound) { con...
AST#method_declaration#Left static getClippedStringWithoutKindFrom AST#parameter_list#Left ( AST#parameter#Left srcText : 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...
static getClippedStringWithoutKindFrom(srcText: string): string { let str: string = srcText; const kind: string | null = AppUtility.getKindFrom(srcText); if (kind !== null) { const indexNoFound: number = -1; const index: number = str.indexOf(kind); if (index !== indexNoFound) { con...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L305-L317
dc9665c311858522b13cf46bb34e3147cad26825
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Sync.ets
arkts
showEccSpecDetailInfo
打印ECC密钥规格
function showEccSpecDetailInfo(key: cryptoFramework.PubKey | cryptoFramework.PriKey, keyType: string) { console.info('show detail of ' + keyType + ':'); try { let p = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FP_P_BN); showBigIntInfo('--- p', p); // length is 224, hex : ffffffffffffffffffffffffff...
AST#function_declaration#Left function showEccSpecDetailInfo AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#L...
function showEccSpecDetailInfo(key: cryptoFramework.PubKey | cryptoFramework.PriKey, keyType: string) { console.info('show detail of ' + keyType + ':'); try { let p = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FP_P_BN); showBigIntInfo('--- p', p); let a = key.getAsyKeySpec(cryptoFramework.Asy...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Sync.ets#L58-L93
7b94188cb84305b2c0f290edf35a1dd41128ff9e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/TrendsDataSource.ets
arkts
deleteDataByIndex
删除列表中处于index位置的对象
public deleteDataByIndex(index: number): void { Logger.info(TAG, `delete data , index = ${index}}`); this.commentsList.splice(index, 1); this.notifyDataDelete(index); }
AST#method_declaration#Left public deleteDataByIndex 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#primar...
public deleteDataByIndex(index: number): void { Logger.info(TAG, `delete data , index = ${index}}`); this.commentsList.splice(index, 1); this.notifyDataDelete(index); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/TrendsDataSource.ets#L101-L105
94fbaa136bcc942ec0610ea5c3d6677f55d92098
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/view/GoodsCommentPage.ets
arkts
构建商品评论页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "商品评论", viewModel: this.vm }) { this.GoodsCommentContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "商品评论" AST#expression#Right AST#component_parameter#Right , AST#component_...
build() { AppNavDestination({ title: "商品评论", viewModel: this.vm }) { this.GoodsCommentContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsCommentPage.ets#L20-L27
b6633a4350d3df3aca07c095468cf940bd2b3da3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
testVibration
测试震动功能
private async testVibration(): Promise<void> { try { console.log('[Settings] Testing vibration...'); // 创建震动效果 const vibrateEffect: vibrator.VibrateTime = { type: 'time', duration: 500 }; // 执行震动 try { await vibrator.startVibration(vibrateEffect, { usage...
AST#method_declaration#Left private async testVibration 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...
private async testVibration(): Promise<void> { try { console.log('[Settings] Testing vibration...'); const vibrateEffect: vibrator.VibrateTime = { type: 'time', duration: 500 }; try { await vibrator.startVibration(vibrateEffect, { usage: 'notification'...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1249-L1282
281353ff04df7e21095b968036f98e674eb2e1b6
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationManagementUtil.ets
arkts
setBadgeNumber
设置角标
async setBadgeNumber(num: number) { await notification.setBadgeNumber(num).then(() => { this.badgeNum = num; logger.info("displayBadge success"); }); }
AST#method_declaration#Left async setBadgeNumber AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#exp...
async setBadgeNumber(num: number) { await notification.setBadgeNumber(num).then(() => { this.badgeNum = num; logger.info("displayBadge success"); }); }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationManagementUtil.ets#L60-L65
4c34a021552b10f978532c5651bcbc233c0caa2d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onMemoryLevel
内存级别警告回调 @param level 内存警告级别
onMemoryLevel(level: AbilityConstant.MemoryLevel): void { console.log(`[EntryAbility] Ability onMemoryLevel: ${level}`); hilog.info(0x0001, 'AI生日提醒', 'Ability onMemoryLevel: %{public}d', level); // 根据内存级别进行相应处理 this.handleMemoryWarning(level); }
AST#method_declaration#Left onMemoryLevel AST#parameter_list#Left ( AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AbilityConstant . MemoryLevel AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : A...
onMemoryLevel(level: AbilityConstant.MemoryLevel): void { console.log(`[EntryAbility] Ability onMemoryLevel: ${level}`); hilog.info(0x0001, 'AI生日提醒', 'Ability onMemoryLevel: %{public}d', level); this.handleMemoryWarning(level); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L103-L110
37c81f10cd65cc46b78c761b771511a5e023076a
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/web/UploadInWeb/entry/src/main/ets/pages/Index.ets
arkts
copyResFile2Sandbox
复制资源文件到沙箱
async copyResFile2Sandbox(resFile: string): Promise<boolean> { let context = getContext(this) //计划复制到的目标路径 let realUri = context.cacheDir + "/" + resFile let rawFd = await context.resourceManager.getRawFd(resFile) //复制资源文件到沙箱cache文件夹 try { fs.copyFileSync(rawFd.fd, realUri) this.san...
AST#method_declaration#Left async copyResFile2Sandbox AST#parameter_list#Left ( AST#parameter#Left resFile : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_...
async copyResFile2Sandbox(resFile: string): Promise<boolean> { let context = getContext(this) let realUri = context.cacheDir + "/" + resFile let rawFd = await context.resourceManager.getRawFd(resFile) try { fs.copyFileSync(rawFd.fd, realUri) this.sandboxFilePath = realUri re...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/web/UploadInWeb/entry/src/main/ets/pages/Index.ets#L157-L172
5c135a9f41756368ca861c4593b20d81b6bc26be
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
saveAddress
保存地址 @returns {void} 无返回值
private saveAddress(): void { const address: Address = new Address(); address.id = this.isEditMode ? this.addressId : 0; address.contact = this.contactName; address.phone = this.phone; address.province = this.province; address.city = this.city; address.district = this.district; address.a...
AST#method_declaration#Left private saveAddress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left addre...
private saveAddress(): void { const address: Address = new Address(); address.id = this.isEditMode ? this.addressId : 0; address.contact = this.contactName; address.phone = this.phone; address.province = this.province; address.city = this.city; address.district = this.district; address.a...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L340-L356
25cdd923c0366d5bfc094c713e11f4b592f01276
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
common/src/main/ets/component/CheckingDots.ets
arkts
cycleDisplay
loop newVersionDotText with CHECKING_DOTS array.
private cycleDisplay(): void { if (this.checkingTid == null) { let index = 0; this.dotNumber = index; this.checkingTid = setInterval(() => { this.dotNumber = index++%3; }, 500); } }
AST#method_declaration#Left private cycleDisplay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#...
private cycleDisplay(): void { if (this.checkingTid == null) { let index = 0; this.dotNumber = index; this.checkingTid = setInterval(() => { this.dotNumber = index++%3; }, 500); } }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/component/CheckingDots.ets#L59-L67
a7896e472dd2fd86df6eb568814319037979964a
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/frame/AbilityKit/DataSynchronization/entry/src/main/ets/viewModel/CommonData.ets
arkts
收支数据类
export class MoneyType { type: string;//支出或收入 money: number;//金额 constructor(type: string, money: number) { this.type = type; this.money = money; } }
AST#export_declaration#Left export AST#class_declaration#Left class MoneyType AST#class_body#Left { AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //支出或收入 AST#property_declaration#Left money : A...
export class MoneyType { type: string; money: number; constructor(type: string, money: number) { this.type = type; this.money = money; } }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/frame/AbilityKit/DataSynchronization/entry/src/main/ets/viewModel/CommonData.ets#L4-L12
78c8f43376bc81655c8a732c5802c2f83bfa8e10
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/highlight/Highlight.ets
arkts
getDrawX
Returns the x-position in pixels where this highlight object was last drawn. @return
public getDrawX(): number { return this.mDrawX; }
AST#method_declaration#Left public getDrawX AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expressi...
public getDrawX(): number { return this.mDrawX; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/Highlight.ets#L176-L178
6b15056343abd8c471a831b083916f510b0a3172
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/router/Router.ets
arkts
executeGuards
执行路由守卫
private async executeGuards(route: RouteConfig): Promise<boolean> { for (const guard of this.guards) { const result = guard(route); if (result instanceof Promise) { const passed = await result; if (!passed) { return false; } } else if (!result) { return fa...
AST#method_declaration#Left private async executeGuards AST#parameter_list#Left ( AST#parameter#Left route : AST#type_annotation#Left AST#primary_type#Left RouteConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gen...
private async executeGuards(route: RouteConfig): Promise<boolean> { for (const guard of this.guards) { const result = guard(route); if (result instanceof Promise) { const passed = await result; if (!passed) { return false; } } else if (!result) { return fa...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Router.ets#L87-L100
976f18fd3ef004039cc941c5a309d066e8772a13
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/RabinKarp.ets
arkts
compareStrings
比较两个字符串是否相等 @param text 文本 @param pattern 模式串 @param start 文本中的起始位置 @returns 是否相等
private static compareStrings(text: string, pattern: string, start: number): boolean { for (let i = 0; i < pattern.length; i++) { if (text[start + i] !== pattern[i]) { return false; } } return true; }
AST#method_declaration#Left private static compareStrings 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 pattern : AST#type_annotation#Left AST#primary_type#Left string AS...
private static compareStrings(text: string, pattern: string, start: number): boolean { for (let i = 0; i < pattern.length; i++) { if (text[start + i] !== pattern[i]) { return false; } } return true; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L87-L94
26a481d56e5d54556eef87c18fb418e9162f97a0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets
arkts
stopRecording
停止录音时释放资源 ✅
private async stopRecording(): Promise<void> { if (!this.isRecording) return; try { await this.avRecorder?.stop(); await this.avRecorder?.release(); } catch (err) { console.error(`停止录音失败: ${JSON.stringify(err)}`); } finally { // 关闭文件描述符 if (this.recordFile?.fd) { a...
AST#method_declaration#Left private async stopRecording 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...
private async stopRecording(): Promise<void> { if (!this.isRecording) return; try { await this.avRecorder?.stop(); await this.avRecorder?.release(); } catch (err) { console.error(`停止录音失败: ${JSON.stringify(err)}`); } finally { if (this.recordFile?.fd) { await fs.cl...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets#L132-L154
b2ea7d650030639d139a4192e8c1a608a675edf1
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/common/datasource/MovieListData.ets
arkts
Stills data
export const STILLS_DATA: Resource[] = [ $r("app.media.ic_movie_one"), $r("app.media.ic_movie_seven"), $r("app.media.ic_movie_eight"), $r("app.media.ic_movie_three") ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left STILLS_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expre...
export const STILLS_DATA: Resource[] = [ $r("app.media.ic_movie_one"), $r("app.media.ic_movie_seven"), $r("app.media.ic_movie_eight"), $r("app.media.ic_movie_three") ];
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/common/datasource/MovieListData.ets#L159-L164
9b47fb517588736f4e2d09c782761567587e7d75
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/CropTransformation.ets
arkts
CropTransformation
图片变换:自定义裁剪效果
@Sendable export class CropTransformation extends PixelMapTransformation { private mWidth: number = 0; private mHeight: number = 0; private mCropType: number = 0; constructor(width: number, height: number, cropType: number) { super(); this.mWidth = width; this.mHeight = height; this.mCropType =...
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class CropTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private mWidth : AST#...
@Sendable export class CropTransformation extends PixelMapTransformation { private mWidth: number = 0; private mHeight: number = 0; private mCropType: number = 0; constructor(width: number, height: number, cropType: number) { super(); this.mWidth = width; this.mHeight = height; this.mCropType =...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/CropTransformation.ets#L22-L84
0ac3c6e5ebb096640afa0fa3b359c2cf13822b3b
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/ComponentBase.ets
arkts
getYOffset
Returns the used offset on the x-axis for drawing the axis labels. This offset is applied before and after the label. @return
public getYOffset(): number { return this.mYOffset; }
AST#method_declaration#Left public getYOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
public getYOffset(): number { return this.mYOffset; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L79-L81
17dae15478cd8215705b67669a12ca12e2f34b64
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/auth/UserSession.ets
arkts
私有构造函数,防止直接实例化
private constructor() { console.info('UserSession: 构造函数调用'); }
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Rig...
private constructor() { console.info('UserSession: 构造函数调用'); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/auth/UserSession.ets#L45-L47
6ee6f87024d7cb283e0f61546f031b765f458d96
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Piece.ets
arkts
MARK: - 构造函数 构造函数 @param pieceNo - piece编号 @param wordIds - wordIds数组
constructor(pieceNo: number, wordIds: number[]) { this._pieceNo = pieceNo; this._wordIds = wordIds; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left pieceNo : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left...
constructor(pieceNo: number, wordIds: number[]) { this._pieceNo = pieceNo; this._wordIds = wordIds; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Piece.ets#L43-L46
419d9b544d131330a2bc3996c9a45e7ca66bf32b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/moduleOptimize.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export let dataOptimize = 'data from module';
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left dataOptimize = AST#expression#Left 'data from module' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export let dataOptimize = 'data from module';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyTheApplicationLevelArkUI/moduleOptimize.ets#L16-L16
22df5f44f499fa5fa931fdbb193d5873ca92680c
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bridges/Audio/InnerAudioTask.ets
arkts
Audio 实体
export class InnerAudioTask { audioId: string = '' paused: boolean = false startTime: number = 0 currentTime: number = 0 duration: number = 0 obeyMuteSwitch: boolean = false autoPlay: boolean = false loop: boolean = false src: string = '' }
AST#export_declaration#Left export AST#class_declaration#Left class InnerAudioTask AST#class_body#Left { AST#property_declaration#Left audioId 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 paused : bo...
export class InnerAudioTask { audioId: string = '' paused: boolean = false startTime: number = 0 currentTime: number = 0 duration: number = 0 obeyMuteSwitch: boolean = false autoPlay: boolean = false loop: boolean = false src: string = '' }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/Audio/InnerAudioTask.ets#L4-L14
79804ab8842fa04619a7f2dfed28dc0fcc651bbd
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/Recorder/entry/src/main/ets/common/CheckTitle.ets
arkts
CheckTitle
Copyright (c) 2022-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,...
@Component export struct CheckTitle { @Link checkNum: number; @Link checkState: boolean; build() { Row() { Image($r('app.media.close')) .id('closeCheck') .size({ width: 40, height: '100%' }) .objectFit(ImageFit.Contain) .margin(10) .onClick(() => { this...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CheckTitle AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right checkNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotat...
@Component export struct CheckTitle { @Link checkNum: number; @Link checkState: boolean; build() { Row() { Image($r('app.media.close')) .id('closeCheck') .size({ width: 40, height: '100%' }) .objectFit(ImageFit.Contain) .margin(10) .onClick(() => { this...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Recorder/entry/src/main/ets/common/CheckTitle.ets#L16-L52
6ea5d27a43e2666eae2faf51d5d446051248e5d1
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/PowerManagerUtil.ets
arkts
getPowerModeName
MODE_NORMAL 600 表示标准模式,默认值。 MODE_POWER_SAVE 601 表示省电模式。 MODE_PERFORMANCE 602 表示性能模式。 MODE_EXTREME_POWER_SAVE 603 表示超级省电模式。
static async getPowerModeName(): Promise<string> { let powerModeNames: Array<string> = await getStringArray($r('app.strarray.power_mode')) switch (power.getPowerMode()) { case powerModes[0]: return powerModeNames[0]; case powerModes[1]: return powerModeNames[1]; case powerModes...
AST#method_declaration#Left static async getPowerModeName 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 >...
static async getPowerModeName(): Promise<string> { let powerModeNames: Array<string> = await getStringArray($r('app.strarray.power_mode')) switch (power.getPowerMode()) { case powerModes[0]: return powerModeNames[0]; case powerModes[1]: return powerModeNames[1]; case powerModes...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/PowerManagerUtil.ets#L37-L50
488b65946a1e47e5b458a44e4fd3c235d808add1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
闰月信息接口
export interface LeapMonthInfo { month: number; days: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LeapMonthInfo AST#object_type#Left { AST#type_member#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left days : AST#type_annotation#Lef...
export interface LeapMonthInfo { month: number; days: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L89-L92
609d435cb0f976b81d82ebe779978282019453b5
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/search/BinarySearch.ets
arkts
findLast
查找最后一个等于目标值的元素 @param arr 已排序的数组 @param target 目标值 @returns 最后一个等于目标值的元素索引,如果不存在则返回-1
public static findLast(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } let left = 0; let right = arr.length - 1; let result = -1; while (left <= right) { const mid = Math.floor((left + right) / 2); if (arr[mid] === target) { ...
AST#method_declaration#Left public static findLast AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation#...
public static findLast(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } let left = 0; let right = arr.length - 1; let result = -1; while (left <= right) { const mid = Math.floor((left + right) / 2); if (arr[mid] === target) { ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/BinarySearch.ets#L71-L94
74532a58d8cb8d5f34fb0352c83c0ca89686f41e
github
Million-mo/tree-sitter-arkts.git
2fd0ad75e2d848709edcf4be038f27b178114ef6
examples/custom_builders.ets
arkts
listItemBuilder
本地Builder方法 - 带参数的复杂Builder
@Builder listItemBuilder(item: string, index: number, isSelected: boolean) { Row() { Checkbox({ name: `checkbox_${index}`, group: 'itemGroup' }) .select(isSelected) .selectedColor(Color.Blue) .onChange((value: boolean) => { this.selectedItems[index] = value }) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right listItemBuilder 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#Lef...
@Builder listItemBuilder(item: string, index: number, isSelected: boolean) { Row() { Checkbox({ name: `checkbox_${index}`, group: 'itemGroup' }) .select(isSelected) .selectedColor(Color.Blue) .onChange((value: boolean) => { this.selectedItems[index] = value }) ...
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/custom_builders.ets#L103-L138
90ce9e0c87cfce3a3f978956529bcc81cfd98f8b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/Index.ets
arkts
buildBottomNavigation
构建底部导航栏
@Builder buildBottomNavigation() { Tabs({ index: this.currentTabIndex }) { TabContent() { // 首页内容在主区域显示 } .tabBar(this.buildTabBarItem('首页', $r('app.media.ic_home'), 0)) TabContent() { // 联系人内容在主区域显示 } .tabBar(this.buildTabBarItem('联系人', $r('app.media.ic_...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBottomNavigation 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...
@Builder buildBottomNavigation() { Tabs({ index: this.currentTabIndex }) { TabContent() { } .tabBar(this.buildTabBarItem('首页', $r('app.media.ic_home'), 0)) TabContent() { } .tabBar(this.buildTabBarItem('联系人', $r('app.media.ic_contacts'), 1)) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L459-L493
39b0297925fb2bbe07fe379f25c086c8af847f29
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/loaderStrategy/IImageLoaderStrategy.ets
arkts
定义图片加载策略接口
export interface IImageLoaderStrategy { loadImage( request: RequestJobRequest, requestList: List<ImageKnifeRequestWithSource> | undefined, fileKey: string, callBackData: ImageKnifeData, callBackTimeInfo: TimeInfo ): Promise<void>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IImageLoaderStrategy AST#object_type#Left { AST#type_member#Left loadImage AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left RequestJobRequest AST#primary_type#Right AST#type_annotation#Right ...
export interface IImageLoaderStrategy { loadImage( request: RequestJobRequest, requestList: List<ImageKnifeRequestWithSource> | undefined, fileKey: string, callBackData: ImageKnifeData, callBackTimeInfo: TimeInfo ): Promise<void>; }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/loaderStrategy/IImageLoaderStrategy.ets#L19-L27
f2c4cbeff202db059afa91bd7ec80a0d849e55dd
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/GiftComponent.ets
arkts
handleSendGift
发送礼物(触发事件传递给父组件)
private handleSendGift(gift: VHGiftItem) { this.closePopup(); }
AST#method_declaration#Left private handleSendGift AST#parameter_list#Left ( AST#parameter#Left gift : AST#type_annotation#Left AST#primary_type#Left VHGiftItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left ...
private handleSendGift(gift: VHGiftItem) { this.closePopup(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/GiftComponent.ets#L117-L119
9dffc5850fe41cf6745da6b28f163fa654e765ee
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/ValidationUtils.ets
arkts
validateName
验证姓名 @param name 姓名 @param type 姓名类型(chinese | english | mixed) @returns 是否有效
static validateName(name: string, type: 'chinese' | 'english' | 'mixed' = 'mixed'): boolean { if (!name || name.trim() === '') { return false; } const trimmedName = name.trim(); switch (type) { case 'chinese': return RegexConstants.CHINESE_NAME_REGEX.test(trimmedName); ...
AST#method_declaration#Left static validateName AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type AST#ERROR#Left : 'chinese' | 'english' | 'mixed' AST#ERROR#Right = AST#...
static validateName(name: string, type: 'chinese' | 'english' | 'mixed' = 'mixed'): boolean { if (!name || name.trim() === '') { return false; } const trimmedName = name.trim(); switch (type) { case 'chinese': return RegexConstants.CHINESE_NAME_REGEX.test(trimmedName); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/ValidationUtils.ets#L43-L58
9baea06aeaf68d0b90106325bdc0570382549309
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets
arkts
doHttpRequest
发起http请求
doHttpRequest() { //http请求对象 let httpRequest = http.createHttp(); let opt: http.HttpRequestOptions = { method: http.RequestMethod.GET, expectDataType: http.HttpDataType.STRING } //配置服务端证书PIN码 if (this.isServerCertFixed) { let certPinning: http.CertificatePinning = { publicKey...
AST#method_declaration#Left doHttpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //http请求对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left...
doHttpRequest() { let httpRequest = http.createHttp(); let opt: http.HttpRequestOptions = { method: http.RequestMethod.GET, expectDataType: http.HttpDataType.STRING } if (this.isServerCertFixed) { let certPinning: http.CertificatePinning = { publicKeyHash: this.fixedCertPub...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets#L143-L166
4c0edf63e2f41bbcae3799dce37212efd7710ff1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
getCachedLunarInfo
获取缓存的农历信息
private getCachedLunarInfo(date: Date): LunarDate | null { const dateKey = this.formatDateKey(date); let cached = this.lunarDateCache.get(dateKey); if (!cached) { // 如果缓存中没有,使用精确农历计算 const lunarInfo = LunarCalendar.solarToLunar(date.getFullYear(), date.getMonth() + 1, date.getDate()); if ...
AST#method_declaration#Left private getCachedLunarInfo AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#L...
private getCachedLunarInfo(date: Date): LunarDate | null { const dateKey = this.formatDateKey(date); let cached = this.lunarDateCache.get(dateKey); if (!cached) { const lunarInfo = LunarCalendar.solarToLunar(date.getFullYear(), date.getMonth() + 1, date.getDate()); if (!lunarInfo) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4304-L4333
47e8121f02259e83973e2256511c50ca8a7b14a3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/ChartPixelMap.ets
arkts
setIcon
设置图标 PixelMap 或者 Resource.id
public setIcon(newIcon: PixelMap| number) { this.icon = newIcon; }
AST#method_declaration#Left public setIcon AST#parameter_list#Left ( AST#parameter#Left newIcon : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) ...
public setIcon(newIcon: PixelMap| number) { this.icon = newIcon; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ChartPixelMap.ets#L23-L25
055402487ae85cdd67e895b555373b03ecac8eb2
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets
arkts
onRequestError
请求失败回调 @returns {void} 无返回值
protected onRequestError(): void { this.setErrorState(); }
AST#method_declaration#Left protected onRequestError 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...
protected onRequestError(): void { this.setErrorState(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L78-L80
ce74db7fa97ee18170f8ddafc792cf77239589bb
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/pages/Index.ets
arkts
isBackgroundScale
是否开启背景缩小
private isBackgroundScale(): ScaleOptions { if (this.windowUtil.mainWindowInfo.widthBp < WidthBreakpoint.WIDTH_LG) { if (this.isShowSidebar || this.isToolViewShow || this.appTmpData.isSystemShare) { return { x: 0.98, y: 0.98 }; } } else if (this.windowUtil.mainWindowInfo.widthBp >= WidthBrea...
AST#method_declaration#Left private isBackgroundScale AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ScaleOptions AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#membe...
private isBackgroundScale(): ScaleOptions { if (this.windowUtil.mainWindowInfo.widthBp < WidthBreakpoint.WIDTH_LG) { if (this.isShowSidebar || this.isToolViewShow || this.appTmpData.isSystemShare) { return { x: 0.98, y: 0.98 }; } } else if (this.windowUtil.mainWindowInfo.widthBp >= WidthBrea...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L416-L427
3422d3d30a3e1238530106d97778332aa17e072b
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets
arkts
onStatusDidChange
观看状态回调 @param player 播放器实例 @param state 状态类型 详见 VHPlayerStatus 的定义.
onStatusDidChange(state: VHPlayerState) { if (state == VHPlayerState.VH_PLAYER_PLAYING) { this.is_start = true; this.is_playing = true; this.isLoading = false; this.isPlayError = false; } else if (state == VHPlayerState.VH_PLAYER_PAUSE || state == VHPlayerState.VH_PLAYER_STOP || st...
AST#method_declaration#Left onStatusDidChange AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left VHPlayerState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui...
onStatusDidChange(state: VHPlayerState) { if (state == VHPlayerState.VH_PLAYER_PLAYING) { this.is_start = true; this.is_playing = true; this.isLoading = false; this.isPlayError = false; } else if (state == VHPlayerState.VH_PLAYER_PAUSE || state == VHPlayerState.VH_PLAYER_STOP || st...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L224-L244
86c374b4fce10a8836b787f2790ec2cd56e768aa
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets
arkts
评论的数据结构
export class CommentModel { // 评论id public id: string; // 评论头像 public url: ResourceStr; // 评论昵称 public user: string; // 回复id public replyId: string; // 回复用户昵称 public replyUser: string; // 回复文本 public text: string; // 回复时间 public commentTime: Date; // 评论下的回复列表 public replyList: CommentDat...
AST#export_declaration#Left export AST#class_declaration#Left class CommentModel AST#class_body#Left { // 评论id AST#property_declaration#Left public id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 评论头像 AST#property_declaratio...
export class CommentModel { public id: string; public url: ResourceStr; public user: string; public replyId: string; public replyUser: string; public text: string; public commentTime: Date; public replyList: CommentData; constructor(id: string, url: ResourceStr, user: string, ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets#L19-L47
be8ecfa769c0c934a7ec0d727990bd6ed7ffc940
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/common/AccountData.ets
arkts
saveAccount
保存账户
static async saveAccount(account: AccountItem): Promise<boolean> { try { if (!AccountDataManager.preferencesStore) { console.error('存储未初始化'); return false; } const accounts = await AccountDataManager.getAllAccounts(); accounts.push(account); await AccountDataMan...
AST#method_declaration#Left static async saveAccount AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left AccountItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
static async saveAccount(account: AccountItem): Promise<boolean> { try { if (!AccountDataManager.preferencesStore) { console.error('存储未初始化'); return false; } const accounts = await AccountDataManager.getAllAccounts(); accounts.push(account); await AccountDataMan...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L44-L63
25b0c468eebb9f4114a8fcb9d15d7ee989fa3574
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/IFillFormatter.ets
arkts
Interface for providing a custom logic to where the filling line of a LineDataSet should end. This of course only works if setFillEnabled(...) is set to true. @author Philipp Jahoda
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/formatter/IFillFormatter.ets#L24-L24
e1bdcda68596e00e9cb7ce0f430105432c4728e6
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
arkts
validateForm
验证表单
validateForm(): boolean { if (!this.dream.title.trim()) { this.errorMessage = '请输入梦想标题'; return false; } if (!this.dream.description.trim()) { this.errorMessage = '请输入梦想描述'; return false; } return true; }
AST#method_declaration#Left validateForm 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AS...
validateForm(): boolean { if (!this.dream.title.trim()) { this.errorMessage = '请输入梦想标题'; return false; } if (!this.dream.description.trim()) { this.errorMessage = '请输入梦想描述'; return false; } return true; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L455-L467
6289ca70a7ab8d93696670e6dcaca18bfd898937
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/main/TopComponent.ets
arkts
TopComponent
home页、报告页、我的页面top栏
@Component export struct TopComponent { @State title: string = 'SmartPerf' build() { //开始测试title Text(this.title) .width('100%') .height('8%') .fontSize('20fp') .fontWeight(FontWeight.Bold) .fontColor($r('app.color.color_fff')) .alignSelf(ItemAlign.Start) .textAlig...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TopComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotat...
@Component export struct TopComponent { @State title: string = 'SmartPerf' build() { Text(this.title) .width('100%') .height('8%') .fontSize('20fp') .fontWeight(FontWeight.Bold) .fontColor($r('app.color.color_fff')) .alignSelf(ItemAlign.Start) .textAlign(TextAlign...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/main/TopComponent.ets#L19-L35
30477daa186ea9936afab496528a8a5d96b705ce
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceTabs.d.ets
arkts
CustomBuilder for tabContent @typedef { function } TabContentBuilder @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export type TabContentBuilder = () => void;
AST#export_declaration#Left export AST#type_declaration#Left type TabContentBuilder = AST#type_annotation#Left AST#function_type#Left 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#function_type#Right AST#t...
export type TabContentBuilder = () => void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceTabs.d.ets#L211-L211
c6484492e013dcb1e91d0e484528ffeab249bbe5
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
common/component/src/main/ets/default/sliderComponent.ets
arkts
Text details
build() { Flex({ direction: FlexDirection.Row }) { Column() { Image(this.leftImage) .width($r('app.float.slider_image_width')) .height($r('app.float.slider_image_height')) .objectFit(ImageFit.Contain); } .align(Alignment.TopStart) .visibility(this.visibl...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right ....
build() { Flex({ direction: FlexDirection.Row }) { Column() { Image(this.leftImage) .width($r('app.float.slider_image_width')) .height($r('app.float.slider_image_height')) .objectFit(ImageFit.Contain); } .align(Alignment.TopStart) .visibility(this.visibl...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/sliderComponent.ets#L35-L96
1e9a1573039dc72d12123d7e854a93c5d9f568dc
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
状态--下载中 @since 2022-06-10
export class Downloading extends BaseState { constructor() { super(); this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.DOWNLOADING; this.downloadStateText = $r('app.string.download_status_downloading'); this.butto...
AST#export_declaration#Left export AST#class_declaration#Left class Downloading extends AST#type_annotation#Left AST#primary_type#Left BaseState AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#bl...
export class Downloading extends BaseState { constructor() { super(); this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.DOWNLOADING; this.downloadStateText = $r('app.string.download_status_downloading'); this.butto...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L310-L331
3fcf75ea61585e6f8749457a1a5c81aec033fc10
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/AudioUtil.ets
arkts
@Author csx @DateTime 2024/6/3 19:12 @TODO AudioUtil 音频工具类(暂未开发完,需要迁移到media后完善) @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Feftool
export class AudioUtil { //视频 https://gitee.com/harmonyos_samples/video-show /** * 音频捕捉器 */ private static audioCapturer: audio.AudioCapturer | undefined = undefined; /** * 初始化音频捕捉器 */ static async init(readDataCallback: (buffer: ArrayBuffer) => void): Promise<string> { let isAuth = await Au...
AST#export_declaration#Left export AST#class_declaration#Left class AudioUtil AST#class_body#Left { //视频 https://gitee.com/harmonyos_samples/video-show /** * 音频捕捉器 */ AST#property_declaration#Left private static audioCapturer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#...
export class AudioUtil { private static audioCapturer: audio.AudioCapturer | undefined = undefined; static async init(readDataCallback: (buffer: ArrayBuffer) => void): Promise<string> { let isAuth = await AuthUtil.checkPermissions('ohos.permission.MICROPHONE'); if (!isAuth) { let res = awai...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/AudioUtil.ets#L26-L122
d804d8d56b19618335d6832275afb55a19a282e2
gitee
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/view_models/playlist_mode.ets
arkts
Playlist
export interface Playlist { id: number name: string coverImgId: number coverImgUrl: string coverImgId_str: string adType: number userId: number createTime: number status: number opRecommend: boolean highQuality: boolean newImported: boolean updateTime: number trackCount: number specialType...
AST#export_declaration#Left export AST#interface_declaration#Left interface Playlist AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left name : AST#type_annotation#Left AST#prim...
export interface Playlist { id: number name: string coverImgId: number coverImgUrl: string coverImgId_str: string adType: number userId: number createTime: number status: number opRecommend: boolean highQuality: boolean newImported: boolean updateTime: number trackCount: number specialType...
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/playlist_mode.ets#L21-L80
7813a38ee7b75061e6dee4b0e68e5370a17c55d4
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
processQueue
处理下载队列
private processQueue(): void { // 如果正在下载的任务数已达到上限,就不启动新的 while (this.activeDownloads < this.MAX_CONCURRENT_DOWNLOADS && this.downloadQueue.length > 0) { const episode = this.downloadQueue.shift(); if (episode) { this.startDownload(episode); } } }
AST#method_declaration#Left private processQueue AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 如果正在下载的任务数已达到上限,就不启动新的 AST#statement#Left AST#while_statement#Left while ( AST#expres...
private processQueue(): void { while (this.activeDownloads < this.MAX_CONCURRENT_DOWNLOADS && this.downloadQueue.length > 0) { const episode = this.downloadQueue.shift(); if (episode) { this.startDownload(episode); } } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L72-L80
d6d18bbca3528667a73e0d2e8d29554a6f9c4431
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageturninganimation/Index.ets
arkts
PageTurningAnimationComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { PageTurningAnimationComponent } from './src/main/ets/view/PageTurningAnimation';
AST#export_declaration#Left export { PageTurningAnimationComponent } from './src/main/ets/view/PageTurningAnimation' ; AST#export_declaration#Right
export { PageTurningAnimationComponent } from './src/main/ets/view/PageTurningAnimation';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageturninganimation/Index.ets#L16-L16
2a4b7d0d650fb64e0004407d7079a73084da8798
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Buttons.ets
arkts
aboutToAppear
页面滚动条 生命周期函数,创建组件实例后,执行build渲染函数之前
aboutToAppear() {}
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear() {}
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Buttons.ets#L15-L15
41d001353ea303d5c65efac4908ff89bd14fb29a
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/setting/AdviceView.ets
arkts
buildAdviceContent
构建反馈内容字符串
private async buildAdviceContent(): Promise<string> { let content = `${this.content.trim()}\n\n--------------\n`; content += `应用版本: ${BundleUtils.getBundleInfoSync().versionName}\n`; content += `用户ID: ${UserManager.shared.userId}\n`; content += `用户名: ${UserManager.shared.userName}`; content += `\n...
AST#method_declaration#Left private async buildAdviceContent 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#Righ...
private async buildAdviceContent(): Promise<string> { let content = `${this.content.trim()}\n\n--------------\n`; content += `应用版本: ${BundleUtils.getBundleInfoSync().versionName}\n`; content += `用户ID: ${UserManager.shared.userId}\n`; content += `用户名: ${UserManager.shared.userName}`; content += `\n...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/setting/AdviceView.ets#L202-L211
0160a1001b431349c8889c9d7a42be75bf0e0da6
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
getConnectionProperties
获取netHandle对应的网络的连接信息 @param netHandle 默认激活的数据网络 @returns
static async getConnectionProperties(netHandle: connection.NetHandle = NetworkUtil.getDefaultNetSync()): Promise<connection.ConnectionProperties> { return connection.getConnectionProperties(netHandle); }
AST#method_declaration#Left static async getConnectionProperties AST#parameter_list#Left ( AST#parameter#Left netHandle : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call...
static async getConnectionProperties(netHandle: connection.NetHandle = NetworkUtil.getDefaultNetSync()): Promise<connection.ConnectionProperties> { return connection.getConnectionProperties(netHandle); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L213-L215
6ef9931e552b056663f3d3e02a3b14ff892cc292
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/pages/inform.ets
arkts
markAllAsRead
一键已读
private markAllAsRead() { this.notifications = this.notifications.map(item => { item.read = true; return item; }); this.unreadCount = 0; CommonVariable.unreadCount=this.unreadCount; }
AST#method_declaration#Left private markAllAsRead AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifications AST#member_exp...
private markAllAsRead() { this.notifications = this.notifications.map(item => { item.read = true; return item; }); this.unreadCount = 0; CommonVariable.unreadCount=this.unreadCount; }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/inform.ets#L187-L194
a3f835bc229b5eb763a7659c471271c386060c59
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/DateUtil.ets
arkts
compareDate
比较指定日期相差的毫秒数 @param date1 @param date2 @param floor
static compareDate(date1: number | string | Date, date2: number | string | Date, floor: boolean = false): number { let dateTime1: number = DateUtil.getFormatDate(date1).getTime(); let dateTime2: number = DateUtil.getFormatDate(date2).getTime(); let diff = dateTime2 - dateTime1; if (floor) { return...
AST#method_declaration#Left static compareDate AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri...
static compareDate(date1: number | string | Date, date2: number | string | Date, floor: boolean = false): number { let dateTime1: number = DateUtil.getFormatDate(date1).getTime(); let dateTime2: number = DateUtil.getFormatDate(date2).getTime(); let diff = dateTime2 - dateTime1; if (floor) { return...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/DateUtil.ets#L283-L291
f8ab5556bd4a82e1ec7a42ae9236c80625b006ab
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/citysearch/src/main/ets/view/CitySearch.ets
arkts
searchCityList
搜索城市展示逻辑
searchCityList(value: string) { let cityNames: string[] = []; CITY_DATA.forEach(item => { if (item.name.includes(value.toUpperCase())) { // 当搜索城市拼音首字母,将相关城市信息展示。例如输入"a",会出现"阿尔山"、"阿勒泰地区"、"安庆"、"安阳"。 // 输入"b",会出现"北京"、"亳州"、"包头"、"宝鸡"。 cityNames = item.dataList; return; } ...
AST#method_declaration#Left searchCityList 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef...
searchCityList(value: string) { let cityNames: string[] = []; CITY_DATA.forEach(item => { if (item.name.includes(value.toUpperCase())) { cityNames = item.dataList; return; } item.dataList.forEach(cityName => { if (cityName.includes(value)) { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/view/CitySearch.ets#L193-L215
7d862ed43f561070d9c5a6d85ede4c530d843719
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
getMonthBirthdays
获取当前月份的所有生日联系人
private getMonthBirthdays(): Contact[] { return this.getFilteredContacts().filter((contact: Contact): boolean => { if (!contact.birthday.isLunar) { // 公历生日直接比较月份 return contact.birthday.month === this.currentMonth; } else { // 农历生日需要转换为公历后比较月份 try { const birthd...
AST#method_declaration#Left private getMonthBirthdays AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_state...
private getMonthBirthdays(): Contact[] { return this.getFilteredContacts().filter((contact: Contact): boolean => { if (!contact.birthday.isLunar) { return contact.birthday.month === this.currentMonth; } else { try { const birthdayThisYear = LunarCalendar.lunar...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4101-L4151
c40a791a4f2237653d7eae9194b3ffe7546dc210
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets
arkts
继承自BasicDataSource的子类,重写了方法
export class TopTabContent extends BasicDataSource { private tabContent: string[] = ['关注', '精选', '推荐', '放映厅']; // 获取数组长度 public totalCount(): number { return this.tabContent.length; } // 获取指定索引数据 public getData(index: number): string { return this.tabContent[index]; } // 改变单个数据 public addDa...
AST#export_declaration#Left export AST#class_declaration#Left class TopTabContent extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private tabContent : AST#type_annotation#Left AST#primary_type#Lef...
export class TopTabContent extends BasicDataSource { private tabContent: string[] = ['关注', '精选', '推荐', '放映厅']; public totalCount(): number { return this.tabContent.length; } public getData(index: number): string { return this.tabContent[index]; } public addData(index: number, data: strin...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L60-L84
2a6fd30b1dee8e69919440f02010026bc07ca2c0
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/SmsLoginViewModel.ets
arkts
updatePhone
更新手机号 @param {string} value - 手机号 @returns {void} 无返回值
updatePhone(value: string): void { }
AST#method_declaration#Left updatePhone AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ...
updatePhone(value: string): void { }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/SmsLoginViewModel.ets#L15-L16
488cd03ece99844586323ce4ce8e0bf2b9468cd0
github