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
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/ReviewPage.ets
arkts
TabBuilder
自定义Tab标签
@Builder TabBuilder(index: number, title: string, icon: string) { Column({ space: 4 }) { SymbolGlyph($r(`sys.symbol.${icon}`)) .fontSize(24) .fontColor([this.selectedTab === index ? '#007DFF' : '#999999']) Text(title) .fontSize(12) .fontColor(this.selectedTab ===...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder 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 title : AST#type_annotation#Left AS...
@Builder TabBuilder(index: number, title: string, icon: string) { Column({ space: 4 }) { SymbolGlyph($r(`sys.symbol.${icon}`)) .fontSize(24) .fontColor([this.selectedTab === index ? '#007DFF' : '#999999']) Text(title) .fontSize(12) .fontColor(this.selectedTab ===...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/ReviewPage.ets#L126-L140
6ac7e13e163ad5daabfed1850c945e028ce40e23
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/utils.ets
arkts
将一个数字或数字字符串格式化成保留两位小数的数字。 @param value - 要格式化的数字或数字字符串 @returns 格式化后的数字,保留两位小数
export function formatToDecimal(value: number | string, decimal: number = 2): number { let num = typeof value === 'string' ? parseFloat(value) : value; if (isNaN(num)) { throw new Error("Invalid input: not a number"); } return Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal); }
AST#export_declaration#Left export AST#function_declaration#Left function formatToDecimal AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#t...
export function formatToDecimal(value: number | string, decimal: number = 2): number { let num = typeof value === 'string' ? parseFloat(value) : value; if (isNaN(num)) { throw new Error("Invalid input: not a number"); } return Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal); }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/utils.ets#L59-L66
c77221ad7281f38106990db25b259876c93e9dd2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/entry1ability/Entry1Ability.ets
arkts
onDestroy
[StartExclude initialize_kernel_in_onCreate_and_pre_connect_to_homepage]
onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); }
AST#method_declaration#Left onDestroy 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#Lef...
onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/entry1ability/Entry1Ability.ets#L33-L35
47d37399ccab7744cc3bb9da2a2aebc4dc1fd8bf
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getNowMonth
获取当前月
static getNowMonth(): number { let date = new Date(); return date.getMonth() + 1; }
AST#method_declaration#Left static getNowMonth 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#variable_declaration#Left let AST#variable_declarator#Left date =...
static getNowMonth(): number { let date = new Date(); return date.getMonth() + 1; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L125-L128
a5553f721cc0d19fb4e378c5633f2cb9fd35acf8
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.multimedia.avVolumePanel.d.ets
arkts
AVVolumePanel
A panel to set the system audio output volume. @syscap SystemCapability.Multimedia.Audio.Volume @atomicservice @since 12
@Component export declare struct AVVolumePanel { /** * Sets the device volume through the volume panel. * The value should be between mininum and maxinum current device volume, otherwise it will be discarded. * * @type { ?number } * @syscap SystemCapability.Multimedia.Audio.Volume * @atomicservice ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AVVolumePanel AST#component_body#Left { /** * Sets the device volume through the volume panel. * The value should be between mininum and maxinum current device volume, othe...
@Component export declare struct AVVolumePanel { @Prop volumeLevel?: number; @Prop volumeParameter?: AVVolumePanelParameter; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.multimedia.avVolumePanel.d.ets#L46-L70
8d1b52fab311e2662cc3a8d32d416eb1b9a5b1f5
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets
arkts
selectFile
选择文件,为简单起见,选择一个不太大的文本文件
selectFile() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.uploadFilePath = result[0] this.msgHistory += "select file: " + this.uploadFilePath + "\r\n"; this.canUpload = true } }).catch((e)...
AST#method_declaration#Left selectFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expres...
selectFile() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.uploadFilePath = result[0] this.msgHistory += "select file: " + this.uploadFilePath + "\r\n"; this.canUpload = true } }).catch((e)...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets#L152-L163
c1373fe38b6db375af481d87b970fbfc6c1bf2dd
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/common/UIUtils.ets
arkts
Toast配置
export class ToastOptions { message: string = ''; duration: number = 2000; constructor(message: string, duration?: number) { this.message = message; this.duration = duration || 2000; } }
AST#export_declaration#Left export AST#class_declaration#Left class ToastOptions AST#class_body#Left { AST#property_declaration#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#R...
export class ToastOptions { message: string = ''; duration: number = 2000; constructor(message: string, duration?: number) { this.message = message; this.duration = duration || 2000; } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/common/UIUtils.ets#L22-L30
3f54a2ec3dee904154e38bded6852643ae98a4c8
github
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/History.ets
arkts
getAll
查所有搜索关键字
getAll() { const obj = this.getStore().getAllSync() // { vue: vue, ts: ts, ui: ui } // ['vue', 'ts', 'ui'] return Object.keys(obj) }
AST#method_declaration#Left getAll AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left obj = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST...
getAll() { const obj = this.getStore().getAllSync() return Object.keys(obj) }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/History.ets#L35-L40
aaf7fdb4efa13a774eefafc457d6d10fc4200961
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets
arkts
计算文件的MD5码
export function computeMD5(file: string | number): Uint8Array { let md5Stream: fs.Stream if (typeof file === 'string') { md5Stream = fs.createStreamSync(file, "r"); } else { md5Stream = fs.fdopenStreamSync(file, "r") } let dataBuff: ArrayBuffer = new ArrayBuffer(4096) let mdAlgName = "MD5"; let ...
AST#export_declaration#Left export AST#function_declaration#Left function computeMD5 AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_an...
export function computeMD5(file: string | number): Uint8Array { let md5Stream: fs.Stream if (typeof file === 'string') { md5Stream = fs.createStreamSync(file, "r"); } else { md5Stream = fs.fdopenStreamSync(file, "r") } let dataBuff: ArrayBuffer = new ArrayBuffer(4096) let mdAlgName = "MD5"; let ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L79-L102
d80d36522c79236d80ecc0027334512bb0dba13a
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/MyDay.ets
arkts
aboutToAppear
初始化日期、天气、播放器、文件夹、关系型数据库数据。
public aboutToAppear(): void { this.getToday(); this.getAVPlayer(); this.getWeather(); if (router.getParams()?.['folder']) { this.folder = router.getParams()['folder'] as Folder; } console.debug('[hxk] MyDay folder: ' + JSON.stringify(this.folder)); this.scheduleTable.getRdbStore(()...
AST#method_declaration#Left public aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#exp...
public aboutToAppear(): void { this.getToday(); this.getAVPlayer(); this.getWeather(); if (router.getParams()?.['folder']) { this.folder = router.getParams()['folder'] as Folder; } console.debug('[hxk] MyDay folder: ' + JSON.stringify(this.folder)); this.scheduleTable.getRdbStore(()...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L211-L225
e02c93fed9bbf306edb38205486b1daede4cfbed
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils.ets
arkts
getRandomInt
获取随机整数(默认包含最小值,不包含最大值) @param min @param max @returns
static getRandomInt(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number { return RandomUtil.getRandomInt(min, max) }
AST#method_declaration#Left static getRandomInt AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left A...
static getRandomInt(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number { return RandomUtil.getRandomInt(min, max) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils.ets#L24-L26
95718481a1ba3256dffe8e04b219c1137b4228a6
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/action/ToastUtil.ets
arkts
showShort
弹出土司,时长为:1.5s,距离底部默认为80vp @param message 提示消息 @param options (距离屏幕底部的位置、是否显示在应用之上)
static showShort(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 1); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; options....
AST#method_declaration#Left static showShort AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ...
static showShort(message: string | Resource, options?: ToastOptions) { if (message || (typeof message === 'string' && message.length > 0)) { options = ToastUtil.initToastDefault(options, 1); let toastOptions = options as promptAction.ShowToastOptions; toastOptions.message = message; options....
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/action/ToastUtil.ets#L61-L68
417746b4f6e1db8855fd14ddff25058459ddffc0
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/CameraOptions.ets
arkts
相机参数类
export class CameraOptions { mediaTypes: Array<cameraPicker.PickerMediaType> = [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO]; //媒体类型。 cameraPosition: camera.CameraPosition = camera.CameraPosition.CAMERA_POSITION_BACK; //相机的位置。 saveUri?: string; //保存配置信息的uri。 videoDuration?: number; //...
AST#export_declaration#Left export AST#class_declaration#Left class CameraOptions AST#class_body#Left { AST#property_declaration#Left mediaTypes : 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 AST#qualified_type#Left c...
export class CameraOptions { mediaTypes: Array<cameraPicker.PickerMediaType> = [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO]; cameraPosition: camera.CameraPosition = camera.CameraPosition.CAMERA_POSITION_BACK; saveUri?: string; videoDuration?: number; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/CameraOptions.ets#L5-L10
10bbd1c4a9f8fc37370f58a0bdd2d129b7a3ab1b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/components/enhanced/EnhancedCard.ets
arkts
padding
链式调用方法
padding(value: 'small' | 'medium' | 'large'): EnhancedCard { this.padding = value; return this; }
AST#method_declaration#Left padding AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right AST#ERROR#Left : 'small' | 'medium' | 'large' AST#ERROR#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EnhancedCard AST#primary_type#Right AST#type_annotation#Right AST#block_sta...
padding(value: 'small' | 'medium' | 'large'): EnhancedCard { this.padding = value; return this; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/enhanced/EnhancedCard.ets#L163-L166
a609cf985b6dd3f0206bd3c6cb5972b0b2018aa1
github
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/common/CommonUtils.ets
arkts
根据矩形区域获取填充Rect区域的文字大小。 @param context @param rect @param initFontSize 9px @returns
export function getTextMaxFontSize(context: CanvasRenderingContext2D, rect: DrawRect, initFontSize: string, txt: string): string { if (initFontSize.endsWith('px') && rect.width > 0 && rect.width > 0) { context.font = initFontSize //计算最最新价格合适的文本大小,文本过大就缩小,反之就放大。文本过大,两种情况:过宽、过高。 var heightFontMaxSizeInt: nu...
AST#export_declaration#Left export AST#function_declaration#Left function getTextMaxFontSize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rect : AST...
export function getTextMaxFontSize(context: CanvasRenderingContext2D, rect: DrawRect, initFontSize: string, txt: string): string { if (initFontSize.endsWith('px') && rect.width > 0 && rect.width > 0) { context.font = initFontSize var heightFontMaxSizeInt: number = parseInt(initFontSize.replace('px', ''),...
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/common/CommonUtils.ets#L12-L55
7ee28c60306e8c7287328bc2516e4d78ffe1e436
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
unlink
删除单个文件,使用Promise异步回调。 @param path 文件的应用沙箱路径。 @returns
static unlink(path: string): Promise<void> { return fs.unlink(path); }
AST#method_declaration#Left static unlink 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promi...
static unlink(path: string): Promise<void> { return fs.unlink(path); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L362-L364
0a4290216447e79cb6ced3ed97e2fe340b86aff3
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets
arkts
connectSocket
连接Socket @param address @param port
async connectSocket(address: string, port: number): Promise<boolean> { Logger.info(`${TAG} tls connectSocket address: ${address}`); try { if (!this.tlsSocket) { return false; } if (await this.isConnected()) { Logger.info(`${TAG} tls connectSocket sucess`); return true;...
AST#method_declaration#Left async connectSocket AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left port : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
async connectSocket(address: string, port: number): Promise<boolean> { Logger.info(`${TAG} tls connectSocket address: ${address}`); try { if (!this.tlsSocket) { return false; } if (await this.isConnected()) { Logger.info(`${TAG} tls connectSocket sucess`); return true;...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets#L128-L164
d0e3607c3d985b55e6dc6458b8dc80bd6be930ba
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/player/PlayerArgs.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/24 12:01 @Version V1.0 @Description
export interface PlayerArgs extends DetailArgs { type: FinItemType }
AST#export_declaration#Left export AST#interface_declaration#Left interface PlayerArgs AST#extends_clause#Left extends DetailArgs AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left FinItemType AST#primary_type#Right AST#type_annotation#Right AST#ty...
export interface PlayerArgs extends DetailArgs { type: FinItemType }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/player/PlayerArgs.ets#L11-L15
7d2f8dd243079cfde2955006c5ae0a24eadf8f58
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets
arkts
addData
向规定位置添加数据
public addData(index: number, data: FlowItemContent): void { this.momentList.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 FlowItemContent AST#primar...
public addData(index: number, data: FlowItemContent): void { this.momentList.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets#L85-L88
518e71638edc69e1485f274efaaed55dd9fed4c4
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/ComponentBase.ets
arkts
setTypeface
sets a specific Typeface for the labels @param tf
public setTypeface(tf: FontFamily /*Typeface*/ ): void { this.mTypeface = tf; }
AST#method_declaration#Left public setTypeface AST#parameter_list#Left ( AST#parameter#Left tf : AST#type_annotation#Left AST#primary_type#Left FontFamily AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right /*Typeface*/ ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS...
public setTypeface(tf: FontFamily ): void { this.mTypeface = tf; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L113-L116
1ca3847ce4e80c4bf9f96cfac39652311b717188
gitee
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/entryability/EntryAbility.ets
arkts
importIconPack
--------------- Icon Pack Manager ---------------//
async importIconPack(uri: string) { const tempDirPath = getContext(this).tempDir; const tempArchiveName = tempDirPath + '/temp.zip'; const tempFolderPath = tempDirPath + '/temp'; try { const userFileFd = (await fs.open(uri)).fd; // check archive size ...
AST#method_declaration#Left async importIconPack AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration...
async importIconPack(uri: string) { const tempDirPath = getContext(this).tempDir; const tempArchiveName = tempDirPath + '/temp.zip'; const tempFolderPath = tempDirPath + '/temp'; try { const userFileFd = (await fs.open(uri)).fd; if ((await fs.stat(us...
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/entryability/EntryAbility.ets#L428-L485
e97ddafe675c7149f5acee52069ca6529bfef04b
github
sea5241/PictureSelector
09bac407ebd61100d1ccbf6e6d3b6349cb0013d7
selector/src/main/ets/utils/SelectorParamUtils.ets
arkts
获取路由参数
export function getSelectorRouterParams(params: object): ArrayList<MediaData> | null { if (params) { let mediaDataParams: MediaDataParams = params['mediaDataParams'] if (mediaDataParams) { let list = new ArrayList<MediaData>() let count = mediaDataParams.mediaDataListCount let mediaDataList ...
AST#export_declaration#Left export AST#function_declaration#Left function getSelectorRouterParams AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat...
export function getSelectorRouterParams(params: object): ArrayList<MediaData> | null { if (params) { let mediaDataParams: MediaDataParams = params['mediaDataParams'] if (mediaDataParams) { let list = new ArrayList<MediaData>() let count = mediaDataParams.mediaDataListCount let mediaDataList ...
https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/utils/SelectorParamUtils.ets#L6-L20
695d541f8e38897c58247925ccbde1d678af5ee2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets
arkts
ToolBoxView
功能说明: 本示例介绍使用zIndex、gesture等接口实现悬浮工具箱效果。 推荐场景: 用于悬浮工具箱场景 核心组件: 1. FloatingWindow: 悬浮工具箱组件 实现步骤: 1. 悬浮球UI准备:构建一个悬浮球的UI效果 @example @Builder toolTouch($$: ToolTouchInterface) { Button(){ Button() .height(CommonConstants.EIGHTY_PERCENT) .width(CommonConstants.EIGHTY_PERCENT) .backgroundColor($$.isDisable ? Color.Red : C...
@Entry @Component export struct ToolBoxView { private windowClass: window.Window | undefined = undefined; @State progress: number = 49; toolList: CustomTool[] = []; @State animationAttribute: VisibleAnimation = new VisibleAnimation(); aboutToAppear(): void { let windowStage: window.WindowStage = ( ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ToolBoxView AST#component_body#Left { AST#property_declaration#Left private windowClass : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified...
@Entry @Component export struct ToolBoxView { private windowClass: window.Window | undefined = undefined; @State progress: number = 49; toolList: CustomTool[] = []; @State animationAttribute: VisibleAnimation = new VisibleAnimation(); aboutToAppear(): void { let windowStage: window.WindowStage = ( ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets#L103-L236
b493e701a5fe1f31e540fdf938b284b0176294dd
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/SearchSchedule.ets
arkts
ItemSwipeLeft
ListItem 右滑显示的组件。将对应日程移动至(或移出)“我的一天”。 @param schedule 组件对应的日程记录
@Builder private ItemSwipeLeft(schedule: Schedule): void { Row() { Image($r('app.media.my_day')) .size({ width: 24, height: 24 }) .fillColor($r('app.color.pure_white')); } .justifyContent(FlexAlign.Center) .backgroundColor($r('app.color.blue')) .size({ width: '100%', height: ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ItemSwipeLeft AST#parameter_list#Left ( AST#parameter#Left schedule : AST#type_annotation#Left AST#primary_type#Left Schedule AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an...
@Builder private ItemSwipeLeft(schedule: Schedule): void { Row() { Image($r('app.media.my_day')) .size({ width: 24, height: 24 }) .fillColor($r('app.color.pure_white')); } .justifyContent(FlexAlign.Center) .backgroundColor($r('app.color.blue')) .size({ width: '100%', height: ...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/SearchSchedule.ets#L375-L393
fe794d733b8509c42ef2d922ba989451af73426c
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserGuildSettings.ets
arkts
应用约束:使用ES模块导出(约束60)
export default ClientUserGuildSettings;
AST#export_declaration#Left export default AST#expression#Left ClientUserGuildSettings AST#expression#Right ; AST#export_declaration#Right
export default ClientUserGuildSettings;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserGuildSettings.ets#L71-L71
778897ea0877e90acb48e9e8dfed66a43794e2b7
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/WeatherManager.ets
arkts
getCacheRemainingMinutes
获取缓存剩余时间(分钟)
getCacheRemainingMinutes(): number { if (!this.cachedWeatherData) return 0; const cacheDuration = this.TEST_MODE ? 10 * 1000 : this.CACHE_DURATION; const elapsed = Date.now() - this.lastUpdateTime; const remaining = cacheDuration - elapsed; return Math.max(0, Math.ceil(remaining / 60000)); }
AST#method_declaration#Left getCacheRemainingMinutes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expre...
getCacheRemainingMinutes(): number { if (!this.cachedWeatherData) return 0; const cacheDuration = this.TEST_MODE ? 10 * 1000 : this.CACHE_DURATION; const elapsed = Date.now() - this.lastUpdateTime; const remaining = cacheDuration - elapsed; return Math.max(0, Math.ceil(remaining / 60000)); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/WeatherManager.ets#L227-L233
e29dc54dd764ba2193bf2828af15221f68a6a785
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets
arkts
getFirstLvMenu
底部一级菜单
@Builder getFirstLvMenu() { Row() { Column() { Image($r('app.media.ic_adjust')) .width($r('app.float.size_30')) .height($r('app.float.size_30')) Text($r('app.string.edit_image_adjust')) .fontColor(Color.White) .fontSize($r('app.float.size_16')) }...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getFirstLvMenu 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#container_content_body#Left { AST#arkts_ui_elem...
@Builder getFirstLvMenu() { Row() { Column() { Image($r('app.media.ic_adjust')) .width($r('app.float.size_30')) .height($r('app.float.size_30')) Text($r('app.string.edit_image_adjust')) .fontColor(Color.White) .fontSize($r('app.float.size_16')) }...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets#L241-L282
a5591c3cf0bc220780cf2721a4616d6b5925c9b5
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets
arkts
writeBufferToFile
Save the arraybuffer to a file.
static writeBufferToFile(path: string, arrayBuffer: ArrayBuffer): number { try { let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let value = fileIo.writeSync(file.fd, arrayBuffer); fileIo.closeSync(file); return value; } catch (err) { Logger.e...
AST#method_declaration#Left static writeBufferToFile 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 arrayBuffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffe...
static writeBufferToFile(path: string, arrayBuffer: ArrayBuffer): number { try { let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let value = fileIo.writeSync(file.fd, arrayBuffer); fileIo.closeSync(file); return value; } catch (err) { Logger.e...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets#L39-L49
017dd01c9030e1582aa723e8f64ccb1835fbe6dd
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets
arkts
国内热门城市数据
export const HOT_CITY = ['北京', '上海', '广州', '深圳', '杭州', '南京', '苏州', '天津', '武汉', '长沙', '重庆', '成都'];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HOT_CITY = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '北京' AST#expression#Right , AST#expression#Left '上海' AST#expression#Right , AST#expression#Left '广州' AST#expression#Right , AST#expression#Left ...
export const HOT_CITY = ['北京', '上海', '广州', '深圳', '杭州', '南京', '苏州', '天津', '武汉', '长沙', '重庆', '成都'];
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets#L86-L87
46d216dc0a74ebdd85984f07504c7d5315099a07
gitee
linhanlove/hormany-os-notion
a65f47bfc1a2bbce531b9af97831eb1ba934c2f8
entry/src/main/ets/pages/auth/Register.ets
arkts
TextStyle
文本样式
@Extend(Text) function TextStyle() { .fontColor(StyleConstants.BASE_STYLE.fontColor) .fontWeight(FontWeight.Bold) .margin({ top: StyleConstants.SPACING}) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function TextStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#membe...
@Extend(Text) function TextStyle() { .fontColor(StyleConstants.BASE_STYLE.fontColor) .fontWeight(FontWeight.Bold) .margin({ top: StyleConstants.SPACING}) }
https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/pages/auth/Register.ets#L291-L295
cf6b9882a024eb1f0b4fe5957ff8c54a4d425b4e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/WithReuseId.ets
arkts
[EndExclude opt_reuseId]
build() { Column() { List({ space: this.LIST_SPACE }) { LazyForEach(this.momentData, (moment: FriendMoment) => { ListItem() { OneMoment({ moment: moment })// ReusId is used to control component reuse .reuseId((moment.image !== '') ? 'withImage_id' : 'noImage_id') ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_pa...
build() { Column() { List({ space: this.LIST_SPACE }) { LazyForEach(this.momentData, (moment: FriendMoment) => { ListItem() { OneMoment({ moment: moment }) .reuseId((moment.image !== '') ? 'withImage_id' : 'noImage_id') } }, (moment: FriendMoment) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/WithReuseId.ets#L35-L52
ffed54f32701bb557813dc3365f3769d8d9c0990
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets
arkts
format
格式化日期 @param date 日期 @param format 格式字符串,例如:'yyyy-MM-dd HH:mm:ss' @returns 格式化后的字符串
static format(date: Date, format: string = 'yyyy_MM_dd_HHmmss'): string { const MAX_LENGTH: number = 2; let year = date.getFullYear().toString(); let month = (date.getMonth() + 1).toString().padStart(MAX_LENGTH, '0'); let day = date.getDate().toString().padStart(MAX_LENGTH, '0'); let hour = date.get...
AST#method_declaration#Left static format AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ...
static format(date: Date, format: string = 'yyyy_MM_dd_HHmmss'): string { const MAX_LENGTH: number = 2; let year = date.getFullYear().toString(); let month = (date.getMonth() + 1).toString().padStart(MAX_LENGTH, '0'); let day = date.getDate().toString().padStart(MAX_LENGTH, '0'); let hour = date.get...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets#L54-L69
f36d672135270b6d56598fbedc97d49fa9fdb7f1
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
loadDescription
Load description of AccessibilityService
async loadDescription(bundleInfo: bundleManager.BundleInfo, serviceName: string): Promise<ResourceStr> { let description: ResourceStr = $r('app.string.no_description_provided'); let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; let moduleInfo: Arra...
AST#method_declaration#Left async loadDescription AST#parameter_list#Left ( AST#parameter#Left bundleInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left...
async loadDescription(bundleInfo: bundleManager.BundleInfo, serviceName: string): Promise<ResourceStr> { let description: ResourceStr = $r('app.string.no_description_provided'); let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; let moduleInfo: Arra...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L228-L257
a58939cc34f00f02604ebc35b8953f89612359c1
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/function_var/function_var_003_T.ets
arkts
Introduction 变量函数
export function function_var_003_T(taint_src : string){ let f1 = ff; f1(taint_src); }
AST#export_declaration#Left export AST#function_declaration#Left function function_var_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function function_var_003_T(taint_src : string){ let f1 = ff; f1(taint_src); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/function_var/function_var_003_T.ets#L6-L9
e02e9e0851733d3090b0ddc0063627408ac16b51
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Transformer.ets
arkts
generateTransformedValuesScatter
Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the SCATTERCHART. @param data @return
public generateTransformedValuesScatter(data: IScatterDataSet, phaseX: number, phaseY: number, from: number, to: number): number[] { const count: number = Math.floor(((to - from) * phaseX + 1) * 2); if (this.valuePointsForGenerateTransformedValuesScatter.length != cou...
AST#method_declaration#Left public generateTransformedValuesScatter AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IScatterDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_t...
public generateTransformedValuesScatter(data: IScatterDataSet, phaseX: number, phaseY: number, from: number, to: number): number[] { const count: number = Math.floor(((to - from) * phaseX + 1) * 2); if (this.valuePointsForGenerateTransformedValuesScatter.length != cou...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L107-L133
5d9d9a0cf9304b63162174a021fd7d341081347b
gitee
batiluoxuanwan/MomentFlow.git
e57aa461223abca74f48893afc2ccf7c2d73e9b8
frontend/entry/src/main/ets/api/UserApi.ets
arkts
login
登录
static async login(account: string, pass: string): Promise<User | null> { return request<User>(`${BASE_URL}/login`, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: JSON.stringify({ "account": account, "password": pass }) }) ...
AST#method_declaration#Left static async login AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pass : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static async login(account: string, pass: string): Promise<User | null> { return request<User>(`${BASE_URL}/login`, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: JSON.stringify({ "account": account, "password": pass }) }) ...
https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/UserApi.ets#L74-L83
f42427ae062c3bb63bba98ee029be7e13ff559b7
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets
arkts
MARK: - COS配置常量(需保密)
export namespace CosConfig { export const region : string = "STap-shanghai";
AST#export_declaration#Left export AST#ERROR#Left namespace CosConfig { export AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left region : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "STap-shanghai" AST#expres...
export namespace CosConfig { export const region : string = "STap-shanghai";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets#L9-L10
bcee5d3ddaf01934760b407bf03cb63cdf6115e9
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
getLabelPosition
returns the position of the y-labels
public getLabelPosition(): YAxisLabelPosition { return this.mPosition; }
AST#method_declaration#Left public getLabelPosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left YAxisLabelPosition AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left...
public getLabelPosition(): YAxisLabelPosition { return this.mPosition; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L227-L229
d20d56ed3ad266f02a5d68ab65f621920e108621
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
getUserInfo
获取用户信息 @returns {User} 用户信息
getUserInfo(): User { return this.userState.getUserInfo(); }
AST#method_declaration#Left getUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left ...
getUserInfo(): User { return this.userState.getUserInfo(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L76-L78
d04b3033490b231e58708a490ba11d801d7ee055
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/FileUtil.ets
arkts
hasDirPath
判断是否是完整路径 @param path 文件路径
static hasDirPath(path: string): boolean { return StrUtil.startsWith(path, "/data/storage/") || StrUtil.startsWith(path, "/storage/"); }
AST#method_declaration#Left static hasDirPath 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_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ...
static hasDirPath(path: string): boolean { return StrUtil.startsWith(path, "/data/storage/") || StrUtil.startsWith(path, "/storage/"); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/FileUtil.ets#L112-L114
8da039f6e2e5b9f488b1048cfb32c67f8f7fa460
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppFunctions.ets
arkts
检查磁盘空间是否足够(带Toast提示)
export function checkDiskSpace(needMegas: number = AppSettings.App.minDisk): boolean { return FileUtility.checkDiskSpace(needMegas); }
AST#export_declaration#Left export AST#function_declaration#Left function checkDiskSpace AST#parameter_list#Left ( AST#parameter#Left needMegas : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AS...
export function checkDiskSpace(needMegas: number = AppSettings.App.minDisk): boolean { return FileUtility.checkDiskSpace(needMegas); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppFunctions.ets#L15-L17
e865934d52341c57a8370226f6b4c2878cdb405e
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets
arkts
getCapitalStringSync
同步返回大写字符串string值
static getCapitalStringSync(resource: ResourceStr): string { if (!resource) { return ''; } if (typeof resource === 'string') { return resource.toUpperCase(); } let result = ResourceUtils.getStringSync(resource); return result?.toUpperCase(); }
AST#method_declaration#Left static getCapitalStringSync AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left stri...
static getCapitalStringSync(resource: ResourceStr): string { if (!resource) { return ''; } if (typeof resource === 'string') { return resource.toUpperCase(); } let result = ResourceUtils.getStringSync(resource); return result?.toUpperCase(); }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets#L42-L51
274e7b5e9c03c1c67490472bb7c537dede07ac9e
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/LoginPage/LoginPage.ets
arkts
verifyCode
验证码识别
verifyCode() { if (this.isAccountFrozen) { promptAction.showToast({ message: '账号已冻结,无法登录', duration: 2000, }); return false; } if (this.account !== 'jay') { promptAction.showToast({ message: '账号错误', duration: 2000, }); return false; } ...
AST#method_declaration#Left verifyCode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isAccountFrozen AST#member_expression#Right AST#expression#R...
verifyCode() { if (this.isAccountFrozen) { promptAction.showToast({ message: '账号已冻结,无法登录', duration: 2000, }); return false; } if (this.account !== 'jay') { promptAction.showToast({ message: '账号错误', duration: 2000, }); return false; } ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/LoginPage/LoginPage.ets#L74-L97
487ccae50b17a1f74c393eaad395dbf4e68dc2b1
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/database/PreferencesHandler.ets
arkts
configure
配置偏好设置处理器,用于初始化用户首选项存储。 @param context 上下文对象,提供对应用程序的访问权限
public async configure(context: Context) { this.preferences = await data_preferences.getPreferences(context, CommonConstants.PREFERENCE_ID); this.preferences.on('change', (data: Record<string, Object>) => { // 当首选项数据发生变化时,通知所有已注册的监听器 for (let preferencesListener of this.listeners) { preferen...
AST#method_declaration#Left public async configure AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left ...
public async configure(context: Context) { this.preferences = await data_preferences.getPreferences(context, CommonConstants.PREFERENCE_ID); this.preferences.on('change', (data: Record<string, Object>) => { for (let preferencesListener of this.listeners) { preferencesListener.onDataChanged(...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesHandler.ets#L23-L31
afd3361b7ff9e18a5838b145ed60d98fd5260841
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SettingsPage.ets
arkts
updateThemeMode
更新主题模式
private async updateThemeMode(mode: ThemeMode): Promise<void> { try { await this.settingsService.updateThemeSettings({ mode }); // 重新加载设置 this.settings = await this.settingsService.getSettings(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to upda...
AST#method_declaration#Left private async updateThemeMode AST#parameter_list#Left ( AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
private async updateThemeMode(mode: ThemeMode): Promise<void> { try { await this.settingsService.updateThemeSettings({ mode }); this.settings = await this.settingsService.getSettings(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to update theme:...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L81-L89
8f2e59426fc2dda673cf7c853b0757471cc0d0ea
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Make (create) a directory in a sync way. @param dir_name A string, the path of the file.
export function sandbox_mkdir_sync(dir_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_dir_directory = filesDir + '/' + dir_name; try { fs.mkdirSync(full_dir_directory, true); } catch (e) { console.error('[storage_tools][sandbox_mkdi...
AST#export_declaration#Left export AST#function_declaration#Left function sandbox_mkdir_sync AST#parameter_list#Left ( AST#parameter#Left dir_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDir ? : AST#ty...
export function sandbox_mkdir_sync(dir_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_dir_directory = filesDir + '/' + dir_name; try { fs.mkdirSync(full_dir_directory, true); } catch (e) { console.error('[storage_tools][sandbox_mkdi...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L411-L421
86df4889cd7b581eac75890bbc810dfd55977e5f
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageDelete.ets
arkts
Emitted whenever a message is deleted. @event Client#messageDelete @param {Object} message The deleted message 应用约束61:使用export default代替module.exports
export default MessageDeleteHandler;
AST#export_declaration#Left export default AST#expression#Left MessageDeleteHandler AST#expression#Right ; AST#export_declaration#Right
export default MessageDeleteHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageDelete.ets#L29-L29
1ac9f819123c9d633eed0b486ef3771bed5192f6
github
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/Tracking.ets
arkts
record
preference的put方法只能放boolean,string,number及其组成的数组,而我们需要传递的是包含多个属性的对象
record(startTime:number,endTime:number,questionId:string){ // 先根据键获得值,未获取到则为空数组[] const json = this.getStore().getSync(this.dataKey,'[]') // 用JSON将字符串数组转为TiameItem类型的对象数组,并存到list中 const list = JSON.parse(json as string) as TimeItem[] //此时可以添加对象进数组 list.push({startTime,endTime,questionId}) /...
AST#method_declaration#Left record AST#parameter_list#Left ( AST#parameter#Left startTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Rig...
record(startTime:number,endTime:number,questionId:string){ const json = this.getStore().getSync(this.dataKey,'[]') const list = JSON.parse(json as string) as TimeItem[] list.push({startTime,endTime,questionId}) this.getStore().putSync(this.dataKey,JSON.stringify(list)) this.getS...
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/Tracking.ets#L21-L32
dcde1a784c20c7c192f4b914112d5d624f9f86a6
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
destroy
Cleanup resources
async destroy(): Promise<void> { await this.rdbHelper.close(); await this.configService.destroy(); this.notificationService.destroy(); await this.ttsService.destroy(); await this.logService.destroy(); console.info('[MainViewModel] Resources cleaned up'); }
AST#method_declaration#Left async destroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argument...
async destroy(): Promise<void> { await this.rdbHelper.close(); await this.configService.destroy(); this.notificationService.destroy(); await this.ttsService.destroy(); await this.logService.destroy(); console.info('[MainViewModel] Resources cleaned up'); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L714-L721
e9d4a3da08800b5a6dcca07f6624e948a8160ebc
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_synchronous.ets
arkts
decryptMessage
解密消息
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('AES128|CCM'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, ccmParams); let decryptUpdate = decoder.doFinalSync(cipherText); return decryptUpdate; }
AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left c...
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('AES128|CCM'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, ccmParams); let decryptUpdate = decoder.doFinalSync(cipherText); return decryptUpdate; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_synchronous.ets#L52-L57
c65035d9a35b28b1b80af1f8b0a3413b5858c3cc
gitee
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getConnectTimeout
Getter and setter for connectTimeout
getConnectTimeout(): number | undefined { return this.connectTimeout; }
AST#method_declaration#Left getConnectTimeout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statemen...
getConnectTimeout(): number | undefined { return this.connectTimeout; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L92-L94
cb86d11119e74c5898e5bbb91cda6bc92945bd8e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/model/DragToSwitchPicturesModule.ets
arkts
tabBar类
export class TabDataModel { // tabId用户切换tabContent id: number = 0; // tab类别 navData: string | Resource = ''; constructor(id: number, navData: string | Resource) { this.navData = navData; this.id = id; } }
AST#export_declaration#Left export AST#class_declaration#Left class TabDataModel AST#class_body#Left { // tabId用户切换tabContent AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#prope...
export class TabDataModel { id: number = 0; navData: string | Resource = ''; constructor(id: number, navData: string | Resource) { this.navData = navData; this.id = id; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/model/DragToSwitchPicturesModule.ets#L30-L40
2f33c2daf54e3827da59d5fd16b4ea3a863d329d
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/model/ListModel.ets
arkts
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 class ListModel { title: string; function: Function | undefined; value: string; constructor(title: string, func: Function | undefined, value: string = '') { this.title = title; this.function = func; this.value = value; } setValue(value: string) { this.value = value; } getValue(...
AST#export_declaration#Left export AST#class_declaration#Left class ListModel AST#class_body#Left { AST#property_declaration#Left title : 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 function : AST#t...
export class ListModel { title: string; function: Function | undefined; value: string; constructor(title: string, func: Function | undefined, value: string = '') { this.title = title; this.function = func; this.value = value; } setValue(value: string) { this.value = value; } getValue(...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/model/ListModel.ets#L16-L38
7282f104244cdacde4d0acfe352ff9323ba33f7c
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/XiaoXunAI/entry/src/main/ets/model/XiaoXunResponse.ets
arkts
通义千问大语言模型请求响应数据结构类(阿里云)
export class XiaoXunResponse { /** * 系统生成的标志本次调用的id */ request_id?: string; /** * 调用结果信息对象 */ output?: TongYiResp_output; /** * 计量信息对象 */ usage?: TongYiResp_usage; }
AST#export_declaration#Left export AST#class_declaration#Left class XiaoXunResponse AST#class_body#Left { /** * 系统生成的标志本次调用的id */ AST#property_declaration#Left request_id ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**...
export class XiaoXunResponse { request_id?: string; output?: TongYiResp_output; usage?: TongYiResp_usage; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/XiaoXunResponse.ets#L4-L19
2201655b3055d0c7feff48a6006fc869d6b8cc78
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/navigation/MainNav.ets
arkts
MainNav
@file 主页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function MainNav(): void { MainPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function MainNav 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_custom_compon...
@Builder export function MainNav(): void { MainPage(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/navigation/MainNav.ets#L8-L11
1ff758d1b100b20af568049af46cbee4d8241000
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/CharUtils.ets
arkts
isEmoji
判断是否为emoji表情符 @param c 字符 @returns 是否为emoji
static isEmoji(c: number): boolean { // 使用 TypeScript 类型断言来告诉编译器我们已知这个条件不会是null或undefined const isNotEmoji = (c === 0x0) || (c === 0x9) || (c === 0xA) || (c === 0xD) || ((c >= 0x20 && c == 0xD7FF)) || ((c >= 0xE000 && c == 0xFFFD)) || ((c >= 0x100000 && c == 0x10FFFF)); r...
AST#method_declaration#Left static isEmoji AST#parameter_list#Left ( AST#parameter#Left c : 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 boolean AST#primary_type#Righ...
static isEmoji(c: number): boolean { const isNotEmoji = (c === 0x0) || (c === 0x9) || (c === 0xA) || (c === 0xD) || ((c >= 0x20 && c == 0xD7FF)) || ((c >= 0xE000 && c == 0xFFFD)) || ((c >= 0x100000 && c == 0x10FFFF)); return !isNotEmoji; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/CharUtils.ets#L37-L47
e999cf829e00d856f604f0147e7755f249176567
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/UserService.ets
arkts
getUserById
根据ID获取用户信息 @param userId 用户ID
async getUserById(userId: number): Promise<UserInfo | null> { try { const userData = await this.cloudDBService.getUserById(userId); if (userData) { return UserInfo.fromCloudObject(userData); } return null; } catch (error) { console.error('获取用户失败:', error); return null...
AST#method_declaration#Left async getUserById AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left...
async getUserById(userId: number): Promise<UserInfo | null> { try { const userData = await this.cloudDBService.getUserById(userId); if (userData) { return UserInfo.fromCloudObject(userData); } return null; } catch (error) { console.error('获取用户失败:', error); return null...
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L175-L186
d5723b0a0978eac17f68a5954a33046ff8569858
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SubwindowAdaptWhenRotate/entry/src/main/ets/pages/Index.ets
arkts
createSubWindow
[StartExclude rotate_sample]
private createSubWindow(): void { window.createWindow({ name: 'subWindow', windowType: window.WindowType.TYPE_DIALOG, ctx: this.getUIContext().getHostContext(), }).then((subWindow: window.Window) => { this.subWindow = subWindow; if (!this.mainWindow) { return; } ...
AST#method_declaration#Left private createSubWindow 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#...
private createSubWindow(): void { window.createWindow({ name: 'subWindow', windowType: window.WindowType.TYPE_DIALOG, ctx: this.getUIContext().getHostContext(), }).then((subWindow: window.Window) => { this.subWindow = subWindow; if (!this.mainWindow) { return; } ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SubwindowAdaptWhenRotate/entry/src/main/ets/pages/Index.ets#L77-L123
bdfb259a882667ec8530114d5fc025789aa54d7c
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
addService
添加服务。用户基于AbstractService定义自己的设备服务,并添加到设备 @param serviceId 服务id,要和设备模型定义一致 @param deviceService 服务实例
public addService(serviceId: string, deviceService: AbstractService): void { deviceService.iotDevice = this; deviceService.serviceId = serviceId; if (!this.services.has(serviceId)) { this.services.set(serviceId, deviceService) } }
AST#method_declaration#Left public addService AST#parameter_list#Left ( AST#parameter#Left serviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left deviceService : AST#type_annotation#Left AST#primary_type#Left AbstractSe...
public addService(serviceId: string, deviceService: AbstractService): void { deviceService.iotDevice = this; deviceService.serviceId = serviceId; if (!this.services.has(serviceId)) { this.services.set(serviceId, deviceService) } }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L82-L89
9a334f7d992551579c07ee9c08ab63d9cfaba895
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/utils/AccountUtil.ets
arkts
账号服务类 登录请求
export function loginWithHuaweiID(UIContext: UIContext, callback: Function = () => { }) { // 创建授权请求,并设置参数 const huaweiIdProvider = new authentication.HuaweiIDProvider(); const loginRequest = huaweiIdProvider.createAuthorizationWithHuaweiIDRequest(); // 默认值为 true,若账号未登录则强制拉起账号登录页 loginRequest.forceAuthorizatio...
AST#export_declaration#Left export AST#function_declaration#Left function loginWithHuaweiID AST#parameter_list#Left ( AST#parameter#Left UIContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_anno...
export function loginWithHuaweiID(UIContext: UIContext, callback: Function = () => { }) { const huaweiIdProvider = new authentication.HuaweiIDProvider(); const loginRequest = huaweiIdProvider.createAuthorizationWithHuaweiIDRequest(); loginRequest.forceAuthorization = true; loginRequest.idTokenSignAlgorith...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/AccountUtil.ets#L8-L45
495bd6c1881c43d8382cf78c6b9d8fcd648ca0af
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/navigation/GoodsGraph.ets
arkts
@file 商品模块导航图 @author Joker.X
export class GoodsGraph implements RouteGraph { /** * 注册商品模块导航路由 */ register(): void { RouteBuild.register(GoodsRoutes.Detail, wrapBuilder(GoodsDetailNav)); RouteBuild.register(GoodsRoutes.Search, wrapBuilder(GoodsSearchNav)); RouteBuild.register(GoodsRoutes.Comment, wrapBuilder(GoodsCommentNav));...
AST#export_declaration#Left export AST#class_declaration#Left class GoodsGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /** * 注册商品模块导航路由 */ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left...
export class GoodsGraph implements RouteGraph { register(): void { RouteBuild.register(GoodsRoutes.Detail, wrapBuilder(GoodsDetailNav)); RouteBuild.register(GoodsRoutes.Search, wrapBuilder(GoodsSearchNav)); RouteBuild.register(GoodsRoutes.Comment, wrapBuilder(GoodsCommentNav)); RouteBuild.register(...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/navigation/GoodsGraph.ets#L12-L22
a1ebe70205bed84165ed9f174041745563831c5b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/mock/MockData.ets
arkts
用户评论列表mock数据
export const REVIEW_DATA: Array<ReviewItem> = [ new ReviewItem('用户1', '主播介绍得好详细,产品看起来很棒,已下单!'), new ReviewItem('用户2', '这个直播间的优惠力度真的大,爱了爱了。') ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left REVIEW_DATA : 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 ReviewItem AST#primary_type#Right AST#type_annotation#Righ...
export const REVIEW_DATA: Array<ReviewItem> = [ new ReviewItem('用户1', '主播介绍得好详细,产品看起来很棒,已下单!'), new ReviewItem('用户2', '这个直播间的优惠力度真的大,爱了爱了。') ];
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/mock/MockData.ets#L20-L23
e8ceb9f769d46015755ec9e7e1b1aa3ed50b48e7
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/homeability/HomeAbility.ets
arkts
onNewWant
Life Cycles Receives a want. @param want The want. @param launchParam The launchParam to determine if this is a continuation or something else.
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { console.log('launchParam launchReason: ' + launchParam.launchReason); this.process_want(want, 'onNewWant'); }
AST#method_declaration#Left onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abi...
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { console.log('launchParam launchReason: ' + launchParam.launchReason); this.process_want(want, 'onNewWant'); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/homeability/HomeAbility.ets#L61-L64
a937535bacd8a28db23995bb21eb714409ec2b53
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Message event after page is back or destroyed if postMessage() is called in H5 page. @typedef OnMessageEvent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare interface OnMessageEvent { /** * The message data list. * * @type { object[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ data: object[]; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnMessageEvent AST#object_type#Left { /** * The message data list. * * @type { object[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#...
export declare interface OnMessageEvent { data: object[]; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L169-L179
0e3c0548c89e212eb6e721e60ad6d61f2551c139
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
decryptCBCSync
解密(CBC模式),同步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|CBC|PKCS7、AES192|CBC|PKCS7、AES128|CBC|PKCS7)。 @returns
static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'AES256|CBC|PKCS7'): cryptoFramework.DataBlob { return AES.decryptSync(data, symKey, ivParams, transformation); }
AST#method_declaration#Left static decryptCBCSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe...
static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'AES256|CBC|PKCS7'): cryptoFramework.DataBlob { return AES.decryptSync(data, symKey, ivParams, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L150-L153
02a71e19359e296edf11d5fa2e5806dd8122a638
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowTabsVertical.ets
arkts
try_scroll_to
Tab controls Tries to scroll to a tab of specific index. @param idx The index of the target tab.
try_scroll_to(idx: number) { let tab_height_default: number = 42; clearTimeout(this.scroll_2_bottom_timeout_handle_id); // Cancel existing timeout; this.scroll_2_bottom_timeout_handle_id = setTimeout(() => { let tar = (idx + 1) * tab_height_default + (idx) * 5; // Determine scroll distance ...
AST#method_declaration#Left try_scroll_to AST#parameter_list#Left ( AST#parameter#Left idx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left l...
try_scroll_to(idx: number) { let tab_height_default: number = 42; clearTimeout(this.scroll_2_bottom_timeout_handle_id); this.scroll_2_bottom_timeout_handle_id = setTimeout(() => { let tar = (idx + 1) * tab_height_default + (idx) * 5; const max_y = (this.bunch_of_tabs.Tabs.length) * tab_...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsVertical.ets#L240-L265
cd8fdc2b9172023193c10371e5d0edc5faf169bb
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerDialog.ets
arkts
toggleMode
切换模式(递增/递减)
private toggleMode() { this.stopTimer(); this.isIncrementing = !this.isIncrementing; this.isPaused = false; // 切换模式时重置时间 this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.startTimer(); }
AST#method_declaration#Left private toggleMode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . stopTimer AST#mem...
private toggleMode() { this.stopTimer(); this.isIncrementing = !this.isIncrementing; this.isPaused = false; this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.startTimer(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L151-L158
9f3ceae2099239987b73eb7dd360a4865ae3503f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
showCalendarPicker
日历选择器弹窗 @param options selected 设置选中项的日期。 options 描述日期选中态底板样式。 默认值:底板样式为圆形。 hintRadius 为0,底板样式为直角矩形。hintRadius为0 ~ 16,底板样式为圆角矩形。hintRadius>=16,底板样式为圆形 onChange:(value: Date) => void 选择弹窗中日期使当前选中项改变时触发该回调。value:选中的日期值。 onAccept:(value: Date) => void 点击弹窗中的“确定”按钮时触发该回调。value:选中的日期值。 onCancel:() => void 点击弹窗中的“取消”按钮时触发该回调...
static showCalendarPicker(options: CalendarDialogOptions) { options.backgroundColor = options.backgroundColor ?? DialogUtil.defaultConfig.backgroundColor; options.backgroundBlurStyle = options.backgroundBlurStyle ?? DialogUtil.defaultConfig.backgroundBlurStyle; options.shadow = options.shadow ?? DialogUtil....
AST#method_declaration#Left static showCalendarPicker AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left CalendarDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expressio...
static showCalendarPicker(options: CalendarDialogOptions) { options.backgroundColor = options.backgroundColor ?? DialogUtil.defaultConfig.backgroundColor; options.backgroundBlurStyle = options.backgroundBlurStyle ?? DialogUtil.defaultConfig.backgroundBlurStyle; options.shadow = options.shadow ?? DialogUtil....
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L133-L140
c8b58df709a3f66eb0a780f27701059bd184650d
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
OptimizationAppDelay/entry/src/main/ets/view/LoadingView.ets
arkts
Skeletal diagram layout
build() { Row() { List({ space: Constants.RESOURCE_LIST_SPACE }) { ForEach(SkeletonData, (item: SkeType) => { ListItem() { ArticleSkeletonView({ isMine: item.isMine, isFeed: item.isFeed }) } }) } .padding({ left: '12vp', right: '12vp'...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_param...
build() { Row() { List({ space: Constants.RESOURCE_LIST_SPACE }) { ForEach(SkeletonData, (item: SkeType) => { ListItem() { ArticleSkeletonView({ isMine: item.isMine, isFeed: item.isFeed }) } }) } .padding({ left: '12vp', right: '12vp'...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/view/LoadingView.ets#L38-L64
5ec25377d6bea1ae9cebf20061d52d95f2db0f19
gitee
eternaljust/Msea_HarmonyOS.git
bd83668f32138238482ee6e78f1d8e8717047a7c
entry/src/main/ets/view/ComponentExtend.ets
arkts
系统默认字体分类
export enum FontCategory { Headline96Light, Headline72Light, Headline60Light, Headline48Regular, Headline38Regular, Headline30Medium, Headline24Medium, Headline20Medium, Subtitle18Medium, Subtitle16Medium, Subtitle14Medium, Body16Regular, Body14Regular, Body12Regular, Button16Medium, But...
AST#export_declaration#Left export AST#enum_declaration#Left enum FontCategory AST#enum_body#Left { AST#enum_member#Left Headline96Light AST#enum_member#Right , AST#enum_member#Left Headline72Light AST#enum_member#Right , AST#enum_member#Left Headline60Light AST#enum_member#Right , AST#enum_member#Left Headline48Regula...
export enum FontCategory { Headline96Light, Headline72Light, Headline60Light, Headline48Regular, Headline38Regular, Headline30Medium, Headline24Medium, Headline20Medium, Subtitle18Medium, Subtitle16Medium, Subtitle14Medium, Body16Regular, Body14Regular, Body12Regular, Button16Medium, But...
https://github.com/eternaljust/Msea_HarmonyOS.git/blob/bd83668f32138238482ee6e78f1d8e8717047a7c/entry/src/main/ets/view/ComponentExtend.ets#L2-L21
27a6fb8176f2f57399196141185dfa6b0720f8e1
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets
arkts
writeStrToFile
Save the text content to a file.
static writeStrToFile(path: string, text: string): number { try { let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let value = fileIo.writeSync(file.fd, text); fileIo.closeSync(file); return value; } catch (err) { Logger.error('FileUtil', 'writ...
AST#method_declaration#Left static writeStrToFile 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 text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static writeStrToFile(path: string, text: string): number { try { let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); let value = fileIo.writeSync(file.fd, text); fileIo.closeSync(file); return value; } catch (err) { Logger.error('FileUtil', 'writ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets#L52-L62
83919c4da5f5b45ac25ade4c7ba44bd03dd980f6
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/TcpDemo/entry/src/main/ets/pages/Index.ets
arkts
bind2Port
绑定本地端口
async bind2Port() { //本地地址 let localAddress = { address: "0.0.0.0", port: this.localPort, family: 1 } await tcpSocket.bind(localAddress) .then(() => { this.msgHistory = 'bind success' + "\r\n"; this.canConnect = true }) .catch((e) => { this.msgHistory = 'bind fail ...
AST#method_declaration#Left async bind2Port AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //本地地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localAddress = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name...
async bind2Port() { let localAddress = { address: "0.0.0.0", port: this.localPort, family: 1 } await tcpSocket.bind(localAddress) .then(() => { this.msgHistory = 'bind success' + "\r\n"; this.canConnect = true }) .catch((e) => { this.msgHistory = 'bind fail ' + e....
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/TcpDemo/entry/src/main/ets/pages/Index.ets#L167-L187
909feff46cca45db4b63a7b639518da78365e2bc
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerDialog.ets
arkts
resetTimer
重置计时
private resetTimer() { if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } this.isRunning = false; this.isPaused = false; // 根据当前模式重置时间 this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.getTimeDigits(this.currentSeconds); this.cl...
AST#method_declaration#Left private resetTimer 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#expressio...
private resetTimer() { if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } this.isRunning = false; this.isPaused = false; this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds; this.getTimeDigits(this.currentSeconds); this.closeDialog(); ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L136-L147
5c4b988d79ae681c2397ef4f55b5ea3129af88f1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
朗读控件
export class TextReaderHelper { /** * 朗读控件初始化,用于初始化TTS引擎和底层播放器,初始化失败会返回对应错误码。 * @param windowStage 窗口管理器 * @param context 当前应用上下文 * @param readParams 朗读参数 * @param panelName 默认值为‘小艺朗读’,并且readParams为undefined该值才生效 * @returns */ static async init(windowStage: window.WindowStage, context: commo...
AST#export_declaration#Left export AST#class_declaration#Left class TextReaderHelper AST#class_body#Left { /** * 朗读控件初始化,用于初始化TTS引擎和底层播放器,初始化失败会返回对应错误码。 * @param windowStage 窗口管理器 * @param context 当前应用上下文 * @param readParams 朗读参数 * @param panelName 默认值为‘小艺朗读’,并且readParams为undefined该值才生效 * @returns ...
export class TextReaderHelper { static async init(windowStage: window.WindowStage, context: common.BaseContext, readerParams?: TextReader.ReaderParam, panelName: string = '小艺朗读'): Promise<void> { WindowManager.setWindowStage(windowStage); if (readerParams === undefined || readerParams === null) { ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L8-L415
501a6eb032833999d02f71ae0e5eec9e59286478
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/MultiDeviceAppDev/MultiColumns/entry/src/main/ets/model/dataType.ets
arkts
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 class OperateTabs { src: Resource name: Resource constructor
AST#export_declaration#Left export AST#ERROR#Left class OperateTabs { src : Resource name : Resource AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class OperateTabs { src: Resource name: Resource constructor
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/MultiColumns/entry/src/main/ets/model/dataType.ets#L16-L20
695fb9bd6add91721c172ddac2c644e2afa102e4
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/sorting/BubbleSort.ets
arkts
optimizedSort
优化的冒泡排序算法 @param arr 需要排序的数组 @returns 排序后的数组
public static optimizedSort(arr: number[]): number[] { const n = arr.length; const result = [...arr]; for (let i = 0; i < n - 1; i++) { let swapped = false; for (let j = 0; j < n - i - 1; j++) { if (result[j] > result[j + 1]) { // 使用临时变量进行交换 const temp = r...
AST#method_declaration#Left public static optimizedSort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat...
public static optimizedSort(arr: number[]): number[] { const n = arr.length; const result = [...arr]; for (let i = 0; i < n - 1; i++) { let swapped = false; for (let j = 0; j < n - i - 1; j++) { if (result[j] > result[j + 1]) { const temp = result[j]; ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/BubbleSort.ets#L35-L59
a8c21eac821706093fad3dc2709ebead629a50c2
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.FoldSplitContainer.d.ets
arkts
Preset split ratio. @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare enum PresetSplitRatio { /** * 1:1 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ LAYOUT_1V1 = 1, /** * 2:3 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ LAYOUT_2V3 = ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PresetSplitRatio AST#enum_body#Left { /** * 1:1 * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#enum_member#Left LAYOUT_1V1 = AST#expression#Left 1 AST...
export declare enum PresetSplitRatio { LAYOUT_1V1 = 1, LAYOUT_2V3 = 0.6666666666666666, LAYOUT_3V2 = 1.5 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FoldSplitContainer.d.ets#L162-L187
06076880a73f302795bd45aec50b98b6fda1a0ae
gitee
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/types/SwipeCardTypes.ets
arkts
卡片点击回调函数类型 @param data - 卡片数据对象 @param index - 卡片在数组中的索引
export type OnCardClickedCallback = (data: object, index: number) => void;
AST#export_declaration#Left export AST#type_declaration#Left type OnCardClickedCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p...
export type OnCardClickedCallback = (data: object, index: number) => void;
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L57-L57
1d339aad6287518f74a6e583ac17d69d12502d42
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/PowerManagerUtil.ets
arkts
getPowerModeName
MODE_NORMAL 600 表示标准模式,默认值。 MODE_POWER_SAVE 601 表示省电模式。 MODE_PERFORMANCE 602 表示性能模式。 MODE_EXTREME_POWER_SAVE 603 表示超级省电模式。
static async getPowerModeName(): Promise<string> { let powerModeNames: Array<string> = await getStringArray($r('app.strarray.power_mode')) switch (power.getPowerMode()) { case PowerManagerUtil.powerModes[0]: return powerModeNames[0]; case PowerManagerUtil.powerModes[1]: return powerM...
AST#method_declaration#Left static async getPowerModeName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right >...
static async getPowerModeName(): Promise<string> { let powerModeNames: Array<string> = await getStringArray($r('app.strarray.power_mode')) switch (power.getPowerMode()) { case PowerManagerUtil.powerModes[0]: return powerModeNames[0]; case PowerManagerUtil.powerModes[1]: return powerM...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/PowerManagerUtil.ets#L49-L62
35c8c53f2160eb12d53c0d8ad36554335dc369f0
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/views/Sounds&NotificationsView.ets
arkts
snList
设置列表 item
@Builder snList(list_title: Resource, hapticList: SNListItemModel[]) { // 列表标题 Text(list_title) .width('100%') .textAlign(TextAlign.Start) .fontColor(Color.Gray) .fontSize(14) .fontWeight(FontWeight.Medium) .padding({ left: 12 }) .margin({ bottom: 8 }) // 列表 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right snList AST#parameter_list#Left ( AST#parameter#Left list_title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left hapticList : AST#type_annotation...
@Builder snList(list_title: Resource, hapticList: SNListItemModel[]) { Text(list_title) .width('100%') .textAlign(TextAlign.Start) .fontColor(Color.Gray) .fontSize(14) .fontWeight(FontWeight.Medium) .padding({ left: 12 }) .margin({ bottom: 8 }) List() { ...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/views/Sounds&NotificationsView.ets#L52-L206
e4b43fb9c5ec6518368e22a3b55deb467fba9c60
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets
arkts
sleep
睡眠
private sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)) }
AST#method_declaration#Left private sleep AST#parameter_list#Left ( AST#parameter#Left ms : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise...
private sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets#L87-L89
3489be7881737d7d34594cb11fb12bc6bce0513f
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/datastore/src/main/ets/datasource/token/TokenStoreDataSourceImpl.ets
arkts
getToken
读取 Token(默认返回空字符串) @returns {Promise<string>} Token
async getToken(): Promise<string> { const value: preferences.ValueType = await this.prefs.get(TokenStoreDataSourceImpl.KEY_TOKEN, ""); return typeof value === "string" ? value : ""; } /** * 清除 Token * @returns {Promise<void>} Promise<void> */ async clearToken(): Promise<void> { await this.pr...
AST#method_declaration#Left async getToken AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
async getToken(): Promise<string> { const value: preferences.ValueType = await this.prefs.get(TokenStoreDataSourceImpl.KEY_TOKEN, ""); return typeof value === "string" ? value : ""; } async clearToken(): Promise<void> { await this.prefs.remove(TokenStoreDataSourceImpl.KEY_TOKEN); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/datastore/src/main/ets/datasource/token/TokenStoreDataSourceImpl.ets#L46-L57
3983dee22ad14a8af8c20426da1f8992a7d458a0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initWxLogin
/配置微信登录
initWxLogin(want: Want){ /////////////////////////////////////////// ///获取appIdentifier,微信登录和微信支付需要用,需要配置在微信开放平台的appIdentifier,不是AppID, /// // (注意:不能使用自动签名:同一应用申请的debug profile或release profile中,appIdentifier一致。 // 注:如果debug启用IDE自动签名,那么appIdentifier为随机分配(此appIdentifier不可作为应用正式的身份标识),不同于应用正式profile中的a...
AST#method_declaration#Left initWxLogin AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { /////////////////////////////////////////// ///...
initWxLogin(want: Want){ 这是自动签名获取的:6918705225533654805,不对。 需要使用自己申请的debug或release时的profile,(release签名不能调试,所以只能用申请debug类型的profile) 6917579325076446931 6917592474741463583 WordTree QQ登录需要获取fingerPrint的md5 if (DebugFlg.isDebugMode()) { ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/entryability/EntryAbility.ets#L160-L190
fc0f53597d45585ee499265cf1e47737eacbacc5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
设置冲突接口
export interface SettingsConflict { key: string; localValue: string | number | boolean | Record<string, string | number | boolean>; remoteValue: string | number | boolean | Record<string, string | number | boolean>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SettingsConflict AST#object_type#Left { AST#type_member#Left key : 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 localValue : AST#type_annotat...
export interface SettingsConflict { key: string; localValue: string | number | boolean | Record<string, string | number | boolean>; remoteValue: string | number | boolean | Record<string, string | number | boolean>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L175-L179
71d0d6cfc8c7d342c6fb188a1a907f4d9113fe05
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets
arkts
GridObjectSortComponentOptions of GridObjectSortComponent. @interface GridEditOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 GridObjectSortComponentOptions of GridObjectSortComponent. @interface GridEditOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since ...
export interface GridObjectSortComponentOptions { /** * Configuration GridObjectSortComponent type. * @type { GridObjectSortComponentType } * @default GridObjectSortComponentType.TEXT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Configu...
AST#export_declaration#Left export AST#interface_declaration#Left interface GridObjectSortComponentOptions AST#object_type#Left { /** * Configuration GridObjectSortComponent type. * @type { GridObjectSortComponentType } * @default GridObjectSortComponentType.TEXT * @syscap SystemCapability.ArkUI.Ark...
export interface GridObjectSortComponentOptions { type?: GridObjectSortComponentType; imageSize?: number | Resource; normalTitle?: ResourceStr; editTitle?: ResourceStr; showAreaTitle?: ResourceStr; addAreaTitle?: ResourceStr; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets#L176-L275
06177787177c674bd4f5423af3e9e8a397c02bc2
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/scrollingCharts/data/Three.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 default class Three { public data: number[] = [ 0.0, //#0 1.2500000558793553E-4, //#1 0.0010000000447034842, //#2 0.0033750004023313683, //#3 0.008000000357627874, //#4 0.015625, //#5 0.027000003218650946, //#6 0.04287500876188338, //#7 0.06400001716613923, //#8 0.091125...
AST#export_declaration#Left export default AST#class_declaration#Left class Three AST#class_body#Left { AST#property_declaration#Left public data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AS...
export default class Three { public data: number[] = [ 0.0, 1.2500000558793553E-4, 0.0010000000447034842, 0.0033750004023313683, 0.008000000357627874, 0.015625, 0.027000003218650946, 0.04287500876188338, 0.06400001716613923, 0.09112502896786043, 0.1250000447034889...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/data/Three.ets#L16-L119
194cc894a650e8833c5421e2dd93f97d118ddf6b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM4.ets
arkts
encryptECBSync
加密(ECB模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|ECB|PKCS7、SM4_128|ECB|PKCS5、等)。 @returns
static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = 'SM4_128|ECB|PKCS7'): cryptoFramework.DataBlob { return SM4.encryptSync(data, symKey, null, transformation); }
AST#method_declaration#Left static encryptECBSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe...
static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = 'SM4_128|ECB|PKCS7'): cryptoFramework.DataBlob { return SM4.encryptSync(data, symKey, null, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L175-L178
10426dbad183b3188140d05ca3baa5ecddb76396
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
containsMonth
是否包含月
static containsMonth(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.YmdH || type == DateType.Ymd || type == DateType.Ym; }
AST#method_declaration#Left static containsMonth AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primar...
static containsMonth(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.YmdH || type == DateType.Ymd || type == DateType.Ym; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L76-L79
795379779bcdd3bc4231803a5d83da528e509734
gitee
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/23.@Builder自定义构建函数.ets
arkts
navItem
1. 全局builder
@Builder function navItem(icon: ResourceStr, txt: string) { Column({space: 10}) { Image(icon) .width('80%') Text(txt) } .width('25%') .onClick(() => { AlertDialog.show({ message: '点了' + txt }) }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function navItem AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left txt : AST#typ...
@Builder function navItem(icon: ResourceStr, txt: string) { Column({space: 10}) { Image(icon) .width('80%') Text(txt) } .width('25%') .onClick(() => { AlertDialog.show({ message: '点了' + txt }) }) }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/23.@Builder自定义构建函数.ets#L41-L54
f528c84cbba58161cfeb458528cd86f075027c42
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/AuthorizedButton/entry/src/main/ets/common/Component/TitleBar.ets
arkts
TitleBar
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct TitleBar { private title: Resource = $r('app.string.EntryAbility_label'); build() { Column() { Row() { Image($r('app.media.back')) .width(24) .height(24) .margin({ left: 24, top: 10 }) .objectFit(ImageFit.Contain) Text(this...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resou...
@Component export struct TitleBar { private title: Resource = $r('app.string.EntryAbility_label'); build() { Column() { Row() { Image($r('app.media.back')) .width(24) .height(24) .margin({ left: 24, top: 10 }) .objectFit(ImageFit.Contain) Text(this...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/AuthorizedButton/entry/src/main/ets/common/Component/TitleBar.ets#L16-L40
2e8d2a658286b0e3ab75f1808cebb6fb11856d36
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Wave/WaveView.ets
arkts
drawWaves
绘制双波纹效果(主波+次波叠加) @param width - 画布宽度 @param height - 画布高度
private drawWaves(width: number, height: number) { this.context.clearRect(0, 0, width, height); // 清空画布 // 绘制主波(浅蓝色半透明) this.context.fillStyle = 'rgba(135, 206, 250, 0.6)'; this.context.fill(this.buildWavePath(width, height)); // 绘制次波(相位偏移产生层次感) this.offsetX += Math.PI / 4; ...
AST#method_declaration#Left private drawWaves AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
private drawWaves(width: number, height: number) { this.context.clearRect(0, 0, width, height); this.context.fillStyle = 'rgba(135, 206, 250, 0.6)'; this.context.fill(this.buildWavePath(width, height)); this.offsetX += Math.PI / 4; this.context.fillStyle = 'rgba(173...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Wave/WaveView.ets#L66-L78
d881d5b5a114f80571cae9983851deaa29ac194f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/todo/TodoService.ets
arkts
initializeMockData
初始化模拟数据 (生产版本 - 清空测试数据)
private initializeMockData(): void { // 生产版本:清空所有测试数据,从空状态开始 this.todos = []; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initialized TodoService with empty todo list for production'); }
AST#method_declaration#Left private initializeMockData 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 AS...
private initializeMockData(): void { this.todos = []; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initialized TodoService with empty todo list for production'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L62-L67
4b2c40f8af3c5fded8e39912f36d5c5e79ee7cd5
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/Computed/computedLocal.ets
arkts
get
cannot trigger Computed
@Computed get fullName() { console.info('---------Computed----------'); this.computedLocalText += 1; return this.firstName + ' ' + this.lastName + this.age; }
AST#method_declaration#Left AST#decorator#Left @ Computed AST#decorator#Right get AST#ERROR#Left fullName AST#ERROR#Right 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_expres...
@Computed get fullName() { console.info('---------Computed----------'); this.computedLocalText += 1; return this.firstName + ' ' + this.lastName + this.age; }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/Computed/computedLocal.ets#L23-L28
c27dd3eb675f7ca104749c7c6382fd8234e760c2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets
arkts
subscribeCallback
订阅eventId为1234565的事件
subscribeCallback(): void { emitter.on(this.callbackEvent, () => { this.hideSubWindow(); }) }
AST#method_declaration#Left subscribeCallback 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#expres...
subscribeCallback(): void { emitter.on(this.callbackEvent, () => { this.hideSubWindow(); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets#L135-L139
1b0dbfdc05117be3326141a1880a12e062fb1865
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Dialog.d.ets
arkts
SelectDialog
Declare CustomDialog SelectDialog @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare CustomDialog SelectDialog @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare CustomDialog SelectDialog @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@CustomDialog export declare struct SelectDialog { /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.Ark...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SelectDialog AST#component_body#Left { /** * Sets the SelectDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @s...
@CustomDialog export declare struct SelectDialog { controller: CustomDialogController; title: ResourceStr; content?: ResourceStr; selectedIndex?: number; confirm?: ButtonOptions; radioContent: Array<SheetInfo>; theme?: Theme | CustomTheme; them...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Dialog.d.ets#L477-L631
4a2417b0b839ef159addae8e78b4bb424d2c6e4d
gitee
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets
arkts
notifyDataChange
通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件
notifyDataChange(index: number): void { Logger.debug('notifyDataChange: ' + index); this.listeners.forEach(listener => { listener.onDataChange(index); }) }
AST#method_declaration#Left notifyDataChange 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#R...
notifyDataChange(index: number): void { Logger.debug('notifyDataChange: ' + index); this.listeners.forEach(listener => { listener.onDataChange(index); }) }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets#L245-L250
7a9e11cccf4820170b14bc9c4a922c8e10f283e8
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/NetUtil.ets
arkts
createConnection
创建网络连接
private static createConnection() { // let netSpecifier: connection.NetSpecifier = { // netCapabilities: { // // 假设当前默认网络是WiFi,需要创建蜂窝网络连接,可指定网络类型为蜂窝网 // bearerTypes: [connection.NetBearType.BEARER_CELLULAR], // // 指定网络能力为Internet // networkCap: [connection.NetCap.NET_CAPABILITY...
AST#method_declaration#Left private static createConnection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // let netSpecifier: connection.NetSpecifier = { // netCapabilities: { // // 假设当前默认网络是WiFi,需要创建蜂窝网络连接,可指定网络类型为蜂窝网 // bearerTypes: [connection.NetBearType.BEARER_CELLULAR]...
private static createConnection() { return connection.createNetConnection(); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/NetUtil.ets#L39-L49
ce5e2fe2b9be7783c33224c4f733f4f0cdddba74
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoThumbListView.ets
arkts
VideoThumbListView
视频帧图片列表预览组件
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; scroller: Scroller = new Scroller(); build() { Column() { List({ space: 0, initialIndex: 0, scroller: this.scroller }) { // TODO: 性能知识点:使用ForEach组件循环渲染数据 ForEach(this.mVideoThumbOption.videoThumbs, ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoThumbListView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right mVideoThumbOption : AST#type_annotation#Left AST#primary_type#Left VideoThumbOption AST#primary_...
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; scroller: Scroller = new Scroller(); build() { Column() { List({ space: 0, initialIndex: 0, scroller: this.scroller }) { ForEach(this.mVideoThumbOption.videoThumbs, (item: ThumbContent, index?: num...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoThumbListView.ets#L20-L48
e12508d7cfc08c697d74f79379edc0144200d7c3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/model/ItemData.ets
arkts
ItemData
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Observed export class ItemData { id: string = ''; title: string | Resource = ''; content: string = ''; from: string | Resource = ''; tail: string | Resource = ''; type: number = 0; pics: Resource[] = []; preview: Resource | string = ''; duration: string = ''; isShowTitle?: Visibility = Visibility.H...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ItemData AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AS...
@Observed export class ItemData { id: string = ''; title: string | Resource = ''; content: string = ''; from: string | Resource = ''; tail: string | Resource = ''; type: number = 0; pics: Resource[] = []; preview: Resource | string = ''; duration: string = ''; isShowTitle?: Visibility = Visibility.H...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/model/ItemData.ets#L16-L33
9087113371ef2542463017d18cb8f9867cee894e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SubHeader.d.ets
arkts
Control style of operation element @enum { OperationStyle } @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Control style of operation element @enum { OperationStyle } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Control style of operation element @enum { OperationStyle } @syscap SystemCap...
export declare enum OperationType { /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * The TextArrow style. * @syscap SystemCapability.Ar...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum OperationType AST#enum_body#Left { /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The TextArrow style. * @syscap SystemCapability.ArkUI.ArkUI.Full * ...
export declare enum OperationType { TEXT_ARROW = 0, BUTTON = 1, ICON_GROUP = 2, LOADING = 3 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeader.d.ets#L45-L125
0e9332311734f0b4f057ded25768587f2cad7716
gitee