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
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/router/Router.ets
arkts
push
Push 跳转
async push(path: string, params?: RouteParams): Promise<void> { const route = this.routes.get(path) || { path: path, name: '', params: params }; // 执行路由守卫 const canNavigate = await this.executeGuards(route); if (!canNavigate) { Logger.warn('Router', `Navigation blocked by guard for: ${path}`)...
AST#method_declaration#Left async push AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params ? : AST#type_annotation#Left AST#primary_type#Left RouteParams AST#primary_typ...
async push(path: string, params?: RouteParams): Promise<void> { const route = this.routes.get(path) || { path: path, name: '', params: params }; const canNavigate = await this.executeGuards(route); if (!canNavigate) { Logger.warn('Router', `Navigation blocked by guard for: ${path}`); r...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Router.ets#L105-L154
0e6ac6a3844fbc6cdfbbb6a2a6dc14ab211109aa
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
快捷方式配置接口
export interface ShortcutConfig { id: string; type: ShortcutType; label: string; description: string; icon: string; targetPage: string; params?: Record<string, any>; isStatic?: boolean; priority: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ShortcutConfig AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left ...
export interface ShortcutConfig { id: string; type: ShortcutType; label: string; description: string; icon: string; targetPage: string; params?: Record<string, any>; isStatic?: boolean; priority: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L28-L38
52b8297aca780ce03b42f5020ebb2674106f3b81
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets
arkts
getAllRecordSounds
获取所有录音记录 @returns RecordSound 数组或 null
async getAllRecordSounds(): Promise<RecordSound[] | null> { if (!this.db) return null; const sql = `SELECT * FROM ${Tables.Record.name}`; return await this.db.getDatas(sql, [], rs => this.createRecordSoundFromRs(rs)); }
AST#method_declaration#Left async getAllRecordSounds AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left RecordSound [ ] AST#ar...
async getAllRecordSounds(): Promise<RecordSound[] | null> { if (!this.db) return null; const sql = `SELECT * FROM ${Tables.Record.name}`; return await this.db.getDatas(sql, [], rs => this.createRecordSoundFromRs(rs)); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L142-L149
766af7c7f7456fdef4c571d20080f4166cbb6683
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets
arkts
getData
Retrieve data at the specified index.
public getData(index: number): void { }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
public getData(index: number): void { }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets#L26-L27
61b71e35b36bd03adfc55792319b2ff857791123
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/bigfolder/src/main/ets/default/view/FolderOpenComponent.ets
arkts
setStartAppInfo
set start app info
setStartAppInfo() { if (CheckEmptyUtils.isEmpty(this.item)) { Log.showError(TAG, 'setStartAppInfo with item') return; } Log.showInfo(TAG, 'app setStartAppInfo'); if (AppStorage.get('deviceType') === CommonConstants.PAD_DEVICE_TYPE) { AppStorage.setOrCreate('openFolderStatus', BigFolder...
AST#method_declaration#Left setStartAppInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CheckEmptyUtils AST#expression#Right ....
setStartAppInfo() { if (CheckEmptyUtils.isEmpty(this.item)) { Log.showError(TAG, 'setStartAppInfo with item') return; } Log.showInfo(TAG, 'app setStartAppInfo'); if (AppStorage.get('deviceType') === CommonConstants.PAD_DEVICE_TYPE) { AppStorage.setOrCreate('openFolderStatus', BigFolder...
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/bigfolder/src/main/ets/default/view/FolderOpenComponent.ets#L645-L657
587acc013d0d51fd9fa5fb591799a0e1acf79357
gitee
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/model/data/SessionData.ets
arkts
主界面会话列表的数据结构
export class SessionData{ wid: string //用户wid headImg: string //头像 name: string //用户昵称 lastMsg: string //最后一条消息简要内容 unReadMsg: number //未读消息数量 constructor
AST#export_declaration#Left export AST#ERROR#Left class SessionData { wid : AST#ERROR#Left string //用户wid headImg : string //头像 name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right //用户昵称 AST#ERROR#Left l as tMsg AST#ERROR#Right : string //最后一条消息简要内容 unReadMsg : ...
export class SessionData{ wid: string headImg: string name: string lastMsg: string unReadMsg: number constructor
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/data/SessionData.ets#L5-L12
35a15cd22aa737d702466eb870115c8a73a99b75
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
encodeCBC
加密-CBC模式 @param str 待加密的字符串 @param key 给定秘钥规格密钥 @param iv iv偏移量字符串 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64) @returns
static encodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding): string { //转换key let symKey = CryptoSyncUtil.convertKeyFromStr(key, symAlgName, keyName, keyCoding); // 初始化加解密操作环境 ...
AST#method_declaration#Left static encodeCBC 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 key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static encodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding): string { let symKey = CryptoSyncUtil.convertKeyFromStr(key, symAlgName, keyName, keyCoding); let mode = crypto...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L157-L173
be8729978bed8d5a7bc62fb9d4381e21fcd9f14b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/VoiceService.ets
arkts
initializeSpeechRecognition
初始化语音识别
private async initializeSpeechRecognition(): Promise<void> { try { this.recognizer = await speechRecognizer.createRecognizer({ language: 'zh-CN', continuous: false, interimResults: true }); // 设置识别事件监听 this.recognizer.on('result', (result) => { hilog.info(Log...
AST#method_declaration#Left private async initializeSpeechRecognition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotati...
private async initializeSpeechRecognition(): Promise<void> { try { this.recognizer = await speechRecognizer.createRecognizer({ language: 'zh-CN', continuous: false, interimResults: true }); this.recognizer.on('result', (result) => { hilog.info(LogConstants.D...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L146-L167
4eaf77858ac1a10116850c9874510f80c76264e7
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
stringToUnit8Array
可理解的字符串转成字节流 @param str 字符串 @param str 字符串C1C3C2格式的,true为是 @returns Uint8Array字节流
static stringToUnit8Array(str: string, isC1C3C2?: boolean): Uint8Array { // if (isC1C3C2) { // str = new SM2Convert().i2dSM2(str); // } let arr = Array<number>(); for (let i = 0, j = str.length; i < j; ++i) { arr.push(str.charCodeAt(i)); } return new Uint8Array(arr); }
AST#method_declaration#Left static stringToUnit8Array 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 isC1C3C2 ? : AST#type_annotation#Left AST#primary_type#Left boolean AST...
static stringToUnit8Array(str: string, isC1C3C2?: boolean): Uint8Array { let arr = Array<number>(); for (let i = 0, j = str.length; i < j; ++i) { arr.push(str.charCodeAt(i)); } return new Uint8Array(arr); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L219-L228
fd4b5ff33899f0418d2e6aed9e533ffe43fdc030
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets
arkts
城市列表项视图 @param alphabetListItem: 列表项数据 @param contentBuilder: 列表项视图
export class AlphabetListItemView { alphabetListItem: AlphabetListItemType; contentBuilder: WrappedBuilder<[string]>; constructor(alphabetListItem: AlphabetListItemType, contentBuilder: WrappedBuilder<[string]>) { this.alphabetListItem = alphabetListItem; this.contentBuilder = contentBuilder; } }
AST#export_declaration#Left export AST#class_declaration#Left class AlphabetListItemView AST#class_body#Left { AST#property_declaration#Left alphabetListItem : AST#type_annotation#Left AST#primary_type#Left AlphabetListItemType AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#proper...
export class AlphabetListItemView { alphabetListItem: AlphabetListItemType; contentBuilder: WrappedBuilder<[string]>; constructor(alphabetListItem: AlphabetListItemType, contentBuilder: WrappedBuilder<[string]>) { this.alphabetListItem = alphabetListItem; this.contentBuilder = contentBuilder; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets#L52-L60
962014227643cb00aa06fff4dd81eea1ca1bf88e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBus.ets
arkts
off
注销事件监听 @param eventName 事件名 @param handler 监听回调;不传handler,注销eventName的所有事件监听
static off(eventName: string, handler?: Function): void { EventBusCore.getInstance().off(eventName, handler); }
AST#method_declaration#Left static off AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler ? : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_...
static off(eventName: string, handler?: Function): void { EventBusCore.getInstance().off(eventName, handler); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBus.ets#L34-L36
a1998f41eb44110f76e357ec445447ed7becec10
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Vibrator/Vibrator.ets
arkts
vibratePreset
预设效果振动 @param effectId 系统预设效果ID,默认'haptic.click'
vibratePreset(effectId: string = 'haptic.click'): void { vibrator.isSupportEffect(effectId, (err: BusinessError, state: boolean) => { if (!err && state) { vibrator.startVibration( { type: 'preset', effectId }, { usage: 'touch' } ); } }); }
AST#method_declaration#Left vibratePreset AST#parameter_list#Left ( AST#parameter#Left effectId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'haptic.click' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann...
vibratePreset(effectId: string = 'haptic.click'): void { vibrator.isSupportEffect(effectId, (err: BusinessError, state: boolean) => { if (!err && state) { vibrator.startVibration( { type: 'preset', effectId }, { usage: 'touch' } ); } }); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Vibrator/Vibrator.ets#L49-L58
2a88e2693a04b573479393e8c57250a5e5a9b61f
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
Default fontSize_Large for texts. Usually used on sub titles. @returns 20
export function fontSize_Large() { return 20; }
AST#export_declaration#Left export AST#function_declaration#Left function fontSize_Large AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 20 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#...
export function fontSize_Large() { return 20; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L21-L23
2f889879f8a25ad15c1d7476d88556d383868bcc
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets
arkts
getPluralStringValueSync
同步返回单复数大写字符串string值
static getPluralStringValueSync(resource: Resource, num: number): string { if (!resource) { return ''; } try { let context = getContext() as common.UIAbilityContext; return context.resourceManager.getPluralStringValueSync(resource, num).toUpperCase(); } catch (error) { let code =...
AST#method_declaration#Left static getPluralStringValueSync AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left numbe...
static getPluralStringValueSync(resource: Resource, num: number): string { if (!resource) { return ''; } try { let context = getContext() as common.UIAbilityContext; return context.resourceManager.getPluralStringValueSync(resource, num).toUpperCase(); } catch (error) { let code =...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets#L57-L70
71a8aaedaee628754fbee0af7f0a0fe6152bc7f9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
isNull
判断对象是否为空 @param source @returns
static isNull(source: CommonAllType) { return source === null || source === undefined; }
AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left CommonAllType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#...
static isNull(source: CommonAllType) { return source === null || source === undefined; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L75-L77
ccde21bd35b417902ce0b7b55a0a9166ab8617dc
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
getLoginInfo
获取当前用户的登录信息 @returns
getLoginInfo(): ILoginRegist | null { return this.loginInfo; }
AST#method_declaration#Left getLoginInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ILoginRegist AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Le...
getLoginInfo(): ILoginRegist | null { return this.loginInfo; }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L54-L56
1571cceef3682327447c2412e0958db36d7fa2ff
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the feature (F) version number, which increases with any planned new features. <p>The F version number monotonically increases from 0 or 1 to 99. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get featureVersion(): int;
AST#method_declaration#Left static get AST#ERROR#Left featureVersion AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left int AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static get featureVersion(): int;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L270-L270
12d7950c4391f7ec178393d340e0f93bab371047
gitee
GAOMUgenius/SounderHarbor.git
ac0efa1a290980999e38aa868259d32c2f107bb2
features/tab/src/main/ets/components/PlayMusicComponent.ets
arkts
calculateRotationAngle
计算当前应该旋转的角度
private calculateRotationAngle(): number { // 确保duration不为0,避免除零错误 if (this.playingMusic.duration <= 0) { return 0; } // 根据播放进度计算角度 (time/duration) * 360° return (this.playingMusic.time / this.playingMusic.duration) * 360 * 3; }
AST#method_declaration#Left private calculateRotationAngle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 确保duration不为0,避免除零错误 AST#statement#Left AST#if_statement#Left if ( AST#ex...
private calculateRotationAngle(): number { if (this.playingMusic.duration <= 0) { return 0; } return (this.playingMusic.time / this.playingMusic.duration) * 360 * 3; }
https://github.com/GAOMUgenius/SounderHarbor.git/blob/ac0efa1a290980999e38aa868259d32c2f107bb2/features/tab/src/main/ets/components/PlayMusicComponent.ets#L18-L26
5f267eaadecfd81fc319024898281044379108ed
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/products/phone/src/main/ets/viewmodel/IndexViewModel.ets
arkts
getIndexItemList
Data information on the home page. @returns IndexItem array.
getIndexItemList(): IndexItem[] { let IndexItemList: IndexItem[] = []; IndexItemList.push(new IndexItem($r('app.string.music_title'), $r('app.string.music_description'), $r('app.string.button_music'), $r('app.media.ic_music'), RouterUrlConstants.MUSIC_LIST)); IndexItemList.push(new IndexItem($r('app.s...
AST#method_declaration#Left getIndexItemList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IndexItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaratio...
getIndexItemList(): IndexItem[] { let IndexItemList: IndexItem[] = []; IndexItemList.push(new IndexItem($r('app.string.music_title'), $r('app.string.music_description'), $r('app.string.button_music'), $r('app.media.ic_music'), RouterUrlConstants.MUSIC_LIST)); IndexItemList.push(new IndexItem($r('app.s...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/products/phone/src/main/ets/viewmodel/IndexViewModel.ets#L28-L35
4bac65c2220ee8a96d5c8b60df61d964dfb2358b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/ContactsPage.ets
arkts
onPageShow
页面生命周期 - 页面显示时
onPageShow() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ContactsPage onPageShow - refreshing contacts'); this.loadContacts(); }
AST#method_declaration#Left onPageShow 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 hilog AST#expression#Right . info AST#member_expressi...
onPageShow() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ContactsPage onPageShow - refreshing contacts'); this.loadContacts(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/ContactsPage.ets#L47-L50
04345c0082527444aa3155f1c990a638cda51793
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/FileUtils.ets
arkts
getParentPath
通过URI或路径,获取对应文件父目录的路径名。 @param uriOrPath URI或路径
static getParentPath(uriOrPath: string): string { const parentUri = FileUtils.getParentUri(uriOrPath); return FileUtils.getFilePath(parentUri) }
AST#method_declaration#Left static getParentPath AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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#prim...
static getParentPath(uriOrPath: string): string { const parentUri = FileUtils.getParentUri(uriOrPath); return FileUtils.getFilePath(parentUri) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L210-L213
95b97f0a1ac9e60b07671ffcfcf72637892f0b3b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CommonRepository.ets
arkts
getEntityPathInfo
获取实体信息与路径 @returns 实体信息与路径
async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.getEntityPathInfo(); }
AST#method_declaration#Left async getEntityPathInfo 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 NetworkResponse AST#type_arguments#Left <...
async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.getEntityPathInfo(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CommonRepository.ets#L35-L37
686dee8cb76db95f9e5664dedb9b84ea25f9588f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets
arkts
签名 @param data 需要签名的数据 @param privateKey 私钥 @returns 签名信息
export async function sign(data: string, privateKey: string): Promise<string> { try { let signer = cryptoFramework.createSign('RSA1024|PKCS1|SHA256'); // 创建非对称密钥生成器实例 let rsaKeyGenerator: cryptoFramework.AsyKeyGenerator = cryptoFramework.createAsyKeyGenerator('RSA1024'); // 将RSA密钥字符串转换为密钥类型 let pr...
AST#export_declaration#Left export AST#function_declaration#Left async function sign AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left privateKey : AST#type_annotation#Left A...
export async function sign(data: string, privateKey: string): Promise<string> { try { let signer = cryptoFramework.createSign('RSA1024|PKCS1|SHA256'); let rsaKeyGenerator: cryptoFramework.AsyKeyGenerator = cryptoFramework.createAsyKeyGenerator('RSA1024'); let priKeyBlob: cryptoFramework.DataBlob...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets#L150-L168
6010815ef5c4440bb98084c702d64a3ba228a2a7
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/view/CorePage.ets
arkts
CoreContent
核心页面内容视图 @returns {void} 无返回值
@Builder private CoreContent() { MediumPaddingVerticalScroll() { ColumnBase({ widthValue: P100 }) { if (this.counterState.count > 0) { this.CounterCard(); SpaceVerticalLarge(); } IBestCellGroup({ inset: true, outerMargin: 0 }) { ForEach(this.vm.cards, (...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CoreContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MediumPaddingVerticalScroll ( ) AST#container_content_...
@Builder private CoreContent() { MediumPaddingVerticalScroll() { ColumnBase({ widthValue: P100 }) { if (this.counterState.count > 0) { this.CounterCard(); SpaceVerticalLarge(); } IBestCellGroup({ inset: true, outerMargin: 0 }) { ForEach(this.vm.cards, (...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/CorePage.ets#L59-L82
a64250d8e241d0aea696601141b1245e42a086b4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/BaseArkWebClient.ets
arkts
ArkWeb事件分发
export interface BaseArkWebClient { /** * 设置webview.WebviewController给实现对象 */ setWebviewController(controller: webview.WebviewController): void; /** * 当Controller成功绑定到Web组件时触发该回调,且禁止在该事件回调前调用Web组件相关的接口,否则会抛出js-error异常。 * 推荐在此事件中注入JS对象registerJavaScriptProxy、设置自定义用户代理setCustomUserAgent,可以在回调中使用loadU...
AST#export_declaration#Left export AST#interface_declaration#Left interface BaseArkWebClient AST#object_type#Left { /** * 设置webview.WebviewController给实现对象 */ AST#type_member#Left setWebviewController AST#parameter_list#Left ( AST#parameter#Left controller : AST#type_annotation#Left AST#primary_type#Left AST#quali...
export interface BaseArkWebClient { setWebviewController(controller: webview.WebviewController): void; onControllerAttached?(): void; onPageBegin?(event: OnPageBeginEvent): void; onPageEnd?(event: OnPageEndEvent): void; onProgressChange?(event: OnProgressChangeEvent): void; onPageVi...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/BaseArkWebClient.ets#L6-L335
93077467769ca270f3644b04c9131209a5e457c9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/StorageManager.ets
arkts
setSecureItem
安全存储敏感数据 @param key 键 @param value 值 @returns 操作结果
static async setSecureItem<T>(key: string, value: T): Promise<StorageResult<void>> { return this.setItem(key, value, { name: AppConstants.SECURE_STORAGE_NAME, encrypted: true }); }
AST#method_declaration#Left static async setSecureItem AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#p...
static async setSecureItem<T>(key: string, value: T): Promise<StorageResult<void>> { return this.setItem(key, value, { name: AppConstants.SECURE_STORAGE_NAME, encrypted: true }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L263-L265
d9808780ecf2044394a022eb070f878408e90e76
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/vipplan.ets
arkts
****************************build****************************
build() { Column() { this.allBodyPlan() this.title() // 内容区域 Column({ space: 24 }) { this.planOption() Button('立即解锁') .width('100%') .height(52) .backgroundColor('#6C5CE7') .fontColor('#FFFFFF') .fontSize(18) .fon...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#L...
build() { Column() { this.allBodyPlan() this.title() Column({ space: 24 }) { this.planOption() Button('立即解锁') .width('100%') .height(52) .backgroundColor('#6C5CE7') .fontColor('#FFFFFF') .fontSize(18) .fontWeight...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/vipplan.ets#L184-L213
e449b6c5383ae09b5271e5aca0eb14b427e51dd3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets
arkts
addCriticalAssetAuth
[End add_critical_asset]
async function addCriticalAssetAuth(): Promise<string> { let result: string = ''; let attr: asset.AssetMap = new Map(); attr.set(asset.Tag.SECRET, stringToArray('demo_pwd')); attr.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); attr.set(asset.Tag.ACCESSIBILITY, asset.Accessibility.DEVICE_FIRST_UNLOCKED); ...
AST#function_declaration#Left async function addCriticalAssetAuth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation...
async function addCriticalAssetAuth(): Promise<string> { let result: string = ''; let attr: asset.AssetMap = new Map(); attr.set(asset.Tag.SECRET, stringToArray('demo_pwd')); attr.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); attr.set(asset.Tag.ACCESSIBILITY, asset.Accessibility.DEVICE_FIRST_UNLOCKED); ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets#L158-L180
7fcee6c6a30c4a0c3fa6aff62a8e13fcab140d7b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets
arkts
setXLocationType
Get x locationType. @param offsetX
public setXLocationType(offsetX: number) { if (offsetX > this.offsetXRight - CommonConstant.OFFSET_RANGE && offsetX < this.offsetXRight + CommonConstant.OFFSET_RANGE) { this.xLocationType = XLocationEnum.XRight; } else if (offsetX > this.offsetXLeft - CommonConstant.OFFSET_RANGE && offsetX < t...
AST#method_declaration#Left public setXLocationType AST#parameter_list#Left ( AST#parameter#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#u...
public setXLocationType(offsetX: number) { if (offsetX > this.offsetXRight - CommonConstant.OFFSET_RANGE && offsetX < this.offsetXRight + CommonConstant.OFFSET_RANGE) { this.xLocationType = XLocationEnum.XRight; } else if (offsetX > this.offsetXLeft - CommonConstant.OFFSET_RANGE && offsetX < t...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets#L78-L88
25094ee8b63d33a430eca9623ccb0582956c541b
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets
arkts
getVerifyMap
获取验证项目映射。 @return {Map<number, VerifyItem>} verifyMap.
getVerifyMap(): Map<number, VerifyItem> { let verifyMap: Map<number, VerifyItem> = new Map(); verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK')); verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR')); return verifyMap; }
AST#method_declaration#Left getVerifyMap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#...
getVerifyMap(): Map<number, VerifyItem> { let verifyMap: Map<number, VerifyItem> = new Map(); verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK')); verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR')); return verifyMap; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets#L15-L20
b42b21857a4fb3046be421aab1dd3adffc67f210
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
extractKeyTopics
从用户消息中提取关键话题
private extractKeyTopics(messages: string[]): string[] { const topics: string[] = []; const keywords = ['提醒', '记录', '任务', '笔记', '备忘', '会议', '工作', '学习', '生活', '计划']; for (const msg of messages) { for (const keyword of keywords) { if (msg.includes(keyword) && !topics.includes(keyword)) { ...
AST#method_declaration#Left private extractKeyTopics AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annot...
private extractKeyTopics(messages: string[]): string[] { const topics: string[] = []; const keywords = ['提醒', '记录', '任务', '笔记', '备忘', '会议', '工作', '学习', '生活', '计划']; for (const msg of messages) { for (const keyword of keywords) { if (msg.includes(keyword) && !topics.includes(keyword)) { ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L417-L432
38ece485036ec21e82bcb61342585338391a525b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
getPurchaseTitle
获取提交订单的标题 @returns {string} 标题文案
private getPurchaseTitle(): string { try { const titleRes: Resource = $r("app.string.purchase_goods"); return ContextUtil.getUIAbilityCtx().resourceManager.getStringSync(titleRes.id); } catch (error) { return ""; } }
AST#method_declaration#Left private getPurchaseTitle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#state...
private getPurchaseTitle(): string { try { const titleRes: Resource = $r("app.string.purchase_goods"); return ContextUtil.getUIAbilityCtx().resourceManager.getStringSync(titleRes.id); } catch (error) { return ""; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L339-L346
e77b727a4dde49f258d1bd0e094802a0e8399268
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/feedback/src/main/ets/view/FeedbackListPage.ets
arkts
FeedbackListContent
反馈列表页面内容视图 @returns {void} 无返回值
@Builder private FeedbackListContent() { Text("反馈列表页面内容视图") }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private FeedbackListContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "反馈列表页面内容视图" AST#ex...
@Builder private FeedbackListContent() { Text("反馈列表页面内容视图") }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/feedback/src/main/ets/view/FeedbackListPage.ets#L33-L36
6460fda91915b15cc799887d6965d4059f80ec2b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TempUtil.ets
arkts
F2C
华氏度转摄氏度 @param f 华氏度 @return 摄氏度
static F2C(f: number): number { return (f - 32) * (5 / 9) }
AST#method_declaration#Left static F2C AST#parameter_list#Left ( AST#parameter#Left f : 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_type#Right AST...
static F2C(f: number): number { return (f - 32) * (5 / 9) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TempUtil.ets#L39-L41
07efab8290b039c9e3fc432361f41b0f35fd1faa
gitee
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
分享文章 @param date @returns
export function shareArticle(title:string,link:string) { return axiosClient.post<any>({ url: `lg/user_article/add/json`, checkResultCode:true, needJumpToLogin:true, checkLoginState:true, params: { 'title':title, 'link':link, } }) }
AST#export_declaration#Left export AST#function_declaration#Left function shareArticle AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left link : AST#type_annotation#Left AST#...
export function shareArticle(title:string,link:string) { return axiosClient.post<any>({ url: `lg/user_article/add/json`, checkResultCode:true, needJumpToLogin:true, checkLoginState:true, params: { 'title':title, 'link':link, } }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L240-L251
50b373048e5c2f133d484711c6fc411ff46a967d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/SearchPage.ets
arkts
buildGreetingResults
构建祝福语搜索结果
@Builder buildGreetingResults() { Column({ space: 12 }) { Text(`祝福语 (${this.searchResult.greetings.length})`) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Column({ space: 1 }) { ForEach(this.searchResult.g...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingResults AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#componen...
@Builder buildGreetingResults() { Column({ space: 12 }) { Text(`祝福语 (${this.searchResult.greetings.length})`) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Column({ space: 1 }) { ForEach(this.searchResult.g...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L535-L573
ab20272074a4f62bcd2897a94abbe04ef674c658
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/pages/PublishMultimediaUpdates.ets
arkts
PublishMultimediaUpdates
功能描述: 本示例主要介绍使用@ohos.file.photoAccessHelper实现访问系统相册获取媒体资源的多媒体发布场景 推荐场景: 需要调用系统图库的场景,如:上传图库图片、发布朋友圈等 核心组件: 1. CommentInputDialog 实现步骤: 1.使用LazyForEach+cacheCount+@Reusable实现懒加载列表。 2.创建ListScroller对象,将ListScroller对象绑定到List组件内。 3.在需要记录当前位置时通过currentOffset方法存储当前偏移量historyOffset,在需要跳转时用scrollTo方法跳转。
@Component export struct PublishMultimediaUpdates { private cachedCountNumber: number = 3; // 懒加载缓存数 @State toolbarList: ToolBarOptions = new ToolBarOptions() private controller1: TabsController = new TabsController() listScroller: ListScroller = new ListScroller(); // scroller控制器 @State commentList: CommentD...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PublishMultimediaUpdates AST#component_body#Left { AST#property_declaration#Left private cachedCountNumber : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST...
@Component export struct PublishMultimediaUpdates { private cachedCountNumber: number = 3; @State toolbarList: ToolBarOptions = new ToolBarOptions() private controller1: TabsController = new TabsController() listScroller: ListScroller = new ListScroller(); @State commentList: CommentData = new CommentData()...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/pages/PublishMultimediaUpdates.ets#L39-L328
4e033775ec077ee382dd1c0fd5f0199220dd8417
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/class.ets
arkts
trainContent
**************************主体内容**************************//
@Builder trainContent() { Column() { Column() { //热身 Row() { Text('热身·'+this.warmUpArry.length+'个') .width('80%') .fontSize(20) .fontWeight(FontWeight.Bold) Toggle({ type: ToggleType.Switch, isOn: this.isOnWarm }) .onChange(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right trainContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_ele...
@Builder trainContent() { Column() { Column() { Row() { Text('热身·'+this.warmUpArry.length+'个') .width('80%') .fontSize(20) .fontWeight(FontWeight.Bold) Toggle({ type: ToggleType.Switch, isOn: this.isOnWarm }) .onChange((isO...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/class.ets#L240-L323
052b513188532e9ffd169def6a7e33565121ba55
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/Utils.ets
arkts
TODO 工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class Utils { /** * 判断字符串是否为空(undefined、null、字符串长度为0) * @param str 被检测的字符串 * @return 是否为空 */ static isEmpty(str: string | undefined | null): boolean { return str === undefined || str === null || str.length === 0; } /** * 判断字符串是否为非空。true为非空空,否则false * @param str * @returns *...
AST#export_declaration#Left export AST#class_declaration#Left class Utils AST#class_body#Left { /** * 判断字符串是否为空(undefined、null、字符串长度为0) * @param str 被检测的字符串 * @return 是否为空 */ AST#method_declaration#Left static isEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type...
export class Utils { static isEmpty(str: string | undefined | null): boolean { return str === undefined || str === null || str.length === 0; } static isNotEmpty(str: string | undefined | null): boolean { return false === Utils.isEmpty(str); } static getFileUri(uriOrPath: string): fileUri...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L24-L160
172e2f612a45fedf567709f3fc77ffad824a9033
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/components/ImageText.ets
arkts
ImageText
图片&文字组合
@Component export struct ImageText { @Prop imageStr: Resource; text: string | Resource = ''; build() { Row() { Image(this.imageStr) .height($r('app.integer.publish_multimedia_updates_handler_icon_height')) .width($r('app.integer.publish_multimedia_updates_handler_icon_width')) ....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageText AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right imageStr : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annota...
@Component export struct ImageText { @Prop imageStr: Resource; text: string | Resource = ''; build() { Row() { Image(this.imageStr) .height($r('app.integer.publish_multimedia_updates_handler_icon_height')) .width($r('app.integer.publish_multimedia_updates_handler_icon_width')) ....
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/components/ImageText.ets#L20-L41
913c38cf21b0bf9ba5189d2e758ebfb9126b0315
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets
arkts
draw
RenderNode进行绘制时会调用draw方法
draw(context: DrawContext): void { const canvas = context.canvas; // 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制 const pen = new drawing.Pen(); // 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑 pen.setAntiAlias(true); pen.setColor(this.penColor); // 开启画笔的抖动绘制效果。抖动绘制可以使得绘制出的颜色更加真实。 pen.setDither(true); // 设置画笔的线宽为10px ...
AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left DrawContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ...
draw(context: DrawContext): void { const canvas = context.canvas; const pen = new drawing.Pen(); pen.setAntiAlias(true); pen.setColor(this.penColor); pen.setDither(true); pen.setStrokeWidth(Constants.PEN_STROKE_WIDTH); canvas.attachPen(pen); canvas.drawPath(...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L39-L54
1ab7d1d58118bd2b921b03615c10daec792b85a2
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets
arkts
getAllSearchHistory
获取所有搜索历史记录,按搜索时间倒序 @returns {Promise<SearchHistory[]>} 搜索历史列表
async getAllSearchHistory(): Promise<SearchHistory[]> { const list: SearchHistoryEntity[] = this.orm.query(SearchHistoryEntity).find(); return list .map((entity) => this.toModel(entity)) .sort((left, right) => (right.searchTime ?? 0) - (left.searchTime ?? 0)); }
AST#method_declaration#Left async getAllSearchHistory 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 SearchHistory [ ] AST#array_type#Right AS...
async getAllSearchHistory(): Promise<SearchHistory[]> { const list: SearchHistoryEntity[] = this.orm.query(SearchHistoryEntity).find(); return list .map((entity) => this.toModel(entity)) .sort((left, right) => (right.searchTime ?? 0) - (left.searchTime ?? 0)); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L69-L74
8c55c9f2bba8ad45873e0c71a0a1b4aa79a5b916
github
AlbertZyc/tab-layout
4ba256eead3792c84128f8679b26ac159a2d7f06
entry/src/main/ets/BasicDataSource.ets
arkts
notifyDataAdd
通知LazyForEach组件需要在index对应索引处添加子组件
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L45-L49
4ea2d8f22cb16b45386e16df5ed3de4a488fc554
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
openSnapshotEditDialog
打开图片裁剪弹窗 @param uri
openSnapshotEditDialog(uri: string): void { DialogUtil.showCustomDialog({ dialogId: this.dialogId, builder: wrapBuilder(imageEditDialogBuilder), dialogType: DialogTypeEnum.BOTTOM, builderParam: { onConfirm: (isCloseDialog?: boolean, data?: ESObject) => { if (isCloseDialog) ...
AST#method_declaration#Left openSnapshotEditDialog AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
openSnapshotEditDialog(uri: string): void { DialogUtil.showCustomDialog({ dialogId: this.dialogId, builder: wrapBuilder(imageEditDialogBuilder), dialogType: DialogTypeEnum.BOTTOM, builderParam: { onConfirm: (isCloseDialog?: boolean, data?: ESObject) => { if (isCloseDialog) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets#L242-L267
ef6d2245ca2549d22290b0693054d985677b7772
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/harB/index.ets
arkts
harBuilder
Copyright (c) 2024 Shenzhen Kaihong 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...
export { harBuilder } from './src/main/ets/components/mainpage/HarB';
AST#export_declaration#Left export { harBuilder } from './src/main/ets/components/mainpage/HarB' ; AST#export_declaration#Right
export { harBuilder } from './src/main/ets/components/mainpage/HarB';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/harB/index.ets#L16-L16
667683db5fb6d54c288ec552894abde03b332094
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/products/phone/entry/src/main/ets/view/CustomDialogExample.ets
arkts
CustomDialogExample
首页右上角点击加号时弹出的列表
@CustomDialog export struct CustomDialogExample { controller: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample({}) }); // 懒加载开关 @StorageLink('lazy_for_each') lazyForEach: boolean | undefined = AppStorage.get('lazy_for_each'); // 组件复用开关 @StorageLink('reusable') reusable: boole...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CustomDialogExample AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right = AST#...
@CustomDialog export struct CustomDialogExample { controller: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample({}) }); @StorageLink('lazy_for_each') lazyForEach: boolean | undefined = AppStorage.get('lazy_for_each'); @StorageLink('reusable') reusable: boolean | undefined = ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/view/CustomDialogExample.ets#L43-L114
57c03729c9bb9db6ab831c958522f416db88b5a4
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
initDatabase
MARK: - 私有方法 初始化数据库连接 @returns Promise<boolean> 返回是否初始化成功 注意:该方法会自动处理连接关闭,调用方无需关心资源释放
private async initDatabase(): Promise<boolean> { // 已初始化则直接返回 if (this.isInitialized) return true; // 检查数据库路径有效性 if (!this.dbPath) { console.error("DBAccessor: 数据库路径不能为空"); return false; } const relativePath = PathUtility.getRelativeDatabasePath(this.dbPath!) const dbFolder ...
AST#method_declaration#Left private async initDatabase AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > A...
private async initDatabase(): Promise<boolean> { if (this.isInitialized) return true; if (!this.dbPath) { console.error("DBAccessor: 数据库路径不能为空"); return false; } const relativePath = PathUtility.getRelativeDatabasePath(this.dbPath!) const dbFolder = PathUtility.getParentP...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L61-L102
da70359ab245547302f12e720ccea08b2fc5ae94
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageflip/src/main/ets/view/CoverFlipPage.ets
arkts
CoverFlipPage
1.在`Stack`组件中布局三个`ReaderPage`,`midPage`位于中间可以根据this.offsetX实时translate自己的位置。 当this.offsetX<0时,translate的x为this.offsetX,midPage向左移动,显现`rightPage`。 当this.offsetX>0,translate的x为0,midPage不动,`leftPage`向右滑动。 2.将滑动翻页的动画和点击翻页的动画封装在一个闭包中,由`isClick`来判断是点击翻页还是滑动翻页, 由`isLeft`来判断点击翻页中是向左翻页还是向右翻页。确定翻页时将this.offsetX设置为this.screenW 或...
@Component export struct CoverFlipPage { @State leftPageContent: string = ""; @State midPageContent: string = ""; @State rightPageContent: string = ""; @State offsetX: number = 0; @Link isMenuViewVisible: boolean; @Link isCommentVisible: boolean; @Link @Watch('updatePage')currentPageNum: number; private...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CoverFlipPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right leftPageContent : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#t...
@Component export struct CoverFlipPage { @State leftPageContent: string = ""; @State midPageContent: string = ""; @State rightPageContent: string = ""; @State offsetX: number = 0; @Link isMenuViewVisible: boolean; @Link isCommentVisible: boolean; @Link @Watch('updatePage')currentPageNum: number; private...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/view/CoverFlipPage.ets#L31-L184
fc8e5094838da8c09ddc5ea4b0caf6ae7ff079d0
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.uiExtensionHost.d.ets
arkts
Properties of UIExtension window @interface UIExtensionHostWindowProxyProperties @syscap SystemCapability.ArkUI.ArkUI.Full @systemapi @since 11
export interface UIExtensionHostWindowProxyProperties { /** * The position and size of the UIExtension window * * @type { window.Rect } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi * @since 11 */ uiExtensionHostWindowProxyRect: window.Rect; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UIExtensionHostWindowProxyProperties AST#object_type#Left { /** * The position and size of the UIExtension window * * @type { window.Rect } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi * @since 11 ...
export interface UIExtensionHostWindowProxyProperties { uiExtensionHostWindowProxyRect: window.Rect; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.uiExtensionHost.d.ets#L277-L287
615dab309115452eec388931ffb4374d42584687
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/constant/AlarmClockConstants.ets
arkts
闹钟页面常量描述。
export class AlarmClockConstants { /** * 闹钟页面时间列表。 */ static readonly TIMES: number[] = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2]; /** * 默认的单个数字最大值。 */ static readonly DEFAULT_SINGLE_DIGIT_MAX: number = 9; /** * 默认的水平角度。 */ static readonly DEFAULT_HORIZONTAL_ANGLE: number = 180; /** * 默...
AST#export_declaration#Left export AST#class_declaration#Left class AlarmClockConstants AST#class_body#Left { /** * 闹钟页面时间列表。 */ AST#property_declaration#Left static readonly TIMES : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_...
export class AlarmClockConstants { static readonly TIMES: number[] = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2]; static readonly DEFAULT_SINGLE_DIGIT_MAX: number = 9; static readonly DEFAULT_HORIZONTAL_ANGLE: number = 180; static readonly DEFAULT_ONE_SECOND_MS: number = 1000; static readonly DEFAU...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/constant/AlarmClockConstants.ets#L4-L61
5ad49a122adc3ba25a63877b77f781b2a44ce1d1
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/MineView.ets
arkts
StatsModule
构建统计模块
@Builder StatsModule() { Row({ space: 12 }) { // 左侧统计 Column({space:4}) { Text('已做题') .fontSize(14) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') Text(String(this.didCount)) .fontSize(24) .fo...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right StatsModule AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#...
@Builder StatsModule() { Row({ space: 12 }) { Column({space:4}) { Text('已做题') .fontSize(14) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') Text(String(this.didCount)) .fontSize(24) .fontFamil...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/MineView.ets#L66-L128
7558678da857834a349da3e0a1b92a21af64121d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowFunction.ets
arkts
创建并展示弹窗 @param { api.SubWindowApi | null } SubWindowApi - SubWindowApi对象 @param { window.WindowStage | undefined } windowStage - WindowStage对象
export function showApiSubWindow(SubWindowApi: api.SubWindowApi | null, windowStage: window.WindowStage | undefined) { SubWindowApi?.initSubWindow({ windowStage: windowStage as window.WindowStage }, { sum: sumResource }); }
AST#export_declaration#Left export AST#function_declaration#Left function showApiSubWindow AST#parameter_list#Left ( AST#parameter#Left SubWindowApi : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left api . SubWindowApi AST#qualified_type#Right AST#primary_type#Right | AST#prima...
export function showApiSubWindow(SubWindowApi: api.SubWindowApi | null, windowStage: window.WindowStage | undefined) { SubWindowApi?.initSubWindow({ windowStage: windowStage as window.WindowStage }, { sum: sumResource }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowFunction.ets#L39-L43
a6e6771fab543fc6210fd413a159a393bd5a9a72
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/home/home.ets
arkts
aboutToAppear
****************************************Building*****************************************//
aboutToAppear(): void { this.getShowContent() }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { this.getShowContent() }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/home.ets#L290-L292
37000fed123a30ab48a716d1ffbe1ee2d5b81b89
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
getLabelCount
Returns the number of label entries the y-axis should have @return
public getLabelCount(): number { return this.mLabelCount; }
AST#method_declaration#Left public getLabelCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp...
public getLabelCount(): number { return this.mLabelCount; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L392-L394
a85ec28ee25ef750ab36c7bae9dd6cd137b7b847
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ReactionEmoji.ets
arkts
应用约束60:使用ES模块导出语法
export default ReactionEmoji;
AST#export_declaration#Left export default AST#expression#Left ReactionEmoji AST#expression#Right ; AST#export_declaration#Right
export default ReactionEmoji;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ReactionEmoji.ets#L28-L28
a2d95c3f1f8ef60fed5d9bffc917204990103afb
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets
arkts
assemblingVideoBean
Assembling the video object
async assemblingVideoBean() { VIDEO_DATA.forEach(async (item: VideoItem) => { let videoBean = await getContext().resourceManager.getRawFd(item.iSrc); let uri = videoBean; this.videoLocalList.push(new VideoItem(item.name, uri, '')); }); }
AST#method_declaration#Left async assemblingVideoBean 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 VIDEO_DATA AST#expression#Right . forE...
async assemblingVideoBean() { VIDEO_DATA.forEach(async (item: VideoItem) => { let videoBean = await getContext().resourceManager.getRawFd(item.iSrc); let uri = videoBean; this.videoLocalList.push(new VideoItem(item.name, uri, '')); }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets#L41-L47
a16b55725d9ffd2f4ddda10e7ffb1770195401a8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSwiperImages
Get swiper image data. @return {Array<Resource>} swiperImages.
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.img_01'), $r('app.media.img_02'), $r('app.media.img_09'), $r('app.media.img_03') ]; return swiperImages; }
AST#method_declaration#Left getSwiperImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.img_01'), $r('app.media.img_02'), $r('app.media.img_09'), $r('app.media.img_03') ]; return swiperImages; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/viewmodel/MainViewModel.ets#L26-L34
99e2af7d66df6d2e9b7bb08b9e349226937ef612
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/XComponentVideo.ets
arkts
release
释放AVPlayer资源
async release() { if (this.isCreate) { this.setOffCallback(); await this.avPlayer.release(); this.isCreate = false; this.isPlaying = false; } }
AST#method_declaration#Left async release 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 . isCreate AST#member_expression#Right AST#e...
async release() { if (this.isCreate) { this.setOffCallback(); await this.avPlayer.release(); this.isCreate = false; this.isPlaying = false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/XComponentVideo.ets#L125-L132
910a2928d7764f609f42918232810dfec30a4930
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/index.ets
arkts
MessageRegistry
========== 工具模块 ========== 消息类型注册表(可选) ⚠️ 普通场景无需使用,只在以下场景需要: - 使用 google.protobuf.Any 类型 - 需要根据类型名动态创建消息
export { MessageRegistry } from './MessageRegistry'
AST#export_declaration#Left export { MessageRegistry } from './MessageRegistry' AST#export_declaration#Right
export { MessageRegistry } from './MessageRegistry'
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L69-L69
a3eec5bc9cfa97850f7eb2c715bef9efea62f5ff
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
addData
改变单个数据 @param {number} index - 索引值 @param {VideoDataType} data - 修改后的值
public addData(index: number, data: VideoDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addData 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#Left data : AST#type_annotation#Left AST#primary_type#Left VideoDataType AST#primary_...
public addData(index: number, data: VideoDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L164-L167
037b7740f13bc492ce14dab6b2e1129fe1dff558
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/SplashScreenSample/entry/src/main/ets/pages/SplashScreenPage.ets
arkts
onPageHide
When the SplashScreenPage is hide, clear interval.
onPageHide() { clearInterval(this.intervalID); }
AST#method_declaration#Left onPageHide AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left clearInterval ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalID AST#member_expression#Right AST#ex...
onPageHide() { clearInterval(this.intervalID); }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/SplashScreenSample/entry/src/main/ets/pages/SplashScreenPage.ets#L54-L56
79276ed81478194c4286ffd7f663bee8ef7f2c5f
gitee
Nuist666/Alzheimer.git
c171b8e739357bfc5a3fc71c90aaea6ce5d463d1
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
video net address
export const NET: string = 'http://vjs.zencdn.net/v/oceans.mp4';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left NET : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'http://vjs.zencdn.net/v/oceans.mp4' AST#expression#Right AST#variable_declarator#Right ;...
export const NET: string = 'http://vjs.zencdn.net/v/oceans.mp4';
https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/common/constants/CommonConstants.ets#L16-L16
b98d8b71f6fab262e12848e81c45137d26bc9a9b
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/StorageUtils.ets
arkts
putBoolean
存储布尔值数据 @param key 存储键 @param value 存储值
static async putBoolean(key: string, value: boolean): Promise<void> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return; } try { await dataPreferences.put(key, value); await dataPreferences.flush();...
AST#method_declaration#Left static async putBoolean AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left boolean AST#primar...
static async putBoolean(key: string, value: boolean): Promise<void> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return; } try { await dataPreferences.put(key, value); await dataPreferences.flush();...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L108-L121
a56c7eab8deee55dfeb47bc25a823e2b79b781fb
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets
arkts
decodeByFormatWithParameter
设置期望的format进行解码 @param imageSource - 图片资源实例。 @returns 位图操作实例。
public decodeByFormatWithParameter(imageSource: image.ImageSource): Promise<image.PixelMap> { Logger.info('getPixelMap DecodeByFormatWithParameter Start'); let decodingOptions: image.DecodingOptions = { editable: true, desiredPixelFormat: 3, // 以RGBA_8888格式进行解码 } return new Promise((resolve,...
AST#method_declaration#Left public decodeByFormatWithParameter AST#parameter_list#Left ( AST#parameter#Left imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramet...
public decodeByFormatWithParameter(imageSource: image.ImageSource): Promise<image.PixelMap> { Logger.info('getPixelMap DecodeByFormatWithParameter Start'); let decodingOptions: image.DecodingOptions = { editable: true, desiredPixelFormat: 3, } return new Promise((resolve, reject) => { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L144-L160
5deaeb12e53e301e9a099b7efd20d17a137b0a5d
gitee
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/types/world.ets
arkts
随机挖矿事件数据归类
export interface TTypeEventBox { items: TMinerActionEventItem[] probability: number }
AST#export_declaration#Left export AST#interface_declaration#Left interface TTypeEventBox AST#object_type#Left { AST#type_member#Left items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TMinerActionEventItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member...
export interface TTypeEventBox { items: TMinerActionEventItem[] probability: number }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/types/world.ets#L29-L32
f5009f1d92adbea155e224a146c89dca62652299
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
getDownloadTask
获取下载任务状态
getDownloadTask(episodeId: string): DownloadTask | undefined { return this.downloadTasks.get(episodeId); }
AST#method_declaration#Left getDownloadTask AST#parameter_list#Left ( AST#parameter#Left episodeId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ...
getDownloadTask(episodeId: string): DownloadTask | undefined { return this.downloadTasks.get(episodeId); }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L275-L277
d406270a276a6aa16453ca4420923d252fdb3647
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets
arkts
showEccSpecDetailInfo
打印ECC密钥规格
function showEccSpecDetailInfo(key: cryptoFramework.PubKey | cryptoFramework.PriKey, keyType: string) { console.info('show detail of ' + keyType + ':'); try { let p = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FP_P_BN); showBigIntInfo('--- p', p); // length is 224, hex : ffffffffffffffffffffffffff...
AST#function_declaration#Left function showEccSpecDetailInfo AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#L...
function showEccSpecDetailInfo(key: cryptoFramework.PubKey | cryptoFramework.PriKey, keyType: string) { console.info('show detail of ' + keyType + ':'); try { let p = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FP_P_BN); showBigIntInfo('--- p', p); let a = key.getAsyKeySpec(cryptoFramework.Asy...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets#L60-L97
24cd77a9e8045ceb8eba8f9dbbb5a6247c6aa8bd
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
BillPage
账单页面
@Builder BillPage() { Column() { // 顶部标题栏 Row() { Text('明细') .fontSize(18) .fontColor('#333333') .fontWeight(FontWeight.Bold) Blank() Row() { Image($r('app.media.search_icon')) .width(22) .height(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right BillPage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 顶部标题栏 AST#arkts_u...
@Builder BillPage() { Column() { Row() { Text('明细') .fontSize(18) .fontColor('#333333') .fontWeight(FontWeight.Bold) Blank() Row() { Image($r('app.media.search_icon')) .width(22) .height(22) ...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L574-L778
da503630b82140a85cd5ac77f3b001d6901fd716
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets
arkts
decodeMsg
解析二进制数据转为字符串 @param buffer
private decodeMsg(buffer: ArrayBuffer): string { Logger.info(TAG, `buffer type = ${typeof buffer}`); Logger.info(TAG, `buffer = ${buffer}`); let dataView = new Uint8Array(buffer); Logger.info(TAG, `length = ${dataView.byteLength}`); let data = ''; for (let i = 0; i < dataView.byteLength; ++i) { ...
AST#method_declaration#Left private decodeMsg AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
private decodeMsg(buffer: ArrayBuffer): string { Logger.info(TAG, `buffer type = ${typeof buffer}`); Logger.info(TAG, `buffer = ${buffer}`); let dataView = new Uint8Array(buffer); Logger.info(TAG, `length = ${dataView.byteLength}`); let data = ''; for (let i = 0; i < dataView.byteLength; ++i) { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets#L125-L138
a099c611dad54cd52de8d30f134298aa0020702c
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/listener/EventControl.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 const enum EventType { SingleTap, DoubleTap, LongPress }
AST#export_declaration#Left export AST#enum_declaration#Left const enum EventType AST#enum_body#Left { AST#enum_member#Left SingleTap AST#enum_member#Right , AST#enum_member#Left DoubleTap AST#enum_member#Right , AST#enum_member#Left LongPress AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#e...
export const enum EventType { SingleTap, DoubleTap, LongPress }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/EventControl.ets#L16-L20
3685d0b1ac5e025c79bb427a98fec00eb17572c4
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets
arkts
getWithFuncParam
[End opt_funcParam] [Start with_func_param]
@Builder function getWithFuncParam(name: string): void { if (name === Constants.NAV_DESTINATION_ITEM_3) { NavDestination() { WithFuncParam() } .title(title()) .backgroundColor('#F1F3F5') } }
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function getWithFuncParam AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : A...
@Builder function getWithFuncParam(name: string): void { if (name === Constants.NAV_DESTINATION_ITEM_3) { NavDestination() { WithFuncParam() } .title(title()) .backgroundColor('#F1F3F5') } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets#L161-L170
a860fc1be0563f39255eb8163fbfae639a3a547e
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderListViewModel.ets
arkts
hideRebuyModal
隐藏再次购买弹窗 @returns {void} 无返回值
hideRebuyModal(): void { this.rebuyModalVisible = false; }
AST#method_declaration#Left hideRebuyModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#mem...
hideRebuyModal(): void { this.rebuyModalVisible = false; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderListViewModel.ets#L80-L82
fd9e8920659b4e53cf74e364110e2c097bc16074
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Multi_device_V2/common/index.ets
arkts
BottomTabsItem
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { BottomTabsItem } from './src/main/ets/viewmodel/BottomTabsItem';
AST#export_declaration#Left export { BottomTabsItem } from './src/main/ets/viewmodel/BottomTabsItem' ; AST#export_declaration#Right
export { BottomTabsItem } from './src/main/ets/viewmodel/BottomTabsItem';
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Multi_device_V2/common/index.ets#L16-L16
d40e42bfdb088888d7b28212a4ce217d3118356d
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/web/WebPrint/entry/src/main/ets/pages/Index.ets
arkts
print
打印web组件内容
print() { if (this.webPrintAdapter == undefined) { this.webPrintAdapter = this.controller.createWebPrintDocumentAdapter("webPrint"); } this.controller.setPrintBackground(this.printBackground) print.print("printJob", this.webPrintAdapter, null, getContext()) .then((task: print.PrintTask) => ...
AST#method_declaration#Left print 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . web...
print() { if (this.webPrintAdapter == undefined) { this.webPrintAdapter = this.controller.createWebPrintDocumentAdapter("webPrint"); } this.controller.setPrintBackground(this.printBackground) print.print("printJob", this.webPrintAdapter, null, getContext()) .then((task: print.PrintTask) => ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/web/WebPrint/entry/src/main/ets/pages/Index.ets#L65-L77
6e23c15fb63fbc4a7d4eb4ed5e7f67310d15c1fa
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
alertDialog
操作确认类弹出框
alertDialog(index: number) { if (index == 0) { //简单使用 DialogHelper.showAlertDialog({ uiContext:this.getUIContext(), backgroundColor: Color.Orange, content: "确定保存该WPS文件吗?", onAction: (action) => { if (action == DialogAction.CANCEL) { ToastUtil.showToa...
AST#method_declaration#Left alertDialog 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement...
alertDialog(index: number) { if (index == 0) { DialogHelper.showAlertDialog({ uiContext:this.getUIContext(), backgroundColor: Color.Orange, content: "确定保存该WPS文件吗?", onAction: (action) => { if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您点...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L189-L256
0ee0d6792d2a7e572e2716613e4628fbd3de15a9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets
arkts
onWindowStageDestroy
[StartExclude save_the_uiContext_to_localstorage_in_entry_ability]
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
AST#method_declaration#Left onWindowStageDestroy 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 { // Main window is destroyed, release UI related resources AST#expression_statement...
onWindowStageDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L48-L51
4999a82cf1f18171e5faef0ae29857fadf257d17
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
AI服务提供商枚举
export enum AIProvider { ZHIPU = 'zhipu', // 智谱AI DEEPSEEK = 'deepseek', // DeepSeek KIMI = 'kimi', // Kimi月之暗面 CUSTOM = 'custom' // 自定义 }
AST#export_declaration#Left export AST#enum_declaration#Left enum AIProvider AST#enum_body#Left { AST#enum_member#Left ZHIPU = AST#expression#Left 'zhipu' AST#expression#Right AST#enum_member#Right , // 智谱AI AST#enum_member#Left DEEPSEEK = AST#expression#Left 'deepseek' AST#expression#Right AST#enum_member#Right , // D...
export enum AIProvider { ZHIPU = 'zhipu', DEEPSEEK = 'deepseek', KIMI = 'kimi', CUSTOM = 'custom' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L137-L142
c32c108b9f1bdb5f3f04a922558468fdb5c854b6
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/Viewmodel/CategoryInfo.ets
arkts
储存记录的类别
export default class CategoryInfo { category: string; icon: string; ordinal: number; typeName: string; constructor(category: string, icon: string, ordinal: number, type: string) { this.category = category; this.icon = icon; this.ordinal = ordinal; this.typeName = type; } }
AST#export_declaration#Left export default AST#class_declaration#Left class CategoryInfo AST#class_body#Left { AST#property_declaration#Left category : 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 ic...
export default class CategoryInfo { category: string; icon: string; ordinal: number; typeName: string; constructor(category: string, icon: string, ordinal: number, type: string) { this.category = category; this.icon = icon; this.ordinal = ordinal; this.typeName = type; } }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/CategoryInfo.ets#L3-L15
627dacac7e5a0ad96859ba5823a2897950bcf2e8
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/utils/DateUtil.ets
arkts
getWeekdayName
获取星期名称
static getWeekdayName(day: number): string { const weekdays = ['日', '一', '二', '三', '四', '五', '六'] return weekdays[day] }
AST#method_declaration#Left static getWeekdayName AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static getWeekdayName(day: number): string { const weekdays = ['日', '一', '二', '三', '四', '五', '六'] return weekdays[day] }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L108-L111
f5907c06ea6383281eefb5abebeb099b80e5c4b8
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/DialogUtil.ets
arkts
closeCustomDialogById
根据弹窗id关闭弹窗 @param dialogId
public static closeCustomDialogById(dialogId: string) { if (!DialogUtil.uiContext) { return; } let promptAction = DialogUtil.uiContext.getPromptAction(); let compCont = DialogUtil.compContMap.get(dialogId); if (compCont) { DialogUtil.compContMap.delete(dialogId); promptAction.close...
AST#method_declaration#Left public static closeCustomDialogById AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#...
public static closeCustomDialogById(dialogId: string) { if (!DialogUtil.uiContext) { return; } let promptAction = DialogUtil.uiContext.getPromptAction(); let compCont = DialogUtil.compContMap.get(dialogId); if (compCont) { DialogUtil.compContMap.delete(dialogId); promptAction.close...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/DialogUtil.ets#L57-L69
28e2f9399e8478dd841bb31dcafb449136dce422
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/KeyItemNumber.ets
arkts
KeyItemNumber
有大小写的按键组件
@Component export struct KeyItemNumber { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume keyState: number; private keyValue: keySourceListType | undefined = undefined; build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justify...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct KeyItemNumber AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Lef...
@Component export struct KeyItemNumber { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume keyState: number; private keyValue: keySourceListType | undefined = undefined; build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justify...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/KeyItemNumber.ets#L30-L89
a2efc5cb99e8161d1c6a86b9c48cce050c0a6249
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
strToBase64
字符串转Base64字符串 @param src 字符串 @returns
static strToBase64(src: string): string { const uint8Array = StrUtil.strToUint8Array(src); const result = Base64Util.encodeToStrSync(uint8Array); return result; }
AST#method_declaration#Left static strToBase64 AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
static strToBase64(src: string): string { const uint8Array = StrUtil.strToUint8Array(src); const result = Base64Util.encodeToStrSync(uint8Array); return result; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L312-L316
be237430bf540cf899d13d5de42406294a0204f7
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.Chip.d.ets
arkts
Defines localized label margin. @interface LocalizedLabelMarginOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface LocalizedLabelMarginOptions { /** * start localized label margin length. * * @type { ?LengthMetrics } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ start?: LengthMetrics; /** * end localized label margin leng...
AST#export_declaration#Left export AST#interface_declaration#Left interface LocalizedLabelMarginOptions AST#object_type#Left { /** * start localized label margin length. * * @type { ?LengthMetrics } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 ...
export interface LocalizedLabelMarginOptions { start?: LengthMetrics; end?: LengthMetrics; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Chip.d.ets#L309-L330
50a772acadf10ca90081f99d52511a09aed5a171
github
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/common/dialog/CommonIconAlertDialog.ets
arkts
CommonIconAlertDialog
Icon+Text自定义弹窗
@CustomDialog export struct CommonIconAlertDialog { @Prop icon:ResourceStr @Prop textStr:string controller?: CustomDialogController build() { Column() { Image(this.icon) .width(176) .height(176) Text(this.textStr) .fontColor('#ffffff') .fontSize(30) .mar...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommonIconAlertDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right A...
@CustomDialog export struct CommonIconAlertDialog { @Prop icon:ResourceStr @Prop textStr:string controller?: CustomDialogController build() { Column() { Image(this.icon) .width(176) .height(176) Text(this.textStr) .fontColor('#ffffff') .fontSize(30) .mar...
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/dialog/CommonIconAlertDialog.ets#L4-L28
9689fd68ea52f554da071e78a3740477a7caef83
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
未读消息数量 @param date @returns
export function getUnRead() { return axiosClient.get<number>({ url: `message/lg/count_unread/json`, checkLoginState: true, }) }
AST#export_declaration#Left export AST#function_declaration#Left function getUnRead AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi...
export function getUnRead() { return axiosClient.get<number>({ url: `message/lg/count_unread/json`, checkLoginState: true, }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L289-L294
b1ab095beefe1c566177f607e1ba0a6e1150704b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets
arkts
disableBluetooth
关闭蓝牙功能
disableBluetooth(): void { Log.showInfo(TAG, `disableBluetooth`); try { this.offBTStateChange(); access.disableBluetooth(); } catch (err) { Log.showError(TAG, `disableBluetooth: err = ${err}`); } }
AST#method_declaration#Left disableBluetooth 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#Lef...
disableBluetooth(): void { Log.showInfo(TAG, `disableBluetooth`); try { this.offBTStateChange(); access.disableBluetooth(); } catch (err) { Log.showError(TAG, `disableBluetooth: err = ${err}`); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets#L82-L90
e6f65a11833aa6198f9a7abb8ee0747e15e3a037
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
applyTheme
应用主题
private async applyTheme(theme: ThemeConfig): Promise<void> { // TODO: 实现实际的主题应用逻辑 // 这里可以通过全局资源管理器或状态管理来应用主题 hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Applying theme: ${theme.type}`); }
AST#method_declaration#Left private async applyTheme AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left ThemeConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
private async applyTheme(theme: ThemeConfig): Promise<void> { hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Applying theme: ${theme.type}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L778-L782
9c7c68647a8b397525d72e509a8fba7e9edbe0a6
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/ThemeManager.ets
arkts
addGlobalThemeChangeCallback
全局主题变化通知
static addGlobalThemeChangeCallback(callback: () => void): void { AppThemeManager.globalThemeChangeCallbacks.push(callback); }
AST#method_declaration#Left static addGlobalThemeChangeCallback AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#R...
static addGlobalThemeChangeCallback(callback: () => void): void { AppThemeManager.globalThemeChangeCallbacks.push(callback); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L119-L121
10bc13722c86f69fb41a08c93f4ac3206622aea1
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
encryptGCMSegmentSync
加密(GCM模式)分段,同步 @param dataBlob 加密或者解密的数据。dataBlob不能为null。 @param key 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES128|GCM|PKCS7、AES192|GCM|PKCS7、AES256|GCM|PKCS7、、等)。 @param len 自定义的数据拆分长度。 @returns
static encryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7', len: number = 128): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher(transformation); cipher.initSync(cryp...
AST#method_declaration#Left static encryptGCMSegmentSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter...
static encryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7', len: number = 128): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher(transformation); cipher.initSync(cryp...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L298-L316
a4cd83e818dce05476aa499e08674f0ddd20fa79
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getAllUnits
获取所有单元 类似Swift的var allUnits: [Unit] { get }
getAllUnits(): Unit[] { return [...this.units]; // 返回副本以避免外部修改 }
AST#method_declaration#Left getAllUnits AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Unit [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ...
getAllUnits(): Unit[] { return [...this.units]; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L305-L307
0e67d8944cc8574cf5feaffdc3b2e822add70294
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SM4.ets
arkts
@Author csx @DateTime 2024/3/18 10:15:03 @TODO SM4 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class SM4 { /** * 生成SM4的对称密钥 * @returns SM4密钥 */ static async generateSM4Key(): Promise<string> { return CryptoUtil.generateSymKey('SM4_128'); } /** * 加密-ECB模式 * @param str 待加密的字符串 * @param sm4Key SM4密钥 * @returns */ static async encodeECB(str: string, sm4Key: string): ...
AST#export_declaration#Left export AST#class_declaration#Left class SM4 AST#class_body#Left { /** * 生成SM4的对称密钥 * @returns SM4密钥 */ AST#method_declaration#Left static async generateSM4Key AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
export class SM4 { static async generateSM4Key(): Promise<string> { return CryptoUtil.generateSymKey('SM4_128'); } static async encodeECB(str: string, sm4Key: string): Promise<string> { return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128); } static async decodeECB(...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4.ets#L25-L76
b992b14b601164161d3780bf724d52c27622b2d0
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_008_F.ets
arkts
Introduction 库函数-string_replace
export function string_lib_func_008_F(taint_src : string) { let clean = "clean"; let t = clean.replace("a","b"); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_008_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function string_lib_func_008_F(taint_src : string) { let clean = "clean"; let t = clean.replace("a","b"); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_008_F.ets#L7-L11
06fdeac3922c731dcbddd364bebf38de2479f426
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets
arkts
getStatusColor
根据订单状态获取标签颜色
getStatusColor(status: string): ResourceStr { switch (status) { case '待接单': return '#FF5E81'; case '已接单': return '#2BCDDC'; case '回收中': return '#36B37E'; case '已完成': return '#6B778C'; default: return '#333333'; } }
AST#method_declaration#Left getStatusColor AST#parameter_list#Left ( AST#parameter#Left status : 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 ResourceStr AST#primary_...
getStatusColor(status: string): ResourceStr { switch (status) { case '待接单': return '#FF5E81'; case '已接单': return '#2BCDDC'; case '回收中': return '#36B37E'; case '已完成': return '#6B778C'; default: return '#333333'; } }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets#L325-L333
c6eac1de5533a0171ade20fd308b07cc1ad81291
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/CandleDataSet.ets
arkts
setDecreasingPaintStyle
Sets paint style when open > close @param decreasingPaintStyle
public setDecreasingPaintStyle(decreasingPaintStyle: Style): void { this.mDecreasingPaintStyle = decreasingPaintStyle; }
AST#method_declaration#Left public setDecreasingPaintStyle AST#parameter_list#Left ( AST#parameter#Left decreasingPaintStyle : AST#type_annotation#Left AST#primary_type#Left Style AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#...
public setDecreasingPaintStyle(decreasingPaintStyle: Style): void { this.mDecreasingPaintStyle = decreasingPaintStyle; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CandleDataSet.ets#L256-L258
07242c5015733bbae47a85c3f8aa0cb83119f742
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/SetAppFontSize/entry/src/main/ets/viewmodel/SettingData.ets
arkts
Setting list item info.
export default class SettingData { /** * Setting list item name. */ settingName: Resource = $r('app.string.empty'); /** * Setting list item image. */ settingImage: Resource = $r('app.string.empty'); }
AST#export_declaration#Left export default AST#class_declaration#Left class SettingData AST#class_body#Left { /** * Setting list item name. */ AST#property_declaration#Left settingName : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left ...
export default class SettingData { settingName: Resource = $r('app.string.empty'); settingImage: Resource = $r('app.string.empty'); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/viewmodel/SettingData.ets#L19-L29
76caca5ccde8a24bf855164ba89ad507e9308389
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
createCustomShortcut
创建自定义快捷方式
async createCustomShortcut(config: Partial<ShortcutConfig>): Promise<string> { try { const shortcutId = `custom_${Date.now()}`; const shortcut: ShortcutInfo = { id: shortcutId, shortLabel: config.label || '自定义快捷方式', longLabel: config.description || '自定义快捷方式描述', iconId: $r...
AST#method_declaration#Left async createCustomShortcut AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ShortcutConfig AST#primary_type#Right AST#type_annotation#Rig...
async createCustomShortcut(config: Partial<ShortcutConfig>): Promise<string> { try { const shortcutId = `custom_${Date.now()}`; const shortcut: ShortcutInfo = { id: shortcutId, shortLabel: config.label || '自定义快捷方式', longLabel: config.description || '自定义快捷方式描述', iconId: $r...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L339-L377
ae829e74bf374e212030dab01efa6c85c38824c1
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/storage/PreferencesUtil.ets
arkts
remove
删除指定键并 flush @param {string} key 键 @returns {Promise<void>} Promise<void>
async remove(key: string): Promise<void> { try { const prefs: preferences.Preferences = await this.getPrefs(); await prefs.delete(key); await prefs.flush(); } catch (error) { throw this.wrapError(error, `删除键 ${key} 失败`); } }
AST#method_declaration#Left async remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise...
async remove(key: string): Promise<void> { try { const prefs: preferences.Preferences = await this.getPrefs(); await prefs.delete(key); await prefs.flush(); } catch (error) { throw this.wrapError(error, `删除键 ${key} 失败`); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L89-L97
88b963574720be0ce25b754e17a9e81e53aa05a0
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/NotificationService.ets
arkts
sendVoiceReminder
发送语音提醒 @param task - 要提醒的任务 @param type - 提醒类型
private async sendVoiceReminder(task: Task, type: ReminderType): Promise<void> { // 检查语音提醒是否启用 if (!this.voiceReminderEnabled) { return; } // 检查是否已经语音提醒过 if (this.voiceNotifiedTaskIds.has(task.id)) { return; } // 检查TTS服务是否可用 if (!this.ttsService.isEnabled()) { return;...
AST#method_declaration#Left private async sendVoiceReminder AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ReminderType...
private async sendVoiceReminder(task: Task, type: ReminderType): Promise<void> { if (!this.voiceReminderEnabled) { return; } if (this.voiceNotifiedTaskIds.has(task.id)) { return; } if (!this.ttsService.isEnabled()) { return; } try { let voiceMessage ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/NotificationService.ets#L182-L221
96c76fb8701ac10c136a84adbedb0ec5c040d02f
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/TimerPage.ets
arkts
startStopwatch
秒表方法
startStopwatch() { this.stopwatchRunning = true; const startTime = Date.now() - this.stopwatchTime; this.stopwatchInterval = setInterval(() => { this.stopwatchTime = Date.now() - startTime; }, 10); }
AST#method_declaration#Left startStopwatch 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 . stopwatchRunning AST#m...
startStopwatch() { this.stopwatchRunning = true; const startTime = Date.now() - this.stopwatchTime; this.stopwatchInterval = setInterval(() => { this.stopwatchTime = Date.now() - startTime; }, 10); }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/TimerPage.ets#L528-L534
91e1dcacec2ab9ff1e5f60bf9ab2ce0b30626abc
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/navigation/NetworkListDemoNav.ets
arkts
NetworkListDemoNav
@file Network List Demo 示例页导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function NetworkListDemoNav(): void { NetworkListDemoPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function NetworkListDemoNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_cu...
@Builder export function NetworkListDemoNav(): void { NetworkListDemoPage(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/navigation/NetworkListDemoNav.ets#L8-L11
3cac3567a5529318733309b4651563dc9cd038fd
github