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
Million-mo/tree-sitter-arkts.git
2fd0ad75e2d848709edcf4be038f27b178114ef6
examples/event_handling.ets
arkts
handleDrag
拖拽事件处理
private handleDrag(event: DragEvent) { this.dragOffset.x = event.getX() this.dragOffset.y = event.getY() this.eventData.gestureInfo = `拖拽位置: (${Math.round(this.dragOffset.x)}, ${Math.round(this.dragOffset.y)})` }
AST#method_declaration#Left private handleDrag AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left DragEvent 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#...
private handleDrag(event: DragEvent) { this.dragOffset.x = event.getX() this.dragOffset.y = event.getY() this.eventData.gestureInfo = `拖拽位置: (${Math.round(this.dragOffset.x)}, ${Math.round(this.dragOffset.y)})` }
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/event_handling.ets#L56-L60
0244ac0454e5a32dc0fa16365be70844e1cea6de
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/NetConnectionUtils.ets
arkts
网络相关工具类 需要ohos.permission.GET_NETWORK_INFO权限。
export class NetConnectionUtils { private constructor() { } private static netConnection: connection.NetConnection; /** * 检查默认数据网络是否被激活 */ static hasDefaultNet(): Promise<boolean> { return connection.hasDefaultNet(); } /** * 检查默认数据网络是否被激活 */ static hasDefaultNetSync(): boolean { r...
AST#export_declaration#Left export AST#class_declaration#Left class NetConnectionUtils AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_dec...
export class NetConnectionUtils { private constructor() { } private static netConnection: connection.NetConnection; static hasDefaultNet(): Promise<boolean> { return connection.hasDefaultNet(); } static hasDefaultNetSync(): boolean { return connection.hasDefaultNetSync(); } static ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/NetConnectionUtils.ets#L11-L127
5c7c0e8a68781392d51192934774bb6013c241f2
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/Constants.ets
arkts
Application Constants Central configuration for the Lumos Agent application
export class Constants { // Database Configuration static readonly DB_NAME: string = 'lumos.db'; static readonly DB_SECURITY_LEVEL: number = 1; // S1 level // Table Names static readonly TABLE_TASKS: string = 'tasks'; static readonly TABLE_MEMOS: string = 'memos'; static readonly TABLE_MOOD_ENTRIES: stri...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { // Database Configuration AST#property_declaration#Left static readonly DB_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'lumos.db' AS...
export class Constants { static readonly DB_NAME: string = 'lumos.db'; static readonly DB_SECURITY_LEVEL: number = 1; static readonly TABLE_TASKS: string = 'tasks'; static readonly TABLE_MEMOS: string = 'memos'; static readonly TABLE_MOOD_ENTRIES: string = 'mood_entries'; static readonly TABLE_CHAT_...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/Constants.ets#L6-L75
581c330d98310dc3df0cca9ba2f1b638daef7b78
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets
arkts
makeNode
实例绑定的NodeContainer组件的宽,单位px MyNodeController实例绑定的NodeContainer创建时触发,创建根节点rootNode并将其挂载至NodeContainer
makeNode(uiContext: UIContext): FrameNode { this.rootNode = new FrameNode(uiContext); if (this.rootNode !== null) { this.rootRenderNode = this.rootNode.getRenderNode(); } return this.rootNode; }
AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FrameNode AST#primary_ty...
makeNode(uiContext: UIContext): FrameNode { this.rootNode = new FrameNode(uiContext); if (this.rootNode !== null) { this.rootRenderNode = this.rootNode.getRenderNode(); } return this.rootNode; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets#L56-L62
1bb8517d8e9d6badd11374d2b552295db24dc9a6
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/model/ImageKnifeData.ets
arkts
request子线程处理时的返回
export interface RequestJobResult { pixelMap: PixelMap | string | undefined bufferSize: number fileKey: string loadFail?: string, size?:Size, type?: string, pixelMapList?:Array<PixelMap>, delayList?: Array<number>, imageKnifeData?: ImageKnifeData, }
AST#export_declaration#Left export AST#interface_declaration#Left interface RequestJobResult AST#object_type#Left { AST#type_member#Left pixelMap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#...
export interface RequestJobResult { pixelMap: PixelMap | string | undefined bufferSize: number fileKey: string loadFail?: string, size?:Size, type?: string, pixelMapList?:Array<PixelMap>, delayList?: Array<number>, imageKnifeData?: ImageKnifeData, }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/model/ImageKnifeData.ets#L115-L125
40bd1d445709055f92bed9db41df9005ce68b450
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/Constraint.ets
arkts
暂时 这么定通用action,用来统一添加close
export type GenericOnAction<T extends ESObject[]> = (...args: T) => void;
AST#export_declaration#Left export AST#type_declaration#Left type GenericOnAction AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ESObject [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > ...
export type GenericOnAction<T extends ESObject[]> = (...args: T) => void;
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/Constraint.ets#L8-L8
ed95a3c376d90b48395f85951d7c55e1b518771c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets
arkts
setSandboxFile
设置沙箱保留
async setSandboxFile(docUris: Array<string>): Promise<void> { try { dlpPermission.setRetentionState(docUris); // 设置沙箱保留 } catch (err) { Logger.error(TAG, 'setRetentionState error:' + (err as BusinessError).code + (err as BusinessError).message); } }
AST#method_declaration#Left async setSandboxFile AST#parameter_list#Left ( AST#parameter#Left docUris : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
async setSandboxFile(docUris: Array<string>): Promise<void> { try { dlpPermission.setRetentionState(docUris); } catch (err) { Logger.error(TAG, 'setRetentionState error:' + (err as BusinessError).code + (err as BusinessError).message); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets#L232-L238
b74b291ad9786e0316dfa5576a1e32fac2216e1f
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets
arkts
initXTPromptHUDConfig
/ 全局参数配置 / API文档 https://gitee.com/kukumalu/xthud
private static initXTPromptHUDConfig(context: UIContext) { XTPromptHUD.globalConfigToast(context, (options: XTHUDToastOptions) => { options.isQueueMode = true // 同时只显示一个 options.isModal = true // 是否为全屏,屏蔽交互 options.closeOnPressBack = false // 控制是否点击系统返回键时关闭 HUD,默认 false,开启后触发返回关闭会执行 onCancel ...
AST#method_declaration#Left private static initXTPromptHUDConfig AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression...
private static initXTPromptHUDConfig(context: UIContext) { XTPromptHUD.globalConfigToast(context, (options: XTHUDToastOptions) => { options.isQueueMode = true options.isModal = true options.closeOnPressBack = false options.closeOnClickOutside = false options.fontSize = _fontSize ...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L98-L187
567eaa57e2ce6abb1982950a1ef3931e81a7e564
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/util.ets
arkts
Parse google.protobuf.Duration from string
export function durationFromJson(str: string): DurationParts { if (typeof str !== 'string' || !str.endsWith('s')) throw new Error('invalid duration') const body = str.slice(0, -1) const m = body.match(/^(-?)(\d+)(?:\.(\d{1,9}))?$/) if (!m) throw new Error('invalid duration') const neg = m[1] === '-' const s...
AST#export_declaration#Left export AST#function_declaration#Left function durationFromJson 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_list#Right : AST#type_annotation#Left A...
export function durationFromJson(str: string): DurationParts { if (typeof str !== 'string' || !str.endsWith('s')) throw new Error('invalid duration') const body = str.slice(0, -1) const m = body.match(/^(-?)(\d+)(?:\.(\d{1,9}))?$/) if (!m) throw new Error('invalid duration') const neg = m[1] === '-' const s...
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/util.ets#L183-L200
e6f58a6f7de920a3a817eae769e8ec019b01e811
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets
arkts
insertOrUpdateOnlineDataForWord
MARK: - 插入或更新删除单词数据(对应Java的insertOrRemoveDeleteWordDataForWord) async insertOrRemoveDeleteWordDataForWord(wordUser: WordUser): Promise<void> { if (!this.db) return; let sql: string; let params: ParamType[]; if (wordUser.deleted) { // 插入或更新 sql = `REPLACE INTO ${Tables.DeleteWord.NAME} ( ${Tables.DeleteWord.Col.TITLE_...
async insertOrUpdateOnlineDataForWord(word: WordDetail): Promise<void> { if (!this.db) return; const titleEn: string | null = word.titleEn; if (!titleEn) return; // 仅 Base64 编码(不加盐) const titleEnBase64: string | null = word.titleEnEncodeToBase64; if (!titleEnBase64) return; // ===========...
AST#method_declaration#Left async insertOrUpdateOnlineDataForWord AST#parameter_list#Left ( AST#parameter#Left word : AST#type_annotation#Left AST#primary_type#Left WordDetail AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left...
async insertOrUpdateOnlineDataForWord(word: WordDetail): Promise<void> { if (!this.db) return; const titleEn: string | null = word.titleEn; if (!titleEn) return; const titleEnBase64: string | null = word.titleEnEncodeToBase64; if (!titleEnBase64) return; const sqlDelete: s...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L236-L339
6260caf2a9d315d4c00ba3f07c1331a4bf7483e8
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HapAndHarDependHar/entry/oh_modules/har_library/oh_modules/har_common/Index.ets
arkts
funcResult
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 { funcResult } from './src/main/ets/utils/Utils';
AST#export_declaration#Left export { funcResult } from './src/main/ets/utils/Utils' ; AST#export_declaration#Right
export { funcResult } from './src/main/ets/utils/Utils';
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HapAndHarDependHar/entry/oh_modules/har_library/oh_modules/har_common/Index.ets#L16-L16
810d88a39f395b78b41f78bb267fd7b540c94ea1
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderDetailPage.ets
arkts
OrderInfoTitle
订单信息标题 @returns {void} 无返回值
@Builder private OrderInfoTitle() { TitleWithLine({ text: $r("app.string.order_info") }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderInfoTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left TitleWithLine ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#express...
@Builder private OrderInfoTitle() { TitleWithLine({ text: $r("app.string.order_info") }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L335-L340
7d91b39c5e7f68925be2f1645382f95611bc5606
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM2.ets
arkts
TODO SM2加解密 author: 桃花镇童长老ᥫ᭡ since: 2024/07/01
export class SM2 { /** * 加密,异步 * @param data 加密或者解密的数据。data不能为null。 * @param pubKey 指定加密公钥。 * @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合,默认SM2_256|SM3。 * @returns */ static async encrypt(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, transformation: string = '...
AST#export_declaration#Left export AST#class_declaration#Left class SM2 AST#class_body#Left { /** * 加密,异步 * @param data 加密或者解密的数据。data不能为null。 * @param pubKey 指定加密公钥。 * @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合,默认SM2_256|SM3。 * @returns */ AST#method_declaration#Left static async encry...
export class SM2 { static async encrypt(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> { return CryptoUtil.encrypt(data, pubKey, null, transformation); } static encryptSync(data: cryptoFramework.DataBlob, ...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM2.ets#L30-L312
08df43568b2b0901c2069a6ae7f40be2787299cf
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/view/WorkerPort.ets
arkts
execColorInfo
Picture pixel calculation
function execColorInfo(bufferArray: ArrayBuffer, last: number, cur: number, hsvIndex: number) { // ... const newBufferArr = bufferArray; let colorInfo = new Uint8Array(newBufferArr); for (let i = 0; i < colorInfo?.length; i += CommonConstants.PIXEL_STEP) { const hsv = rgb2hsv(colorInfo[i + RGBIndex.RED], co...
AST#function_declaration#Left function execColorInfo AST#parameter_list#Left ( AST#parameter#Left bufferArray : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left last : AST#type_annotation#Left AST#primary_type#Left numbe...
function execColorInfo(bufferArray: ArrayBuffer, last: number, cur: number, hsvIndex: number) { const newBufferArr = bufferArray; let colorInfo = new Uint8Array(newBufferArr); for (let i = 0; i < colorInfo?.length; i += CommonConstants.PIXEL_STEP) { const hsv = rgb2hsv(colorInfo[i + RGBIndex.RED], colorInf...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/view/WorkerPort.ets#L25-L39
753b01a27397c9cb6bcda762131573e0ec211af4
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowTabsVertical.ets
arkts
is_right_align
Data
is_right_align() { return (this.preferred_hand_left_or_right == 'right' && !this.preferred_hand_reverse_tabs_panel) || (!(this.preferred_hand_left_or_right == 'right') && this.preferred_hand_reverse_tabs_panel); }
AST#method_declaration#Left is_right_align AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#...
is_right_align() { return (this.preferred_hand_left_or_right == 'right' && !this.preferred_hand_reverse_tabs_panel) || (!(this.preferred_hand_left_or_right == 'right') && this.preferred_hand_reverse_tabs_panel); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsVertical.ets#L269-L272
862044df5ee5a66310a208793df2f5e272160c80
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkcompiler/esmodule/esmodule_dynamicimport/Sharelibraryhsp/src/main/ets/utils/Calc.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 function add(a:number, b:number): number{ return a + b; }
AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Lef...
export function add(a:number, b:number): number{ return a + b; }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/Sharelibraryhsp/src/main/ets/utils/Calc.ets#L16-L18
ed5f385efc986657a9ad5e063bdef0bf61628a5d
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/Index.ets
arkts
RouterModule
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 { RouterModule } from './src/main/ets/utils/RouterModule';
AST#export_declaration#Left export { RouterModule } from './src/main/ets/utils/RouterModule' ; AST#export_declaration#Right
export { RouterModule } from './src/main/ets/utils/RouterModule';
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/Index.ets#L16-L16
131c2363ec7c17a37af0b929e6d798a2af82fe43
gitee
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/PersonalInformation.ets
arkts
兴趣项列表
constructor(hobbyItems: HobbyItem[]) { this.hobbyItems = hobbyItems; // 初始化兴趣项列表 }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left hobbyItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HobbyItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement...
constructor(hobbyItems: HobbyItem[]) { this.hobbyItems = hobbyItems; }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/PersonalInformation.ets#L25-L27
48309da146f020ae087b0874cddb14aefce9a334
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Utils/DMPWindowUtils.ets
arkts
getBottomSafeArea
系统返回的单位应该是px @param _windowStage @returns
public static getBottomSafeArea(_windowStage: window.WindowStage): number { let windowClass: window.Window = _windowStage.getMainWindowSync(); // 获取应用主窗口 // 2. 获取布局避让遮挡的区域 let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; // 以导航条避让为例 let avoidArea = windowClass.getWindowAvoidArea(type); ret...
AST#method_declaration#Left public static getBottomSafeArea 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#paramete...
public static getBottomSafeArea(_windowStage: window.WindowStage): number { let windowClass: window.Window = _windowStage.getMainWindowSync(); let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; let avoidArea = windowClass.getWindowAvoidArea(type); return avoidArea.bottomRect.height; }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPWindowUtils.ets#L60-L66
1ea5f990046ac05b2c5f2ab0a48db4481caf4972
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets
arkts
YearViewItem
时间计算工具类 年视图子组件
@Component export struct YearViewItem { // 年视图离屏画布列表 @State yearViewList: Array<OffscreenCanvas> = []; @Prop @Watch('updateYearData') year: number; // 年视图月份点击回调 onMonthClick: (year: number, month: number) => void = () => { }; /** * 更新年数据 */ updateYearData() { this.yearViewList = []; for (...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct YearViewItem AST#component_body#Left { // 年视图离屏画布列表 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right yearViewList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Arra...
@Component export struct YearViewItem { @State yearViewList: Array<OffscreenCanvas> = []; @Prop @Watch('updateYearData') year: number; onMonthClick: (year: number, month: number) => void = () => { }; updateYearData() { this.yearViewList = []; for (let i = 1; i <= Constants.MONTHS_NUM; i++) {...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets#L24-L178
6842ca0eb2cc807d560cf68e9722f2fcaf47dc75
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.router.d.ets
arkts
clear
Clears all historical pages and retains only the current page at the top of the stack. @syscap SystemCapability.ArkUI.ArkUI.Full @since 3 @deprecated since 8
static clear(): void;
AST#method_declaration#Left static clear 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#method_declaration#Right
static clear(): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L291-L291
75e65bca9943b97c47ecac87fc5b898f0762a64c
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
StatisticsPage
统计页面
@Builder StatisticsPage() { Column() { // 滚动内容区域 Scroll() { Column() { // 支出/收入 Tab 切换 Row() { // 支出 Tab Column() { Text('支出') .fontSize(18) .fontColor(this.statisticsTabIndex === 0 ? '#333333' : '#999999...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right StatisticsPage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 滚动内容区域 AST#...
@Builder StatisticsPage() { Column() { Scroll() { Column() { Row() { Column() { Text('支出') .fontSize(18) .fontColor(this.statisticsTabIndex === 0 ? '#333333' : '#999999') .fontWeight(Fo...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L857-L1158
718150cda28a2aa27aca81de0c726cedc14d7bc7
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/DFX/AppRecovery/entry/src/main/ets/ability/SecondAbility.ets
arkts
restoreLocalStorage
Read previous saved status from want if we are launched by appRecovery
restoreLocalStorage(want: Want) : void { if (want.parameters !== undefined) { this.storage.setOrCreate<string>('FaultTriggerPageString', want.parameters['FaultTriggerPageString'] as string); this.storage.setOrCreate<number>('FaultTriggerPageCounter', want.parameters['FaultTriggerPageCounter'] as number)...
AST#method_declaration#Left restoreLocalStorage AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
restoreLocalStorage(want: Want) : void { if (want.parameters !== undefined) { this.storage.setOrCreate<string>('FaultTriggerPageString', want.parameters['FaultTriggerPageString'] as string); this.storage.setOrCreate<number>('FaultTriggerPageCounter', want.parameters['FaultTriggerPageCounter'] as number)...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DFX/AppRecovery/entry/src/main/ets/ability/SecondAbility.ets#L32-L37
e0f71015a86c0daede5105e0ebdfdfb73b2f4fe4
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
isNotEmpty
判断字符串是否为非空。true为非空空,否则false @param str @returns
static isNotEmpty(str: string | undefined | null) { return false == StringUtils.isEmpty(str); }
AST#method_declaration#Left static isNotEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Ri...
static isNotEmpty(str: string | undefined | null) { return false == StringUtils.isEmpty(str); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L48-L50
668cb9eaf68f87bcaa8e209ef048d423b3a2e18f
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/Viewmodel/AccountingInfo.ets
arkts
储存记账信息的数据结构
export default class AccountingInfo { id: number; date: string; amount: number; category: string; typeName: string; icon: string; remark: string; constructor(id: number, date: string, amount: number, category: string, typeName: string, icon: string, remark: string,) { this.id = id; this.date =...
AST#export_declaration#Left export default AST#class_declaration#Left class AccountingInfo AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left date :...
export default class AccountingInfo { id: number; date: string; amount: number; category: string; typeName: string; icon: string; remark: string; constructor(id: number, date: string, amount: number, category: string, typeName: string, icon: string, remark: string,) { this.id = id; this.date =...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/AccountingInfo.ets#L5-L24
43eb86b2ba4ef76c84bf699c36f4ab9022aa1692
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/efRcpConfig.ets
arkts
系统框架级别请求响应码对象
export class sysCodeEvent { /** * 请求响应码监听-业务自行处理数据 */ listener: (code: number) => void = () => { }; }
AST#export_declaration#Left export AST#class_declaration#Left class sysCodeEvent AST#class_body#Left { /** * 请求响应码监听-业务自行处理数据 */ AST#property_declaration#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_typ...
export class sysCodeEvent { listener: (code: number) => void = () => { }; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L45-L51
eae13ffa50e247aa5c58366f468c89a3d7ab5b66
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets
arkts
encryption
加密
async encryption(message: string): Promise<string> { if (!this.publicKey) { sendProcessMessage("本地未找到公钥,开始下载...", MessagePosition.Right); // 获取公钥 await this.downloadPublicKey(); sendProcessMessage("公钥下载成功", MessagePosition.Right); } if (this.aesKey === "") { sendProcessMessage(...
AST#method_declaration#Left async encryption AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left...
async encryption(message: string): Promise<string> { if (!this.publicKey) { sendProcessMessage("本地未找到公钥,开始下载...", MessagePosition.Right); await this.downloadPublicKey(); sendProcessMessage("公钥下载成功", MessagePosition.Right); } if (this.aesKey === "") { sendProcessMessage("本地未找到A...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/client/LocalClient.ets#L80-L100
1046d179ca60401d790b5f6393c02aada714e4a3
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Service/DMPSendableObjects.ets
arkts
初始化引擎用的数据结构
export class initPayload { command: string; context: common.UIAbilityContext; appIndex: number; isDebugMode: boolean; constructor(command: string, appIndex: number, context: common.UIAbilityContext, isDebugMode: boolean) { this.command = command; this.appIndex = appIndex; this.context = context; ...
AST#export_declaration#Left export AST#class_declaration#Left class initPayload AST#class_body#Left { AST#property_declaration#Left command : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left context : AS...
export class initPayload { command: string; context: common.UIAbilityContext; appIndex: number; isDebugMode: boolean; constructor(command: string, appIndex: number, context: common.UIAbilityContext, isDebugMode: boolean) { this.command = command; this.appIndex = appIndex; this.context = context; ...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Service/DMPSendableObjects.ets#L60-L72
c028ba6aa96c63f72eb7e54e9bb5328ee63be1f1
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets
arkts
addObserver
添加生命周期观察者 @param observer @param inRootView 当前页面是否是Navigation根视图中 可选参数
public addObserver<T extends ILifecycleObserver>(observer: T, inRootView: boolean = false) { RouterMgr.getInstance().lifecycleMgr.addObserver(observer, this.targetClassName, inRootView); }
AST#method_declaration#Left public addObserver AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left ILifecycleObserver AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left...
public addObserver<T extends ILifecycleObserver>(observer: T, inRootView: boolean = false) { RouterMgr.getInstance().lifecycleMgr.addObserver(observer, this.targetClassName, inRootView); }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets#L31-L34
2d05395e547053e53740e2f2dd80623c3ab28431
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/pages/Index.ets
arkts
refreshChange
实时监听是否刷新全部问卷列表
@Monitor('refresh') async refreshChange() { if (this.refresh) { // 刷新所有问卷信息 this.surveys = await this.distributedDB.getAllSurveys(); // 刷新侧边栏主列表 this.getSBMainItem(); // 刷新侧边栏主列表 item 的数量 this.getSBMainItemNum(); // 刷新完毕 this.refresh = false; } }
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'refresh' AST#expression#Right ) AST#decorator#Right async refreshChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#mem...
@Monitor('refresh') async refreshChange() { if (this.refresh) { this.surveys = await this.distributedDB.getAllSurveys(); this.getSBMainItem(); item 的数量 this.getSBMainItemNum(); this.refresh = false; } }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L238-L250
c4e66b66a0468966746f7384b1e8e13e3c043fd9
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
主题配置接口
export interface ThemeConfig { mode: ThemeMode; primaryColor: string; accentColor: string; customColors?: Record<string, string>; animationEnabled: boolean; animationDuration: number; fontSize: FontSize; borderRadius: BorderRadius; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ThemeConfig AST#object_type#Left { AST#type_member#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left primaryColor : AST#type_annota...
export interface ThemeConfig { mode: ThemeMode; primaryColor: string; accentColor: string; customColors?: Record<string, string>; animationEnabled: boolean; animationDuration: number; fontSize: FontSize; borderRadius: BorderRadius; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L29-L38
1e7952fcdb3b9887a55d97b2e89b91016e7b1554
github
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets
arkts
Search for keywords and related city data.
export const ALL_CITY2 = [ new CityGroup('a', uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_A').id)), new CityGroup('an', uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_an').id)), new CityGroup('b', uiCo...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ALL_CITY2 = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CityGroup AST#expression#Right AST#new_expression#...
export const ALL_CITY2 = [ new CityGroup('a', uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_A').id)), new CityGroup('an', uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.city_data_an').id)), new CityGroup('b', uiCo...
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets#L89-L96
ff7863105da3226c5c1bd594592dbbb63e141c8f
github
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/got.ets
arkts
request
发起HTTP请求
async request<T = ArrayBuffer>( url: string, options: RequestOptions = {}, ): Promise<Response<T>> { const mergedOptions: RequestOptions = { ...this.defaultOptions, ...options, url, }; // 处理查询参数 if (mergedOptions.params) { ...
AST#method_declaration#Left async request AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_an...
async request<T = ArrayBuffer>( url: string, options: RequestOptions = {}, ): Promise<Response<T>> { const mergedOptions: RequestOptions = { ...this.defaultOptions, ...options, url, }; if (mergedOptions.params) { const...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/got.ets#L39-L54
d4825fa2395b0dda05dea06b9c79719fe83fe108
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets
arkts
@author: HZWei @date: 2024/10/26 @desc:
export class LifecycleRegistry { private targetClassName: string private constructor(className: string) { this.targetClassName = className; } public static create(component: object): LifecycleRegistry { const className = `${component.constructor.name}${SPLIT_SYMBOL}${util.getHash(component)}` retu...
AST#export_declaration#Left export AST#class_declaration#Left class LifecycleRegistry AST#class_body#Left { AST#property_declaration#Left private targetClassName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#constructor_decla...
export class LifecycleRegistry { private targetClassName: string private constructor(className: string) { this.targetClassName = className; } public static create(component: object): LifecycleRegistry { const className = `${component.constructor.name}${SPLIT_SYMBOL}${util.getHash(component)}` retu...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets#L14-L61
4cb2f80735453d51f086f4a794475f0ddb76207b
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.batteryInfo.d.ets
arkts
Battery health status of a device. @enum { int } @syscap SystemCapability.PowerManager.BatteryManager.Core @since 20
export enum BatteryHealthState { /** * Unknown state. * * @syscap SystemCapability.PowerManager.BatteryManager.Core * @since 20 */ UNKNOWN, /** * The battery is in healthy state. * * @syscap SystemCapability.PowerManager.BatteryManager.Core * @since 20 */ ...
AST#export_declaration#Left export AST#enum_declaration#Left enum BatteryHealthState AST#enum_body#Left { /** * Unknown state. * * @syscap SystemCapability.PowerManager.BatteryManager.Core * @since 20 */ AST#enum_member#Left UNKNOWN AST#enum_member#Right , /** * The battery is in healthy s...
export enum BatteryHealthState { UNKNOWN, GOOD, OVERHEAT, OVERVOLTAGE, COLD, DEAD }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.batteryInfo.d.ets#L279-L322
8ade6acbdc872dc8ccab38a7a209d03daa12c4be
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets
arkts
addFootprint
添加足迹记录 @param {Footprint} footprint 足迹记录 @returns {Promise<void>} Promise<void>
async addFootprint(footprint: Footprint): Promise<void> { this.orm.save(this.toEntity(footprint)); }
AST#method_declaration#Left async addFootprint AST#parameter_list#Left ( AST#parameter#Left footprint : AST#type_annotation#Left AST#primary_type#Left Footprint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty...
async addFootprint(footprint: Footprint): Promise<void> { this.orm.save(this.toEntity(footprint)); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L44-L46
671a2e63e4545b97e445c0c3bf83580e7f62defb
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
removeInterceptor
移除拦截器 @param interceptor @param stackName @returns true:移除成功,false:移除失败
public static removeInterceptor<T extends IInterceptor>(interceptor: T, stackName: string = DEFAULT_STACK_NAME): boolean { return ZRouter.getRouterMgr().removeInterceptor<T>(interceptor, stackName) }
AST#method_declaration#Left public static removeInterceptor AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left IInterceptor AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#paramet...
public static removeInterceptor<T extends IInterceptor>(interceptor: T, stackName: string = DEFAULT_STACK_NAME): boolean { return ZRouter.getRouterMgr().removeInterceptor<T>(interceptor, stackName) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L300-L303
cd8e9e01101d9350844d2e6bad338319e6c1d141
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BarDataSet.ets
arkts
setStackLabels
Sets labels for different values of bar-stacks, in case there are one. @param labels
public setStackLabels(labels: string[]): void { this.mStackLabels = labels; }
AST#method_declaration#Left public setStackLabels AST#parameter_list#Left ( AST#parameter#Left labels : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation...
public setStackLabels(labels: string[]): void { this.mStackLabels = labels; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarDataSet.ets#L285-L287
b541bb226e1d690ddb134c0b6579f8594e4ab766
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/menu/VHInviteDialog.ets
arkts
closePopup
关闭弹窗
private closePopup() { this.resetState(); this.controller.close() }
AST#method_declaration#Left private closePopup AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetState AST#me...
private closePopup() { this.resetState(); this.controller.close() }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/menu/VHInviteDialog.ets#L54-L57
239044d341104d021bfe99bb99d41dcdf2d1412a
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringPyHelper.ets
arkts
convertUnicodeForPinyin
// 复合字符编码(拼音) 统一转换为复合形式 / 若用拼音保存为文件名时,这时Mac上文件(路径)名的编码形式,码点形式也会被自动转换为复合码形式 / 因为腾讯云Cos上的文件是直接从Mac上传的,所以必须要采用相同的字符形式,才能在Cos的SDK下载时URLEncode地址也一样
static convertUnicodeForPinyin(str: string): string { if (!str || str.length === 0) return str; /////////////////////////////////////////////////////////////// //通过URL可将码点表示 ---转换成---> 复合码表示, // "t\u{00f3}u n\u{01ce}o" // 码点直接表示:tóu nǎ // ↓↓↓↓↓↓↓↓↓↓↓↓ // "to\u{0301}u na\u{030c}o" //...
AST#method_declaration#Left static convertUnicodeForPinyin 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#...
static convertUnicodeForPinyin(str: string): string { if (!str || str.length === 0) return str; return str.normalize('NFD'); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringPyHelper.ets#L7-L20
797b2561443df091b8145478181e2b0ebff192ec
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/VoiceService.ets
arkts
语音合成配置接口
export interface TTSConfig { voice: string; // 语音类型 rate: number; // 语速 (0.5-2.0) pitch: number; // 音调 (0.5-2.0) volume: number; // 音量 (0-1) language: string; // 语言 }
AST#export_declaration#Left export AST#interface_declaration#Left interface TTSConfig AST#object_type#Left { AST#type_member#Left voice : 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 rate : AST#type_annotation...
export interface TTSConfig { voice: string; rate: number; pitch: number; volume: number; language: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L28-L34
f6eece13de8fde883182001b3f40cd7d64266bcb
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/notification/NotificationPermissionChecker.ets
arkts
isNotificationEnabled
判断是否有通知权限 @returns
static isNotificationEnabled(): Promise<boolean>{ return notificationManager.isNotificationEnabled() }
AST#method_declaration#Left static isNotificationEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right >...
static isNotificationEnabled(): Promise<boolean>{ return notificationManager.isNotificationEnabled() }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/notification/NotificationPermissionChecker.ets#L10-L12
80349367bdb03741e6e90c968d5b8014e64b8bce
gitee
ericple/oh-bill
058af8872c927b9730467798549539e586e275fe
entry/src/main/ets/data/balanceTypes.ets
arkts
Copyright (c) 2023 Ericple OpenBill is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER E...
export interface IBillType { title: string; img: Resource; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IBillType AST#object_type#Left { AST#type_member#Left title : 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 img : AST#type_annotation#Left AST...
export interface IBillType { title: string; img: Resource; }
https://github.com/ericple/oh-bill/blob/058af8872c927b9730467798549539e586e275fe/entry/src/main/ets/data/balanceTypes.ets#L8-L10
2c49422c030626c887513f684806551846f9fdc9
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets
arkts
isVideoPhotoFn
判断录像或者照片模式
isVideoPhotoFn(): void { if (this.modelBagCol == 'photo' || this.modelBagCol == 'portrait' || this.modelBagCol == 'night') { CameraService.takePicture(); } else if (this.modelBagCol == 'video' || this.modelBagCol == 'superStab') { this.isModeBol = false; if (this.timer !== undefined) { ...
AST#method_declaration#Left isVideoPhotoFn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left A...
isVideoPhotoFn(): void { if (this.modelBagCol == 'photo' || this.modelBagCol == 'portrait' || this.modelBagCol == 'night') { CameraService.takePicture(); } else if (this.modelBagCol == 'video' || this.modelBagCol == 'superStab') { this.isModeBol = false; if (this.timer !== undefined) { ...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets#L147-L163
a2368e571dc5f87d0b2bedee798f4db7a53a3a6e
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets
arkts
has
/ 根据key检查缓存值是否存在
public static has(key: string): boolean { key = JhEncryptUtils.aesEncrypt(key) return PreferencesUtil.hasSync(key) }
AST#method_declaration#Left public static has AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type...
public static has(key: string): boolean { key = JhEncryptUtils.aesEncrypt(key) return PreferencesUtil.hasSync(key) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L74-L77
71ef480fe6a0918477c9f552a7b7f9f0e7a14552
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
addLifecycleObserver
` 添加单个NavDestination页面的生命周期观察者,在NavDestination页面模版模式下才会生效 @param observer
public static addLifecycleObserver(observer: LifecycleObserver): TemplateMgr { return TemplateMgr.getInstance().addObserver(observer) }
AST#method_declaration#Left public static addLifecycleObserver AST#parameter_list#Left ( AST#parameter#Left observer : AST#type_annotation#Left AST#primary_type#Left LifecycleObserver AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t...
public static addLifecycleObserver(observer: LifecycleObserver): TemplateMgr { return TemplateMgr.getInstance().addObserver(observer) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L330-L332
831ab6d48360e06e3c86e59ac6033fc1c39a6378
gitee
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/view_models/playlist_mode.ets
arkts
PlaylistResponse
export interface PlaylistResponse { code: number message?: string relatedVideos?: any playlist?: Playlist urls?: any privileges?: Privilege[] sharedPrivilege?: any resEntrance?: any fromUsers?: any fromUserCount?: number songFromUsers?: any }
AST#export_declaration#Left export AST#interface_declaration#Left interface PlaylistResponse AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left message ? : AST#type_annotatio...
export interface PlaylistResponse { code: number message?: string relatedVideos?: any playlist?: Playlist urls?: any privileges?: Privilege[] sharedPrivilege?: any resEntrance?: any fromUsers?: any fromUserCount?: number songFromUsers?: any }
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/playlist_mode.ets#L4-L16
768ba5fca47a798e7452605d8a45f718af74cd72
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/HyperlinkDrag.ets
arkts
HyperlinkDrag
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 HyperlinkDrag { @State visible: boolean = true // 自定义拖拽过程中显示的内容 @Builder pixelMapBuilder() { Hyperlink("https://www.openharmony.cn", 'OpenHarmony') .color('#007DFF') } build() { Column() { Hyperlink("https://www.openharmony.cn", 'OpenHarmony') .id('hyperl...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HyperlinkDrag AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right visible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_ann...
@Component export struct HyperlinkDrag { @State visible: boolean = true @Builder pixelMapBuilder() { Hyperlink("https://www.openharmony.cn", 'OpenHarmony') .color('#007DFF') } build() { Column() { Hyperlink("https://www.openharmony.cn", 'OpenHarmony') .id('hyperlink') .c...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/HyperlinkDrag.ets#L16-L46
9519f3c86c748cad1d80543ad59da2c4f3d65b88
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
getPixelMapFromMedia
用户获取resource目录下的media中的图片PixelMap @param resource 例如:$r("app.media.icon") @returns
static async getPixelMapFromMedia(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> { let uint8Array = await Tools.getMediaContent(resource); return await Tools.createImageSource(uint8Array.buffer).createPixelMap(options); }
AST#method_declaration#Left static async getPixelMapFromMedia AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Le...
static async getPixelMapFromMedia(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> { let uint8Array = await Tools.getMediaContent(resource); return await Tools.createImageSource(uint8Array.buffer).createPixelMap(options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L127-L130
6822c55f4f4f948a4a8ee1fa681f0ea0d081758c
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/ScatterDataSet.ets
arkts
setScatterShapeHoleRadius
Sets the radius of the hole in the shape (applies to Square, Circle and Triangle) Set this to <= 0 to remove holes. @param holeRadius
public setScatterShapeHoleRadius(holeRadius: number): void { this.mScatterShapeHoleRadius = holeRadius; }
AST#method_declaration#Left public setScatterShapeHoleRadius AST#parameter_list#Left ( AST#parameter#Left holeRadius : 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 vo...
public setScatterShapeHoleRadius(holeRadius: number): void { this.mScatterShapeHoleRadius = holeRadius; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L125-L127
41a433a3c7cfb8e6bf6706fc3cb694cc6c87f1d7
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
@file 个人中心页面 ViewModel @author Joker.X
@ObservedV2 export default class ProfileViewModel extends BaseViewModel { /** * 全局用户状态 */ private readonly userState: UserState = getUserState(); /** * 退出登录弹窗显示状态 */ @Trace showLogoutDialog: boolean = false; /** * 页面显示时回调 * @returns {void} 无返回值 */ aboutToAppear(): void { this.use...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class ProfileViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 全局用户状态 */ AST...
@ObservedV2 export default class ProfileViewModel extends BaseViewModel { private readonly userState: UserState = getUserState(); @Trace showLogoutDialog: boolean = false; aboutToAppear(): void { this.userState.refreshUserInfo(); } requestLogout(): void { this.showLogoutDialog = true; ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L10-L113
549d196e79c03aeaf128697d6a671a24e9b58928
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
refreshList
刷新列表 @returns {Promise<void>} Promise<void>
async refreshList(): Promise<void> { await this.runWithLoading(async (): Promise<void> => { await this.fetchList(); }); }
AST#method_declaration#Left async refreshList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
async refreshList(): Promise<void> { await this.runWithLoading(async (): Promise<void> => { await this.fetchList(); }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets#L115-L119
ebf9f7ea0c39ab83d14a34f703edab9755d982c5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/network/BaseNetWorkView.ets
arkts
渲染网络请求状态视图 @returns {void} 无返回值
build() { Column() { if (this.uiState === BaseNetWorkUiState.LOADING) { Column() { if (this.loadingBuilder) { this.loadingBuilder(); } else { this.buildDefaultLoading(); } } .transition(TransitionEffect.OPACITY.animation({ duration:...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expre...
build() { Column() { if (this.uiState === BaseNetWorkUiState.LOADING) { Column() { if (this.loadingBuilder) { this.loadingBuilder(); } else { this.buildDefaultLoading(); } } .transition(TransitionEffect.OPACITY.animation({ duration:...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/network/BaseNetWorkView.ets#L62-L91
35fd3671e09ff8a5238e54e50a12b2a271a538ed
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
首页文章文章 @param date @returns
export function getHomeArticle(page: number) { return axiosClient.get<HomeArticleModel>({ url: `article/list/${page}/json`, showLoading: page === 0 }) }
AST#export_declaration#Left export AST#function_declaration#Left function getHomeArticle AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS...
export function getHomeArticle(page: number) { return axiosClient.get<HomeArticleModel>({ url: `article/list/${page}/json`, showLoading: page === 0 }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L52-L57
40eedd61dcfc9725199ff506cc8acc94ec4b16fa
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
完整农历系统设计.ets
arkts
getLunarDayCn
获取农历日期中文表示
private static getLunarDayCn(lunarDay: number): string { if (lunarDay < 1 || lunarDay > 30) { return "未知"; } return LUNAR_DAYS[lunarDay - 1]; }
AST#method_declaration#Left private static getLunarDayCn AST#parameter_list#Left ( AST#parameter#Left lunarDay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string A...
private static getLunarDayCn(lunarDay: number): string { if (lunarDay < 1 || lunarDay > 30) { return "未知"; } return LUNAR_DAYS[lunarDay - 1]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L422-L427
19af93f4e06cc55804713aca8afd289d0320c735
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/utils/DateUtil.ets
arkts
getDaysInMonth
获取月份天数
static getDaysInMonth(year: number, month: number): number { return new Date(year, month + 1, 0).getDate() }
AST#method_declaration#Left static getDaysInMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
static getDaysInMonth(year: number, month: number): number { return new Date(year, month + 1, 0).getDate() }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L31-L33
24048b4786ecf9c645669119a8e39f8848cbf6be
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NumberUtil.ets
arkts
average
计算数字的平均值 @param numbers - 要计算的数字列表 @returns 平均值
static average(...numbers: number[]): number { if (numbers.length > 0) { const sum = numbers.reduce((acc, num) => acc + num, 0); return sum / numbers.length; } return 0; }
AST#method_declaration#Left static average AST#parameter_list#Left ( AST#parameter#Left ... numbers : 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_list#Right : AST#type_annotation#L...
static average(...numbers: number[]): number { if (numbers.length > 0) { const sum = numbers.reduce((acc, num) => acc + num, 0); return sum / numbers.length; } return 0; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L145-L151
d7a7a36224106ec46351ab5d14d1acf8d1b62587
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets
arkts
webBuilder
[Start call_onActive_method_to_pre_render_offline_web_component]
@Builder function webBuilder(data:Data) { Column() { Web({ src: data.url, controller: data.controller }) .onPageBegin(() => { // 调用onActive,开启渲染 data.controller.onActive(); }) // [StartExclude call_onActive_method_to_pre_render_offline_web_component] .onFirstMeaningfulPaint...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function webBuilder AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Data AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder...
@Builder function webBuilder(data:Data) { Column() { Web({ src: data.url, controller: data.controller }) .onPageBegin(() => { data.controller.onActive(); }) .onFirstMeaningfulPaint(() =>{ if (!shouldInactive) { return; } data.con...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets#L30-L51
e06f8950d380109c10c5c1f50faf93137a6e99c9
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.RecentPhotoComponent.d.ets
arkts
Recent photo info @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 13
export declare class RecentPhotoInfo { /** * The dateTaken of photos or videos * * @type { ?number } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ dateTaken?: number; /** * The identifier of photos or videos * * @type { ?string } ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class RecentPhotoInfo AST#class_body#Left { /** * The dateTaken of photos or videos * * @type { ?number } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 ...
export declare class RecentPhotoInfo { dateTaken?: number; identifier?: string; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.RecentPhotoComponent.d.ets#L174-L194
109e059546d43a199d790c313f220a2a1e360c1c
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets
arkts
@memo
export function hookRadioContentModifier( receiver: ArkRadioComponent, value?: ContentModifier<RadioConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const radioBuilder = (parentNode: KPointer, config: RadioConfiguration): KPointer => { re...
AST#export_declaration#Left export AST#function_declaration#Left function hookRadioContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkRadioComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value ? : ...
export function hookRadioContentModifier( receiver: ArkRadioComponent, value?: ContentModifier<RadioConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const radioBuilder = (parentNode: KPointer, config: RadioConfiguration): KPointer => { re...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L162-L175
4c714effcea62c4f17681585164854d8e8990425
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets
arkts
setStartAppInfo
set start app info
private setStartAppInfo() { Log.showInfo(TAG, 'app setStartAppInfo'); AppStorage.setOrCreate('startAppItemInfo', this.formItem); AppStorage.setOrCreate('startAppTypeFromPageDesktop', CommonConstants.OVERLAY_TYPE_CARD); this.mPageDesktopStartAppHandler.setAppIconSize(this.mFormItemWidth, this.mFormItemHe...
AST#method_declaration#Left private setStartAppInfo 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 Log AST#expression#Right . showInfo AST#...
private setStartAppInfo() { Log.showInfo(TAG, 'app setStartAppInfo'); AppStorage.setOrCreate('startAppItemInfo', this.formItem); AppStorage.setOrCreate('startAppTypeFromPageDesktop', CommonConstants.OVERLAY_TYPE_CARD); this.mPageDesktopStartAppHandler.setAppIconSize(this.mFormItemWidth, this.mFormItemHe...
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets#L302-L308
05eb2aa9cde1669d2e30d792d8a8093021abd2e6
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
saveChatLog
保存聊天记录到数据库
private async saveChatLog(content: string, isUser: boolean, emotion: string): Promise<void> { try { const chatLog = new ChatLog( 0, ChatLog.getTodayDateString(), content, isUser, emotion, Date.now() ); await this.rdbHelper.insertChatLog(chatLog); ...
AST#method_declaration#Left private async saveChatLog AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isUser : AST#type_annotation#Left AST#primary_type#Left boolean AST...
private async saveChatLog(content: string, isUser: boolean, emotion: string): Promise<void> { try { const chatLog = new ChatLog( 0, ChatLog.getTodayDateString(), content, isUser, emotion, Date.now() ); await this.rdbHelper.insertChatLog(chatLog); ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L317-L331
c7d49843d1ffd32d8103a19263ca1195fea549c4
github
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/pages/WeeklyTaskPage.ets
arkts
addNewTask
添加新任务
private addNewTask(): void { if (this.newTaskName.trim() === '') { console.log('任务名称不能为空'); return; } const now = new Date(); const newTask = new TaskTimeRange( `task_${Date.now()}`, this.newTaskName.trim(), new Date(now.getFullYear(), now.getMonth(), now.getDate(), 16, 0)...
AST#method_declaration#Left private addNewTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Le...
private addNewTask(): void { if (this.newTaskName.trim() === '') { console.log('任务名称不能为空'); return; } const now = new Date(); const newTask = new TaskTimeRange( `task_${Date.now()}`, this.newTaskName.trim(), new Date(now.getFullYear(), now.getMonth(), now.getDate(), 16, 0)...
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L159-L177
60182d6fffb8161dca4740a16a7e800a89bdfeae
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/NavigationWithArgsPage.ets
arkts
NavigationWithArgsContent
带参跳转示例页内容视图 @returns {void} 无返回值
@Builder private NavigationWithArgsContent() { ColumnCenter() { Text(this.vm.routeParams.goodsId.toString() ?? $r("app.string.demo_navigation_with_args_value_empty")); Text(this.vm.routeParams.goodsName ?? $r("app.string.demo_navigation_with_args_value_empty")); } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private NavigationWithArgsContent 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 ColumnCenter ( ) AST#container_content_b...
@Builder private NavigationWithArgsContent() { ColumnCenter() { Text(this.vm.routeParams.goodsId.toString() ?? $r("app.string.demo_navigation_with_args_value_empty")); Text(this.vm.routeParams.goodsName ?? $r("app.string.demo_navigation_with_args_value_empty")); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NavigationWithArgsPage.ets#L34-L40
78c80a910c627cbab6f70af52a57d86b5e0aa090
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets
arkts
FlashSaleSection
限时精选
@Builder FlashSaleSection() { Column() { Column({ space: AppDimensions.spaceMedium }) { // 标题行 Row() { Row({ space: AppDimensions.spaceSmall }) { Text('⏰') .fontSize(20) Text('限时精选') .fontSize(AppTypography.fontSizeLarge) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right FlashSaleSection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui...
@Builder FlashSaleSection() { Column() { Column({ space: AppDimensions.spaceMedium }) { Row() { Row({ space: AppDimensions.spaceSmall }) { Text('⏰') .fontSize(20) Text('限时精选') .fontSize(AppTypography.fontSizeLarge) ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L191-L233
2e36ff7f0f204cfcaad6bc82eb006b92a15be666
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Utils/DMPStack.ets
arkts
clear
清空栈
clear(): void { this._items = []; }
AST#method_declaration#Left clear 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...
clear(): void { this._items = []; }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPStack.ets#L34-L36
5e906dbb2a60cf5146dc6edf2d9cf47ec8e8292b
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets
arkts
计算特定类型账目在指定日期的月收支统计
export function monthStatistics(accounts: Array<Account>, accountType: number, date: Date = new Date()): number { return accounts .filter((account) => account.accountType === accountType && isSameMonth(date, account.date)) .map((account) => account.amount) .reduce((total, cur) => total + cur, 0); }
AST#export_declaration#Left export AST#function_declaration#Left function monthStatistics AST#parameter_list#Left ( AST#parameter#Left accounts : 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 Account AST#primary_type#R...
export function monthStatistics(accounts: Array<Account>, accountType: number, date: Date = new Date()): number { return accounts .filter((account) => account.accountType === accountType && isSameMonth(date, account.date)) .map((account) => account.amount) .reduce((total, cur) => total + cur, 0); }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets#L15-L20
13f9237bab04275fabc2dab2d6f32f50d08b92d0
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets
arkts
toStr
格式化字符串 @param source @param defaultValue @returns
static toStr(source: string | null | undefined, defaultValue = ''): string { if (source === null || source === undefined) { return defaultValue; } return String(source); }
AST#method_declaration#Left static toStr AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Righ...
static toStr(source: string | null | undefined, defaultValue = ''): string { if (source === null || source === undefined) { return defaultValue; } return String(source); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets#L47-L52
3c65368caae26d6a1611dc7fc29817cf307d0ce7
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets
arkts
setDrawHighlightIndicators
Enables / disables both vertical and horizontal highlight-indicators. @param enabled
public setDrawHighlightIndicators(enabled: boolean): void { this.setDrawVerticalHighlightIndicator(enabled); this.setDrawHorizontalHighlightIndicator(enabled); }
AST#method_declaration#Left public setDrawHighlightIndicators 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 voi...
public setDrawHighlightIndicators(enabled: boolean): void { this.setDrawVerticalHighlightIndicator(enabled); this.setDrawHorizontalHighlightIndicator(enabled); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets#L60-L63
469b7f0ded23a667dc73e279b2f57d300b881b9f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM4.ets
arkts
encryptCBCSync
加密(CBC模式),同步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|CBC|PKCS7、SM4_128|CBC|PKCS5、等) @returns
static encryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): cryptoFramework.DataBlob { return SM4.encryptSync(data, symKey, ivParams, transformation); }
AST#method_declaration#Left static encryptCBCSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe...
static encryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): cryptoFramework.DataBlob { return SM4.encryptSync(data, symKey, ivParams, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L123-L126
38d1dddb4fc65759ea57051db211c8fa0f35a444
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets
arkts
自定义日历类型:YEAR年视图 MONTH月视图 WEEK周视图
export enum CalendarViewType { YEAR, // 年视图 MONTH, // 月视图 WEEK, // 周视图 }
AST#export_declaration#Left export AST#enum_declaration#Left enum CalendarViewType AST#enum_body#Left { AST#enum_member#Left YEAR AST#enum_member#Right , // 年视图 AST#enum_member#Left MONTH AST#enum_member#Right , // 月视图 AST#enum_member#Left WEEK AST#enum_member#Right , // 周视图 } AST#enum_body#Right AST#enum_declaration#R...
export enum CalendarViewType { YEAR, MONTH, WEEK, }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets#L257-L261
838417cb9e00ceb2cc1a18c54c46dda18dffe1df
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/WebPage.ets
arkts
snapShot
截图函数。
async snapShot() { // 获取Web页面尺寸 this.getWebSize(); // 截图前的状态初始化 await this.beforeSnapshot(); // TODO: 性能知识点: 使用Canvas离屏绘制在缓冲区拼接截图 const canvasSetting: RenderingContextSettings = new RenderingContextSettings(true); const offCanvasCtx: OffscreenCanvasRenderingContext2D = new OffscreenCan...
AST#method_declaration#Left async snapShot AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取Web页面尺寸 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Rig...
async snapShot() { this.getWebSize(); await this.beforeSnapshot(); const canvasSetting: RenderingContextSettings = new RenderingContextSettings(true); const offCanvasCtx: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(this.h5Width, this.h5Height, canvasSet...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/WebPage.ets#L198-L259
520fe065b6b31793470eb10278df4cbcebaaffbd
gitee
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getCertificatePinning
Getter and setter for certificatePinning
getCertificatePinning(): http.CertificatePinning | http.CertificatePinning[] | undefined { return this.certificatePinning; }
AST#method_declaration#Left getCertificatePinning AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left http . CertificatePinning AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left ht...
getCertificatePinning(): http.CertificatePinning | http.CertificatePinning[] | undefined { return this.certificatePinning; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L191-L193
b60c7890f3244190a29799b4e88d4499e3cd6320
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
JSCrash/entry/src/main/ets/pages/utils.ets
arkts
showError
Outputs error-level logs. @param tag Identifies the log tag. @param format Indicates the log format string. @param args Indicates the log parameters. @since 7
static showError(tag: string): void { if (Log.isLoggable(tag, hilog.LogLevel.ERROR)) { hilog.error(DOMAIN, TAG, tag + SYMBOL); } }
AST#method_declaration#Left static showError AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
static showError(tag: string): void { if (Log.isLoggable(tag, hilog.LogLevel.ERROR)) { hilog.error(DOMAIN, TAG, tag + SYMBOL); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L64-L68
8ce2cf927c641a4accc16c9b27fcda246db738a3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagemosaic/Index.ets
arkts
ImageMosaicViewComponent
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 { ImageMosaicViewComponent } from './src/main/ets/view/ImageMosaicView';
AST#export_declaration#Left export { ImageMosaicViewComponent } from './src/main/ets/view/ImageMosaicView' ; AST#export_declaration#Right
export { ImageMosaicViewComponent } from './src/main/ets/view/ImageMosaicView';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagemosaic/Index.ets#L16-L16
700cebd105397529033d0fafce04a9b3486d77ca
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets
arkts
init
初始化存储
public async init() { try { if (!this.preferences) { const context = getContext(); this.preferences = await dataPreferences.getPreferences(context, PREFERENCES_NAME); console.info('存储初始化成功'); } } catch (error) { console.error('存储初始化失败:', error); throw new Error('存...
AST#method_declaration#Left public async init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unar...
public async init() { try { if (!this.preferences) { const context = getContext(); this.preferences = await dataPreferences.getPreferences(context, PREFERENCES_NAME); console.info('存储初始化成功'); } } catch (error) { console.error('存储初始化失败:', error); throw new Error('存...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets#L13-L24
d3c596d376bd5687e5a4311ee2670564b34dd2ed
github
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getMovie
获取电影信息 @param id 电影id @returns
public getMovie(id: string): Promise<FinItem> { return this.requireApi().getMovie(id) }
AST#method_declaration#Left public getMovie AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promi...
public getMovie(id: string): Promise<FinItem> { return this.requireApi().getMovie(id) }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L79-L81
3d2e5069b212b9bc5ff561b39a266405c2b1ec5d
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/storage/StorageManager.ets
arkts
setStringWithExpire
设置带过期时间的值
static async setStringWithExpire(key: string, value: string, expireDays: number): Promise<void> { await StorageManager.setString(key, value); const expireTime = Date.now() + expireDays * 24 * 60 * 60 * 1000; await StorageManager.setNumber(`${key}_timestamp`, expireTime); }
AST#method_declaration#Left static async setStringWithExpire 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 value : AST#type_annotation#Left AST#primary_type#Left string AS...
static async setStringWithExpire(key: string, value: string, expireDays: number): Promise<void> { await StorageManager.setString(key, value); const expireTime = Date.now() + expireDays * 24 * 60 * 60 * 1000; await StorageManager.setNumber(`${key}_timestamp`, expireTime); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L274-L278
95ab8fd6498ace958960bc34cad17bbd8ab0c7c3
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets
arkts
getFirstPartFromText
从指定的中文翻译中获取第一个分号前的部分(包含词性.意思,如: n.食物)
static getFirstPartFromText(srcText: string): string { let strComma = BaseWordUtility.STR_COMMA_HALF; let strComma2 = BaseWordUtility.STR_COMMA_FULL; let strCommaSub = BaseWordUtility.STR_COMMA_SUB_HALF; let strCommaSub2 = BaseWordUtility.STR_COMMA_SUB_FULL; let str = srcText; const ind...
AST#method_declaration#Left static getFirstPartFromText AST#parameter_list#Left ( AST#parameter#Left srcText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST...
static getFirstPartFromText(srcText: string): string { let strComma = BaseWordUtility.STR_COMMA_HALF; let strComma2 = BaseWordUtility.STR_COMMA_FULL; let strCommaSub = BaseWordUtility.STR_COMMA_SUB_HALF; let strCommaSub2 = BaseWordUtility.STR_COMMA_SUB_FULL; let str = srcText; const ind...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L41-L113
101f5d73ec324165d7434bc0cb74d597cce7709d
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets
arkts
animateXY
Animates values along both the X and Y axes, in a linear fashion. @param durationMillisX animation duration along the X axis @param durationMillisY animation duration along the Y axis
public animateXY(durationMillisX: number, durationMillisY: number) { animateXY(durationMillisX, durationMillisY, Easing.Linear, Easing.Linear); }
AST#method_declaration#Left public animateXY AST#parameter_list#Left ( AST#parameter#Left durationMillisX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left durationMillisY : AST#type_annotation#Left AST#primary_type#Left num...
public animateXY(durationMillisX: number, durationMillisY: number) { animateXY(durationMillisX, durationMillisY, Easing.Linear, Easing.Linear); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L74-L76
996cc61156c889cc89e95e171fe2bd0ed305d5cc
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the build time. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get buildTime(): string;
AST#method_declaration#Left static get AST#ERROR#Left build Time 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 buildTime(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L360-L360
3701ba75de54fc7c33b7b7f2265c4c8d8c24208a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
performPeriodicTasks
执行定期任务
private async performPeriodicTasks(): Promise<void> { try { // 清理过期的智能建议 this.cleanExpiredSuggestions(); // 生成新的智能建议 await this.generateSmartSuggestions(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Failed to perfor...
AST#method_declaration#Left private async performPeriodicTasks 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#Righ...
private async performPeriodicTasks(): Promise<void> { try { this.cleanExpiredSuggestions(); await this.generateSmartSuggestions(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Failed to perform periodic tasks: ${err...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L519-L531
798ee387a5af3f83eb63a84718908216af7c5102
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets
arkts
MyVideoComponent
[End buffer_power_case_1] [Start buffer_power_case_2]
@Component export struct MyVideoComponent { @State videoSrc: Resource | string = $r('app.media.test_video'); private controller: VideoController = new VideoController(); build() { Column() { Video({ src: this.videoSrc, controller: this.controller, }) .width(300) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyVideoComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right videoSrc : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primar...
@Component export struct MyVideoComponent { @State videoSrc: Resource | string = $r('app.media.test_video'); private controller: VideoController = new VideoController(); build() { Column() { Video({ src: this.videoSrc, controller: this.controller, }) .width(300) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets#L49-L84
f0edcce84161bf395e627edb89c571d653507fd7
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/OrderCacheStoreRepository.ets
arkts
loadCarts
读取选中的购物车项 @returns {Promise<Cart[] | null>} 购物车列表,不存在返回 null
loadCarts(): Promise<Cart[] | null> { return this.dataSource.getCarts(); }
AST#method_declaration#Left loadCarts 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#union_type#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#pri...
loadCarts(): Promise<Cart[] | null> { return this.dataSource.getCarts(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderCacheStoreRepository.ets#L39-L41
b7a0f1d5deb26e703facf459e328ce260105f117
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
arkts
makeNode
创建节点
makeNode(uiContext: UIContext): FrameNode | null { if (!this.node) { this.node = new BuilderNode(uiContext); this.node.build(this.builder, this.data); } else { this.update(this.data); } return this.node.getFrameNode(); }
AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Fram...
makeNode(uiContext: UIContext): FrameNode | null { if (!this.node) { this.node = new BuilderNode(uiContext); this.node.build(this.builder, this.data); } else { this.update(this.data); } return this.node.getFrameNode(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L41-L49
89beaa11a01c6114423e1765bba83eb74189d03b
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets
arkts
获取用户今日任务 @param userId 用户ID @param page 页码 @param size 每页大小 @returns 今日任务列表
export function getTodayTasks(userId: number, page: number = 0, size: number = 5): Promise<PageResponse<Task>> { const params: TaskQueryParams = { page, size }; try { return request<PageResponse<Task>>( RequestMethod.GET, `/tasks/user/${userId}/today`, params ); } catch (error) { c...
AST#export_declaration#Left export AST#function_declaration#Left function getTodayTasks AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Left AS...
export function getTodayTasks(userId: number, page: number = 0, size: number = 5): Promise<PageResponse<Task>> { const params: TaskQueryParams = { page, size }; try { return request<PageResponse<Task>>( RequestMethod.GET, `/tasks/user/${userId}/today`, params ); } catch (error) { c...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L77-L89
0d43e23f42edff68bef76647f6f0ecc68d117034
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets
arkts
makeNode
从NodeController根节点获取的RenderNode,用于添加和删除新创建的MyRenderNode实例 MyNodeController实例绑定的NodeContainer创建时触发,创建根节点rootNode并将其挂载至NodeContainer
makeNode(uiContext: UIContext): FrameNode { this.rootNode = new FrameNode(uiContext); if (this.rootNode !== null) { this.rootRenderNode = this.rootNode.getRenderNode(); } return this.rootNode; }
AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FrameNode AST#primary_ty...
makeNode(uiContext: UIContext): FrameNode { this.rootNode = new FrameNode(uiContext); if (this.rootNode !== null) { this.rootRenderNode = this.rootNode.getRenderNode(); } return this.rootNode; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L65-L71
36a7b592ddb9ea1154ed7b19d9b95b17bcb7c999
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc/entry/src/main/ets/model/ImageList.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class ImageList { image: Resource value: string constructor
AST#export_declaration#Left export AST#ERROR#Left class ImageList { image : Resource value : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class ImageList { image: Resource value: string constructor
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc/entry/src/main/ets/model/ImageList.ets#L15-L19
f2240c5c0260e7e101865e7194aaf4963397d317
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/titileComponent.ets
arkts
CustomTitle
自定义标题栏组件(移除了@Entry)
@Entry @Component export struct CustomTitle { @Prop title: string = '默认标题'; @Prop showBack: boolean = true; build() { Row() { if (this.showBack) { // 使用系统图标代替自定义图标 Image($r('app.media.back')) .width(24) .height(24) .margin({ left: 16 }) .onClick((...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct CustomTitle AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left s...
@Entry @Component export struct CustomTitle { @Prop title: string = '默认标题'; @Prop showBack: boolean = true; build() { Row() { if (this.showBack) { Image($r('app.media.back')) .width(24) .height(24) .margin({ left: 16 }) .onClick(() => { ...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/titileComponent.ets#L4-L35
acd71274bba572f8bbd4eb83f48235bfe3294b14
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceNavigation.d.ets
arkts
Indicates the options of Navigation's gradientBackground. @typedef GradientBackground @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
export interface GradientBackground { /** * the primaryColor of Background. * * @type { ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ primaryColor: ResourceColor; /** * the secondaryColor of Background. * * @type { ?ResourceColor } * ...
AST#export_declaration#Left export AST#interface_declaration#Left interface GradientBackground AST#object_type#Left { /** * the primaryColor of Background. * * @type { ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ AST#type_member#Left primaryColor : AST...
export interface GradientBackground { primaryColor: ResourceColor; secondaryColor?: ResourceColor; backgroundTheme?: BackgroundTheme; mixMode?: MixMode; alpha?: GradientAlpha; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets#L382-L432
14584f08e6ef88bd66029431327cc712fdbb1fd2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/SelectGifTimeFrameView.ets
arkts
SelectGifTimeFrameView
选取生成gif时间片段页面
@Component export struct SelectGifTimeFrameView { @State promptText: string = ''; @State ratio: number = 1.0; @Prop @Watch("watchPlayEvent") playEvent: number = 0; @State mVideoThumbOption: VideoThumbOption = { videoThumbs: [], videoThumbWidth: 0 }; @State progress: number = 0; private seekBarWid...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SelectGifTimeFrameView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right promptText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right A...
@Component export struct SelectGifTimeFrameView { @State promptText: string = ''; @State ratio: number = 1.0; @Prop @Watch("watchPlayEvent") playEvent: number = 0; @State mVideoThumbOption: VideoThumbOption = { videoThumbs: [], videoThumbWidth: 0 }; @State progress: number = 0; private seekBarWid...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/SelectGifTimeFrameView.ets#L27-L192
6cf0fb86e00057428cdba33a2f98d70bde884b06
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/mediafullscreen/src/main/ets/view/MediaFullScreen.ets
arkts
MediaFullScreenComponent
组件zIndex 功能描述: 本示例介绍了使用@ohos.multimedia.media接口和@ohos.window接口配合XComponent组件实现媒体全屏的功能。 推荐场景: 多用于首页瀑布流媒体播放等场景 核心组件: 1. window 2. XComponent 实现步骤: 1. 在自定义组件XVideoComponent内调用changeOrientation方法,实现媒体全屏效果。 2. 调用@ohos.window的getLastWindow方法获取当前应用内最上层的子窗口,若无应用子窗口,则返回应用主窗口。 3. 利用获取到的窗口对象,调用setWindowSystemBarEnable方法设置窗口是否...
@Component export struct MediaFullScreenComponent { popPage: (() => void) | undefined = undefined; @State maskShow: boolean = false; // 遮罩层是否显示 @State isLandscape: boolean = false; // 是否横屏状态 @State cachedCountNumber: number = 6; // 懒加载缓存数 @State contentData: FlowItemContentsData = new FlowItemContentsData(); ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MediaFullScreenComponent AST#component_body#Left { AST#property_declaration#Left popPage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#...
@Component export struct MediaFullScreenComponent { popPage: (() => void) | undefined = undefined; @State maskShow: boolean = false; @State isLandscape: boolean = false; @State cachedCountNumber: number = 6; @State contentData: FlowItemContentsData = new FlowItemContentsData(); @State selectedVideo: str...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mediafullscreen/src/main/ets/view/MediaFullScreen.ets#L44-L158
7574667275aeff638d7084d8e7ba6595e5e1a053
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/NavigationResultPage.ets
arkts
NavigationResultContent
结果回传示例页内容视图 @returns {void} 无返回值
@Builder private NavigationResultContent() { MediumPaddingVerticalScroll() { ColumnBase({ widthValue: P100 }) { this.InputSection(); }; }; }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private NavigationResultContent 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 MediumPaddingVerticalScroll ( ) AST#contai...
@Builder private NavigationResultContent() { MediumPaddingVerticalScroll() { ColumnBase({ widthValue: P100 }) { this.InputSection(); }; }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NavigationResultPage.ets#L35-L42
ef97ff6c18fe4d46f19d41eb6f738caae993cd41
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
stopContinuousTask
结束后台任务 @returns {void}
stopContinuousTask(): void { // 避免重新停止后台任务 if (!this.isBackgroundTaskRunning) { return; } // TODO:知识点:停止后台任务 backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => { console.info(`Succeeded in operationing stopBackgroundRunning.`); this.isBackgroundTaskRunning =...
AST#method_declaration#Left stopContinuousTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 避免重新停止后台任务 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member...
stopContinuousTask(): void { if (!this.isBackgroundTaskRunning) { return; } backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => { console.info(`Succeeded in operationing stopBackgroundRunning.`); this.isBackgroundTaskRunning = false; }).catch((err: Busi...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L320-L333
c446b848e7b7664afb311b87f02f939bfab6eba1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
isLayoutFullScreen
判断窗口是否为沉浸式,默认为false。true表示沉浸式;false表示非沉浸式。 @param windowClass 不传该值,默认主窗口。 @returns
static isLayoutFullScreen(windowClass: window.Window = AppUtil.getMainWindow()): boolean { return WindowUtil.getWindowProperties(windowClass).isLayoutFullScreen; }
AST#method_declaration#Left static isLayoutFullScreen AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left...
static isLayoutFullScreen(windowClass: window.Window = AppUtil.getMainWindow()): boolean { return WindowUtil.getWindowProperties(windowClass).isLayoutFullScreen; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L99-L101
6ca6e2de9bd679b9986f1423250d5ffc0e6ce06e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ChatbotEngine.ets
arkts
步骤类型枚举
export enum StepType { PROMPT = 'prompt', COLLECT_INPUT = 'collect_input', VALIDATE = 'validate', CONFIRM = 'confirm', EXECUTE = 'execute', COMPLETE = 'complete' }
AST#export_declaration#Left export AST#enum_declaration#Left enum StepType AST#enum_body#Left { AST#enum_member#Left PROMPT = AST#expression#Left 'prompt' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left COLLECT_INPUT = AST#expression#Left 'collect_input' AST#expression#Right AST#enum_member#Right , AS...
export enum StepType { PROMPT = 'prompt', COLLECT_INPUT = 'collect_input', VALIDATE = 'validate', CONFIRM = 'confirm', EXECUTE = 'execute', COMPLETE = 'complete' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L59-L66
b27e7d382d604c74398a89350c398372a530fd80
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/editaddress/src/main/ets/model/Address.ets
arkts
表单验证的数据结构 @param {string} name 收件人 @param {string} areaName 省市区 @param {number | number []} provinceArr 处理后的省市区数组 @param {string} area 详细地址 @param {string} phone 手机号 @param {string} tag 地址标签
export class Address { name: string = ''; areaName: string = ''; provinceArr: number | number [] = [0, 0, 0]; area: string = ''; phone: string = ''; tag: string = ''; constructor(name: string, areaName: string, provinceArr: number | number [], area: string, phone: string, tag: string) { this.name...
AST#export_declaration#Left export AST#class_declaration#Left class Address AST#class_body#Left { AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST...
export class Address { name: string = ''; areaName: string = ''; provinceArr: number | number [] = [0, 0, 0]; area: string = ''; phone: string = ''; tag: string = ''; constructor(name: string, areaName: string, provinceArr: number | number [], area: string, phone: string, tag: string) { this.name...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/model/Address.ets#L25-L42
ac79dec4bd859b72a500df4cff48590540b927b7
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets
arkts
pop
[End static_async_push] [Start static_pop] 通过路由栈名routerName获取对应的NavPathStack对象,并使用该对象的pop方法实现返回上个路由
public static pop(routerName: string): void { RouterModule.getRouter(routerName).pop(); }
AST#method_declaration#Left public static pop AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_...
public static pop(routerName: string): void { RouterModule.getRouter(routerName).pop(); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L64-L66
48b5fcd20f7ed4e81706182da25beecfa0ad1836
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets
arkts
自定义日历控制器。用于控制年、月、周视图间切换场景下刷新日期数据。
export class CalendarController { // 视图刷新接口 public swiperRefresh = (value: CalendarViewType) => { }; // 视图刷新接口(仅用于在年视图上点击月份切换到月视图时刷新) public swiperYearToMonthRefresh = (year: number, month: number) => { }; // 日程点数据刷新接口 public schedulePointRefresh = () => { }; }
AST#export_declaration#Left export AST#class_declaration#Left class CalendarController AST#class_body#Left { // 视图刷新接口 AST#property_declaration#Left public swiperRefresh = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Cale...
export class CalendarController { public swiperRefresh = (value: CalendarViewType) => { }; (仅用于在年视图上点击月份切换到月视图时刷新) public swiperYearToMonthRefresh = (year: number, month: number) => { }; public schedulePointRefresh = () => { }; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets#L244-L254
8646042c000a0959c6608f2daed0c54dfa3f6c8a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/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/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L163-L166
7c5c9ff2b178e01c3c31d7ea2c3d5fe0b7a85697
gitee