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
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets
arkts
start
启动倒计时(回调函数方式)
start(callback: (remainMs: number) => void): void { if (this.remainMs <= 0) return; // 清理可能存在的旧定时器[6](@ref) this.stop(); this.callback = callback; this.active = true; this.paused = false; // 使用setInterval创建定时器[8](@ref) this.timerId = setInterval(() => { if (!this.active) return;...
AST#method_declaration#Left start AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left remainMs : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) A...
start(callback: (remainMs: number) => void): void { if (this.remainMs <= 0) return; this.stop(); this.callback = callback; this.active = true; this.paused = false; this.timerId = setInterval(() => { if (!this.active) return; this.remainMs = Math.max(0, this.remainMs - t...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L27-L48
b037f6de82c0b8a4509bc6f48c71625cad9647a9
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderLogisticsPage.ets
arkts
OrderLogisticsPage
@file 订单物流页面视图 @author Joker.X
@ComponentV2 export struct OrderLogisticsPage { /** * 订单物流页面 ViewModel */ @Local private vm: OrderLogisticsViewModel = new OrderLogisticsViewModel(); /** * 当前窗口安全区状态 */ @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); /** * 物流步骤条分组 ID */ @Local priv...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderLogisticsPage AST#component_body#Left { /** * 订单物流页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left O...
@ComponentV2 export struct OrderLogisticsPage { @Local private vm: OrderLogisticsViewModel = new OrderLogisticsViewModel(); @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); @Local private stepsGroupId: string = "order_logistics_steps"; build() { AppNavDe...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L21-L339
372244d6c39e7bafee635f922e27fae853350197
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/greeting/GreetingService.ets
arkts
getInstance
获取单例实例
static getInstance(): GreetingService { if (!GreetingService.instance) { GreetingService.instance = new GreetingService(); } return GreetingService.instance; }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GreetingService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Lef...
static getInstance(): GreetingService { if (!GreetingService.instance) { GreetingService.instance = new GreetingService(); } return GreetingService.instance; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/greeting/GreetingService.ets#L91-L96
2de11f835265f658d00a13bd4030cf413b2d40c4
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/util/StopWatchUtils.ets
arkts
格式化毫秒数为字符串,以分钟、秒和毫秒为单位。 @param milliseconds 要格式化的毫秒数 @return 格式化后的字符串,格式为 "分:秒.毫秒"
export function formatMilliseconds(milliseconds: number): string { // 将毫秒数转换为总秒数 const totalSeconds = Math.floor(milliseconds / 1000); // 计算分钟数 const minutes = Math.floor(totalSeconds / 60); // 计算剩余的秒数 const seconds = totalSeconds % 60; // 计算剩余的毫秒数 const millisecondsFraction = Math.floor((milliseconds %...
AST#export_declaration#Left export AST#function_declaration#Left function formatMilliseconds AST#parameter_list#Left ( AST#parameter#Left milliseconds : 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_annota...
export function formatMilliseconds(milliseconds: number): string { const totalSeconds = Math.floor(milliseconds / 1000); const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; const millisecondsFraction = Math.floor((milliseconds % 1000) / 10); const formattedMinutes...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/StopWatchUtils.ets#L7-L24
a20050cbe88e135e14474a19fd7ea6fd81bd8df7
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSA.ets
arkts
@Author csx @DateTime 2024/3/18 10:48:03 @TODO RSA @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class RSA { /** * 生成RSA的非对称密钥 * @returns RSA密钥{publicKey:公钥,privateKey:私钥} */ static async generateRSAKey(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('RSA1024'); } /** * 生成2048位RSA的非对称密钥 * @returns 2048位RSA密钥{publicKey:2048位公钥,privateKey:2048位私钥} */ static async g...
AST#export_declaration#Left export AST#class_declaration#Left class RSA AST#class_body#Left { /** * 生成RSA的非对称密钥 * @returns RSA密钥{publicKey:公钥,privateKey:私钥} */ AST#method_declaration#Left static async generateRSAKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_typ...
export class RSA { static async generateRSAKey(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('RSA1024'); } static async generate2048RSAKey(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('RSA2048'); } static async encodePKCS1(str: string, pubKey: string): Promise<s...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L29-L178
f64e17649b26c2028c0218b3de132af7426e4d50
gitee
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
makeCurrent
绑定线程与上下文 @param draw @param read @param context @returns
makeCurrent(draw: EGLSurface | undefined, read: EGLSurface | undefined, context: EGLContext | undefined): boolean;
AST#method_declaration#Left makeCurrent AST#parameter_list#Left ( AST#parameter#Left draw : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left EGLSurface AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , A...
makeCurrent(draw: EGLSurface | undefined, read: EGLSurface | undefined, context: EGLContext | undefined): boolean;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L154-L154
444d9975be69501213e277840ebd05aad184074b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/model/TISheetOptions.ets
arkts
文本/文本展示半模态
export interface TISheetOptions extends BaseSheetOptions { content: string | PixelMap | Resource; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TISheetOptions AST#extends_clause#Left extends BaseSheetOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left content : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AS...
export interface TISheetOptions extends BaseSheetOptions { content: string | PixelMap | Resource; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/model/TISheetOptions.ets#L4-L6
e3c86ff7f2c7c1d5e7583bd76931b006787b2ff7
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/base/BaseProfilerUtils.ets
arkts
提取字符串数字
export function extractNumber(originStr) { let result = ''; for (var index = 0; index < originStr.length; index++) { const element: string = originStr[index]; if (element.match('^[0-9]*$')) { result += element; } } return result; }
AST#export_declaration#Left export AST#function_declaration#Left function extractNumber AST#parameter_list#Left ( AST#parameter#Left originStr AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expressi...
export function extractNumber(originStr) { let result = ''; for (var index = 0; index < originStr.length; index++) { const element: string = originStr[index]; if (element.match('^[0-9]*$')) { result += element; } } return result; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/base/BaseProfilerUtils.ets#L138-L147
867ac00d6014ae513cdd6762f25b8c75fb2bfaab
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/BoyerMoore.ets
arkts
findFirstMatch
查找模式串在文本中的第一个出现位置 @param text 文本字符串 @param pattern 模式串 @returns 第一个匹配位置,如果未找到则返回 -1
static findFirstMatch(text: string, pattern: string): number { if (!text || !pattern || pattern.length === 0) { return -1; } const badCharTable = BoyerMoore.buildBadCharTable(pattern); const goodSuffixTable = BoyerMoore.buildGoodSuffixTable(pattern); const m = pattern.length; const n = te...
AST#method_declaration#Left static findFirstMatch AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
static findFirstMatch(text: string, pattern: string): number { if (!text || !pattern || pattern.length === 0) { return -1; } const badCharTable = BoyerMoore.buildBadCharTable(pattern); const goodSuffixTable = BoyerMoore.buildGoodSuffixTable(pattern); const m = pattern.length; const n = te...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/BoyerMoore.ets#L86-L113
9b7e8a5033a84cafa066cbffd5d32a00eb5d437f
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/TaoYao.ets
arkts
isMicrophoneMute
麦克风是否静音,在系统设置里面开启超级隐私模式,麦克风会被静音。 @returns true 静音
static isMicrophoneMute(): Promise<boolean> { const microphoneGlobalSwitch = new MicrophoneGlobalSwitch() microphoneGlobalSwitch.isMicrophoneMute() return microphoneGlobalSwitch.isMicrophoneMute() }
AST#method_declaration#Left static isMicrophoneMute 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 > AST#...
static isMicrophoneMute(): Promise<boolean> { const microphoneGlobalSwitch = new MicrophoneGlobalSwitch() microphoneGlobalSwitch.isMicrophoneMute() return microphoneGlobalSwitch.isMicrophoneMute() }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L146-L150
44c269b645c0b283626df02cd40a43a099500081
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.AlbumPickerComponent.d.ets
arkts
The callback of onEmptyAreaClick event @typedef { function } EmptyAreaClickCallback @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 13
export type EmptyAreaClickCallback = () => void /** * AlbumPickerOptions Object * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */
AST#export_declaration#Left export AST#type_declaration#Left type EmptyAreaClickCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right ...
export type EmptyAreaClickCallback = () => void
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.AlbumPickerComponent.d.ets#L82-L90
c4da2a62d4da0d41fd946c287e024488981d37df
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/common/utils/HttpUtils.ets
arkts
登录响应数据
export interface LoginData { token: string; user: UserInfo; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LoginData AST#object_type#Left { AST#type_member#Left token : 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 user : AST#type_annotation#Left AS...
export interface LoginData { token: string; user: UserInfo; }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/HttpUtils.ets#L43-L46
c7aeeecfdc91bafced2402ae7943a6a00e26958f
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/BookInfoRule.ets
arkts
书籍详情页规则
export class BookInfoRule { init?: string name?: string author?: string intro?: string kind?: string lastChapter?: string updateTime?: string coverUrl?: string tocUrl?: string wordCount?: string canReName?: string downloadUrls?: string constructor
AST#export_declaration#Left export AST#ERROR#Left class BookInfoRule { init AST#ERROR#Left ? : AST#ERROR#Left string name ? : string author ? : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Left in tro ? : AST#type_annota...
export class BookInfoRule { init?: string name?: string author?: string intro?: string kind?: string lastChapter?: string updateTime?: string coverUrl?: string tocUrl?: string wordCount?: string canReName?: string downloadUrls?: string constructor
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/BookInfoRule.ets#L4-L18
e07355bd27ca9df05f083fcf5242fd9f42058647
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
insertOrUpdateMoodEntry
==================== MOOD ENTRY OPERATIONS ==================== Insert or update a mood entry for a specific date If entry exists for the date, update it; otherwise, insert new @param moodEntry - MoodEntry object to insert/update @returns Row ID
async insertOrUpdateMoodEntry(moodEntry: MoodEntry): Promise<number> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { // Check if entry exists for this date const existingEntry = await this.getMoodEntryByDate(moodEntry.date); const valueBucket: relationa...
AST#method_declaration#Left async insertOrUpdateMoodEntry AST#parameter_list#Left ( AST#parameter#Left moodEntry : AST#type_annotation#Left AST#primary_type#Left MoodEntry AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST...
async insertOrUpdateMoodEntry(moodEntry: MoodEntry): Promise<number> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { const existingEntry = await this.getMoodEntryByDate(moodEntry.date); const valueBucket: relationalStore.ValuesBucket = { 'date'...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L446-L481
0538a417a64da73b017df1dea85b26cc6a033fb5
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
offAbilityLifecycle
取消监听应用内生命周期。使用callback异步回调。仅支持主线程调用。 @param callbackId 回调方法,返回注册监听事件的ID。 @returns
static async offAbilityLifecycle(callbackId: number): Promise<void> { return AppUtil.getApplicationContext().off('abilityLifecycle', callbackId); }
AST#method_declaration#Left static async offAbilityLifecycle AST#parameter_list#Left ( AST#parameter#Left callbackId : 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 AS...
static async offAbilityLifecycle(callbackId: number): Promise<void> { return AppUtil.getApplicationContext().off('abilityLifecycle', callbackId); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L312-L314
0395452e8790b7326cf5094617c781fdbd14f676
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
cancelOrder
取消订单 @param {CancelOrderRequest} params - 取消订单参数 @returns {Promise<NetworkResponse<boolean>>} 是否取消成功
async cancelOrder(params: CancelOrderRequest): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.post("order/info/cancel", params); return resp.data; }
AST#method_declaration#Left async cancelOrder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CancelOrderRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
async cancelOrder(params: CancelOrderRequest): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.post("order/info/cancel", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L82-L86
8f1232ca999cc3b61fc8ff5c94d68264f72e6b2b
github
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/utils/crypto.ets
arkts
decode
@throws
static decode(msg: string, key: string) { const combined = new Uint8Array(buffer.from(msg, 'base64').buffer) const symKeyBlob: cryptoFramework.DataBlob = { data: new Uint8Array(buffer.from(key, 'utf-8').buffer) } const aesGenerator: cryptoFramework.SymKeyGenerator = cryptoFramework.createSymKeyGenerator('AE...
AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right ...
static decode(msg: string, key: string) { const combined = new Uint8Array(buffer.from(msg, 'base64').buffer) const symKeyBlob: cryptoFramework.DataBlob = { data: new Uint8Array(buffer.from(key, 'utf-8').buffer) } const aesGenerator: cryptoFramework.SymKeyGenerator = cryptoFramework.createSymKeyGenerator('AE...
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/utils/crypto.ets#L33-L46
a84245d472d38a292b8118684613fc0dd87d31e6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
游戏统计接口
export interface GameStatistics { totalGames: number; totalWins: number; totalScore: number; bestScore: number; averageScore: number; totalTimePlayed: number; favoriteGame: GameType; perfectGames: number; currentStreak: number; bestStreak: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GameStatistics AST#object_type#Left { AST#type_member#Left totalGames : 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 totalWins : AST#type_ann...
export interface GameStatistics { totalGames: number; totalWins: number; totalScore: number; bestScore: number; averageScore: number; totalTimePlayed: number; favoriteGame: GameType; perfectGames: number; currentStreak: number; bestStreak: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L132-L143
6b44248c74c6a0d926b3213d2c8c3b5cc3c46fd7
github
HarmonyCandies/loading_more_list.git
49ab379fb8baff92fc42f7c3bc6fcea87a1f4970
loading_more_list/src/main/ets/viewmodel/LoadingMoreBase.ets
arkts
/ loading more base class
export abstract class LoadingMoreBase<T> extends DataSourceBase<T | LoadingMoreItem> { public abstract hasMore: boolean; private isLoading: boolean = false; indicatorStatus: IndicatorStatus = IndicatorStatus.none; lastItemIsLoadingMoreItem: boolean = true; totalCount(): number { return this.length + (th...
AST#export_declaration#Left export AST#class_declaration#Left abstract class LoadingMoreBase AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left DataSourceBase AST#type_arguments#Left < AST...
export abstract class LoadingMoreBase<T> extends DataSourceBase<T | LoadingMoreItem> { public abstract hasMore: boolean; private isLoading: boolean = false; indicatorStatus: IndicatorStatus = IndicatorStatus.none; lastItemIsLoadingMoreItem: boolean = true; totalCount(): number { return this.length + (th...
https://github.com/HarmonyCandies/loading_more_list.git/blob/49ab379fb8baff92fc42f7c3bc6fcea87a1f4970/loading_more_list/src/main/ets/viewmodel/LoadingMoreBase.ets#L95-L221
63fccbdf5992beff1302b33e9ff09186da8882ae
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/data/singleData.ets
arkts
商品信息类型
export class GoodsType { public src: string public name: string public collect: string public price: string public collected: boolean constructor
AST#export_declaration#Left export AST#ERROR#Left class GoodsType { AST#property_declaration#Left public src : 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 public name : AST#type_annotation#Left AST#p...
export class GoodsType { public src: string public name: string public collect: string public price: string public collected: boolean constructor
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/data/singleData.ets#L17-L23
26796e22c5a65f46a7db39a73a3f5a3b4ce20ed0
gitee
from-north-to-north/OpenHarmony_p7885
f6ea526c039db535a7c958fa154ccfcb3668b37c
hap/Cpu_info_float_windows/hap/Cpu_info_3.8/entry/src/main/ets/controller/FloatWindowController.ets
arkts
悬浮窗控制类
export default class FloatWindowController { // 创建单例模式 private static mInstance: FloatWindowController | null = null; public static getInstance(): FloatWindowController { if (FloatWindowController.mInstance == null) { FloatWindowController.mInstance = new FloatWindowController(); } return Floa...
AST#export_declaration#Left export default AST#class_declaration#Left class FloatWindowController AST#class_body#Left { // 创建单例模式 AST#property_declaration#Left private static mInstance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left FloatWindowController AST#primary_type#Right | AST#primary_type#Le...
export default class FloatWindowController { private static mInstance: FloatWindowController | null = null; public static getInstance(): FloatWindowController { if (FloatWindowController.mInstance == null) { FloatWindowController.mInstance = new FloatWindowController(); } return FloatWindowCo...
https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/Cpu_info_float_windows/hap/Cpu_info_3.8/entry/src/main/ets/controller/FloatWindowController.ets#L12-L102
0067121731aaa16e8108310bb7a4e3fff485ebee
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/PickerUtils.ets
arkts
saveDocument
通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。 @param options @returns static async saveDocument(newFileNames?: Array<string>): Promise<Array<string>> { try { let documentPicker = new picker.DocumentViewPicker(); if (newFileNames == undefined || newFileNames == null || newFileNames.length == 0) { return await documentPicker....
static async saveDocument(options?: picker.DocumentSaveOptions): Promise<Array<string>> { const documentPicker = new picker.DocumentViewPicker(getContext()); return documentPicker.save(options); }
AST#method_declaration#Left static async saveDocument AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . DocumentSaveOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter...
static async saveDocument(options?: picker.DocumentSaveOptions): Promise<Array<string>> { const documentPicker = new picker.DocumentViewPicker(getContext()); return documentPicker.save(options); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PickerUtils.ets#L189-L192
65a5789ea93b68063818a8549ae0e9514301cd3c
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/plan.ets
arkts
handleDay
获取一个周的日期
function handleDay(today: string, i: number): number { // 将日期字符串转换为Date对象 const targetDate = new Date(today); // 检查日期是否有效 if (isNaN(targetDate.getTime())) { console.error("无效的日期字符串"); return 0; // 或其他默认值 } // 计算i天后的日期 targetDate.setDate(targetDate.getDate() + i); // 返回日期中的"日"部分 return targe...
AST#function_declaration#Left function handleDay AST#parameter_list#Left ( AST#parameter#Left today : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
function handleDay(today: string, i: number): number { const targetDate = new Date(today); if (isNaN(targetDate.getTime())) { console.error("无效的日期字符串"); return 0; } targetDate.setDate(targetDate.getDate() + i); return targetDate.getDate(); }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L96-L111
c1fc7d2907acbaef8c7fb5d6042038e7493c4407
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.app.d.ets
arkts
setImageCacheCount
Set image cache capacity of decoded image count. if not set, the application will not cache any decoded image. @param { number } value - capacity of decoded image count. @syscap SystemCapability.ArkUI.ArkUI.Full @since 7 Set image cache capacity of decoded image count. if not set, the application will not cache any ...
static setImageCacheCount(value: number): void;
AST#method_declaration#Left static setImageCacheCount AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima...
static setImageCacheCount(value: number): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.app.d.ets#L314-L314
347aaa5bddd27316fe32ad2a4d127ba45d64b151
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets
arkts
set
设置设备影子监听器,用于接收设备侧请求平台下发的设备影子数据。 此监听器只能接收平台到直连设备的请求,子设备的请求由AbstractGateway处理 @param shadowListener 设备影子监听器
public set shadowListener(value: ShadowListener | null) { this._shadowListener = value; }
AST#method_declaration#Left public set AST#ERROR#Left shadow List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ShadowListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AS...
public set shadowListener(value: ShadowListener | null) { this._shadowListener = value; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets#L108-L110
33a58a73733fee17aba14363ee855d7af2767317
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/ValidationUtils.ets
arkts
isValidPhone
验证手机号(中国)
static isValidPhone(phone: string): boolean { const phoneRegex = /^1[3-9]\d{9}$/; return phoneRegex.test(phone); }
AST#method_declaration#Left static isValidPhone AST#parameter_list#Left ( AST#parameter#Left phone : 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_...
static isValidPhone(phone: string): boolean { const phoneRegex = /^1[3-9]\d{9}$/; return phoneRegex.test(phone); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ValidationUtils.ets#L17-L20
254b627cdb4d09682b19aeed226624e1184c190b
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets
arkts
isRegister
Check whether the registration button can be clicked.
isRegister() { this.isRegisterAvailable = false; let isAvailable = (this.username.length > 0) && (this.password.length > 0) && (this.confirmPassword.length > 0); if (isAvailable) { this.isRegisterAvailable = true; } }
AST#method_declaration#Left isRegister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRegisterAvailable AST#me...
isRegister() { this.isRegisterAvailable = false; let isAvailable = (this.username.length > 0) && (this.password.length > 0) && (this.confirmPassword.length > 0); if (isAvailable) { this.isRegisterAvailable = true; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets#L39-L45
0e74dd3fb4a10a583c8d67b77b4677b0fef97c8b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
reset
Reset.
reset(): void { Logger.debug(TAG, 'reset'); let limit = this.calcNewLimit(); this.cropShow.init(limit, this.imageRatio); this.initialize(); this.refresh(); }
AST#method_declaration#Left reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expre...
reset(): void { Logger.debug(TAG, 'reset'); let limit = this.calcNewLimit(); this.cropShow.init(limit, this.imageRatio); this.initialize(); this.refresh(); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L363-L369
33004e5ced5f96a960ef3215e74c5569d6948db4
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/utils/RegexUtil.ets
arkts
TODO 正则工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class RegexUtil { /** * 英文字母 、数字和下划线 */ static readonly REG_GENERAL: string = "^\\w+$"; /** * 数字 */ static readonly REG_NUMBERS: string = "^\\d+$"; /** * 字母 */ static readonly REG_WORD: string = "^[a-zA-Z]+$"; /** * 单个中文汉字 * 参照维基百科汉字Unicode范围(https://zh.wikipedia.org/wiki/%...
AST#export_declaration#Left export AST#class_declaration#Left class RegexUtil AST#class_body#Left { /** * 英文字母 、数字和下划线 */ AST#property_declaration#Left static readonly REG_GENERAL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^\\w+$...
export class RegexUtil { static readonly REG_GENERAL: string = "^\\w+$"; static readonly REG_NUMBERS: string = "^\\d+$"; static readonly REG_WORD: string = "^[a-zA-Z]+$"; static readonly REG_CHINESE: string = "^[\u2E80-\u2EFF\u2F00-\u2FDF\u31C0-\u31EF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uD840\uD...
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/utils/RegexUtil.ets#L25-L274
2b10b3a9b1ae3bcf4bdbaeb14dc62b5901bb5832
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/BusinessSample/entry/src/main/ets/common/bean/ListItemData.ets
arkts
List item data entity.
export class ListItemData { /** * List item title. */ title: Resource; /** * List item sub title. */ subTitle: Resource; /** * List item widget type. */ widget: WidgetType; }
AST#export_declaration#Left export AST#class_declaration#Left class ListItemData AST#class_body#Left { /** * List item title. */ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * ...
export class ListItemData { title: Resource; subTitle: Resource; widget: WidgetType; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BusinessSample/entry/src/main/ets/common/bean/ListItemData.ets#L6-L21
0929ec7daa5808aad31971c46a6a0b1b20c02a29
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/UserFile/UserFileURI/entry/src/main/ets/pages/Index.ets
arkts
photoPickerGetUri
[Start ] 调用PhotoViewPicker.select选择图片
async function photoPickerGetUri() { try { let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; // 设置最多可以选择的图片数量为1 photoSelectOptions.maxSelectNumber = 1; let photoPicker = new photoAccessHelper.PhotoVie...
AST#function_declaration#Left async function photoPickerGetUri AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoSelectOptions = A...
async function photoPickerGetUri() { try { let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 1; let photoPicker = new photoAccessHelper.PhotoViewPicker(); ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/UserFileURI/entry/src/main/ets/pages/Index.ets#L48-L62
2d48e08406abadfecf88a0fe42de9bc8dcb02de2
gitee
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
entry/src/main/ets/rdb/MessageDialog.ets
arkts
短通知 @param message 提示文本 @param time 停留时间
export function showToast(message: string, time: number = 3000) { promptAction.showToast({ message, duration: time }) }
AST#export_declaration#Left export AST#function_declaration#Left function showToast 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#Left time : AST#type_annotation#Left AST#p...
export function showToast(message: string, time: number = 3000) { promptAction.showToast({ message, duration: time }) }
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/entry/src/main/ets/rdb/MessageDialog.ets#L15-L20
40100f19e01d72064a28aff6f0bc42764914ffa1
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/bluetooth.ets
arkts
confirmPairing
Confirm pairing
confirmPairing(accept: boolean) { LogUtil.info(this.TAG_PAGE + 'confirmPairing pairingDevice'); try { if (this.pairingDevice && this.pairingDevice.deviceId != null && this.controller) { this.controller.confirmPairing(this.pairingDevice.deviceId, accept); } } catch (err) { LogUtil.i...
AST#method_declaration#Left confirmPairing AST#parameter_list#Left ( AST#parameter#Left accept : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#L...
confirmPairing(accept: boolean) { LogUtil.info(this.TAG_PAGE + 'confirmPairing pairingDevice'); try { if (this.pairingDevice && this.pairingDevice.deviceId != null && this.controller) { this.controller.confirmPairing(this.pairingDevice.deviceId, accept); } } catch (err) { LogUtil.i...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/bluetooth.ets#L616-L625
2047201171050b6f00934834566a23248ebf7be4
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
startEasy
朗读控件起播,拉起播放器面板并开始播放。 @param id 文章id @param bodyInfo 正文信息(长度10000汉字以内) @param title 标题 @param author 文章的作者 @param date 文章的时间 @returns
static startEasy(id: string, bodyInfo: string, title?: string, author?: string, date?: string): Promise<void> { const readInfoList: TextReader.ReadInfo[] = [{ id: id, title: { text: title ?? '', isClickable: true }, author: { text: author ?? '', isClickable: t...
AST#method_declaration#Left static startEasy 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#Left bodyInfo : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
static startEasy(id: string, bodyInfo: string, title?: string, author?: string, date?: string): Promise<void> { const readInfoList: TextReader.ReadInfo[] = [{ id: id, title: { text: title ?? '', isClickable: true }, author: { text: author ?? '', isClickable: t...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L52-L70
70121b342b42151c4fe3e98a05ca653334eaaa69
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets
arkts
showToast
创建并弹出dialogContent对应的自定义弹窗 @param contentView 自定义弹窗中显示的组件内容。 @param options 弹窗样式。
showToast(options: ToastOptions) { const showToastOptions = options as promptAction.ShowToastOptions; showToastOptions.textColor = options.fontColor; if (options.uiContext) { options.uiContext.getPromptAction().showToast(showToastOptions); } else { window.getLastWindow(getContext()).then((re...
AST#method_declaration#Left showToast AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ToastOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#...
showToast(options: ToastOptions) { const showToastOptions = options as promptAction.ShowToastOptions; showToastOptions.textColor = options.fontColor; if (options.uiContext) { options.uiContext.getPromptAction().showToast(showToastOptions); } else { window.getLastWindow(getContext()).then((re...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L56-L66
90070aa29aa26740b2e945642104cc60bff376fe
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/constants/ImageViewerConstants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class ImageViewerConstants { // 缩放动画的持续时间 static readonly ANIMATE_DURATION: number = 300; // swiper中缓存图片的数量 static readonly SWIPER_CACHE_COUNT: number = 2; // 测试文件名称 static readonly IMAGE_NAME: string = "imageviewer_test1.jpg"; }
AST#export_declaration#Left export AST#class_declaration#Left class ImageViewerConstants AST#class_body#Left { // 缩放动画的持续时间 AST#property_declaration#Left static readonly ANIMATE_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AS...
export class ImageViewerConstants { static readonly ANIMATE_DURATION: number = 300; static readonly SWIPER_CACHE_COUNT: number = 2; static readonly IMAGE_NAME: string = "imageviewer_test1.jpg"; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/constants/ImageViewerConstants.ets#L16-L23
a6139bdc8b4258e51a4846c8246613a472b05960
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/model/DetailMode.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 SwiperPicturesModel { public src: Resource; constructor(src: Resource) { this.src = src; } }
AST#export_declaration#Left export AST#class_declaration#Left class SwiperPicturesModel AST#class_body#Left { AST#property_declaration#Left public src : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#L...
export class SwiperPicturesModel { public src: Resource; constructor(src: Resource) { this.src = src; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/model/DetailMode.ets#L16-L22
f94e363af52869f76152b557fad2eed3a7c78c46
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets
arkts
this
为图表添加手势识别监听器
this.model.setOnChartGestureListener(this.chartGestureListener);
AST#method_declaration#Left this AST#ERROR#Left . model . setOnChartGesture List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . chartGesture List ener AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
this.model.setOnChartGestureListener(this.chartGestureListener);
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets#L113-L113
2ed6000d5d1e1d82c107a54cc2bc7e2bd980da4e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
delayRefresh
Delay refresh. @param delay
private delayRefresh(delay: number): void { this.isWaitingRefresh = true; this.timeoutId = setTimeout(() => { this.cropShow.enlargeCropArea(); this.splitLineShow = false; this.refresh(); this.isWaitingRefresh = false; }, delay); }
AST#method_declaration#Left private delayRefresh AST#parameter_list#Left ( AST#parameter#Left delay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
private delayRefresh(delay: number): void { this.isWaitingRefresh = true; this.timeoutId = setTimeout(() => { this.cropShow.enlargeCropArea(); this.splitLineShow = false; this.refresh(); this.isWaitingRefresh = false; }, delay); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L442-L450
5e3e8f6fa80669fa7322e3caee317debd6005d45
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/MPPointF.ets
arkts
recycleInstance
public static MPPointF getInstance() { return pool.get(); } public static MPPointF getInstance(MPPointF copy) { MPPointF result = pool.get(); result.x = copy.x; result.y = copy.y; return result; }
public static recycleInstance(instance: MPPointF) { MPPointF.pool.recycle(instance); }
AST#method_declaration#Left public static recycleInstance AST#parameter_list#Left ( AST#parameter#Left instance : AST#type_annotation#Left AST#primary_type#Left MPPointF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statem...
public static recycleInstance(instance: MPPointF) { MPPointF.pool.recycle(instance); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/MPPointF.ets#L68-L70
b67ecfba57729d415138d80de038a1c4b3a53511
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/model/DataObject.ets
arkts
callRemote
调用端调用startAbilityByCall接口拉起对端Ability
callRemote(context: common.UIAbilityContext) { if (caller) { Logger.error(TAG, 'call remote already'); return; } // 调用genSessionId接口创建一个sessionId、获取对端设备networkId if (!this.sessionId) { this.sessionId = distributedDataObject.genSessionId(); } Logger.info(TAG, `gen sessionId: ${...
AST#method_declaration#Left callRemote AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bloc...
callRemote(context: common.UIAbilityContext) { if (caller) { Logger.error(TAG, 'call remote already'); return; } if (!this.sessionId) { this.sessionId = distributedDataObject.genSessionId(); } Logger.info(TAG, `gen sessionId: ${this.sessionId}`); let deviceId = getRemoteD...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/model/DataObject.ets#L61-L100
9a963e53f9bc17d73ce6cfa704ad39c7bf5b69df
gitee
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/pages/component/MinuteLineComponent.ets
arkts
_drawChengJiaoLiang
绘制成交量
_drawChengJiaoLiang() { this.context.strokeStyle = '#e99a4c' this.context.lineWidth = 0.8600009 this.stockData.line.forEach((value, index) => { if (value.price) this.context.beginPath() this.context.moveTo(value.lineX, ((this.stockData.maxChengJiaoLiang - value.chengJiaoLiang) / this.sto...
AST#method_declaration#Left _drawChengJiaoLiang AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#ex...
_drawChengJiaoLiang() { this.context.strokeStyle = '#e99a4c' this.context.lineWidth = 0.8600009 this.stockData.line.forEach((value, index) => { if (value.price) this.context.beginPath() this.context.moveTo(value.lineX, ((this.stockData.maxChengJiaoLiang - value.chengJiaoLiang) / this.sto...
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/MinuteLineComponent.ets#L332-L342
969c700877dc8fa2c584b64747847a9e7862a972
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/MD5.ets
arkts
hash
计算MD5哈希值
public static hash(input: string): string { const encoder: TextEncoder = new TextEncoder(); const inputBytes: Uint8Array = encoder.encode(input); const inputSize: number = inputBytes.length; // 计算填充后的消息大小 let paddedMessageSize: number = 0; if (inputSize % 64 < 56) { paddedMessageSize = in...
AST#method_declaration#Left public static hash AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
public static hash(input: string): string { const encoder: TextEncoder = new TextEncoder(); const inputBytes: Uint8Array = encoder.encode(input); const inputSize: number = inputBytes.length; let paddedMessageSize: number = 0; if (inputSize % 64 < 56) { paddedMessageSize = inputSize + 64 ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/MD5.ets#L75-L169
32fb937158b49e9f530713848c1221645b363646
github
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
mineModule/src/main/ets/components/ProfileComp.ets
arkts
updateNickName
更新昵称
updateNickName() { this.dialog.open() this.mViewModel.updateNickName(this.user.nickName) .then(res => { ToastUtils.showToast('更新昵称成功') AuthorUtils.setUser(this.user) this.dialog.close() }) .catch(e => { this.dialog.close() }) }
AST#method_declaration#Left updateNickName AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left th...
updateNickName() { this.dialog.open() this.mViewModel.updateNickName(this.user.nickName) .then(res => { ToastUtils.showToast('更新昵称成功') AuthorUtils.setUser(this.user) this.dialog.close() }) .catch(e => { this.dialog.close() }) }
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/mineModule/src/main/ets/components/ProfileComp.ets#L133-L144
401484cb90430b6ed3566de2212b8a1c197d5b79
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets
arkts
saveSnapshot
保存图片到相册。
async saveSnapshot(result: SaveButtonOnClickResult) { // TODO: 知识点:使用SaveButton组件可以免申请权限,用户点击后,临时将文件存入系统目录 if (result === SaveButtonOnClickResult.SUCCESS) { const helper = photoAccessHelper.getPhotoAccessHelper(this.context); // 使用保存控件 try { // onClick触发后10秒内通过createAsset接口创建图片文件,10秒后c...
AST#method_declaration#Left async saveSnapshot AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left SaveButtonOnClickResult AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // TODO: 知识点:使用SaveButton...
async saveSnapshot(result: SaveButtonOnClickResult) { if (result === SaveButtonOnClickResult.SUCCESS) { const helper = photoAccessHelper.getPhotoAccessHelper(this.context); try { const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'png'); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L248-L285
1bc6c0e180bf6377b8b020f11f6e5fa5afcfa288
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/view/AddTargetDialog.ets
arkts
dialogButtonStyle
Custom button style.
@Extend(Button) function dialogButtonStyle() { .fontSize($r('app.float.button_font')) .height($r('app.float.dialog_btn_height')) .width($r('app.float.dialog_btn_width')) .backgroundColor(Color.White) .fontColor($r('app.color.main_blue')) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Button AST#expression#Right ) AST#decorator#Right function dialogButtonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left ...
@Extend(Button) function dialogButtonStyle() { .fontSize($r('app.float.button_font')) .height($r('app.float.dialog_btn_height')) .width($r('app.float.dialog_btn_width')) .backgroundColor(Color.White) .fontColor($r('app.color.main_blue')) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/AddTargetDialog.ets#L77-L83
4d81eaab18867dacee5a9390c482744c8e46c26f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/login/LoginView.ets
arkts
handleLoginCompletion
处理登录结果
private handleLoginCompletion(succeed: boolean, msg?: string | null): void { if (succeed) { Toast.showMessage($r('app.string.login_msg_login_succeed')) this.navPath.pop(true) this.onDismiss(true) //登录成功回调 /// 登录时,只从Server读取,不写入 SubscriptionInfoManager.shared.asyncRefreshSubscriptionIn...
AST#method_declaration#Left private handleLoginCompletion AST#parameter_list#Left ( AST#parameter#Left succeed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg ? : AST#type_annotation#Left AST#union_type#Left AST#prima...
private handleLoginCompletion(succeed: boolean, msg?: string | null): void { if (succeed) { Toast.showMessage($r('app.string.login_msg_login_succeed')) this.navPath.pop(true) this.onDismiss(true) SubscriptionInfoManager.shared.asyncRefreshSubscriptionInfo(true) logEvent("log...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/LoginView.ets#L334-L350
929bb19f7d064fd972055a4479b0a8ff06575c69
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/TextToSpeechService.ets
arkts
setEnabled
启用/禁用TTS
setEnabled(enabled: boolean): void { this.isTTSEnabled = enabled; if (!enabled) { this.stop(); } this.logService.tts(`TTS ${enabled ? '已启用' : '已禁用'}`); }
AST#method_declaration#Left setEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
setEnabled(enabled: boolean): void { this.isTTSEnabled = enabled; if (!enabled) { this.stop(); } this.logService.tts(`TTS ${enabled ? '已启用' : '已禁用'}`); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L386-L392
7a7bc048ca5e3369a91f530e5676950011feb159
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
BptaUseResources/entry/src/main/ets/pages/music/Recording.ets
arkts
[EndExclude recording_audio_capturer]
export default class EntryAbility extends UIAbility { // ... onForeground(): void { //Apply for the resources required by the system, or reapply for the resources released in onBackground () audio.createAudioCapturer(audioCapturerOptions, (err, data) => { if (err) { console.error(`Invokecreat...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // ... AST#method_declaration#Left onForeground AST#parameter_list#Left ( ) AST#parameter_list#...
export default class EntryAbility extends UIAbility { onForeground(): void { audio.createAudioCapturer(audioCapturerOptions, (err, data) => { if (err) { console.error(`InvokecreateAudioCapturerfailed,codeis${err.code},messageis${err.message}`); } else { console.info('Invokecre...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseResources/entry/src/main/ets/pages/music/Recording.ets#L38-L57
4c6e66fc85b375337454193c285a8c56e0e2f34f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/Constants.ets
arkts
翻译子分隔符(Android版暂时只考虑全角,)
export const linesSeperator : string = "\n";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left linesSeperator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "\n" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declara...
export const linesSeperator : string = "\n";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/Constants.ets#L8-L8
468dda7c0e952e110d599d2b1d131ea76724e3b9
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/Memo.ets
arkts
Memo Data Model Represents a text note without a specific time Database row representation for Memo
export interface MemoRow { id: number; content: string; created_at: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MemoRow AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#type_annotation#Left AST#...
export interface MemoRow { id: number; content: string; created_at: number; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/Memo.ets#L9-L13
61c10019e85ec887c6d4018ea61b7b9766fbf672
github
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
getAxisByValue
代理到 C++ 实例的 getXByValue 方法
getAxisByValue(targetTime: number): number { return this.instance.getAxisByValue(targetTime); }
AST#method_declaration#Left getAxisByValue AST#parameter_list#Left ( AST#parameter#Left targetTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
getAxisByValue(targetTime: number): number { return this.instance.getAxisByValue(targetTime); }
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L201-L203
846c80c985e7a9935dcf0b907303c8adf6c97144
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
updateUserNickname
更新用户昵称
updateUserNickname(nickname: string): void { if (nickname && nickname.trim().length > 0) { this.userInfo.nickname = nickname.trim(); console.info(`用户昵称已更新为: ${nickname}`); } }
AST#method_declaration#Left updateUserNickname AST#parameter_list#Left ( AST#parameter#Left nickname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t...
updateUserNickname(nickname: string): void { if (nickname && nickname.trim().length > 0) { this.userInfo.nickname = nickname.trim(); console.info(`用户昵称已更新为: ${nickname}`); } }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L162-L167
97feed1707061981e52b6ea244c0c2d2d57cb692
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/settings/LanguageSettingsPage.ets
arkts
buildLanguageItem
构建语言项
@Builder buildLanguageItem(languageInfo: LanguageInfo, index: number) { Row({ space: 16 }) { // 旗帜 Text(languageInfo.flag) .fontSize(24) .width(32) .textAlign(TextAlign.Center) // 语言信息 Column({ space: 4 }) { Text(languageInfo.nativeName) .fontSize...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildLanguageItem AST#parameter_list#Left ( AST#parameter#Left languageInfo : AST#type_annotation#Left AST#primary_type#Left LanguageInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#typ...
@Builder buildLanguageItem(languageInfo: LanguageInfo, index: number) { Row({ space: 16 }) { Text(languageInfo.flag) .fontSize(24) .width(32) .textAlign(TextAlign.Center) Column({ space: 4 }) { Text(languageInfo.nativeName) .fontSize(16) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/settings/LanguageSettingsPage.ets#L341-L407
9e2e3f918a8065ce88443ed4da403c58c03307f3
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
setWindowSystemBarEnable
设置主窗口三键导航栏、状态栏、底部导航条的可见模式,状态栏与底部导航条通过status控制、三键导航栏通过navigation控制,使用Promise异步回调。 @param names 设置窗口全屏模式时状态栏、三键导航栏和底部导航条是否显示。例如,需全部显示,该参数设置为['status', 'navigation'];不设置,则默认不显示。 @param windowClass 不传该值,默认主窗口。 @returns
static async setWindowSystemBarEnable(names: Array<'status' | 'navigation'>, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.setWindowSystemBarEnable(names); }
AST#method_declaration#Left static async setWindowSystemBarEnable AST#parameter_list#Left ( AST#parameter#Left names : AST#type_annotation#Left AST#primary_type#Left Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left < 'status' | 'navigation' > AST#ERROR#Right , AST#parameter#Left...
static async setWindowSystemBarEnable(names: Array<'status' | 'navigation'>, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.setWindowSystemBarEnable(names); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L185-L188
bfd1a7632b49d1b8e0840bc7ba3751507c33350c
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/stateManagement/base/backingValue.d.ets
arkts
@file @kit ArkUI @arkts 1.2
export declare class BackingValue<T> { public constructor(initValue: T) public get value(): T public set value(newVale: T) }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class BackingValue AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { AST#method_declaration#Left public AST#ERROR#Left constructor AST#parame...
export declare class BackingValue<T> { public constructor(initValue: T) public get value(): T public set value(newVale: T) }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/stateManagement/base/backingValue.d.ets#L21-L25
3411c6c2a3ff9bd3f96f2fa720afef935cb89008
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/SpecSelectModal.ets
arkts
SpecHeaderInfo
顶部商品信息 @returns {void} 无返回值
@Builder private SpecHeaderInfo(): void { RowStartCenter({ widthValue: P100 }) { // 商品图片 NetWorkImage({ model: this.selectedSpec?.images?.[0] ?? this.goods?.mainPic ?? "", widthValue: 100, heightValue: 100, cornerRadius: $r("app.float.radius_small") }); Spac...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private SpecHeaderInfo 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#arkts_ui_element#Left AST#u...
@Builder private SpecHeaderInfo(): void { RowStartCenter({ widthValue: P100 }) { NetWorkImage({ model: this.selectedSpec?.images?.[0] ?? this.goods?.mainPic ?? "", widthValue: 100, heightValue: 100, cornerRadius: $r("app.float.radius_small") }); SpaceHorizo...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/SpecSelectModal.ets#L185-L218
fa958b6e27f64a047c7d4d5224a14588d5d7ae1f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
preloadLunarData
预加载农历数据 @param year 年份
async preloadLunarData(year: number): Promise<void> { if (this.useOnlineData) { await this.onlineLunarService.preloadLunarData(year); } }
AST#method_declaration#Left async preloadLunarData 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L...
async preloadLunarData(year: number): Promise<void> { if (this.useOnlineData) { await this.onlineLunarService.preloadLunarData(year); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L425-L429
bfc1cc22d1e3940c60ff84e6a4ffe6a72990fe1b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
错误信息接口
export interface AppError { code: number; message: string; details?: Record<string, Object>; timestamp: number; stack?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AppError 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_annotation#Left A...
export interface AppError { code: number; message: string; details?: Record<string, Object>; timestamp: number; stack?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L31-L37
0c385d74dae5ebd41c6a2cd17aada8cee7d7b775
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets
arkts
getTabBarImage
顶部状态栏高度 获取tabBar选中和未选中时的图片
getTabBarImage(index: number): Resource { if (this.currentIndex === index) { return TAB_BAR_DATA[index].selectedImageUri; } return TAB_BAR_DATA[index].imageUri; }
AST#method_declaration#Left getTabBarImage AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type...
getTabBarImage(index: number): Resource { if (this.currentIndex === index) { return TAB_BAR_DATA[index].selectedImageUri; } return TAB_BAR_DATA[index].imageUri; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets#L122-L127
6fc9157e801b9b4e4bf73c05a5b056e4735b8643
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
avplayerPlay
播放二维码扫描成功提示音
avplayerPlay() { if (this.avPlayer) { this.avPlayer.playDrip(); } }
AST#method_declaration#Left avplayerPlay AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#ex...
avplayerPlay() { if (this.avPlayer) { this.avPlayer.playDrip(); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L236-L240
8fa02d12ccd2deea0f6663d03cfe327a1d110f5c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/component/OrderCard.ets
arkts
buildDivider
构建分割线 @returns {void} 无返回值
@Builder private buildDivider(): void { Column() .width(P100) .height($r("app.float.space_divider")) .backgroundColor($r("app.color.border")); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildDivider 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#arkts_ui_element#Left AST#ui_...
@Builder private buildDivider(): void { Column() .width(P100) .height($r("app.float.space_divider")) .backgroundColor($r("app.color.border")); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/component/OrderCard.ets#L178-L184
755adc8d0c251d94baf00ff04e2d2136d35a7eab
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/analytics/AnalyticsService.ets
arkts
trackEvent
记录使用事件
trackEvent(eventType: UsageEvent['eventType'], eventData?: any): void { const event: UsageEvent = { eventType, eventData, timestamp: new Date().toISOString(), sessionId: this.currentSessionId }; this.usageEvents.push(event); hilog.debug(LogConstants.DOMAIN_APP, LogConstants...
AST#method_declaration#Left trackEvent AST#parameter_list#Left ( AST#parameter#Left eventType : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left UsageEvent [ AST#ERROR#Left 'eventType' AST#ERROR#Right ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par...
trackEvent(eventType: UsageEvent['eventType'], eventData?: any): void { const event: UsageEvent = { eventType, eventData, timestamp: new Date().toISOString(), sessionId: this.currentSessionId }; this.usageEvents.push(event); hilog.debug(LogConstants.DOMAIN_APP, LogConstants...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AnalyticsService.ets#L151-L163
8f4150bd96abd1b420e0e9f900e889e3746ad474
github
HarmonyCandies/image_editor.git
16924481f667efa4bdd1a0b39e6f5a80c43e5ff4
entry/src/main/ets/pages/Index.ets
arkts
aboutToDisappear
在自定义组件即将析构销毁时将dialogController置空
aboutToDisappear() { this.dialogController = null // 将dialogController置空 }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogController AST#member_expre...
aboutToDisappear() { this.dialogController = null }
https://github.com/HarmonyCandies/image_editor.git/blob/16924481f667efa4bdd1a0b39e6f5a80c43e5ff4/entry/src/main/ets/pages/Index.ets#L26-L28
95925dac9f23027455caa03901fe862b80f395fc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ReviewDataModel.ets
arkts
ReviewItem 评论项。 包含用户名和评论内容。
export class ReviewItem { userName: string; // 用户名 reviewContent: string; // 评论内容 constructor(userName: string, reviewContent: string) { this.userName = userName; this.reviewContent = reviewContent; } }
AST#export_declaration#Left export AST#class_declaration#Left class ReviewItem AST#class_body#Left { AST#property_declaration#Left userName : 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 revie...
export class ReviewItem { userName: string; reviewContent: string; constructor(userName: string, reviewContent: string) { this.userName = userName; this.reviewContent = reviewContent; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ReviewDataModel.ets#L21-L29
19ae5cd571d4085f00595c541ce52bc5bab3254e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets
arkts
CommonItemInput
TextInput of change panel @param inputValue change inputValue
@Component export struct CommonItemInput { @Link inputValue: string; private name!: Resource; private placeholder?: ResourceStr = ''; build() { Row() { Text(this.name) .margin({ left: 12, right: 12 }) Blank() TextInput({ placeholder: this.placeholder }) .size(TOOL_WIDTH) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItemInput AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_...
@Component export struct CommonItemInput { @Link inputValue: string; private name!: Resource; private placeholder?: ResourceStr = ''; build() { Row() { Text(this.name) .margin({ left: 12, right: 12 }) Blank() TextInput({ placeholder: this.placeholder }) .size(TOOL_WIDTH) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L305-L329
f7d6de42f8a410ecf640f9a353bd62f8adde291b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PermissionUtil.ets
arkts
requestPermissionOnSetting
二次向用户申请授权(单个权限 或 读写权限组,建议使用该方法)。 @param permissions 需要授权的权限集合 @returns true表示授权成功继续业务操作,false表示用户拒绝授权
static async requestPermissionOnSetting(permissions: Permissions | Array<Permissions>): Promise<boolean> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); const context: Context = AppUtil.getContext(); //requestPermissionOnSetting会判断权限的授权状态来决定是否唤起弹窗 let grantStatus = ...
AST#method_declaration#Left static async requestPermissionOnSetting AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Permissions AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_anno...
static async requestPermissionOnSetting(permissions: Permissions | Array<Permissions>): Promise<boolean> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); const context: Context = AppUtil.getContext(); let grantStatus = await atManager.requestPermissionOnSetting(cont...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L102-L110
fafa648864f0a7e0354812bf779e43ca767b4d29
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/CustomKeyboard.ets
arkts
myGridItem
底部导航栏高度
@Builder myGridItem(item: IKeyAttribute) { if (typeof item.label === 'object') { Image(item.label) .width($r("app.integer.custom_keyboard_to_h5_key_image_size")) .height($r("app.integer.custom_keyboard_to_h5_key_image_size")) .objectFit(ImageFit.Contain) } else { Text(item....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right myGridItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left IKeyAttribute AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bo...
@Builder myGridItem(item: IKeyAttribute) { if (typeof item.label === 'object') { Image(item.label) .width($r("app.integer.custom_keyboard_to_h5_key_image_size")) .height($r("app.integer.custom_keyboard_to_h5_key_image_size")) .objectFit(ImageFit.Contain) } else { Text(item....
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/components/CustomKeyboard.ets#L34-L47
3c0f08121d39a2dfed5b835f9b3b5768660c8a24
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Native/NdkNativeWindow/entry/src/main/ets/pages/Index.ets
arkts
debounceClick
防抖函数
private debounceClick( action: () => void, delay: number = 500 ) { if (this.debounceTimer) { clearTimeout(this.debounceTimer); } this.debounceTimer = setTimeout(() => { action(); this.debounceTimer = null; }, delay); }
AST#method_declaration#Left private debounceClick AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#functio...
private debounceClick( action: () => void, delay: number = 500 ) { if (this.debounceTimer) { clearTimeout(this.debounceTimer); } this.debounceTimer = setTimeout(() => { action(); this.debounceTimer = null; }, delay); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Native/NdkNativeWindow/entry/src/main/ets/pages/Index.ets#L35-L43
d18d50c620216669dedf664a4b9245c8533e79ce
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
getCommemorationsByContact
获取联系人的所有纪念日 @param contactId 联系人ID
async getCommemorationsByContact(contactId: number): Promise<CommemorationEntity[]> { this.checkInitialization(); return await this.commemorationDAO.getCommemorationsByContactId(contactId); }
AST#method_declaration#Left async getCommemorationsByContact AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST...
async getCommemorationsByContact(contactId: number): Promise<CommemorationEntity[]> { this.checkInitialization(); return await this.commemorationDAO.getCommemorationsByContactId(contactId); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L176-L179
d2ab719733d87708b226297d590b6eaa7b8181b3
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkcompiler/esmodule/esmodule_dynamicimport/Staticlibraryhar/BuildProfile.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class BuildProfile { static readonly HAR_VERSION = '1.0.0'; static readonly BUILD_MODE_NAME = 'release'; static readonly DEBUG = false; }
AST#export_declaration#Left export default AST#class_declaration#Left class BuildProfile AST#class_body#Left { AST#property_declaration#Left static readonly HAR_VERSION = AST#expression#Left '1.0.0' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUILD_MODE_NAME = AST...
export default class BuildProfile { static readonly HAR_VERSION = '1.0.0'; static readonly BUILD_MODE_NAME = 'release'; static readonly DEBUG = false; }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/Staticlibraryhar/BuildProfile.ets#L16-L20
e1e112e893fe633054e21cd0cda1f0fa2fb7837f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/Tcp2TwoWayTls.ets
arkts
loadFile
加载文件内容并设置状态
loadFile(fileUri: string, callback: (content: string) => void) { workerPort.postMessage({ type: 'loadFile', fileUri: fileUri }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsTwoWayMessage = e.data; if (response.type === 'fileLoaded') { if (response.caContent) { ...
AST#method_declaration#Left loadFile AST#parameter_list#Left ( AST#parameter#Left fileUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left (...
loadFile(fileUri: string, callback: (content: string) => void) { workerPort.postMessage({ type: 'loadFile', fileUri: fileUri }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsTwoWayMessage = e.data; if (response.type === 'fileLoaded') { if (response.caContent) { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/Tcp2TwoWayTls.ets#L308-L328
2174b9adb8bcc565c971de448d86cd8d1c479476
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/features/statistics/src/main/ets/commons/Constants.ets
arkts
rgb
export const INCOME_BAR_HIGHLIGHT_COLOR: number = 0xf2992c;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left INCOME_BAR_HIGHLIGHT_COLOR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0xf2992c AST#expression#Right AST#variable_declarator#Right ; AST#...
export const INCOME_BAR_HIGHLIGHT_COLOR: number = 0xf2992c;
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/features/statistics/src/main/ets/commons/Constants.ets#L21-L21
1b47652b59d71ede84ff9a3e3d20014009019d25
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/common/RatingBar.ets
arkts
星星大小
build() { Row() { ForEach([1, 2, 3, 4, 5], (index: number) => { Text() { if (this.rating >= index) { // 满星 Span('★') .fontSize(this.starSize) .fontColor($r('app.color.rating_star')) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#ui_component#Right AST#ERROR#Left { ForEach ( AST#ERROR#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#L...
build() { Row() { ForEach([1, 2, 3, 4, 5], (index: number) => { Text() { if (this.rating >= index) { Span('★') .fontSize(this.starSize) .fontColor($r('app.color.rating_star')) }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/common/RatingBar.ets#L11-L20
54649c171bc49f6b61558f559eccf09b4a742b46
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/ECDSA.ets
arkts
generateECDSAKey
生成ECDSA的非对称密钥 @returns ECDSA密钥{publicKey:公钥,privateKey:私钥}
static async generateECDSAKey(): Promise<OutDTO<CryptoKey>> { return CryptoUtil.generateCryptoKey('ECC256'); }
AST#method_declaration#Left static async generateECDSAKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AS...
static async generateECDSAKey(): Promise<OutDTO<CryptoKey>> { return CryptoUtil.generateCryptoKey('ECC256'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/ECDSA.ets#L31-L33
f93a335d1da380956bab991c4565b57a1b4b508e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnAxisAlignRadioList.ets
arkts
ColumnAxisAlignRadioList
Set Axis Alignment in Column
@Component export struct ColumnAxisAlignRadioList { private columnModuleList: ContainerModuleItem[] = getColumnModuleList(); private groupName: string = this.columnModuleList[1].groupName; private moduleName: Resource = this.columnModuleList[1].moduleName; private radioList: Array<string> = this.columnModuleLis...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ColumnAxisAlignRadioList AST#component_body#Left { AST#property_declaration#Left private columnModuleList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContainerModuleItem [ ] AST#array_type#Rig...
@Component export struct ColumnAxisAlignRadioList { private columnModuleList: ContainerModuleItem[] = getColumnModuleList(); private groupName: string = this.columnModuleList[1].groupName; private moduleName: Resource = this.columnModuleList[1].moduleName; private radioList: Array<string> = this.columnModuleLis...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnAxisAlignRadioList.ets#L23-L56
404243194679244fcee53056d533b025d272e8d5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/DictSelectModal.ets
arkts
onItemClick
处理字典项点击 @param {DictItem} item - 字典项 @returns {void} 无返回值
private onItemClick(item: DictItem): void { this.onItemSelected(item); }
AST#method_declaration#Left private onItemClick AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left DictItem 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_ty...
private onItemClick(item: DictItem): void { this.onItemSelected(item); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L166-L168
718f0acbda52e5289d07940eeca7cd07d5533511
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/efRcpConfig.ets
arkts
请求拦截加解密操作
export class cryptoEvent { /** * 请求加密操作-业务自行处理数据 */ requestEncoder: (request: rcp.RequestContext) => rcp.RequestContext = (request: rcp.RequestContext): rcp.RequestContext => { return request; }; /** * 请求解密操作-业务自行处理数据 */ responseDecoder: (response: rcp.Response) =...
AST#export_declaration#Left export AST#class_declaration#Left class cryptoEvent AST#class_body#Left { /** * 请求加密操作-业务自行处理数据 */ AST#property_declaration#Left requestEncoder : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#prim...
export class cryptoEvent { requestEncoder: (request: rcp.RequestContext) => rcp.RequestContext = (request: rcp.RequestContext): rcp.RequestContext => { return request; }; responseDecoder: (response: rcp.Response) => rcp.Response = (response: rcp.Response): rcp.Response => { ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L87-L102
efb6d4a99d9c726ca0718200a013fe0927ef5dd6
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.router.d.ets
arkts
@typedef RouterOptions @syscap SystemCapability.ArkUI.ArkUI.Lite @since 8 @typedef RouterOptions @syscap SystemCapability.ArkUI.ArkUI.Lite @atomicservice @since 11
export interface RouterOptions { /** * URI of the destination page, which supports the following formats: * 1. Absolute path of the page, which is provided by the pages list in the config.json file. * Example: * pages/index/index * pages/detail/detail * 2. Particular path....
AST#export_declaration#Left export AST#interface_declaration#Left interface RouterOptions AST#object_type#Left { /** * URI of the destination page, which supports the following formats: * 1. Absolute path of the page, which is provided by the pages list in the config.json file. * Example: * ...
export interface RouterOptions { url: string; params?: Object; recoverable?: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.router.d.ets#L137-L195
ebeae4800540d91264ae13008f8f9289edbc409a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getStartOfYear
获取本年开始日期 @param date 基准日期,默认为今天 @returns 本年开始日期
static getStartOfYear(date: Date = new Date()): Date { return new Date(date.getFullYear(), 0, 1); }
AST#method_declaration#Left static getStartOfYear AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Da...
static getStartOfYear(date: Date = new Date()): Date { return new Date(date.getFullYear(), 0, 1); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L171-L173
c9273bc27a8b849bb28c368818e1f3828d6c275d
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
library/common/src/main/ets/services/IEntryService.ets
arkts
@author: HZWei @date: 2025/8/16 @desc:
export interface IEntryService extends IProvider { /** * 在底层模块 获取首页的视图 * @returns */ getBannerView(): WrappedBuilder<[]>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IEntryService AST#extends_clause#Left extends IProvider AST#extends_clause#Right AST#object_type#Left { /** * 在底层模块 获取首页的视图 * @returns */ AST#type_member#Left getBannerView AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#typ...
export interface IEntryService extends IProvider { getBannerView(): WrappedBuilder<[]>; }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/library/common/src/main/ets/services/IEntryService.ets#L8-L15
3e51c504dd1876b15b5980c69bc6c22709a93cbf
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModule.ets
arkts
[Start export_change_global_data_200]
export let data2 = 'data from side effect module';
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left data2 = AST#expression#Left 'data from side effect module' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export let data2 = 'data from side effect module';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModule.ets#L17-L17
25947a51b235029fd21f7db8fa17a54a7b665bad
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfSysCodeInterceptor.ets
arkts
intercept
拦截器 @param context @param next @returns
async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise<rcp.Response> { try { //响应对象 const response = await next.handle(context); //无监听则抛出异常 if (!this.codeEventListener) { let efRcpError = new EfRcpError(10010, '系统级响应码监听异常', '启用系统级响应码监听请设置efRcpConfig...
AST#method_declaration#Left async intercept AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . RequestContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left next : AST#typ...
async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise<rcp.Response> { try { const response = await next.handle(context); if (!this.codeEventListener) { let efRcpError = new EfRcpError(10010, '系统级响应码监听异常', '启用系统级响应码监听请设置efRcpConfig.sysCodeEvent属性~...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfSysCodeInterceptor.ets#L43-L70
a8a42ce293a6a48c1b8ebcf7e3b09dacae9b1a4b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
generateSmartSuggestions
生成智能推荐
async generateSmartSuggestions(): Promise<SmartSuggestion[]> { const suggestions: SmartSuggestion[] = []; try { // 祝福语准备建议 const greetingSuggestions = await this.generateGreetingSuggestions(); suggestions.push(...greetingSuggestions); // 礼物建议 const giftSuggestions = await this.ge...
AST#method_declaration#Left async generateSmartSuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SmartSuggestion [ ] AST#array_type#R...
async generateSmartSuggestions(): Promise<SmartSuggestion[]> { const suggestions: SmartSuggestion[] = []; try { const greetingSuggestions = await this.generateGreetingSuggestions(); suggestions.push(...greetingSuggestions); const giftSuggestions = await this.generateGiftSuggest...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L344-L372
9f937b2370bcd5c51e630d4ec7bf2f834da74332
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
抛出单例对象
export const efRcp = EfRcp.getInstance();
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left efRcp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EfRcp AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argume...
export const efRcp = EfRcp.getInstance();
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L534-L534
f94b7fd97a3573bf6d45103534abbb38e5d5ecf4
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/InputTextDialog.ets
arkts
InputTextDialog
Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 l...
@CustomDialog export default struct InputTextDialog { @Link inputValue: string; controller: CustomDialogController; cancel: () => void = () => {}; confirm: () => void = () => {}; build() { Column() { Text($r('app.string.input_text_dialog_text')) .fontSize($r('app.float.size_20')) .m...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct InputTextDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ...
@CustomDialog export default struct InputTextDialog { @Link inputValue: string; controller: CustomDialogController; cancel: () => void = () => {}; confirm: () => void = () => {}; build() { Column() { Text($r('app.string.input_text_dialog_text')) .fontSize($r('app.float.size_20')) .m...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/InputTextDialog.ets#L15-L49
b0cd57d6e32a6cab706bd8af74f0bdf8eafb50b0
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
update_title
Data Sync Asks the tab to update its title, usually called when the tab loads something new.
update_title() { try { let title = this.controller?.getTitle(); if (title && this.title != title) { // Update on change; this.title = title; } } catch (e) { console.error('[update_title] Failed: ' + e); } return this.title; }
AST#method_declaration#Left update_title AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left title = AST#expression#Left AST#call_express...
update_title() { try { let title = this.controller?.getTitle(); if (title && this.title != title) { this.title = title; } } catch (e) { console.error('[update_title] Failed: ' + e); } return this.title; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L803-L813
91b3194166414aede61aea7d0f58d18b17fc287a
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
selectAvatar
选择头像
async selectAvatar() { try { const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 1; const photoViewPicker = new photoAccessHelper.PhotoViewPicker(); ...
AST#method_declaration#Left async selectAvatar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left photoSelectOptions = AST#expression#...
async selectAvatar() { try { const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 1; const photoViewPicker = new photoAccessHelper.PhotoViewPicker(); ...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L548-L571
fd86358a7489e942d785cd939c98ba65596a7fd0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listitemoverflow/src/main/ets/pages/AboutMe.ets
arkts
featureItem
功能组件。 @param icon 图标 @param text 标签 @param prompt 点击后的提示语
@Builder featureItem(icon: ResourceStr, text: ResourceStr, prompt: ResourceStr) { Row() { Image(icon).imageStyle() Text(text) .fontSize($r("sys.float.ohos_id_text_size_body1")) .margin($r("app.integer.listitem_overflow_default_margin")) } .width("100%") .toastOnClick(prompt) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right featureItem AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : AST#type_annotation#Lef...
@Builder featureItem(icon: ResourceStr, text: ResourceStr, prompt: ResourceStr) { Row() { Image(icon).imageStyle() Text(text) .fontSize($r("sys.float.ohos_id_text_size_body1")) .margin($r("app.integer.listitem_overflow_default_margin")) } .width("100%") .toastOnClick(prompt) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listitemoverflow/src/main/ets/pages/AboutMe.ets#L253-L262
ee9aa883ab6e56eb024ffcd56133cc59c19c47db
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
decodeECB128
解密-ECB模式-128位 @param str 加密的字符串 @param aesKey AES密钥-128位 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns
static decodeECB128(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.decodeECB(str, aesKey, 'AES128', 'AES128|ECB|PKCS7', 128, keyCoding, dataCoding); }
AST#method_declaration#Left static decodeECB128 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static decodeECB128(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.decodeECB(str, aesKey, 'AES128', 'AES128|ECB|PKCS7', 128, keyCoding, dataCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L284-L287
25213785c8ea73cdf4cfde56b9118f6f4bc3620f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/login/ResetPasswordView.ets
arkts
resetPassword
重置密码逻辑
private resetPassword(): void { if (this.safeCode.trim() === '') { Toast.showMessage($r('app.string.resetpwd_msg_need_code')) return; } if (this.password === '') { Toast.showMessage($r('app.string.resetpwd_msg_need_pwd')) return; } if (this.password !== this.confirmPassword...
AST#method_declaration#Left private resetPassword AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression...
private resetPassword(): void { if (this.safeCode.trim() === '') { Toast.showMessage($r('app.string.resetpwd_msg_need_code')) return; } if (this.password === '') { Toast.showMessage($r('app.string.resetpwd_msg_need_pwd')) return; } if (this.password !== this.confirmPassword...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/ResetPasswordView.ets#L160-L192
ddbe47da03c67a279870a9a28dcb4e345f668a1e
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/ReminderService.ets
arkts
openNotificationPermission
请求开启通知权限。
public openNotificationPermission() { notification.requestEnableNotification().then(() => { Logger.info('开启通知权限成功'); }).catch((err: Error) => { Logger.error('开启通知权限失败,原因:' + JSON.stringify(err)); }); }
AST#method_declaration#Left public openNotificationPermission AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#e...
public openNotificationPermission() { notification.requestEnableNotification().then(() => { Logger.info('开启通知权限成功'); }).catch((err: Error) => { Logger.error('开启通知权限失败,原因:' + JSON.stringify(err)); }); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/ReminderService.ets#L15-L21
d87a07aa5ffd71c2bb3ce980da100a9156f904dd
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
热启动
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { Logger.info('[EntryAbility.onNewWant]', 'Ability onNewWant'); // 是否为系统分享 this.getShareData(want, launchParam); // 应用接续 this.receiveContinueData(want, launchParam); // 获取router事件中传递的targetPage参数 this.formDataHandle(wan...
AST#method_declaration#Left onNewWant 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#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abi...
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { Logger.info('[EntryAbility.onNewWant]', 'Ability onNewWant'); this.getShareData(want, launchParam); this.receiveContinueData(want, launchParam); this.formDataHandle(want); }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/entryability/EntryAbility.ets#L38-L49
e60ee23f3b4645ae982da6d8784f2b6bba448e2d
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/common/component.ets
arkts
TitleBar
返回按钮宽高比
@Component export default struct TitleBar { public title: string | Resource = $r('app.string.VPN_Case'); public hasBackPress: boolean = false; build() { Row() { if (this.hasBackPress) { Row() { Image($r('app.media.back')) .id('btnBack') .width(BACK_BUTTON_SIZE)...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct TitleBar AST#component_body#Left { AST#property_declaration#Left public title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource...
@Component export default struct TitleBar { public title: string | Resource = $r('app.string.VPN_Case'); public hasBackPress: boolean = false; build() { Row() { if (this.hasBackPress) { Row() { Image($r('app.media.back')) .id('btnBack') .width(BACK_BUTTON_SIZE)...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/common/component.ets#L26-L57
34387405a21e284ddb678f68726170fbe4db5dce
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Chip.d.ets
arkts
Defines accessibility options of default close icon. @interface CloseOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 14
export interface CloseOptions extends AccessibilityOptions {}
AST#export_declaration#Left export AST#interface_declaration#Left interface CloseOptions AST#extends_clause#Left extends AccessibilityOptions AST#extends_clause#Right AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface CloseOptions extends AccessibilityOptions {}
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L360-L360
4bb054c0da14ae5295d6f235fc181d6a4a15c5d3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets
arkts
窗口管理模型
export default class WindowModel { // 默认的顶部导航栏高度 public static readonly STATUS_BAR_HEIGHT = 38.8; // 默认的底部导航条高度 public static readonly BOTTOM_AVOID_HEIGHT = 10; // WindowModel 单例 private static instance?: WindowModel; /** * 获取WindowModel单例实例 * @returns {WindowModel} WindowModel */ static getIn...
AST#export_declaration#Left export default AST#class_declaration#Left class WindowModel AST#class_body#Left { // 默认的顶部导航栏高度 AST#property_declaration#Left public static readonly STATUS_BAR_HEIGHT = AST#expression#Left 38.8 AST#expression#Right ; AST#property_declaration#Right // 默认的底部导航条高度 AST#property_declaration#Left ...
export default class WindowModel { public static readonly STATUS_BAR_HEIGHT = 38.8; public static readonly BOTTOM_AVOID_HEIGHT = 10; private static instance?: WindowModel; static getInstance(): WindowModel { if (!WindowModel.instance) { WindowModel.instance = new WindowModel(); } ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets#L23-L195
ebeccf4475e76841f70778459a2276a69385730d
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/UserState.ets
arkts
UserState
全局用户状态
@ObservedV2 export class UserState { /** * 认证信息 */ @Type(Auth) @Trace private auth: Auth = new Auth(); /** * 用户信息 */ @Type(User) @Trace userInfo: User = new User(); /** * 更新用户登录状态(认证 + 用户信息) * @param {Auth} auth - 认证信息 * @param {User} user - 用户信息 * @returns {void} 无返回值 * @e...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class UserState AST#class_body#Left { /** * 认证信息 */ AST#property_declaration#Left AST#decorator#Left @ Type ( AST#expression#Left Auth AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Trace AST#decorato...
@ObservedV2 export class UserState { @Type(Auth) @Trace private auth: Auth = new Auth(); @Type(User) @Trace userInfo: User = new User(); updateUserState(auth: Auth, user: User): void { this.auth = Auth.fromResponse(auth); this.userInfo = User.fromResponse(user); new TokenStoreReposit...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L20-L173
e9a28819a542872ff6cf14b22ad38b4b85abec6a
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
Defines the GestureGroup. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export declare class GestureGroup { /** * Return to Obtain GestureGroup. * * @param { function } factory * @param { GestureMode } mode * @param { GestureType[] } gesture * @returns { GestureGroup } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicser...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class GestureGroup AST#class_body#Left { /** * Return to Obtain GestureGroup. * * @param { function } factory * @param { GestureMode } mode * @param { GestureType[] } gesture * @returns { G...
export declare class GestureGroup { static $_instantiate(factory: () => GestureGroup, mode: GestureMode, ...gesture: GestureType[]): GestureGroup; onCancel(event: Callback<void>): GestureGroup; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L725-L753
47727f63d5d4df7c9d94a4ff70532f131ccfbb3e
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/StringUtil.ets
arkts
bytesToStr
Bytes转字符串 @param bytes @returns
public static bytesToStr(bytes: Uint8Array): string { let str = ''; for (let i = 0; i < bytes.length; i++) { str += String.fromCharCode(bytes[i]); } return str; }
AST#method_declaration#Left public static bytesToStr AST#parameter_list#Left ( AST#parameter#Left bytes : AST#type_annotation#Left AST#primary_type#Left Uint8Array 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#...
public static bytesToStr(bytes: Uint8Array): string { let str = ''; for (let i = 0; i < bytes.length; i++) { str += String.fromCharCode(bytes[i]); } return str; }
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#L215-L222
5a76a0784ae3c7045f923eac9d0fdabfbba1c6bf
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
isSameDay
判断是否是同一天
static isSameDay(date1: number | string | Date, date2: number | string | Date) { date1 = DateUtils.getFormatDate(date1); date2 = DateUtils.getFormatDate(date2); let blSameYear = date1.getFullYear() === date2.getFullYear(); let blSameMonth = date1.getMonth() === date2.getMonth(); let blSameDay = date...
AST#method_declaration#Left static isSameDay AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Righ...
static isSameDay(date1: number | string | Date, date2: number | string | Date) { date1 = DateUtils.getFormatDate(date1); date2 = DateUtils.getFormatDate(date2); let blSameYear = date1.getFullYear() === date2.getFullYear(); let blSameMonth = date1.getMonth() === date2.getMonth(); let blSameDay = date...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L217-L224
c4c6d86dfe51fd32eb4ef4e69c82a4e7c2e01293
gitee