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
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
mergeAll
========== 合并操作 ========== 深度合并多个消息(后面的覆盖前面的) 合并语义(Protobuf 标准): - 标量字段:后面的覆盖前面的 - repeated 字段:追加(不是替换!) - 嵌套消息:递归合并 @param messages 消息数组 @returns 合并后的消息,如果数组为空则返回 null 使用示例: ```typescript const base = Person.create({ name: 'Alice', age: 30 }) const update1 = Person.create({ age: 31 }) const update2 = Person.create...
static mergeAll<T extends Message>(messages: T[]): T | null { if (messages.length === 0) { return null } const result = messages[0].clone() as T for (let i = 1; i < messages.length; i++) { result.mergeFrom(messages[i]) } return result }
AST#method_declaration#Left static mergeAll AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AS...
static mergeAll<T extends Message>(messages: T[]): T | null { if (messages.length === 0) { return null } const result = messages[0].clone() as T for (let i = 1; i < messages.length; i++) { result.mergeFrom(messages[i]) } return result }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L99-L109
ca9665863b286437edbc1d39570ac8c3525ce86c
github
dividez/harmonyos-games.git
78482622646cb5294d06c0aab1571f31b308b24c
features/number/src/main/ets/services/PreferencesUtil.ets
arkts
getPreferencesFromStorage
调用getPreferences方法读取指定首选项持久化文件, 将数据加载到Preferences实例,用于数据操作
async getPreferencesFromStorage() { console.log('context', context); console.log('content2', content2); await dataPreferences.getPreferences(content2, PREFERENCES_NAME).then((data) => { this.preferences = data; console.info(`Succeeded in getting preferences`); }).catch((err: BusinessError) =...
AST#method_declaration#Left async getPreferencesFromStorage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . l...
async getPreferencesFromStorage() { console.log('context', context); console.log('content2', content2); await dataPreferences.getPreferences(content2, PREFERENCES_NAME).then((data) => { this.preferences = data; console.info(`Succeeded in getting preferences`); }).catch((err: BusinessError) =...
https://github.com/dividez/harmonyos-games.git/blob/78482622646cb5294d06c0aab1571f31b308b24c/features/number/src/main/ets/services/PreferencesUtil.ets#L15-L24
03a08e9238cca71f60dcd3ca4190c4b3e7984beb
github
ark-ui/MiniCanvas
2a9a12127ed5ea5b6b87da252d258c8ad5700f56
mini_canvas/src/main/ets/components/canvas/gradient.ets
arkts
设置渐变断点值,包括偏移和颜色
export class Gradient { readonly x0: number; readonly y0: number; readonly x1: number; readonly y1: number; private readonly colorStopMap: LightWeightMap<number, string> = new LightWeightMap() constructor
AST#export_declaration#Left export AST#ERROR#Left class Gradient { AST#property_declaration#Left readonly x0 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left readonly y0 : AST#type_annotation#Left AST#...
export class Gradient { readonly x0: number; readonly y0: number; readonly x1: number; readonly y1: number; private readonly colorStopMap: LightWeightMap<number, string> = new LightWeightMap() constructor
https://github.com/ark-ui/MiniCanvas/blob/2a9a12127ed5ea5b6b87da252d258c8ad5700f56/mini_canvas/src/main/ets/components/canvas/gradient.ets#L6-L15
b2bd0de53bfce152dc369828489aeb68c1ab55e6
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/AddCityPage.ets
arkts
pageTransition
页面过渡效果配置。
pageTransition() { // 定义页面进入时的效果,从底侧滑入,时长为300ms,无论页面栈发生push还是pop操作均可生效 PageTransitionEnter({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); // 定义页面退出时的效果,向底侧滑出,时长为300ms,无论页面栈发生push还是pop操作均可生效 PageTransitionExit({ type: RouteType.None, durati...
AST#method_declaration#Left pageTransition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 定义页面进入时的效果,从底侧滑入,时长为300ms,无论页面栈发生push还是pop操作均可生效 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PageTransitionEnter ( AST#component_parameters#Left { AS...
pageTransition() { PageTransitionEnter({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); PageTransitionExit({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/AddCityPage.ets#L20-L27
2afb49577901d0ab0a7fab78182fab40da5e9ac4
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/search/JumpSearch.ets
arkts
search
标准跳跃查找 @param arr 已排序的数组 @param target 目标值 @returns 目标值在数组中的索引,如果不存在则返回-1
public static search(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } const n = arr.length; let step = Math.floor(Math.sqrt(n)); let prev = 0; // 找到目标值可能存在的区间 while (arr[Math.min(step, n) - 1] < target) { prev = step; step += Math.floo...
AST#method_declaration#Left public static search 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#Le...
public static search(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } const n = arr.length; let step = Math.floor(Math.sqrt(n)); let prev = 0; while (arr[Math.min(step, n) - 1] < target) { prev = step; step += Math.floor(Math.sqrt(n))...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/JumpSearch.ets#L12-L44
05344edda54bdca14503c8ede03a1c30af63bbd6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/nativerawfile/src/main/ets/utils/Constants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class Constants { // 需要预加载的so文件数组 public static readonly LIBRARY_PATH_ARRAY: string[] = ['libnativerawfile.so']; }
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // 需要预加载的so文件数组 AST#property_declaration#Left public static readonly LIBRARY_PATH_ARRAY : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right ...
export default class Constants { public static readonly LIBRARY_PATH_ARRAY: string[] = ['libnativerawfile.so']; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativerawfile/src/main/ets/utils/Constants.ets#L16-L19
219efc69cde2f81fbb83f3573f77fceade0488eb
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
getOrigins
以Promise方式异步获取当前使用Web SQL数据库的所有源的信息。 @returns
static async getOrigins(): Promise<Array<webview.WebStorageOrigin>> { return await webview.WebStorage.getOrigins(); }
AST#method_declaration#Left static async getOrigins 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 Array AST#type_arguments#Left < AST#type_...
static async getOrigins(): Promise<Array<webview.WebStorageOrigin>> { return await webview.WebStorage.getOrigins(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L231-L233
8c92ffa71c048cd4a422529aad4396f7256c6a6a
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/Pointer.ets
arkts
reset
Resets this pointer to be used again.
reset(): void { this.id = Pointer.UNUSED_P; this.index = Pointer.UNUSED_P; }
AST#method_declaration#Left reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expre...
reset(): void { this.id = Pointer.UNUSED_P; this.index = Pointer.UNUSED_P; }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L181-L184
222ad61d74a74100a97752938b4ebf1489280a30
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DeviceUtils.ets
arkts
getPhoneBrand
获取设备品牌 (等效Android的getPhoneBrand)
static getPhoneBrand(): string { return deviceInfo.brand.toLowerCase() || 'unknown'; }
AST#method_declaration#Left static getPhoneBrand AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_exp...
static getPhoneBrand(): string { return deviceInfo.brand.toLowerCase() || 'unknown'; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DeviceUtils.ets#L60-L62
f43b9717eea2149577eba584ecfc080d2efc6f6a
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FLog.ets
arkts
setDebug
日志域,需要根据实际项目配置
public static setDebug(debug: boolean): void { FLog.DEBUG = debug; }
AST#method_declaration#Left public static setDebug AST#parameter_list#Left ( AST#parameter#Left debug : 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#type_annotation#Left AST#primary_type#Left void AST#primary...
public static setDebug(debug: boolean): void { FLog.DEBUG = debug; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FLog.ets#L15-L17
baad4250dce4dba079b423f4eaceae9079532bc2
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/highlight/RadarHighlighter.ets
arkts
getHighlightsAtIndex
Returns an array of Highlight objects for the given index. The Highlight objects give information about the value at the selected index and the DataSet it belongs to. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations. @param index @return
protected getHighlightsAtIndex(index: number): Highlight[] { if (this.mChart == null || this.mChart.getData() == null) { return []; } const highlightBuffer: Highlight[] = []; let animator = this.mChart.getAnimator(); if (!animator) { return []; } const phaseX = animator.getPhase...
AST#method_declaration#Left protected getHighlightsAtIndex 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 AST#array...
protected getHighlightsAtIndex(index: number): Highlight[] { if (this.mChart == null || this.mChart.getData() == null) { return []; } const highlightBuffer: Highlight[] = []; let animator = this.mChart.getAnimator(); if (!animator) { return []; } const phaseX = animator.getPhase...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/RadarHighlighter.ets#L60-L103
234bd1538ec445099e81e13e46b86adc4a51ca27
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
clearSessionCookieSync
清除所有会话cookie。
static clearSessionCookieSync(): void { webview.WebCookieManager.clearSessionCookieSync(); }
AST#method_declaration#Left static clearSessionCookieSync 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#Lef...
static clearSessionCookieSync(): void { webview.WebCookieManager.clearSessionCookieSync(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L222-L224
45a5c83f2a85be9068f1363e0a94b94d707e5928
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets
arkts
DeleteLastItem
删除最后一个元素
public DeleteLastItem(): void { this.dataArray.splice(-1, 1); this.notifyDataDelete(this.dataArray.length); }
AST#method_declaration#Left public DeleteLastItem 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#ex...
public DeleteLastItem(): void { this.dataArray.splice(-1, 1); this.notifyDataDelete(this.dataArray.length); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets#L116-L119
222a12dcc52bbce77bae16b08ffcaffdcbbbb54c
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/affirmdev/99.10.8/package/index.ets
arkts
toHex
替代Buffer实现(规则75)
function toHex(data: string): string { const encoder = new TextEncoder(); const bytes = encoder.encode(data); let hex = ''; for (const byte of bytes) { hex += byte.toString(16).padStart(2, '0'); } return hex; }
AST#function_declaration#Left function toHex AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
function toHex(data: string): string { const encoder = new TextEncoder(); const bytes = encoder.encode(data); let hex = ''; for (const byte of bytes) { hex += byte.toString(16).padStart(2, '0'); } return hex; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/affirmdev/99.10.8/package/index.ets#L46-L54
875cf85bcc2ab6353642efc4f82bcd42782a7cb0
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/LocationUtil.ets
arkts
address2Location
地理逆编码,将地理描述转换为具体坐标-无需申请定位权限 @param locationName 地理位置中文描述 @returns 编码后location对象
static async address2Location(locationName: string): Promise<geoLocationManager.GeoAddress> { //校验是否逆编码可用 let isAvailable = geoLocationManager.isGeocoderAvailable(); if (isAvailable) { let geocodeRequest: geoLocationManager.GeoCodeRequest = { description: locationName, maxItems: 1, ...
AST#method_declaration#Left static async address2Location AST#parameter_list#Left ( AST#parameter#Left locationName : 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...
static async address2Location(locationName: string): Promise<geoLocationManager.GeoAddress> { let isAvailable = geoLocationManager.isGeocoderAvailable(); if (isAvailable) { let geocodeRequest: geoLocationManager.GeoCodeRequest = { description: locationName, maxItems: 1, locale...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/LocationUtil.ets#L74-L92
796098261e0c279fadd5458dcdb94aa4f42cc167
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/arkts/@arkts.collections.d.ets
arkts
setAllBits
Sets all of bits in a bit vector to a particular element. @param { number } element - Element to be set (0 means 0, else means 1). @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. @throws { BusinessError } 10200011 - The setAllB...
setAllBits(element: number): void;
AST#method_declaration#Left setAllBits AST#parameter_list#Left ( AST#parameter#Left element : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right...
setAllBits(element: number): void;
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/arkts/@arkts.collections.d.ets#L5527-L5527
8bb7590e1bbe88fe4a6f9ad5ccd9d25900f3d7d8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets
arkts
handleAuthResult
[End obtain_supported_capabilities] 用于处理示例1,示例2,示例3和示例4的部分操作 [Start authentication_example1] [Start authentication_example2] [Start authentication_example3] [Start authentication_example4]
handleAuthResult(userAuthInstance: userAuth.UserAuthInstance, exampleNumber: number) { // [StartExclude authentication_example1] // [StartExclude authentication_example2] // [StartExclude authentication_example3] // [StartExclude authentication_example4] try { // [EndExclude authentication_exa...
AST#method_declaration#Left handleAuthResult AST#parameter_list#Left ( AST#parameter#Left userAuthInstance : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . UserAuthInstance AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le...
handleAuthResult(userAuthInstance: userAuth.UserAuthInstance, exampleNumber: number) { try { userAuthInstance.on('result', { onResult: (result: userAuth.UserAuthResult) => { this.result[example...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L102-L171
045040aff9c8cc75606d5a36d5abd99cc84b49cf
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets
arkts
[Start class_routerModule]
export class RouterModule { // WrappedBuilder支持@Builder描述的组件以参数的形式进行封装存储 static builderMap: Map<string, WrappedBuilder<[object]>> = new Map<string, WrappedBuilder<[object]>>(); // 初始化路由栈,需要关联Navigation组件 static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>(); // [StartExclude class_rou...
AST#export_declaration#Left export AST#class_declaration#Left class RouterModule AST#class_body#Left { // WrappedBuilder支持@Builder描述的组件以参数的形式进行封装存储 AST#property_declaration#Left static builderMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Lef...
export class RouterModule { static builderMap: Map<string, WrappedBuilder<[object]>> = new Map<string, WrappedBuilder<[object]>>(); static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>(); public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L19-L81
565079eb0ca6ae390d46541cf6ce6be523931f7e
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/result/src/main/ets/RequestHelper.ets
arkts
runInternal
核心执行逻辑 @param {boolean} returnFull - 是否返回完整响应 @returns {Promise<NetworkResponse<T> | T>} 结果
private async runInternal(returnFull: boolean): Promise<NetworkResponse<T> | T> { if (this.beforeStart) { this.beforeStart(); } if (this.useLoading) { ToastUtils.showLoading(); } try { const rawResp: NetworkResponse<T> = await this.source; const resp: NetworkResponse<T> = new...
AST#method_declaration#Left private async runInternal AST#parameter_list#Left ( AST#parameter#Left returnFull : 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#type_annotation#Left AST#primary_type#Left AST#gene...
private async runInternal(returnFull: boolean): Promise<NetworkResponse<T> | T> { if (this.beforeStart) { this.beforeStart(); } if (this.useLoading) { ToastUtils.showLoading(); } try { const rawResp: NetworkResponse<T> = await this.source; const resp: NetworkResponse<T> = new...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L103-L131
63462eff95e3b6a293744b3e1ee86e89ef6710e8
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/EncryptUtils.ets
arkts
base64Encode
Base64 编码
static base64Encode(text: string): string { // 简化实现,实际应使用标准Base64编码 return btoa(text); }
AST#method_declaration#Left static base64Encode 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static base64Encode(text: string): string { return btoa(text); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/EncryptUtils.ets#L37-L40
26e299b20c534700136079aef5dffdb92a8adc26
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets
arkts
ShareButton
功能说明: 本示例介绍如何在应用中,通过url自动生成二维码,并通过Share Kit的接口拉起系统分享。 推荐场景: 需要通过url生成二维码分享的场景 核心组件: 1. ShareButton: 分享按钮 实现步骤: 1. 数据准备: 传入需要分享的url,按钮会自动生成图片 @example ShareButton({ url: this.helperUrl, }) 功能描述: 1.通过url自动生成二维码 实现原理: 1.通过createBarcode生成二维码。 2.将生成的二维码与当前图片合并。 3.调用系统的Share Kit,构建出分享对象,拉起系统分享框。 @param {string} url - ...
@Component export struct ShareButton { @BuilderParam slot: () => void; // slot 供自定义UI使用 @Prop @Watch("refreshUrl") url: string = ''; // 刷新的url @Prop linkTitle: string = ''; // 刷新的url @Prop linkDesc: string = ''; // 刷新的url private ctx: Context = getContext(this); private imageBarCode: image.PixelMap | null =...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ShareButton AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right slot : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#paramete...
@Component export struct ShareButton { @BuilderParam slot: () => void; @Prop @Watch("refreshUrl") url: string = ''; @Prop linkTitle: string = ''; @Prop linkDesc: string = ''; private ctx: Context = getContext(this); private imageBarCode: image.PixelMap | null = null; private imageBackground: image.Pi...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets#L53-L184
21f572d679db1e23703b1cf37e659f4cd0f09551
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets
arkts
aboutToAppear
当controller对应的NodeContainer在Appear的时候进行回调
aboutToAppear() { console.info('aboutToAppear'); // 切换到前台后,不需要停止渲染 shouldInactive = false; }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_exp...
aboutToAppear() { console.info('aboutToAppear'); shouldInactive = false; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets#L73-L77
6bea9a0b43eaa55275f331224a46023b61eb3ca1
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/DFXStateManagement/src/main/ets/view/DFXStateBeforeOptimization.ets
arkts
isRenderSpecialImage
默认透明度
private isRenderSpecialImage(): number { // Image每次渲染时透明度增加0.1, 在0-1之间循环 this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange; return this.opacityNum; }
AST#method_declaration#Left private isRenderSpecialImage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // Image每次渲染时透明度增加0.1, 在0-1之间循环 AST#statement#Left AST#expression_statement#Le...
private isRenderSpecialImage(): number { this.opacityNum = (this.opacityNum + opacityChangeValue) % opacityChangeRange; return this.opacityNum; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/DFXStateManagement/src/main/ets/view/DFXStateBeforeOptimization.ets#L37-L41
10e927d093ac734f28b8e3f9efb27dc09ae6890a
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Listens to the holding hand and auto update settings if applicable.
export function listen_holding_hand() { if (canIUse("SystemCapability.MultimodalAwareness.Motion")) { try { motion.on('holdingHandChanged', (m: motion.HoldingHandStatus) => { try { if (AppStorage.get('preferred_hand_auto') as boolean == true) { // Set preferred hand if recogniz...
AST#export_declaration#Left export AST#function_declaration#Left function listen_holding_hand AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#ar...
export function listen_holding_hand() { if (canIUse("SystemCapability.MultimodalAwareness.Motion")) { try { motion.on('holdingHandChanged', (m: motion.HoldingHandStatus) => { try { if (AppStorage.get('preferred_hand_auto') as boolean == true) { if (m == motion.Hold...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L385-L413
e235d0719f38f80058eb720490cddb858b22364f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/utils/ArrayBufferUtils.ets
arkts
2 bytes for each char
export default class ArrayBufferUtils { static byte2ArrayBuffer(data: Array<number>): ArrayBuffer { let view = new Uint8Array(data); return view.buffer; } static arrayBuffer2Byte(buf: ArrayBuffer): Array<number> { let arr = new Uint8Array(buf); let result: Array<number> = []; for (let i = 0;...
AST#export_declaration#Left export default AST#class_declaration#Left class ArrayBufferUtils AST#class_body#Left { AST#method_declaration#Left static byte2ArrayBuffer AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < ...
export default class ArrayBufferUtils { static byte2ArrayBuffer(data: Array<number>): ArrayBuffer { let view = new Uint8Array(data); return view.buffer; } static arrayBuffer2Byte(buf: ArrayBuffer): Array<number> { let arr = new Uint8Array(buf); let result: Array<number> = []; for (let i = 0;...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/utils/ArrayBufferUtils.ets#L18-L45
1b8b7e71988a1a3e28daae7b7d09fadf77ecfac6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/Constants/Constant.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { static readonly FULL_SIZE: string = '100%'; static readonly NINETY_PERCENT_SIZE: string = '90%'; static readonly EIGHTY_PERCENT_SIZE: string = '80%'; static readonly FORTY_PERCENT_SIZE: string = '40%'; // video的list长度 static readonly VIDEO_LIST_LENGTH = 20; // panel中嵌套的list长度 s...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly FULL_SIZE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#pro...
export class Constants { static readonly FULL_SIZE: string = '100%'; static readonly NINETY_PERCENT_SIZE: string = '90%'; static readonly EIGHTY_PERCENT_SIZE: string = '80%'; static readonly FORTY_PERCENT_SIZE: string = '40%'; static readonly VIDEO_LIST_LENGTH = 20; static readonly PANEL_LIST_LENGTH ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/Constants/Constant.ets#L16-L32
8ffded6d31f43fe75bb3c46bd189c1e12200253c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
获取当前应用未删除的通知数 @returns {Promise<number>} number
export async function getActiveCount(): Promise<number> { return notificationManager.getActiveNotificationCount(); }
AST#export_declaration#Left export AST#function_declaration#Left async function getActiveCount 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 number AST#primary_t...
export async function getActiveCount(): Promise<number> { return notificationManager.getActiveNotificationCount(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L351-L353
db2a9e26f9b32205bbd25f85d46cb559c642b1b9
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
check_save_history
Actions Checks and saves history record under certain conditions (if is a new, legal history entry). @param source
check_save_history(source: string) { let saved = false; if (!this.pre_restoration_stage) { let is_new_history = (this.last_saved_url != this.url); if (is_new_history) { if (this.can_save_history(this.url)) { console.log('[bunch_of_tabs]' + source + ' Save history for [' + this.titl...
AST#method_declaration#Left check_save_history AST#parameter_list#Left ( AST#parameter#Left source : 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_declaratio...
check_save_history(source: string) { let saved = false; if (!this.pre_restoration_stage) { let is_new_history = (this.last_saved_url != this.url); if (is_new_history) { if (this.can_save_history(this.url)) { console.log('[bunch_of_tabs]' + source + ' Save history for [' + this.titl...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L907-L922
b5ee71fa84df7ca9bbbb338473cf0b2035d76616
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets
arkts
delete
删除tab项 @param name - tab项标题
public delete(name: string) { this.keys = []; this.tabsInfo.delete(name); }
AST#method_declaration#Left public delete 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_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressio...
public delete(name: string) { this.keys = []; this.tabsInfo.delete(name); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets#L76-L79
801513802ddb15235d5fccde446296e41f9f3493
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/UserFile/SelectingUserFiles/entry/src/main/ets/pages/Index.ets
arkts
readAudioFile
[Start audio_view_picker]
readAudioFile(uri: string) { try { // [Start openmode_read_only] const file = fs.openSync(uri, fs.OpenMode.READ_ONLY); Logger.info('file fd: ' + file.fd); // [Start openmode_read_only] // [Start fs_read_sync] const buffer = new ArrayBuffer(4096); // 分配一个大小为4096字节的缓冲区 const...
AST#method_declaration#Left readAudioFile AST#parameter_list#Left ( AST#parameter#Left uri : 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#try_statement#Left try AST#...
readAudioFile(uri: string) { try { const file = fs.openSync(uri, fs.OpenMode.READ_ONLY); Logger.info('file fd: ' + file.fd); const buffer = new ArrayBuffer(4096); const readLen = fs.readSync(file.fd, buffer); Logger.info('readSync data to file succeed and buffer...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/SelectingUserFiles/entry/src/main/ets/pages/Index.ets#L187-L207
464e7ee03a1025787692775da5db6e6732e035e9
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setDrawHoleEnabled
set this to true to draw the pie center empty @param enabled
public setDrawHoleEnabled(enabled: boolean): void { this.mDrawHole = enabled; }
AST#method_declaration#Left public setDrawHoleEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : 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#type_annotation#Left AST#primary_type#Left void AST#pr...
public setDrawHoleEnabled(enabled: boolean): void { this.mDrawHole = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L459-L461
8f35bcccacadecf46e7b8a827e3e3d3f1af62186
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/Task.ets
arkts
fromRow
Create Task from database row
static fromRow(row: TaskRow): Task { return new Task( row.id, row.title, row.due_time, row.is_done === 1, row.created_at || 0 ); }
AST#method_declaration#Left static fromRow AST#parameter_list#Left ( AST#parameter#Left row : AST#type_annotation#Left AST#primary_type#Left TaskRow AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Righ...
static fromRow(row: TaskRow): Task { return new Task( row.id, row.title, row.due_time, row.is_done === 1, row.created_at || 0 ); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/Task.ets#L45-L53
8235405762ffaf3a8255a3ead587bd4886239a38
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
JSCrash/entry/src/main/ets/pages/utils.ets
arkts
printArgs
[Start TestJSErrorUtils]
@Concurrent export function printArgs(args: number): number { return args }
AST#decorated_export_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right export function printArgs AST#parameter_list#Left ( AST#parameter#Left args : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ...
@Concurrent export function printArgs(args: number): number { return args }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L8-L11
64c4d7e7dda5c0f6bbfaf53b5ff881e3145ad7b5
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
arkts
paymentDialog
支付弹窗组件
@Builder paymentDialog() { // 遮罩层 Column() .width('100%') .height('100%') .backgroundColor('#000000') .opacity(0.5) .onClick(() => { this.showPaymentDialog = false; // 点击遮罩层关闭弹窗 }) // 弹窗内容 Column() { Text('确认支付') .fontSize(20) .font...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right paymentDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 遮罩层 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_...
@Builder paymentDialog() { Column() .width('100%') .height('100%') .backgroundColor('#000000') .opacity(0.5) .onClick(() => { this.showPaymentDialog = false; }) Column() { Text('确认支付') .fontSize(20) .fontWeight(FontWeight.Bold) ...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L380-L440
e3a40100064a348464fa253bb98ad9690dce660e
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
get
============================================================ MARK: - 是否显示广告
get canShowAds(): boolean { return !this.isActive }
AST#method_declaration#Left get AST#ERROR#Left canShowAds AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expr...
get canShowAds(): boolean { return !this.isActive }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L174-L176
8c1c7aa9ca547363a9a2961456b53276a0560fa4
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/base/BaseProfilerUtils.ets
arkts
通用遍历目录节点 @param path @param regexp
export function travelFile(path: string, regexp: string): Array<String> { let dir; let fileNames = []; if (!isAccess(path)) { return []; } try { dir = fileio.opendirSync(path); do { var dirent = dir.readSync(); if (dirent == null) { break; } let name: String = dir...
AST#export_declaration#Left export AST#function_declaration#Left function travelFile AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left regexp : AST#type_annotation#Left AST#p...
export function travelFile(path: string, regexp: string): Array<String> { let dir; let fileNames = []; if (!isAccess(path)) { return []; } try { dir = fileio.opendirSync(path); do { var dirent = dir.readSync(); if (dirent == null) { break; } let name: String = dir...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/base/BaseProfilerUtils.ets#L74-L97
ad6008642d6e83c05963590595097799cb479908
gitee
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/core/init.ets
arkts
游戏世界数据初始化
export function initWorldData(): TArchiveFile { const defaultUserData: TAchiveUser = { name: '', attrs: { strength: 0, strong: 0, intellect: 0, luck: 0 }, items: [], mapIndex: 0, exp: 0, level: 1, meditationPoint: 0, } const defaultGameState: t.TGameState = { per: 0, ...
AST#export_declaration#Left export AST#function_declaration#Left function initWorldData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TArchiveFile AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declarati...
export function initWorldData(): TArchiveFile { const defaultUserData: TAchiveUser = { name: '', attrs: { strength: 0, strong: 0, intellect: 0, luck: 0 }, items: [], mapIndex: 0, exp: 0, level: 1, meditationPoint: 0, } const defaultGameState: t.TGameState = { per: 0, ...
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/init.ets#L13-L37
47eeccbdcbb7a7c8443301a040ee643e870eaa01
github
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/views/Home/HomePage.ets
arkts
aboutToAppear
主动上报
aboutToAppear(): void { tracking.report(true) }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { tracking.report(true) }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/views/Home/HomePage.ets#L32-L34
f633b9a024ce4f0ec96b8849d8210846cb3900fe
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/AlarmClockPage.ets
arkts
aboutToAppear
在页面即将显示时触发的生命周期函数
aboutToAppear() { // 查询闹钟数据 this.alarmClockModel.queryAlarmsTasker((alarms: Array<AlarmItem>) => { this.alarmClockModel.disableExpiredReminders(); // 将查询到的数据赋值给 alarmItems 和 nearestAlarmTime animateTo({ duration: CommonConstants.ANIMATION_MEDIUM_DURATION }, () => { this.alarmItems = al...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 查询闹钟数据 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expressio...
aboutToAppear() { this.alarmClockModel.queryAlarmsTasker((alarms: Array<AlarmItem>) => { this.alarmClockModel.disableExpiredReminders(); animateTo({ duration: CommonConstants.ANIMATION_MEDIUM_DURATION }, () => { this.alarmItems = alarms; this.nearestAlarmTime = findNearestAla...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/AlarmClockPage.ets#L35-L63
4e6067528f9a05fd474f978f4fc7303d7adb9daf
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
setGrayScale
设置灰阶,APP一键置灰。 @param grayScale 该参数为浮点数,取值范围为[0.0, 1.0]。 @param onlyMainWindow 是否只置灰主窗口,默认false。 @returns
static async setGrayScale(grayScale: number = 1.0, onlyMainWindow: boolean = false): Promise<void> { try { ArkWebHelper.getContext().windowStage.getMainWindowSync().setWindowGrayScale(grayScale); if (!onlyMainWindow) { let subWindows = await ArkWebHelper.getContext().windowStage.getSubWindow(); ...
AST#method_declaration#Left static async setGrayScale AST#parameter_list#Left ( AST#parameter#Left grayScale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1.0 AST#expression#Right AST#parameter#Right , AST#parameter#Left onlyMainWindow : A...
static async setGrayScale(grayScale: number = 1.0, onlyMainWindow: boolean = false): Promise<void> { try { ArkWebHelper.getContext().windowStage.getMainWindowSync().setWindowGrayScale(grayScale); if (!onlyMainWindow) { let subWindows = await ArkWebHelper.getContext().windowStage.getSubWindow(); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L391-L404
d0785284ced5ad8b4bdfad064f44228ec56af6e7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/PhotoHelper.ets
arkts
applyChanges
安全控件保存。提交媒体变更请求,插入图片/视频。 @param srcFileUri 需要确保srcFileUri对应的资源存在
static async applyChanges(srcFileUri: string): Promise<photoAccessHelper.PhotoAsset> { const context = getContext(); const photoHelper = photoAccessHelper.getPhotoAccessHelper(context); const assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = photoAccessHelper.MediaAssetChangeRequest.crea...
AST#method_declaration#Left static async applyChanges AST#parameter_list#Left ( AST#parameter#Left srcFileUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
static async applyChanges(srcFileUri: string): Promise<photoAccessHelper.PhotoAsset> { const context = getContext(); const photoHelper = photoAccessHelper.getPhotoAccessHelper(context); const assetChangeRequest: photoAccessHelper.MediaAssetChangeRequest = photoAccessHelper.MediaAssetChangeRequest.crea...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PhotoHelper.ets#L160-L169
1e0937c463256bd37ce571e8b2a23a7448f4206b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets
arkts
publicGenKeyFunc
调用generateKeyItem生成密钥
async function publicGenKeyFunc(keyAlias: string, huksOptions: huks.HuksOptions) { console.info(`enter promise generateKeyItem`); let throwObject: ThrowObject = { isThrow: false }; try { await generateKeyItem(keyAlias, huksOptions, throwObject) .then((data) => { console.info(`promise: generateKe...
AST#function_declaration#Left async function publicGenKeyFunc AST#parameter_list#Left ( AST#parameter#Left keyAlias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Le...
async function publicGenKeyFunc(keyAlias: string, huksOptions: huks.HuksOptions) { console.info(`enter promise generateKeyItem`); let throwObject: ThrowObject = { isThrow: false }; try { await generateKeyItem(keyAlias, huksOptions, throwObject) .then((data) => { console.info(`promise: generateKe...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets#L137-L157
65ab1df4fb3751e28520f825cc7fbf34c70a8a34
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/MessageContent.ets
arkts
@file 客服消息内容 @author Joker.X
export class MessageContent { /** * 消息类型 TEXT/IMAGE/VOICE/VIDEO/FILE/LINK/LOCATION/EMOJI */ type: string = ""; /** * 消息数据 */ data: string = ""; constructor(init?: Partial<MessageContent>) { if (!init) return; this.type = init.type ?? this.type; this.data = init.data ?? this.data; } ...
AST#export_declaration#Left export AST#class_declaration#Left class MessageContent AST#class_body#Left { /** * 消息类型 TEXT/IMAGE/VOICE/VIDEO/FILE/LINK/LOCATION/EMOJI */ AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#e...
export class MessageContent { type: string = ""; data: string = ""; constructor(init?: Partial<MessageContent>) { if (!init) return; this.type = init.type ?? this.type; this.data = init.data ?? this.data; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/MessageContent.ets#L5-L20
e686e21c81d7853c95e0e55912cc01f72ad57e77
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
getManagerByName
根据考卷名称获取数据 @param name
getManagerByName(name: string | Resource, type: EXAM_MANAGER_TYPE, currentQuestionId: number = 0, chapterName: string = '', wrongOrCollect?: WRONG_COLLECT): ExamManager { let examManager = this.examManagerList.find(item => item.name === name); if (examManager === undefined || wrongOrCollect !== undefined) {...
AST#method_declaration#Left getManagerByName AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , A...
getManagerByName(name: string | Resource, type: EXAM_MANAGER_TYPE, currentQuestionId: number = 0, chapterName: string = '', wrongOrCollect?: WRONG_COLLECT): ExamManager { let examManager = this.examManagerList.find(item => item.name === name); if (examManager === undefined || wrongOrCollect !== undefined) {...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L93-L104
9575e3441e4559312d7ad27cec56e0b0469c1fa9
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
getTranslationByKey
根据键获取翻译
private getTranslationByKey(key: string, language: SupportedLanguage): string | undefined { const translations = this.translations.get(language); if (!translations) return undefined; const keys = key.split('.'); let current: TranslationKeys | string = translations; for (const k of keys) { if...
AST#method_declaration#Left private getTranslationByKey AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLa...
private getTranslationByKey(key: string, language: SupportedLanguage): string | undefined { const translations = this.translations.get(language); if (!translations) return undefined; const keys = key.split('.'); let current: TranslationKeys | string = translations; for (const k of keys) { if...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L633-L665
92117ed7d22f0586d995341f1eb4b32f7e3402cf
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/DBPlan_Piece_Box_learn.ets
arkts
MARK: - Plan的Piece的text / 该结构体表示一个学习计划中的单个Piece(学习单元)的文本信息
export class DBPiece { planId : number | null = null; // 计划ID pieceNo : number | null = null; // Piece的编号 wordId : number | null = null; // 该Piece的学习文本的wordId }
AST#export_declaration#Left export AST#class_declaration#Left class DBPiece AST#class_body#Left { AST#property_declaration#Left planId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_anno...
export class DBPiece { planId : number | null = null; pieceNo : number | null = null; wordId : number | null = null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlan_Piece_Box_learn.ets#L15-L19
05d60a25b3dea57a2df57696afd0046c1ae7dec9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example3/common/LazyForEach.ets
arkts
继承自BasicDataSource的子类,重写了方法。 @class @extends {BasicDataSource}
export class MyDataSource extends BasicDataSource { public dataArray: string[] = []; /** * 获取数组长度。 * @returns {number} 返回数组长度。 */ public totalCount(): number { return this.dataArray.length; } /** * 获取指定索引数据。 * @param {number} index - 索引值。 * @returns {string} 返回指定索引数据。 */ public ge...
AST#export_declaration#Left export AST#class_declaration#Left class MyDataSource 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 public dataArray : AST#type_annotation#Left AST#primary_type#Left A...
export class MyDataSource extends BasicDataSource { public dataArray: string[] = []; public totalCount(): number { return this.dataArray.length; } public getData(index: number): string { return this.dataArray[index]; } public addData(index: number, data: string): void { this.dataArra...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example3/common/LazyForEach.ets#L133-L171
0187aa6a7ded567a165b27ddb4513fc84e418420
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets
arkts
实现IDataSource接口的对象,用于瀑布流组件加载数据
export class WaterFlowDataSource implements IDataSource { private dataArray: SceneModuleInfo[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: SceneModuleInfo[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i]); } } /** * 获取索引对应的数据 ...
AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SceneModuleInfo...
export class WaterFlowDataSource implements IDataSource { private dataArray: SceneModuleInfo[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: SceneModuleInfo[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i]); } } public getData(i...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L21-L183
022f037b7e4b87316f05a80f8a95b76ce2780939
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/common/AccountData.ets
arkts
账户数据接口
export interface AccountItem { id: string; name: string; // 账户名称 type: string; // 账户类型(如:微信钱包、支付宝等) iconText: string; // 图标文字 iconColor: string; // 图标颜色 balance: string; // 账户余额 note: string; // 备注 currency: string; // 币种 includeInTotal: boolean; // 是否计入总资产 canBeSelected: boolean; // 记账时是否可被选择 isC...
AST#export_declaration#Left export AST#interface_declaration#Left interface AccountItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST...
export interface AccountItem { id: string; name: string; type: string; iconText: string; iconColor: string; balance: string; note: string; currency: string; includeInTotal: boolean; canBeSelected: boolean; isCredit: boolean; }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L4-L16
de55cd755e153dd253e5bba3fc6b414041ebd750
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/book/BookDbAccess.ets
arkts
createOneBaseDictFromRs
BaseDict ResultSet → Model
private createOneBaseDictFromRs(rs: relationalStore.ResultSet): BaseDict { let dict = new BaseDict() dict.dictId = rs.getLong(rs.getColumnIndex(Table.BaseDict.Col.dictId)) dict.dictName = ResultSetTool.decodeString(rs, Table.BaseDict.Col.dictName) dict.textDb = ResultSetTool.decodeStrin...
AST#method_declaration#Left private createOneBaseDictFromRs AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_l...
private createOneBaseDictFromRs(rs: relationalStore.ResultSet): BaseDict { let dict = new BaseDict() dict.dictId = rs.getLong(rs.getColumnIndex(Table.BaseDict.Col.dictId)) dict.dictName = ResultSetTool.decodeString(rs, Table.BaseDict.Col.dictName) dict.textDb = ResultSetTool.decodeStrin...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/BookDbAccess.ets#L152-L160
60e6ad9378fbffd669f062246d074d557870bab2
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AudioRecorder.ets
arkts
resumeRecordingProcess
恢复录制对应的流程
async resumeRecordingProcess(): Promise<void> { if (this.avRecorder !== undefined && this.avRecorder.state === 'paused') { // 仅在paused状态下调用resume为合理状态切换 await this.avRecorder.resume(); } }
AST#method_declaration#Left async resumeRecordingProcess 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 > AS...
async resumeRecordingProcess(): Promise<void> { if (this.avRecorder !== undefined && this.avRecorder.state === 'paused') { await this.avRecorder.resume(); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AudioRecorder.ets#L91-L95
56b2543bd9d99eaa2b712841753a1e7636a14c15
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/DESSync.ets
arkts
encodeECB
加密-ECB模式 @param str 待加密的字符串 @param desKey 3DES密钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64 @returns
static encodeECB(str: string, desKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeECB(str, desKey, '3DES192', '3DES192|ECB|PKCS7', 192, keyCoding, resultCoding); }
AST#method_declaration#Left static encodeECB 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 desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static encodeECB(str: string, desKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeECB(str, desKey, '3DES192', '3DES192|ECB|PKCS7', 192, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DESSync.ets#L46-L49
0669d52d1f098ed959c53d3bc5784e3dca771b8c
gitee
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/common/History_Info.ets
arkts
JSON_to
给一个JSON对象,返回一个FarmBean
static JSON_to(message):History_Info{ var temp:History_Info = new History_Info( message.fieldId, message.name, message.sensor_IP, message.sensor_port ); temp.history_humidity = History_Info.to_arraylist(message.history_humidity); //console.info('load len of '+temp.history_tempera...
AST#method_declaration#Left static JSON_to AST#parameter_list#Left ( AST#parameter#Left message AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left History_Info AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declara...
static JSON_to(message):History_Info{ var temp:History_Info = new History_Info( message.fieldId, message.name, message.sensor_IP, message.sensor_port ); temp.history_humidity = History_Info.to_arraylist(message.history_humidity); temp.history_temperature = History_Info.to_ar...
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/common/History_Info.ets#L112-L132
43f948c4bd27a1b6bbdd66ff8079f472aef7c1a7
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/listener/ChartTouchListener.ets
arkts
endAction
Calls the OnChartGestureListener to do the end callback @param me
public endAction(me: TouchEvent) { let l: OnChartGestureListener = this.mChart.getOnChartGestureListener(); if (l != null) { l.onChartGestureEnd(me, this.mLastGesture); } }
AST#method_declaration#Left public endAction AST#parameter_list#Left ( AST#parameter#Left me : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#...
public endAction(me: TouchEvent) { let l: OnChartGestureListener = this.mChart.getOnChartGestureListener(); if (l != null) { l.onChartGestureEnd(me, this.mLastGesture); } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/listener/ChartTouchListener.ets#L89-L95
24e4bdcc0abc843f50dab659ced2082eb8753dcf
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/ui/dropdown/Dropdown.ets
arkts
下拉菜单组件
export interface DropdownOption { label: string; value: string; disabled?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DropdownOption AST#object_type#Left { AST#type_member#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left value : AST#type_annotation#L...
export interface DropdownOption { label: string; value: string; disabled?: boolean; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/dropdown/Dropdown.ets#L4-L8
6c2e6d1cadc67f4ab61f0b8f68d3fb06ee8c3616
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/model/CustomAnimation.ets
arkts
CustomAnimation
动效参数集,包含更改UI的动效属性
@Observed export class CustomAnimation { }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class CustomAnimation AST#class_body#Left { } AST#class_body#Right AST#decorated_export_declaration#Right
@Observed export class CustomAnimation { }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/CustomAnimation.ets#L19-L22
ecbd4cc3142b0cf9f6f49d0e1b2ef1f4ddace219
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the OS version represented by a string. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get osFullName(): string;
AST#method_declaration#Left static get AST#ERROR#Left osFullName AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static get osFullName(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L233-L233
56fa6acf36c6e40700ce322dc4646085744605e5
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/Rect.ets
arkts
inset
Insets the rectangle on all sides specified by the insets. @hide @param left The amount to add from the rectangle's left @param top The amount to add from the rectangle's top @param right The amount to subtract from the rectangle's right @param bottom The amount to subtract from the rectangle's bottom
public inset(left: number, top: number, right: number, bottom: number) { this.left += left; this.top += top; this.right -= right; this.bottom -= bottom; }
AST#method_declaration#Left public inset AST#parameter_list#Left ( AST#parameter#Left left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left top : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right ...
public inset(left: number, top: number, right: number, bottom: number) { this.left += left; this.top += top; this.right -= right; this.bottom -= bottom; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L199-L204
42d88eabecade1229dae16d9117f7d23f2c24d10
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets
arkts
aboutToAppear
当controller对应的NodeContainer在Appear的时候进行回调
aboutToAppear() { console.log('aboutToAppear'); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expr...
aboutToAppear() { console.log('aboutToAppear'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets#L61-L63
f02c83b509b81f40538298c0c8fdc81b5bb97166
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DateUtils.ets
arkts
equal
日期相等判断 @param date1 日期1 @param date2 日期2 @returns true 如果时间戳相同
static equal(date1: Date, date2: Date): boolean { return date1.getTime() === date2.getTime(); }
AST#method_declaration#Left static equal AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right A...
static equal(date1: Date, date2: Date): boolean { return date1.getTime() === date2.getTime(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L62-L64
abfb7124ebbc085715466eb0473a75a9310e9363
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/managers/SystemSizeManager.ets
arkts
init
初始化窗口实例 @param windowStage 窗口阶段对象
public init(windowStage: window.WindowStage): void { // 获取主窗口对象 this.windowObj = windowStage.getMainWindowSync(); // 设置窗口为全屏布局(内容绘制区域覆盖系统栏) // this.windowObj.setWindowLayoutFullScreen(true); // 初始化窗口尺寸和系统栏信息 this.updateWindowMetrics(); // 注册窗口监听事件 this.registerListeners(); }
AST#method_declaration#Left public init AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty...
public init(windowStage: window.WindowStage): void { this.windowObj = windowStage.getMainWindowSync(); this.updateWindowMetrics(); this.registerListeners(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/managers/SystemSizeManager.ets#L40-L51
b23901bf57d74a6eff7921ad5fbe4946f3da55bd
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/FeedbackRepository.ets
arkts
getFeedbackPage
分页查询意见反馈列表 @param params 分页请求参数 @returns 反馈分页数据
async getFeedbackPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Feedback>>> { return this.networkDataSource.getFeedbackPage(params); }
AST#method_declaration#Left async getFeedbackPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PageRequest 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 getFeedbackPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Feedback>>> { return this.networkDataSource.getFeedbackPage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FeedbackRepository.ets#L36-L38
3cab88c0e99c09c337e8098d2410f71ea3ef0a22
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/TaskInfoApi.ets
arkts
updateDataByDate
update taskInfo @param taskInfo @param callback
updateDataByDate(taskInfo: TaskInfo, callback: Function): void { const valueBucket = generateBucket(taskInfo); let tableName = Const.TASK_INFO.tableName; if (!tableName) { return; } let predicates = new dataRdb.RdbPredicates(tableName); predicates.equalTo('date', taskInfo.date).and().equal...
AST#method_declaration#Left updateDataByDate AST#parameter_list#Left ( AST#parameter#Left taskInfo : AST#type_annotation#Left AST#primary_type#Left TaskInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#pr...
updateDataByDate(taskInfo: TaskInfo, callback: Function): void { const valueBucket = generateBucket(taskInfo); let tableName = Const.TASK_INFO.tableName; if (!tableName) { return; } let predicates = new dataRdb.RdbPredicates(tableName); predicates.equalTo('date', taskInfo.date).and().equal...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/TaskInfoApi.ets#L62-L74
a29b5a6af7c36d6b3cc4014798b8626d743c0ba0
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets
arkts
应用约束1:去除any类型,明确参数类型
constructor(message: Message, filter: CollectorFilter, options: ReactionCollectorOptions = {}) { super(message.client, filter, options); this.message = message; this.users = new Collection(); // 应用约束7:使用private代替#私有字段 this.client.setMaxListeners(this.client.getMaxListeners() + 1); // 应用约束...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filter : AST#type_annotation#Left AST#primary_type#Left CollectorFilter AST...
constructor(message: Message, filter: CollectorFilter, options: ReactionCollectorOptions = {}) { super(message.client, filter, options); this.message = message; this.users = new Collection(); this.client.setMaxListeners(this.client.getMaxListeners() + 1); this.client.on('messageReac...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets#L20-L31
e46010cad0f41c90e01678c07db844b35741e882
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getStringArrayByName
获取指定资源名称对应的字符串数组 @param resName 资源名称
static async getStringArrayByName(resName: string): Promise<Array<string>> { return ResUtil.getResourceManager().getStringArrayByName(resName); }
AST#method_declaration#Left static async getStringArrayByName AST#parameter_list#Left ( AST#parameter#Left resName : 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#...
static async getStringArrayByName(resName: string): Promise<Array<string>> { return ResUtil.getResourceManager().getStringArrayByName(resName); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L182-L184
02e26d3b144a7656ff3e47b69ed93a92587f1f18
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/AvatarComponent.ets
arkts
changePoseWithTransition
平滑换姿势
private changePoseWithTransition() { // 淡出 this.imageOpacity = 0; setTimeout(() => { // 切换姿势 this.currentPoseIndex = (this.currentPoseIndex + 1) % 100; // 淡入 setTimeout(() => { this.imageOpacity = 1; }, 100); }, 300); }
AST#method_declaration#Left private changePoseWithTransition 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 . imageOpacit...
private changePoseWithTransition() { this.imageOpacity = 0; setTimeout(() => { this.currentPoseIndex = (this.currentPoseIndex + 1) % 100; setTimeout(() => { this.imageOpacity = 1; }, 100); }, 300); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/AvatarComponent.ets#L280-L293
bbce2130099d84d8cf4b96a43d098275cb24d6af
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
entry/src/main/ets/pages/LiveEnterPage.ets
arkts
onVHNetworkConnect
消息服务连接成功
onVHNetworkConnect(): void { }
AST#method_declaration#Left onVHNetworkConnect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
onVHNetworkConnect(): void { }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/entry/src/main/ets/pages/LiveEnterPage.ets#L138-L140
0d72e9506797fc631bbe4f340f5d90af668f56cd
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
add
/为已经存在的plan添加新的words
public static async add(wordIds: number[], plan: Plan): Promise<void> { if (wordIds.length === 0) return; /////新加一个piece const addNewPiece = (pieceNo: number, wordId: number) => { //新加一个piece let newPiece = new Piece(pieceNo, [wordId] ); //计算newPiece在DayOfs中的位置 let boxes = PlanMana...
AST#method_declaration#Left public static async add AST#parameter_list#Left ( AST#parameter#Left wordIds : 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 plan : AST#type_annotati...
public static async add(wordIds: number[], plan: Plan): Promise<void> { if (wordIds.length === 0) return; const addNewPiece = (pieceNo: number, wordId: number) => { let newPiece = new Piece(pieceNo, [wordId] ); let boxes = PlanManager.boxesComputed(newPiece, plan.distances); ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L372-L413
76d78ef61be9bf9250706f4f582af9e3e071ea12
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/grid/DataInGrid.ets
arkts
DataInGrid
[Start build_a_office_services_grid_of_foreach]
@Entry @Component export struct DataInGrid { @State services: Array<string> = ['Meeting', 'Voting', 'Check-in', 'Printing']; build() { // [StartExclude build_a_office_services_grid_of_foreach] NavDestination() { // [EndExclude build_a_office_services_grid_of_foreach] Column({ space: 12 }) { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct DataInGrid AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right services : AST#type_annotation#Left AST#primary_type#Lef...
@Entry @Component export struct DataInGrid { @State services: Array<string> = ['Meeting', 'Voting', 'Check-in', 'Printing']; build() { NavDestination() { Column({ space: 12 }) { ComponentCard({ title: $r('app.string.DataInGrid_titleOfficeServices') }) { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/grid/DataInGrid.ets#L19-L91
5549e48daa30e02e75aa37df664b5f1d43532632
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/live/LiveManager.ets
arkts
setVolume
设置音量
setVolume(volume: number): void { this.liveStatus.volume = Math.max(0, Math.min(100, volume)); EventBus.emit('LIVE_VOLUME_CHANGED', { volume: this.liveStatus.volume }); }
AST#method_declaration#Left setVolume AST#parameter_list#Left ( AST#parameter#Left volume : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right A...
setVolume(volume: number): void { this.liveStatus.volume = Math.max(0, Math.min(100, volume)); EventBus.emit('LIVE_VOLUME_CHANGED', { volume: this.liveStatus.volume }); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/live/LiveManager.ets#L141-L144
e669c2111b962c1f1d635662aaed81fbf028763c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
reportContent
举报内容
async reportContent( targetType: 'post' | 'comment' | 'user', targetId: string, type: ReportType, reason: string, description?: string ): Promise<boolean> { try { if (!this.currentUser) return false; const report: Report = { id: `report_${Date.now()}`, reporterId: ...
AST#method_declaration#Left async reportContent AST#parameter_list#Left ( AST#parameter#Left targetType AST#parameter#Right AST#ERROR#Left : 'post' | 'comment' | 'user' AST#ERROR#Right , AST#parameter#Left targetId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ...
async reportContent( targetType: 'post' | 'comment' | 'user', targetId: string, type: ReportType, reason: string, description?: string ): Promise<boolean> { try { if (!this.currentUser) return false; const report: Report = { id: `report_${Date.now()}`, reporterId: ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L464-L495
daae12934b33c838a7700ed3f5b19217458c4015
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
checkNewVersion
从服务器取搜索新版本 @return resolve 新版本信息/reject 错误信息
async checkNewVersion(): Promise<UpgradeData<update.CheckResult>> { return new Promise((resolve, reject) => { this.updateManager.checkNewVersion().then((result: UpgradeData<update.CheckResult>) => { if (result?.callResult === UpgradeCallResult.OK) { globalThis.cachedNewVersionInfo = result?....
AST#method_declaration#Left async checkNewVersion 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 UpgradeData AST#type_arguments#Left < AST#t...
async checkNewVersion(): Promise<UpgradeData<update.CheckResult>> { return new Promise((resolve, reject) => { this.updateManager.checkNewVersion().then((result: UpgradeData<update.CheckResult>) => { if (result?.callResult === UpgradeCallResult.OK) { globalThis.cachedNewVersionInfo = result?....
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L131-L142
d2cbd805bb7dbc5931a9a1d3fced1b9ee5ab55fb
gitee
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets
arkts
Provides settings for brush fill when drawing. @syscap SystemCapability.Graphics.Drawing @since 11
export class Brush { static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); }
AST#export_declaration#Left export AST#class_declaration#Left class Brush AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parameter_list#R...
export class Brush { static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L672-L673
9f6ab272b5760ae7249cc371ed5040c3b86361f9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets
arkts
getAnimateSelectIndex
获取动画控制的下标 用于切换选项时,先让标签回到底部,然后让当前选项在上移
getAnimateSelectIndex() { // 动画等待时间 - 用于等待上一个选项动画结束 let animateDelay = 500; animateTo({ duration: this.animateTime, delay: animateDelay }, () => { this.animateSelectIndex = this.selectIndex }) }
AST#method_declaration#Left getAnimateSelectIndex AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 动画等待时间 - 用于等待上一个选项动画结束 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animateDelay = AST#expression#Left 500 AST#expression#Right AST#variable_declarato...
getAnimateSelectIndex() { let animateDelay = 500; animateTo({ duration: this.animateTime, delay: animateDelay }, () => { this.animateSelectIndex = this.selectIndex }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets#L60-L69
0b8dcfda69d85b9f6d8574d1f059681e860f0e06
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/models/ContactModel.ets
arkts
create
静态方法:创建联系人
static create(params: CreateContactParams): Contact { const now = new Date().toISOString(); const id = ContactModel.generateId(); const birthdayInfo = ContactModel.createBirthdayInfo(params.birthday); const contact: Contact = { id, name: params.name.trim(), avatar: params.ava...
AST#method_declaration#Left static create AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateContactParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Contact AST#...
static create(params: CreateContactParams): Contact { const now = new Date().toISOString(); const id = ContactModel.generateId(); const birthdayInfo = ContactModel.createBirthdayInfo(params.birthday); const contact: Contact = { id, name: params.name.trim(), avatar: params.ava...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L27-L51
ccf9bca50f0b1d7b0fcc9b4328b23b8a77adf44e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets
arkts
getLatestProgressValue
Get the latest progress.
getLatestProgressValue(): number { if (this.targetData.length === 0) { return 0; } return this.targetData[this.targetData.length - CommonConstants.ONE_TASK].progressValue; }
AST#method_declaration#Left getLatestProgressValue 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#if_statement#Left if ( AST#expression#Left AST#binary_express...
getLatestProgressValue(): number { if (this.targetData.length === 0) { return 0; } return this.targetData[this.targetData.length - CommonConstants.ONE_TASK].progressValue; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets#L73-L78
fc9bbd99cf0cba292652708190f40d1f9282e1e3
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/searchPage.ets
arkts
setSearchKeyword
set search keyword
setSearchKeyword() { this.searchKeyword = SearchUtil.stripKeyword(this.inputKeyword).trim() }
AST#method_declaration#Left setSearchKeyword 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 . searchKeyword AST#member_expressi...
setSearchKeyword() { this.searchKeyword = SearchUtil.stripKeyword(this.inputKeyword).trim() }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/searchPage.ets#L157-L159
aaeb500c834879def6215049a2516c703259649b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AudioRecorder.ets
arkts
pauseRecordingProcess
暂停录制对应的流程
async pauseRecordingProcess(): Promise<void> { if (this.avRecorder !== undefined && this.avRecorder.state === 'started') { // 仅在started状态下调用pause为合理状态切换 await this.avRecorder.pause(); } }
AST#method_declaration#Left async pauseRecordingProcess 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...
async pauseRecordingProcess(): Promise<void> { if (this.avRecorder !== undefined && this.avRecorder.state === 'started') { await this.avRecorder.pause(); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AudioRecorder.ets#L84-L88
6ee16bdefd8ca3084e00d2ee8f00a1f4e1b4a3f8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
getLeaderboard
获取排行榜数据
async getLeaderboard(type: 'points' | 'level' | 'achievements' = 'points', limit: number = 10): Promise<LeaderboardEntry[]> { try { // TODO: 实现真实的排行榜数据查询 // 这里提供模拟数据 const mockData: LeaderboardEntry[] = [ { userId: '1', username: '生日达人', level: 5, points: 1250, rank: 1, change: 0, achievem...
AST#method_declaration#Left async getLeaderboard AST#parameter_list#Left ( AST#parameter#Left type AST#ERROR#Left : 'points' | 'level' | 'achievements' AST#ERROR#Right = AST#expression#Left 'points' AST#expression#Right AST#parameter#Right , AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left numb...
async getLeaderboard(type: 'points' | 'level' | 'achievements' = 'points', limit: number = 10): Promise<LeaderboardEntry[]> { try { const mockData: LeaderboardEntry[] = [ { userId: '1', username: '生日达人', level: 5, points: 1250, rank: 1, change: 0, achievements: 15 }, { userId: '2...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L473-L489
aa1077e4a5fb22c68bf445b9682d4aec60ac3a29
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
getZoomRatioRange
[End init_camera] Obtains the variable focal length range
getZoomRatioRange(): Array<number> { let zoomRatioRange: Array<number> = []; if (this.session !== undefined) { try { zoomRatioRange = this.session.getZoomRatioRange(); } catch (error) { let err = error as BusinessError; Logger.warn('testTag', `getZoomRatioRange failed, code=$...
AST#method_declaration#Left getZoomRatioRange AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
getZoomRatioRange(): Array<number> { let zoomRatioRange: Array<number> = []; if (this.session !== undefined) { try { zoomRatioRange = this.session.getZoomRatioRange(); } catch (error) { let err = error as BusinessError; Logger.warn('testTag', `getZoomRatioRange failed, code=$...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L212-L223
b2b772ca4ab6ee486cb5151db9301b92c80bf3ca
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
PersistProp
Called when a persistence property is stored. @since 7 @deprecated since 10
static PersistProp<T>(key: string, defaultValue: T): void { PersistentStorage.persistProp(key, defaultValue) }
AST#method_declaration#Left static PersistProp AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter...
static PersistProp<T>(key: string, defaultValue: T): void { PersistentStorage.persistProp(key, defaultValue) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L373-L375
02015c9ad085fb50f031036ec9d0bdc89e3f4a3f
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/ScatterDataSet.ets
arkts
setScatterShapeSize
Sets the size in density pixels the drawn scattershape will have. This only applies for non custom shapes. @param size
public setScatterShapeSize(size: number) { this.mShapeSize = size; }
AST#method_declaration#Left public setScatterShapeSize AST#parameter_list#Left ( AST#parameter#Left size : 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 ...
public setScatterShapeSize(size: number) { this.mShapeSize = size; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L85-L87
1fc34a2d378177a63d6755c4db49249de86b8fdc
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleStatsManager.ets
arkts
loadRealTimeStats
加载实时统计数据
private loadRealTimeStats(): void { try { const taskStats = this.taskViewModel.getTaskStats(); const todayTasks = this.taskViewModel.getTodayTasks(); const allTasks = this.taskViewModel.getAllTasks(); const completedToday = todayTasks.filter(task => task.completed).length; // 计算真实的专注时...
AST#method_declaration#Left private loadRealTimeStats 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#try_statement#Left try AST#block_statement#Left { AST#statem...
private loadRealTimeStats(): void { try { const taskStats = this.taskViewModel.getTaskStats(); const todayTasks = this.taskViewModel.getTodayTasks(); const allTasks = this.taskViewModel.getAllTasks(); const completedToday = todayTasks.filter(task => task.completed).length; cons...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleStatsManager.ets#L90-L118
ef228652ea4bb8711e2c307ecc5b9b1ea8173e04
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/userdata/UserData.ets
arkts
/ 用于服务器上备份和恢复用户数据
export class UserDataJson { user_id?: number | null = null; book_id?: number | null = null; user_data_addr?: string | null = null; create_date?: string | null = null; update_date?: string | null = null; }
AST#export_declaration#Left export AST#class_declaration#Left class UserDataJson AST#class_body#Left { AST#property_declaration#Left user_id ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#t...
export class UserDataJson { user_id?: number | null = null; book_id?: number | null = null; user_data_addr?: string | null = null; create_date?: string | null = null; update_date?: string | null = null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/userdata/UserData.ets#L14-L20
fb276e0d1a8c53125ad061a31aee0d1f502640d8
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getWordById
根据单词ID获取单词
getWordById(id: number): WordUser | undefined { return this.allWords.find(word => word.idx === id); }
AST#method_declaration#Left getWordById 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_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left WordUser AS...
getWordById(id: number): WordUser | undefined { return this.allWords.find(word => word.idx === id); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L444-L446
12f7a3e4a6342e9318a73df3bb78a92c3182d198
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/utils/DateUtils.ets
arkts
判断两个日期是否是同一天
export function isSameDay(date1: Date | number, date2: Date | number): boolean { // 如果输入的日期是数字,将其转换为日期对象 if (typeof date1 === 'number') { date1 = new Date(date1) } if (typeof date2 === 'number') { date2 = new Date(date2) } // 判断两个日期的年、月、日是否相同 return isSameMonth(date1, date2) && date1.getDate() ...
AST#export_declaration#Left export AST#function_declaration#Left function isSameDay AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_anno...
export function isSameDay(date1: Date | number, date2: Date | number): boolean { if (typeof date1 === 'number') { date1 = new Date(date1) } if (typeof date2 === 'number') { date2 = new Date(date2) } return isSameMonth(date1, date2) && date1.getDate() === date2.getDate() }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L45-L57
59cd6d16d2ac8e0790125528e0637fd188e3fac2
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildUpcomingBirthdays
即将到来的生日
@Builder buildUpcomingBirthdays() { Column({ space: 16 }) { Row() { Text('📅 即将到来') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .layoutWeight(1) Text('查看更多') .fontSize(14) .fontColor(this.COLORS...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUpcomingBirthdays AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compon...
@Builder buildUpcomingBirthdays() { Column({ space: 16 }) { Row() { Text('📅 即将到来') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .layoutWeight(1) Text('查看更多') .fontSize(14) .fontColor(this.COLORS...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1579-L1671
71ece83fd0ea75245cd0c65f392b9191ba4045af
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets
arkts
processHomeData
API响应处理
private processHomeData(homeData: HomePageData): void { if (homeData) { if (homeData.dreamStats) { this.dreamStats = homeData.dreamStats; // 如果梦想完成率为0但有已完成任务,则使用任务完成率 if (this.dreamStats.dreamCompletionRate === 0 && this.dreamStats.completedTasks > 0) { console.info(...
AST#method_declaration#Left private processHomeData AST#parameter_list#Left ( AST#parameter#Left homeData : AST#type_annotation#Left AST#primary_type#Left HomePageData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS...
private processHomeData(homeData: HomePageData): void { if (homeData) { if (homeData.dreamStats) { this.dreamStats = homeData.dreamStats; if (this.dreamStats.dreamCompletionRate === 0 && this.dreamStats.completedTasks > 0) { console.info('梦想完成率为0但存在已完成任务,使用任务完成率表示整体...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets#L800-L820
f43b5f9b38c1b8126bcfc92054335c0b99f6c2db
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/OrderCacheStoreRepository.ets
arkts
构造函数 @param {OrderCacheStoreDataSource} [dataSource] 可选自定义数据源
constructor(dataSource?: OrderCacheStoreDataSource) { this.dataSource = dataSource ?? new OrderCacheStoreDataSourceImpl(); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dataSource ? : AST#type_annotation#Left AST#primary_type#Left OrderCacheStoreDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left ...
constructor(dataSource?: OrderCacheStoreDataSource) { this.dataSource = dataSource ?? new OrderCacheStoreDataSourceImpl(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderCacheStoreRepository.ets#L22-L24
fd16f4d0886c3a1016f1d9ccc3df50af04aed67a
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/NotificationUtil.ets
arkts
readOrRemoveNotice
读取或清除通知后重置角标 @param want
static readOrRemoveNotice(want: Want) { //获取从通知进入的参数 if (want.parameters && want.parameters["eftoolNotice"]) { //设置角标 notificationManager.getActiveNotificationCount().then(num => { notificationManager.setBadgeNumber(num); }) } }
AST#method_declaration#Left static readOrRemoveNotice AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { //获取从通知进入的参数 AST#ui_control_flow#...
static readOrRemoveNotice(want: Want) { if (want.parameters && want.parameters["eftoolNotice"]) { notificationManager.getActiveNotificationCount().then(num => { notificationManager.setBadgeNumber(num); }) } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L411-L419
6c753be692451476f3ab9228c19ee98e4b1cb6c7
gitee
Delsin-Yu/JustPDF.git
d53f566e02820dac46e1752151750144acbed50a
entry/src/main/ets/components/PageInfo.ets
arkts
cancelPendingTasks
Cancels all pending cache tasks.
public cancelPendingTasks(): void { for (const pendingTask of this.pendingTasks.values()) { try { taskpool.cancel(pendingTask.task); } catch (error) { // Task may have already completed or been cancelled hilog.debug(0, 'PDFView', `取消任务时出错: ${error}`); } } this.pendi...
AST#method_declaration#Left public cancelPendingTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const pendingTask of AST#expression...
public cancelPendingTasks(): void { for (const pendingTask of this.pendingTasks.values()) { try { taskpool.cancel(pendingTask.task); } catch (error) { hilog.debug(0, 'PDFView', `取消任务时出错: ${error}`); } } this.pendingTasks.clear(); }
https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L192-L202
60ed52f1d60067275aa7ec436f3d63f723251561
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets
arkts
@author 惟草木之零落兮 @date 2024/5/22 20:10
export default class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = []; private originDataArray: T[] = []; //获取数据源总长度 public totalCount(): number { return this.originDataArray.length??0; } //根据下标获取数据 public getData(index: number): T { r...
AST#export_declaration#Left export default AST#class_declaration#Left class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declarati...
export default class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = []; private originDataArray: T[] = []; public totalCount(): number { return this.originDataArray.length??0; } public getData(index: number): T { return this.originDat...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L6-L122
7dbda0d7315dc2dcdb007af3a4e5e33170e10e48
github
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/demo/entry/src/main/ets/views/DividerPage.ets
arkts
DividerPage
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct DividerPage { @Prop referenceLineBol: boolean build() { if (this.referenceLineBol) { Stack() { Column() { Divider().color(Color.White) Divider().color(Color.White) }.justifyContent(FlexAlign.SpaceEvenly).height('100%') Row() { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DividerPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right referenceLineBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#ty...
@Component export struct DividerPage { @Prop referenceLineBol: boolean build() { if (this.referenceLineBol) { Stack() { Column() { Divider().color(Color.White) Divider().color(Color.White) }.justifyContent(FlexAlign.SpaceEvenly).height('100%') Row() { ...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/views/DividerPage.ets#L16-L35
65c1816cba7bfcbd286928a1d5f3b447c3c6985c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/AddressListPage.ets
arkts
AddressListPage
@file 地址列表页面视图 @author Joker.X
@ComponentV2 export struct AddressListPage { /** * 地址列表页面 ViewModel */ @Local private vm: AddressListViewModel = new AddressListViewModel(); /** * 列表滚动控制器,用于刷新同步 */ private listScroller: Scroller = new Scroller(); /** * 当前窗口安全区状态 */ @Param windowSafeAreaState: WindowSafeAreaState = get...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct AddressListPage AST#component_body#Left { /** * 地址列表页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Addr...
@ComponentV2 export struct AddressListPage { @Local private vm: AddressListViewModel = new AddressListViewModel(); private listScroller: Scroller = new Scroller(); @Param windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); build() { AppNavDestination({ title: $r("app....
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressListPage.ets#L20-L139
f965a14baac618ac4b7aea295ed1e86c20c8457c
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/model/BasicDataSource.ets
arkts
ShareModel
Share Model
@Observed export class ShareModel { heart: number; star: number; message: number; constructor(heart: number, star: number, message: number) { this.heart = heart; this.star = star; this.message = message; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ShareModel AST#class_body#Left { AST#property_declaration#Left heart : 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 ShareModel { heart: number; star: number; message: number; constructor(heart: number, star: number, message: number) { this.heart = heart; this.star = star; this.message = message; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/model/BasicDataSource.ets#L68-L79
af5e81c7667f692f2df84b953c084cfbe0df739f
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/pages/EditPage.ets
arkts
[End photo_buffer_callback]
build() { Column() { Column() { // DocsCode 1 Image($r('app.media.ic_public_back')) .objectFit(ImageFit.Cover) .onClick(() => { Logger.info(TAG, 'back onClick'); this.getUIContext().getRouter().back(); }) .width(40) .hei...
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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // DocsCod...
build() { Column() { Column() { Image($r('app.media.ic_public_back')) .objectFit(ImageFit.Cover) .onClick(() => { Logger.info(TAG, 'back onClick'); this.getUIContext().getRouter().back(); }) .width(40) .height(40) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/pages/EditPage.ets#L96-L130
449953e5883ba64d45cd0332b8c1cd96523c8bbd
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/network/NetworkPageData.ets
arkts
@file 网络分页数据模型 @author Joker.X
export class NetworkPageData<T> { /** * 数据列表 */ list: Array<T> | null; /** * 分页元数据 */ pagination: NetworkPageMeta | null; /** * 构造函数,对接口返回做空值兜底 * @param {Partial<NetworkPageData<T>>} payload - 接口返回的分页数据 */ constructor(payload?: Partial<NetworkPageData<T>>) { this.list = payload?.li...
AST#export_declaration#Left export AST#class_declaration#Left class NetworkPageData AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { /** * 数据列表 */ AST#property_declaration#Left list : AST#type_annotation#Left AST#union_type#Left AST#pr...
export class NetworkPageData<T> { list: Array<T> | null; pagination: NetworkPageMeta | null; constructor(payload?: Partial<NetworkPageData<T>>) { this.list = payload?.list ?? null; this.pagination = payload?.pagination ? new NetworkPageMeta(payload.pagination) : null; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/network/NetworkPageData.ets#L7-L25
80a6410b9779516cc5e44f36eb9f04cfd19a8f87
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Model/DMPBundleInstallConfig.ets
arkts
包管理安装配置信息
export class DMPBundleInstallConfig { context: Context; launchAppType: DMPLaunchType = DMPLaunchType.OnLine; appId: string; appIndex: number; public appVersion: string = ''; public appLocalFilePath: string = ''; public sdkId: string = ''; public sdkVersion: string = ''; public sdkLocalFilePath: string...
AST#export_declaration#Left export AST#class_declaration#Left class DMPBundleInstallConfig AST#class_body#Left { AST#property_declaration#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left ...
export class DMPBundleInstallConfig { context: Context; launchAppType: DMPLaunchType = DMPLaunchType.OnLine; appId: string; appIndex: number; public appVersion: string = ''; public appLocalFilePath: string = ''; public sdkId: string = ''; public sdkVersion: string = ''; public sdkLocalFilePath: string...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Model/DMPBundleInstallConfig.ets#L6-L27
05e9ac6081f79b807fd5f7665d977778cca905d1
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Checks settings to figure out if currently is in free window mode. @param context The UIAbility Context. @returns A boolean value.
export function get_free_window_mode(context: Context) { if (deviceInfo.deviceType == '2in1') { console.log('[free] return true for 2in1 type!'); AppStorage.setOrCreate('free_window_mode', true); return true; } let free = settings.getValueSync(context, 'window_pcmode_switch_status', 'false', settings....
AST#export_declaration#Left export AST#function_declaration#Left function get_free_window_mode AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement...
export function get_free_window_mode(context: Context) { if (deviceInfo.deviceType == '2in1') { console.log('[free] return true for 2in1 type!'); AppStorage.setOrCreate('free_window_mode', true); return true; } let free = settings.getValueSync(context, 'window_pcmode_switch_status', 'false', settings....
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L272-L283
96a29694e1a5bd18c579a842d1c1c59afa3be48d
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/cross_file/cross_file_004_F/cross_file_004_F_b.ets
arkts
Introduction export-default/import
export default function cross_file_004_F_b(taint_src : string) { let _t = taint_src; let clean = cross_file_004_F_a("_"); taint.Sink(clean); }
AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function cross_file_004_F_b 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...
export default function cross_file_004_F_b(taint_src : string) { let _t = taint_src; let clean = cross_file_004_F_a("_"); taint.Sink(clean); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_004_F/cross_file_004_F_b.ets#L7-L11
03f65ac36a6b6fc98ad47d3e7d43466248d557af
github