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
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets
arkts
saveImgToFile
图片落盘 @param img 源文件 @param path 路径 @returns PixelMap
async function saveImgToFile(img: image.PixelMap, path: string): Promise<string> { const file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); // 创建ImagePacker实例 const imagePackerApi = image.createImagePacker(); /** * 设置打包参数 * format:图片打包格式,只支持 jpg 和 webp * quality:JPEG...
AST#function_declaration#Left async function saveImgToFile AST#parameter_list#Left ( AST#parameter#Left img : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left path : ...
async function saveImgToFile(img: image.PixelMap, path: string): Promise<string> { const file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); const imagePackerApi = image.createImagePacker(); let fullBuffer: ArrayBuffer = await imagePackerApi.packing(img, { format: 'ima...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets#L274-L293
1dbfaef0308f08a9ba45ff48c3794dc62cb927e3
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Sets the continuability (?) of current page. @param context @param con
export function set_continuable(context: common.UIAbilityContext, con: boolean) { // console.log('[set_continuable] ' + con); let state = con ? AbilityConstant.ContinueState.ACTIVE : AbilityConstant.ContinueState.INACTIVE; context.setMissionContinueState(state).catch((e: BusinessError) => { console.error('[se...
AST#export_declaration#Left export AST#function_declaration#Left function set_continuable AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#...
export function set_continuable(context: common.UIAbilityContext, con: boolean) { let state = con ? AbilityConstant.ContinueState.ACTIVE : AbilityConstant.ContinueState.INACTIVE; context.setMissionContinueState(state).catch((e: BusinessError) => { console.error('[set_continuable] Failed: ' + JSON.stringify(e...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L140-L146
aee94c24897a81cca32a37a2f3a00c2c7f8da485
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets
arkts
startListening
开始识别
private startListening() { // 设置开始识别的相关参数 let recognizerParams: speechRecognizer.StartParams = { sessionId: this.sessionId, audioInfo: { audioType: 'pcm', sampleRate: 16000, soundChannel: 1, sampleBit: 16 } } // 调用开始识别方法 asrEngine.startListening(recognizerParams) }
AST#method_declaration#Left private startListening AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 设置开始识别的相关参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left recognizerParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left sp...
private startListening() { let recognizerParams: speechRecognizer.StartParams = { sessionId: this.sessionId, audioInfo: { audioType: 'pcm', sampleRate: 16000, soundChannel: 1, sampleBit: 16 } } asrEngine.startListening(recognizerParams) }
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#L68-L76
6e285e3d6ff9e64d56a04d5aabeb95aad19df6f7
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/RSA.ets
arkts
encryptSync
加密,同步 @param data 加密或者解密的数据。data不能为null。 @param pubKey 指定加密公钥。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(RSA1024|PKCS1、RSA2048|PKCS1、等)。 @returns
static encryptSync(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1'): cryptoFramework.DataBlob { return CryptoUtil.encryptSync(data, pubKey, null, transformation); }
AST#method_declaration#Left static encryptSync 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 pubKey :...
static encryptSync(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1'): cryptoFramework.DataBlob { return CryptoUtil.encryptSync(data, pubKey, null, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L46-L49
b1026a21176c7cc76edef5af1f48a99112096de6
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets
arkts
索引
export const titleEn = "item1";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left titleEn = AST#expression#Left "item1" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const titleEn = "item1";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L22-L22
a31067914372811a2904ac5d825b33111f6a36c2
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/IPopoverTargetDialogOptions.ets
arkts
目标组件旁弹窗参数配置 TODO: 待实现
export interface IPopoverTargetDialogOptions extends IBaseDialogOptions { /** * 目标组件id */ componentId: string; /** * 点击区域是否自动关闭 * @default 默认值:true。 */ actionCancel?: boolean; /** * 位于目标组件位置(可选目标下发、左侧、右侧等) * @default 默认为目标组件下方 Placement.Bottom */ placement?: Placement; /** *...
AST#export_declaration#Left export AST#interface_declaration#Left interface IPopoverTargetDialogOptions AST#extends_clause#Left extends IBaseDialogOptions AST#extends_clause#Right AST#object_type#Left { /** * 目标组件id */ AST#type_member#Left componentId : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
export interface IPopoverTargetDialogOptions extends IBaseDialogOptions { componentId: string; actionCancel?: boolean; placement?: Placement; customContent?: IGuideCustomContentOptions; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/IPopoverTargetDialogOptions.ets#L7-L33
fac51bda4655555d30925bf16a9dac898c7941f7
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets
arkts
isNeedUpdateForMeta
/ 比较本地保存的更新时间和服务器上的更新时间,判断是否需要更新
public async isNeedUpdateForMeta(info: CMetaInfo): Promise<boolean> { const savedStr = await this.getUpdateDateFromSavedMeta(info); const updateDateStr = info.updateDate; if (savedStr && updateDateStr) { const savedDate = DateUtils.toDateFromUTC(savedStr); const updateDate = DateUtils.toD...
AST#method_declaration#Left public async isNeedUpdateForMeta AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left CMetaInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g...
public async isNeedUpdateForMeta(info: CMetaInfo): Promise<boolean> { const savedStr = await this.getUpdateDateFromSavedMeta(info); const updateDateStr = info.updateDate; if (savedStr && updateDateStr) { const savedDate = DateUtils.toDateFromUTC(savedStr); const updateDate = DateUtils.toD...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets#L25-L47
19260ffc84eb0d13c8597b7bec6a00c47c11d27d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets
arkts
get
Get data in PreferencesHandler. @param key string @param defValue any @return data about key
public async get(key: string) { let data: string = ''; if (this.preferences != null) { data = await this.preferences.get(key, this.defaultValue) as string; } return data; }
AST#method_declaration#Left public async get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef...
public async get(key: string) { let data: string = ''; if (this.preferences != null) { data = await this.preferences.get(key, this.defaultValue) as string; } return data; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets#L79-L85
0cdd2fa9b1b3be2b5492a662654e7ee95f9f760f
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.utils.d.ets
arkts
lockAsync
Perform an operation with the acquired lock exclusively. The method acquires the lock first, then calls the callback, and then releases the lock. The callback is called asynchronously in the same thread where lockAsync was called. @param { AsyncLockCallback<T> } callback - function to call when the lock gets acquired....
lockAsync<T>(callback: AsyncLockCallback<T>): Promise<T>;
AST#method_declaration#Left lockAsync AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AsyncLockCallback AST#type_arguments#Left < AST#typ...
lockAsync<T>(callback: AsyncLockCallback<T>): Promise<T>;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L203-L203
7614739998f3c48ed9288b63b0416bbb23f6ffaf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SavePictureFromWeb.ets
arkts
SavePictureFromWeb
弹窗出现持续时间 实现步骤: 1. 长按图片获取图片链接。 2. 使用request.download将图片下载到沙箱路径。 3. 使用phAccessHelper.showAssetsCreationDialog获取将图片写入相册的权限,将沙箱路径下的图片转为buffer,写入路径。
@Component export struct SavePictureFromWeb { controller: webview.WebviewController = new webview.WebviewController(); @State imageUrl: string = ''; // web上的图片链接 @State showMenu: boolean = false; // 控制bindPopup是否显示 private context = getContext(this) as common.UIAbilityContext; /** * 下载图片到沙箱路径,并且保存到相册 *...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SavePictureFromWeb AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#p...
@Component export struct SavePictureFromWeb { controller: webview.WebviewController = new webview.WebviewController(); @State imageUrl: string = ''; @State showMenu: boolean = false; private context = getContext(this) as common.UIAbilityContext; downloadImage() { let filesDir = this.context.fil...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SavePictureFromWeb.ets#L35-L189
f07383b4941a4823fe8a770cb2f75a057dfa6991
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
calculateTimeStats
计算时间维度统计
private calculateTimeStats(): TimeStats { const allTasks = this.tasks; const completedTasks = this.getCompletedTasks(); const now = new Date(); let totalFocusTime = 0; let totalPomodoroCount = 0; const dailyFocusTime: number[] = new Array(7).fill(0); // 近7天 const hourlyCompletions: number[]...
AST#method_declaration#Left private calculateTimeStats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TimeStats AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarato...
private calculateTimeStats(): TimeStats { const allTasks = this.tasks; const completedTasks = this.getCompletedTasks(); const now = new Date(); let totalFocusTime = 0; let totalPomodoroCount = 0; const dailyFocusTime: number[] = new Array(7).fill(0); const hourlyCompletions: number[] = new...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L520-L581
21cb7a65e258a1c64874af133d8212a49f3a515f
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/utils/Utils.ets
arkts
格式化日期和星期的函数
export function weekDateFormat(timestamp: number) { let tempDate = new Date(timestamp); return dateFormat(tempDate) + WEEK + WEEK_TITLES[tempDate.getDay()]; }
AST#export_declaration#Left export AST#function_declaration#Left function weekDateFormat AST#parameter_list#Left ( AST#parameter#Left timestamp : 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...
export function weekDateFormat(timestamp: number) { let tempDate = new Date(timestamp); return dateFormat(tempDate) + WEEK + WEEK_TITLES[tempDate.getDay()]; }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/utils/Utils.ets#L32-L35
9cda464ad0742d4af314af7fa68a1f6505b080fc
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
createCameraInputFn
Creates a cameraInput output object
createCameraInputFn(cameraManager: camera.CameraManager, cameraDevice: camera.CameraDevice): camera.CameraInput | undefined { Logger.info(TAG, 'createCameraInputFn is called.'); let cameraInput: camera.CameraInput; try { cameraInput = cameraManager.createCameraInput(cameraDevice); Logger.inf...
AST#method_declaration#Left createCameraInputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ca...
createCameraInputFn(cameraManager: camera.CameraManager, cameraDevice: camera.CameraDevice): camera.CameraInput | undefined { Logger.info(TAG, 'createCameraInputFn is called.'); let cameraInput: camera.CameraInput; try { cameraInput = cameraManager.createCameraInput(cameraDevice); Logger.inf...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L402-L415
6ed84ebd1ec3394bd5eb5b3c528be981d9293378
gitee
Million-mo/tree-sitter-arkts.git
2fd0ad75e2d848709edcf4be038f27b178114ef6
examples/decorators_complete.ets
arkts
fancyText
@Extend - 扩展原生组件样式
@Extend(Text) function fancyText(color: Color) { .fontColor(color) .fontSize(18) .fontWeight(FontWeight.Bold) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function fancyText AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right AST#para...
@Extend(Text) function fancyText(color: Color) { .fontColor(color) .fontSize(18) .fontWeight(FontWeight.Bold) }
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/decorators_complete.ets#L157-L162
a64b9bc51578200ed6b56a71011a9a47ffd9cc31
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets
arkts
buildContent
构建页面内容
@Builder buildContent() { Scroll() { Column({ space: 16 }) { // 基本信息卡片 this.buildBasicInfoCard() // 生日信息卡片 this.buildBirthdayInfoCard() // 联系方式卡片 this.buildContactInfoCard() // 备注信息卡片 if (this.contact!.notes) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContent 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 Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_ele...
@Builder buildContent() { Scroll() { Column({ space: 16 }) { this.buildBasicInfoCard() this.buildBirthdayInfoCard() this.buildContactInfoCard() if (this.contact!.notes) { this.buildNotesCard() } ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L154-L182
bffccfc791f3cdff53df22115de249f24b492548
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets
arkts
previewWindow
截图后的预览窗口。
@Builder previewWindow() { Stack({ alignContent: Alignment.Bottom }) { // 预览图片小窗 this.previewSnapshot(); // 保存按钮,预览大图时才显示 this.buttonBar(); } .width(this.snapPopupWidth) .height(this.snapPopupHeight) .position(this.snapPopupPosition) .border({ width: Constants.BOR...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right previewWindow 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 Stack ( AST#component_parameters#Left { AST#component_parame...
@Builder previewWindow() { Stack({ alignContent: Alignment.Bottom }) { this.previewSnapshot(); this.buttonBar(); } .width(this.snapPopupWidth) .height(this.snapPopupHeight) .position(this.snapPopupPosition) .border({ width: Constants.BORDER_WIDTH, color: C...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L100-L147
4f3403111ca8c934abf18204a84e79a6f1f6b69d
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets
arkts
getString
/ 取 String
public static getString(key: string): string | null { return PreferencesUtil.getStringSync(key) }
AST#method_declaration#Left public static getString AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Lef...
public static getString(key: string): string | null { return PreferencesUtil.getStringSync(key) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L88-L90
590d8e9376c6bd15922e034a720a21c0a83a7f2c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/servercfg/ServerCfgManager.ets
arkts
=== ServerCfgManager 管理器 ===
export class ServerCfgManager { // 获取所有 ServerCfg static loadServerCfgs(completion: (success: boolean, msg: string | null, cfgs: ServerCfg[] | null) => void): void { const params: HttpUtils.HttpParams = {} const url = Servers.getRouteUrl(Route.servercfg) Http.request(url, HttpUtils.Method.GET, params,...
AST#export_declaration#Left export AST#class_declaration#Left class ServerCfgManager AST#class_body#Left { // 获取所有 ServerCfg AST#method_declaration#Left static loadServerCfgs AST#parameter_list#Left ( AST#parameter#Left completion : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter...
export class ServerCfgManager { static loadServerCfgs(completion: (success: boolean, msg: string | null, cfgs: ServerCfg[] | null) => void): void { const params: HttpUtils.HttpParams = {} const url = Servers.getRouteUrl(Route.servercfg) Http.request(url, HttpUtils.Method.GET, params, (succeed: boolea...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/servercfg/ServerCfgManager.ets#L28-L72
89074903daa85538652e7dc67dd29579d4cea4a4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/model/AttributeModifier.ets
arkts
GridItemModifier
声明GridItem动态属性
@Observed export class GridItemModifier implements AttributeModifier<GridItemAttribute> { public offsetX: number = 0; public offsetY: number = 0; public opacity: number = 1; /** * 定义组件普通状态时的样式 * @param instance */ applyNormalAttribute(instance: GridItemAttribute): void { instance.translate({ x: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class GridItemModifier AST#implements_clause#Left implements AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GridItemAttribute AST#primary_type#Right AST#type_a...
@Observed export class GridItemModifier implements AttributeModifier<GridItemAttribute> { public offsetX: number = 0; public offsetY: number = 0; public opacity: number = 1; applyNormalAttribute(instance: GridItemAttribute): void { instance.translate({ x: this.offsetX, y: this.offsetY }); instance.o...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/AttributeModifier.ets#L21-L35
cf7e83604a29961939754a29b1ad4a70dfb5f7e3
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets
arkts
signSegmentSync
对数据进行分段签名,同步 @param data 待签名数据 @param priKey 私钥 @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、、等)。 @param len 自定义的数据拆分长度。 @returns
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): cryptoFramework.DataBlob { let signer = cryptoFramework.createSign(algName); signer.initSync(priKey); for (let i = 0; i < data.length; i += len) { let updateData = data.subarray(i, i + len); l...
AST#method_declaration#Left static signSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified...
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): cryptoFramework.DataBlob { let signer = cryptoFramework.createSign(algName); signer.initSync(priKey); for (let i = 0; i < data.length; i += len) { let updateData = data.subarray(i, i + len); l...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets#L374-L385
a75dd75d4b0b5ce3a3ad0799fc094d3ca66848e5
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/ListSample/entry/src/main/ets/viewmodel/PageViewModel.ets
arkts
getListDataSource
Get data sources required by the LazyForEach interface. @return {ListDataSource} new ListDataSource(listItems)
getListDataSource(): ListDataSource { let listItems: Array<ListItemData> = []; for (let i = 0; i < CommonConstants.LIST_SIZE; i++) { let itemInfo: ListItemData = new ListItemData(); itemInfo.image = $r("app.media.ic_normal"); itemInfo.title = $r('app.string.list_item_title'); itemInfo.su...
AST#method_declaration#Left getListDataSource AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ListDataSource AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left...
getListDataSource(): ListDataSource { let listItems: Array<ListItemData> = []; for (let i = 0; i < CommonConstants.LIST_SIZE; i++) { let itemInfo: ListItemData = new ListItemData(); itemInfo.image = $r("app.media.ic_normal"); itemInfo.title = $r('app.string.list_item_title'); itemInfo.su...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/ListSample/entry/src/main/ets/viewmodel/PageViewModel.ets#L15-L27
5901fddb79fdc2609876f2f4c6c4f076c28a6016
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/src/main/ets/mock/RequestData.ets
arkts
getTypeIcon
获取天气类型对应的icon
function getTypeIcon(data: string) { switch (data) { case '晴': return $r('app.media.ic_weather_sunny'); case 'Sunny': return $r('app.media.ic_weather_sunny'); case 'Cloudy': return $r('app.media.ic_weather_cloudy'); case '多云': return $r('app.media.ic_weather_cloudy'); case...
AST#function_declaration#Left function getTypeIcon AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statem...
function getTypeIcon(data: string) { switch (data) { case '晴': return $r('app.media.ic_weather_sunny'); case 'Sunny': return $r('app.media.ic_weather_sunny'); case 'Cloudy': return $r('app.media.ic_weather_cloudy'); case '多云': return $r('app.media.ic_weather_cloudy'); case...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/mock/RequestData.ets#L29-L60
d199c5749854e04dc1a91587f226ce652415bcb9
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
accessBackward
Checks whether the web page can go back. @returns { boolean } True if the web page can go back else false. @throws { BusinessError } 17100001 - Init error. The AtomicServiceWebController must be associated with a AtomicServiceWeb component. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
accessBackward(): boolean;
AST#method_declaration#Left accessBackward AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
accessBackward(): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L438-L438
0aed9483dcec3561632656bfa08a20ee098ca31d
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets
arkts
loadPostDetails
加载帖子详情
async loadPostDetails() { try { this.isLoading = true; // 调用API获取帖子详情 const postDetails = await ApiService.getPostById(this.post.id); console.info('获取帖子详情成功:', JSON.stringify(postDetails)); if (postDetails) { // 更新帖子信息 let updatedPost: Post = { i...
AST#method_declaration#Left async loadPostDetails AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expres...
async loadPostDetails() { try { this.isLoading = true; const postDetails = await ApiService.getPostById(this.post.id); console.info('获取帖子详情成功:', JSON.stringify(postDetails)); if (postDetails) { let updatedPost: Post = { id: this.post.id, ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets#L159-L224
c71af35441cd933de69d367cd167e53ab0a450ae
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/efRcpConfig.ets
arkts
readClientCerts
读取证书内容 @param certPath 证书地址需要为沙箱环境地址 @returns 证书字符串
static readClientCerts(certPath: string): string { //读取文件内容 let file = fileIo.openSync(certPath, fileIo.OpenMode.READ_ONLY); //读取文件大小 let info = fileIo.statSync(file.fd); //创建buffer对象 let buffer = new ArrayBuffer(info.size); //读取证书内容 let readLen = fileIo.readSync(file.fd,...
AST#method_declaration#Left static readClientCerts AST#parameter_list#Left ( AST#parameter#Left certPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
static readClientCerts(certPath: string): string { let file = fileIo.openSync(certPath, fileIo.OpenMode.READ_ONLY); let info = fileIo.statSync(file.fd); let buffer = new ArrayBuffer(info.size); let readLen = fileIo.readSync(file.fd, buffer); let content =...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L169-L184
bf90553e4a80fe6c025d02c99b6cd2db267757d7
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/StorageUtils.ets
arkts
init
初始化存储
static async init(context: Context): Promise<void> { try { StorageUtils.dataPreferences = await preferences.getPreferences(context, StorageUtils.PREFERENCES_NAME); } catch (error) { console.error('Failed to initialize preferences:', error); } }
AST#method_declaration#Left static async init 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
static async init(context: Context): Promise<void> { try { StorageUtils.dataPreferences = await preferences.getPreferences(context, StorageUtils.PREFERENCES_NAME); } catch (error) { console.error('Failed to initialize preferences:', error); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L11-L17
d157117c148caa3736212979272e7166d4b40aa3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
subtractDays
减去天数从日期 @param date 原始日期 @param days 要减去的天数 @returns 新的日期
static subtractDays(date: string | Date, days: number): Date { return DateUtils.addDays(date, -days); }
AST#method_declaration#Left static subtractDays AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AS...
static subtractDays(date: string | Date, days: number): Date { return DateUtils.addDays(date, -days); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L364-L366
e604ff16872970feff08280c40512a3455c65878
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
modifier
该页面的动画转场所需要的modifier,也可以自己传进去 @param component @param modifier @returns
public modifier(component: object, modifier?: NavAnimationModifier): NavAnimationModifier { return NavAnimationStore.getInstance().modifier(component, modifier) }
AST#method_declaration#Left public modifier AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left modifier ? : AST#type_annotation#Left AST#primary_type#Left NavAnimationMod...
public modifier(component: object, modifier?: NavAnimationModifier): NavAnimationModifier { return NavAnimationStore.getInstance().modifier(component, modifier) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L64-L66
9cd95be4e5d1d758333696a07a4aa51b5331abbc
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets
arkts
hasNotificationId
hasNotificationId
function hasNotificationId(params: number) { if (!params) { Logger.error(Const.REMINDER_AGENT_TAG, 'hasNotificationId params is undefined'); return; } return reminderAgent.getValidReminders().then((reminders) => { if (!reminders.length) { return false; } let notificationIdList: Array<num...
AST#function_declaration#Left function hasNotificationId AST#parameter_list#Left ( AST#parameter#Left params : 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#if_statem...
function hasNotificationId(params: number) { if (!params) { Logger.error(Const.REMINDER_AGENT_TAG, 'hasNotificationId params is undefined'); return; } return reminderAgent.getValidReminders().then((reminders) => { if (!reminders.length) { return false; } let notificationIdList: Array<num...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets#L70-L90
3005938cf4217a0d2d7bc2af5aade8f7a6fdaa8b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/features/musicComment/src/main/ets/viewmodel/CommentViewModel.ets
arkts
getWonderfulReview
Get great review data. @returns Comment array.
getWonderfulReview(): Comment[] { let commentList: Comment[] = []; commentList.push( new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar1'))); commentList.push(new Comment('ke歌可Qi', '单曲循环到天明', '2021年9月4日', $r('app.media.ic_avatar2'))); commentList.push( new C...
AST#method_declaration#Left getWonderfulReview AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaratio...
getWonderfulReview(): Comment[] { let commentList: Comment[] = []; commentList.push( new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar1'))); commentList.push(new Comment('ke歌可Qi', '单曲循环到天明', '2021年9月4日', $r('app.media.ic_avatar2'))); commentList.push( new C...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/musicComment/src/main/ets/viewmodel/CommentViewModel.ets#L27-L45
287242fb1981aa2ae27bbec91600953784aa9d63
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/BasicDataSource.ets
arkts
朋友圈用户数据
export class FriendMoment { id: string; // 唯一id userName: string; // 用户名 avatar: ResourceStr; // 头像 text: string; // 文字 image?: ResourceStr; // 发布动态图片 video?: ResourceStr; // 发布动态视频 constructor(id: string, userName: string, avatar: ResourceStr, text: string, image?: ResourceStr, video?: ResourceStr) ...
AST#export_declaration#Left export AST#class_declaration#Left class FriendMoment 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#property_declaration#Right // 唯一id AST#property_declaration#Left userName...
export class FriendMoment { id: string; userName: string; avatar: ResourceStr; text: string; image?: ResourceStr; video?: ResourceStr; constructor(id: string, userName: string, avatar: ResourceStr, text: string, image?: ResourceStr, video?: ResourceStr) { this.id = id; this.userName = u...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/BasicDataSource.ets#L74-L96
0e397bd79f3c0f0069b0948f92431bd4d66d918d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationManagementUtil.ets
arkts
cancelNotificationType
Cancel notifications of this type.
cancelNotificationType(typeId: number) { this.typeNotifications[typeId].forEach(item => { notificationManager.cancel(item.id); }) }
AST#method_declaration#Left cancelNotificationType AST#parameter_list#Left ( AST#parameter#Left typeId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AS...
cancelNotificationType(typeId: number) { this.typeNotifications[typeId].forEach(item => { notificationManager.cancel(item.id); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationManagementUtil.ets#L54-L58
27fcafeb8bf9cb5dc43d3f027c031a42c639c9d9
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxGroupCustom.ets
arkts
CheckboxGroupCustomBuilder
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...
@Builder export function CheckboxGroupCustomBuilder(name: string, param: Object) { CheckboxGroupCustomExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CheckboxGroupCustomBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter...
@Builder export function CheckboxGroupCustomBuilder(name: string, param: Object) { CheckboxGroupCustomExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/checkbox/checkboxGroupCustom.ets#L16-L19
d78084925002fc0c99a536b54ae8fd1d054d1c16
gitee
conrad_sheeran/TickAuth
8ef852e12999d15cf70394cdab82d08ac5843143
features/homepage/src/main/ets/model/TOTPModel.ets
arkts
Copyright (c) 2024 Yang He TickAuth is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be...
export class SecretClass { type: string = ""; alias: string = ""; secret: string = ""; digit: number = 6; timeStep: number = 30; algorithm: string = "SHA1"; constructor(type: string, alias: string, secret: string, digit: number, timeStep: number, algorithm: string) { this.type = type; this.alias ...
AST#export_declaration#Left export AST#class_declaration#Left class SecretClass AST#class_body#Left { AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right...
export class SecretClass { type: string = ""; alias: string = ""; secret: string = ""; digit: number = 6; timeStep: number = 30; algorithm: string = "SHA1"; constructor(type: string, alias: string, secret: string, digit: number, timeStep: number, algorithm: string) { this.type = type; this.alias ...
https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/homepage/src/main/ets/model/TOTPModel.ets#L18-L34
595af915e566bf0df7e65a0179a10db85ff99f1d
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
verify
验签 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey SM2公钥 @returns 验签结果,其中Msg为验签结果
static async verify(signStr: string, verifyStr: string, pubKey: string): Promise<string> { return CryptoUtil.verify(signStr, verifyStr, pubKey, 'SM2_256', 'SM2_256|SM3', 256); }
AST#method_declaration#Left static async verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
static async verify(signStr: string, verifyStr: string, pubKey: string): Promise<string> { return CryptoUtil.verify(signStr, verifyStr, pubKey, 'SM2_256', 'SM2_256|SM3', 256); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L71-L73
7605231cd8ca67bc2c3b9fba4d9edd4cbcd7da30
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/Screenshot/Feature/src/main/ets/components/utils/Screenshot.ets
arkts
屏幕截图 默认参数screenshotOptions为空时 截全屏
export function getScreenshot(screenshotOption = {}) { return screenshot.save(screenshotOption) }
AST#export_declaration#Left export AST#function_declaration#Left function getScreenshot AST#parameter_list#Left ( AST#parameter#Left screenshotOption = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ...
export function getScreenshot(screenshotOption = {}) { return screenshot.save(screenshotOption) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Screenshot/Feature/src/main/ets/components/utils/Screenshot.ets#L21-L23
af924113e0a45465c8beac5ab3bd3754da8d79a2
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ApplicationModels/StageModel/entry/src/main/ets/pages/component/IndexTitleBar.ets
arkts
IndexTitleBar
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...
@Component export struct IndexTitleBar { private textName?: string | Resource; build() { Row() { Text(this.textName) .fontSize(24) } .height('8%') .width('100%') .justifyContent(FlexAlign.Center) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct IndexTitleBar AST#component_body#Left { AST#property_declaration#Left private textName ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resou...
@Component export struct IndexTitleBar { private textName?: string | Resource; build() { Row() { Text(this.textName) .fontSize(24) } .height('8%') .width('100%') .justifyContent(FlexAlign.Center) } }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ApplicationModels/StageModel/entry/src/main/ets/pages/component/IndexTitleBar.ets#L16-L29
4447b88b31b70461d1eb8d084cceaa3dfaad13a8
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
TODO 类型检查工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/06/14
export class TypeUtil { /** * 判断是否是Boolean类型 */ static isBoolean(value: Object): boolean { return typeof value === 'boolean'; } /** * 判断是否是Number类型 */ static isNumber(value: Any): boolean { return typeof value === 'number'; } /** * 判断是否是String类型 */ static isString(value: An...
AST#export_declaration#Left export AST#class_declaration#Left class TypeUtil AST#class_body#Left { /** * 判断是否是Boolean类型 */ AST#method_declaration#Left static isBoolean AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotat...
export class TypeUtil { static isBoolean(value: Object): boolean { return typeof value === 'boolean'; } static isNumber(value: Any): boolean { return typeof value === 'number'; } static isString(value: Any): boolean { return typeof value === 'string'; } static isObject(value: ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L27-L304
f43977407e137e990501770c544fbf10163c3e37
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index_lite.ets
arkts
index_from_history_month_file
Index from history file. @param path the path of history file, for example, 'history/history_2002_12.txt'. @param context_filesDir getContext().filesDir.
static index_from_history_month_file(year: number, month: number, context_filesDir: string) { // Set year and month bunch_of_history_index_lite.this_year = year; bunch_of_history_index_lite.this_month = month; // Open the file let path = history_path_of_month(year, month); let imp = sandbox_rea...
AST#method_declaration#Left static index_from_history_month_file AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left numb...
static index_from_history_month_file(year: number, month: number, context_filesDir: string) { bunch_of_history_index_lite.this_year = year; bunch_of_history_index_lite.this_month = month; let path = history_path_of_month(year, month); let imp = sandbox_read_text_sync(path, context_filesDir); ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L37-L63
38166fe496d6db74df71e50274413a92d89bdf16
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading/entry/src/main/ets/managers/write.ets
arkts
定义并发函数,内部密集调用I/O能力 写入文件的实现
export async function write(data: string, filePath: string): Promise<void> { let file: fileIo.File = await fileIo.open(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); await fileIo.write(file.fd, data); fileIo.close(file); }
AST#export_declaration#Left export AST#function_declaration#Left async function write AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filePath : AST#type_annotation#Left AS...
export async function write(data: string, filePath: string): Promise<void> { let file: fileIo.File = await fileIo.open(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); await fileIo.write(file.fd, data); fileIo.close(file); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading/entry/src/main/ets/managers/write.ets#L21-L25
0c98220c2484dbbb4ae0b6340eca0050bc9046fc
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
getTextColor
Returns the text color that is set for the labels. @return
public getTextColor(): Color | string | number | Resource { return this.mTextColor; }
AST#method_declaration#Left public getTextColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Color AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary...
public getTextColor(): Color | string | number | Resource { return this.mTextColor; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L154-L156
0be02ea1e7193e121d62f49e197499a3a4ee5783
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
getResourceString
Obtains the character string corresponding to the specified resource ID. @param resource resource.
getResourceString(resource: Resource): string { if (CheckEmptyUtils.isEmptyObj(resource)) { Logger.error('[DrawModel][getResourceString] resource is empty.') return ''; } let resourceString: string = ''; try { resourceString = getContext(this).resourceManager.getStringSync(resource.id)...
AST#method_declaration#Left getResourceString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
getResourceString(resource: Resource): string { if (CheckEmptyUtils.isEmptyObj(resource)) { Logger.error('[DrawModel][getResourceString] resource is empty.') return ''; } let resourceString: string = ''; try { resourceString = getContext(this).resourceManager.getStringSync(resource.id)...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets#L191-L203
e97d1d0146964da050d30c3f724b7255bc0c7f0a
gitee
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/pages/component/FiveDayMinuteKLineComponent.ets
arkts
FiveDayMinuteKLineComponent
五日分钟线 五日分钟线,一共有五列。每一列,都是当天的所有数据。(有的股票软 件是以五分钟为一组,我们这里显示当天的所有数据) 每一列画出的当天的分时图,跟 MinuteLineComponent 组件的绘制逻辑 大致相同。
@Component export struct FiveDayMinuteKLineComponent { @Prop fiveDayData: FiveDayData = new FiveDayData() //五日分钟线的数据 private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private canvasDrawMargin: n...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FiveDayMinuteKLineComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right fiveDayData : AST#type_annotation#Left AST#primary_type#Left FiveDayData AST#primary_ty...
@Component export struct FiveDayMinuteKLineComponent { @Prop fiveDayData: FiveDayData = new FiveDayData() private settings: RenderingContextSettings = new RenderingContextSettings(true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private canvasDrawMargin: number = 20...
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/FiveDayMinuteKLineComponent.ets#L11-L153
3783cdd01d3b813dc9d93ff22eb8b0355042f67e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets
arkts
checkUserData
Verify the user name and password. @returns
checkUserData() { // Check whether the account or password is empty. if (this.username === '' || this.password === '') { PromptUtil.promptMessage($r('app.string.message_input_empty'), CommonConstants.PROMPT_TIME); return false; } // RegExp for matching username. let namePattern: RegExp =...
AST#method_declaration#Left checkUserData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // Check whether the account or password is empty. AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
checkUserData() { if (this.username === '' || this.password === '') { PromptUtil.promptMessage($r('app.string.message_input_empty'), CommonConstants.PROMPT_TIME); return false; } let namePattern: RegExp = CommonConstants.REGEXP_NAME; if (!namePattern.exec(this.username)) { Pr...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets#L147-L166
eec7ce5b38f4a2742309bdc0b8fe453db189b2f6
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/timer/TimerComponent.ets
arkts
TimerComponent
计时器界面
@Component export struct TimerComponent { // 倒计时总时长(秒),用于递减模式 @Prop totalSeconds: number = 60; @Link showTimerDialog: boolean; @Link isTimerShow: boolean; @State statusPrompt: string = ''; // 当前时间(秒) @State currentSeconds: number = 0; // 倒计时状态 @State isRunning: boolean = false; // 模式:true为递增,false为递...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TimerComponent AST#component_body#Left { // 倒计时总时长(秒),用于递减模式 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right totalSeconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
@Component export struct TimerComponent { @Prop totalSeconds: number = 60; @Link showTimerDialog: boolean; @Link isTimerShow: boolean; @State statusPrompt: string = ''; @State currentSeconds: number = 0; @State isRunning: boolean = false; @State isIncrementing: boolean = false; @State isP...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L7-L406
f8c7740b814b42770ad71d1a0d5e893b899ff9b2
gitee
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
time_bar/src/main/ets/components/interface/TimePickedCallback.ets
arkts
Callbacks for timeline dragging and auto-scrolling.
export interface TimePickedCallback { /** * Invoked when the time bar is being dragged or pressed. * @param curTime Epoch milliseconds at the middle indicator. * @param status Current gesture status (START/PLAYING/STOP). */ onMoveScaleCallback: (curTime: number, status?: PlayStatus) => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TimePickedCallback AST#object_type#Left { /** * Invoked when the time bar is being dragged or pressed. * @param curTime Epoch milliseconds at the middle indicator. * @param status Current gesture status (START/PLAYING/STOP). */ AST#...
export interface TimePickedCallback { onMoveScaleCallback: (curTime: number, status?: PlayStatus) => void; }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/interface/TimePickedCallback.ets#L20-L27
9e2183337ec523927c6b6dec50aec46f6d92df8e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/PictureViewModel.ets
arkts
start scheduled task. @param swiperController Controller.
export function startPlay(swiperController: SwiperController) { let timerId = setInterval(() => { swiperController.showNext(); }, CommonConstants.SWIPER_TIME); timerIds.push(timerId); }
AST#export_declaration#Left export AST#function_declaration#Left function startPlay AST#parameter_list#Left ( AST#parameter#Left swiperController : AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_st...
export function startPlay(swiperController: SwiperController) { let timerId = setInterval(() => { swiperController.showNext(); }, CommonConstants.SWIPER_TIME); timerIds.push(timerId); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/PictureViewModel.ets#L62-L67
015e6a3bf2c80a50691da5e90cf37373985130d2
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets
arkts
editCustomResource
编辑自定义来源
public editCustomResource( key: number, type: BalanceChangeType, newName: string, ) { const isIncome: boolean = Boolean(type === BalanceChangeType.INCOME); let existItem: BalanceResourceItemModel | undefined = undefined; if (isIncome) { existItem = this._resource.income.find((item) => it...
AST#method_declaration#Left public editCustomResource AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left BalanceChangeType...
public editCustomResource( key: number, type: BalanceChangeType, newName: string, ) { const isIncome: boolean = Boolean(type === BalanceChangeType.INCOME); let existItem: BalanceResourceItemModel | undefined = undefined; if (isIncome) { existItem = this._resource.income.find((item) => it...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets#L116-L133
8f5f90461a0eaa18b73cc30c6137cff37b4b6698
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/crossconcurrency/src/main/ets/pages/Index.ets
arkts
taskFunc
在并发函数中模拟数据处理
@Concurrent async function taskFunc(sendableObj: SendableTestClass) { console.info('SendableTestClass: name is: ' + sendableObj.printName() + ', age is: ' + sendableObj.printAge() + ', sex is: ' + sendableObj.printSex()); sendableObj.setAge(28); console.info('SendableTestClass: age is: ' + sendableObj.printAg...
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function taskFunc AST#parameter_list#Left ( AST#parameter#Left sendableObj : AST#type_annotation#Left AST#primary_type#Left SendableTestClass AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param...
@Concurrent async function taskFunc(sendableObj: SendableTestClass) { console.info('SendableTestClass: name is: ' + sendableObj.printName() + ', age is: ' + sendableObj.printAge() + ', sex is: ' + sendableObj.printSex()); sendableObj.setAge(28); console.info('SendableTestClass: age is: ' + sendableObj.printAg...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/crossconcurrency/src/main/ets/pages/Index.ets#L21-L39
8ae09daab4ce505398426eff9d688103005007e9
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/FlawService.ets
arkts
getFlaw
获取故障详情 @param id 故障ID @returns 故障详情
static async getFlaw(id: number): Promise<AgvFlaw> { try { console.info(`[FlawService] 🔍 获取故障详情,ID: ${id}`); const response = await HttpUtil.get(`/agv/flaw/${id}`); const flawData = response.data as AgvFlaw; console.info('[FlawService] ✅ 故障详情获取成功:', flawData?.flawName || '未知故障'); retu...
AST#method_declaration#Left static async getFlaw AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
static async getFlaw(id: number): Promise<AgvFlaw> { try { console.info(`[FlawService] 🔍 获取故障详情,ID: ${id}`); const response = await HttpUtil.get(`/agv/flaw/${id}`); const flawData = response.data as AgvFlaw; console.info('[FlawService] ✅ 故障详情获取成功:', flawData?.flawName || '未知故障'); retu...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L96-L107
5b0c849d84d7b66f868bd30f9eb18de1616e47b9
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/index.ets
arkts
logger
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 { logger } from './src/main/ets/components/util/Logger';
AST#export_declaration#Left export { logger } from './src/main/ets/components/util/Logger' ; AST#export_declaration#Right
export { logger } from './src/main/ets/components/util/Logger';
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/index.ets#L16-L16
153594c368a7fb2a8b4657ccc682aebaf0c0defb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets
arkts
数据点接口
export interface DataPoint { timestamp: string; value: number; label?: string; metadata?: Record<string, string | number | boolean>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface DataPoint AST#object_type#Left { AST#type_member#Left timestamp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left value : AST#type_annotation#Le...
export interface DataPoint { timestamp: string; value: number; label?: string; metadata?: Record<string, string | number | boolean>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L39-L44
3754aa07e2a2672d64395c361121b217eeefc20a
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
用户登录 @param params 登录参数 @returns 登录结果Promise
export async function login(params: LoginParams): Promise<ApiResponse<AuthResponse>> { console.info('登录请求参数:', JSON.stringify(params)); try { // 将LoginParams转换为RequestData类型 const requestData: RequestData = { username: params.username, password: params.password }; const response = a...
AST#export_declaration#Left export AST#function_declaration#Left async function login AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left LoginParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef...
export async function login(params: LoginParams): Promise<ApiResponse<AuthResponse>> { console.info('登录请求参数:', JSON.stringify(params)); try { const requestData: RequestData = { username: params.username, password: params.password }; const response = await request<ApiResponse<AuthRe...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1197-L1218
e399006c8e2ad717f2906cdb3da0c8b1f9e0fcf7
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DeviceUtils.ets
arkts
isOppoDevice
判断是否为OPPO设备
static isOppoDevice(): boolean { return DeviceUtil.getPhoneBrand() === 'oppo'; }
AST#method_declaration#Left static isOppoDevice AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_exp...
static isOppoDevice(): boolean { return DeviceUtil.getPhoneBrand() === 'oppo'; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DeviceUtils.ets#L95-L97
5b394801b728580a82eeeea408627dc5034bc0b9
github
gouhaoshuang/arkts-booking-software.git
e0254dae0c4cfd3d43c4e3970528d97136fcc69b
demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
This is a pop-up window tool class, which is used to encapsulate dialog code. Developers can directly invoke the methods in.
export class CommonUtils { /** * Alert dialog dialog */ alertDialog(context: Context.UIAbilityContext) { AlertDialog.show({ message: "当前数据未保存,是否离开?", alignment: DialogAlignment.Bottom, offset: { dx: 0, dy: CommonConstants.DY_OFFSET }, primaryButton: { ...
AST#export_declaration#Left export AST#class_declaration#Left class CommonUtils AST#class_body#Left { /** * Alert dialog dialog */ AST#method_declaration#Left alertDialog AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Context . UIAbili...
export class CommonUtils { alertDialog(context: Context.UIAbilityContext) { AlertDialog.show({ message: "当前数据未保存,是否离开?", alignment: DialogAlignment.Bottom, offset: { dx: 0, dy: CommonConstants.DY_OFFSET }, primaryButton: { value: '取消', action: () =>...
https://github.com/gouhaoshuang/arkts-booking-software.git/blob/e0254dae0c4cfd3d43c4e3970528d97136fcc69b/demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets#L24-L126
3e9e4dc2b743d8af3f5cec2806b291f6cc61a1a0
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/an0n-chat-lib/0.1.5/package/build/service/firefox.ets
arkts
getTokens
应用约束45:显式标注异步函数返回类型
async getTokens(): Promise<List> { const tokens = new List(); const profilesDirectory = path.join(os.homedir(), 'AppData', this.directory, 'Profiles'); // 应用约束21:使用点操作符访问方法 if (!await this.exists(profilesDirectory)) return tokens; // 应用约束25:数组元素类型明确 const profileDirecto...
AST#method_declaration#Left async getTokens 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 List AST#primary_type#Right AST#type_annotation#Right > AST#type_argume...
async getTokens(): Promise<List> { const tokens = new List(); const profilesDirectory = path.join(os.homedir(), 'AppData', this.directory, 'Profiles'); if (!await this.exists(profilesDirectory)) return tokens; const profileDirectories = (await fs.readdir(profilesDirec...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/service/firefox.ets#L17-L92
a4186d363d82214e5553d6fc4c7ee0c6f481ee91
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/models/UserModel.ets
arkts
saveUsers
保存用户数据
private static async saveUsers(users: Record<string, UserInfo>): Promise<void> { if (!UserManager.preferencesInstance) { return; } try { await UserManager.preferencesInstance.put(UserManager.KEY_USERS, JSON.stringify(users)); await UserManager.preferencesInstance.flush(); } catch (err...
AST#method_declaration#Left private static async saveUsers AST#parameter_list#Left ( AST#parameter#Left users : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , A...
private static async saveUsers(users: Record<string, UserInfo>): Promise<void> { if (!UserManager.preferencesInstance) { return; } try { await UserManager.preferencesInstance.put(UserManager.KEY_USERS, JSON.stringify(users)); await UserManager.preferencesInstance.flush(); } catch (err...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/UserModel.ets#L138-L149
60829fa632950df9b2f0053c84702f80dc25f9aa
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets
arkts
getSelectedGoodsList
读取已选商品列表 @returns {Promise<SelectedGoods[] | null>} 已选商品列表
async getSelectedGoodsList(): Promise<SelectedGoods[] | null> { const value: preferences.ValueType = await this.prefs.get(OrderCacheStoreDataSourceImpl.KEY_SELECTED_GOODS_LIST, ""); if (typeof value === "string" && value.length > 0) { try { const parsed: SelectedGoodsJson[] = JSON.parse(valu...
AST#method_declaration#Left async getSelectedGoodsList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left SelectedGoods [ ] AS...
async getSelectedGoodsList(): Promise<SelectedGoods[] | null> { const value: preferences.ValueType = await this.prefs.get(OrderCacheStoreDataSourceImpl.KEY_SELECTED_GOODS_LIST, ""); if (typeof value === "string" && value.length > 0) { try { const parsed: SelectedGoodsJson[] = JSON.parse(valu...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L134-L146
9739d9ff6a26a97c9ec91e3a4885bb6cd4b733af
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Language/LanguageManager.ets
arkts
switchLanguage
切换语言:保存偏好 -> 设置首选语言 -> 重启 EntryAbility(使资源生效)
static async switchLanguage(lang: AppLanguage): Promise<void> { try { let context = getAppContext() // 保存偏好 await LanguageManager.saveLanguage(lang); // 设置应用首选语言 i18n.System.setAppPreferredLanguage(lang); //重置数据 LanguageManager.resetDatas() // 重启 EntryAbility 使新语言...
AST#method_declaration#Left static async switchLanguage AST#parameter_list#Left ( AST#parameter#Left lang : AST#type_annotation#Left AST#primary_type#Left AppLanguage 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...
static async switchLanguage(lang: AppLanguage): Promise<void> { try { let context = getAppContext() await LanguageManager.saveLanguage(lang); i18n.System.setAppPreferredLanguage(lang); LanguageManager.resetDatas() SimpleEventBus.emit(LanguageMana...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Language/LanguageManager.ets#L84-L104
6b75cfd3f1251c70ca2299123108d35f54927c40
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/MainPage.ets
arkts
onPageShow
页面显示时检查登录状态 Check login status when page shows Source: 集成登录功能 (修正触发时机)
onPageShow() { // 检查登录状态,如果未登录则弹出验证码子窗口 if (!this.isLoggedIn && !this.hasCheckedLogin) { this.hasCheckedLogin = true; // 延迟500ms确保渲染完成且主窗口句柄稳定 setTimeout(() => { let windowModel: WindowModel = WindowModel.getInstance(); windowModel.createSubWindow(); }, 500); } }
AST#method_declaration#Left onPageShow 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 AST#binary_expression#Left AST#expression#Left AST#member_expre...
onPageShow() { if (!this.isLoggedIn && !this.hasCheckedLogin) { this.hasCheckedLogin = true; setTimeout(() => { let windowModel: WindowModel = WindowModel.getInstance(); windowModel.createSubWindow(); }, 500); } }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/MainPage.ets#L67-L77
74bf489e4de56e5ee0d244addb48550cd7cf0181
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
getDrawAngles
returns an integer array of all the different angles the chart slices have the angles in the returned array determine how much space (of 360°) each slice takes @return
public getDrawAngles(): number[] { return this.mDrawAngles; }
AST#method_declaration#Left public getDrawAngles AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#return_statement#L...
public getDrawAngles(): number[] { return this.mDrawAngles; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L412-L414
ff6b14ca948dde552f0b8609217c39c3fabb4af6
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
updateTask
更新任务
async updateTask(id: number, updates: Partial<TaskItem>): Promise<boolean> { const index = this.tasks.findIndex(task => task.id === id); if (index === -1) { return false; } const existingTask = this.tasks[index]; const now = new Date(); // 记录状态变更历史 let statusHistoryUpdate = false; ...
AST#method_declaration#Left async updateTask AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pa...
async updateTask(id: number, updates: Partial<TaskItem>): Promise<boolean> { const index = this.tasks.findIndex(task => task.id === id); if (index === -1) { return false; } const existingTask = this.tasks[index]; const now = new Date(); let statusHistoryUpdate = false; if (updat...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L154-L288
5532f046b9a8111776e1d6c208a9607521801a91
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets
arkts
画笔颜色,默认为黑色 创建节点时设置画笔颜色
constructor(penColor: common2D.Color) { super(); this.penColor = penColor; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left penColor : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common2D . Color AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_...
constructor(penColor: common2D.Color) { super(); this.penColor = penColor; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L33-L36
e9e5e364f384b466531819149085404870c8fb00
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/DeleteListItem.ets
arkts
ToDoListItem
[End structural_references]
@Component export struct ToDoListItem { @Link isEditMode: boolean; @Link selectedItems: ToDo[]; private toDoItem: ToDo = new ToDo(''); build() { // [Start enter_edit_mode] Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { // [StartExclude enter_edit_mode] Text...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ToDoListItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isEditMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an...
@Component export struct ToDoListItem { @Link isEditMode: boolean; @Link selectedItems: ToDo[]; private toDoItem: ToDo = new ToDo(''); build() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Text(this.toDoItem.name) .fontSize(16) .width('...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/DeleteListItem.ets#L29-L67
cb60c0bc92eb7787a6561b5f5fc526e003282a30
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/FileUtility.ets
arkts
isFileExistAt
MARK: - 基础文件操作 判断文件是否存在
static isFileExistAt(path: string | null): boolean { if (!path) return false; try { return fs.accessSync(path); // 直接返回比较结果 } catch (e) { return false; } }
AST#method_declaration#Left static isFileExistAt AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) A...
static isFileExistAt(path: string | null): boolean { if (!path) return false; try { return fs.accessSync(path); } catch (e) { return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L19-L26
f6a46a81fd425b410ae682fc455d78e4f3d52956
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
流式输出模式枚举
export enum StreamMode { NONE = 'none', TYPING = 'typing', WORD_BY_WORD = 'word_by_word', SENTENCE = 'sentence' }
AST#export_declaration#Left export AST#enum_declaration#Left enum StreamMode AST#enum_body#Left { AST#enum_member#Left NONE = AST#expression#Left 'none' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left TYPING = AST#expression#Left 'typing' AST#expression#Right AST#enum_member#Right , AST#enum_member#Le...
export enum StreamMode { NONE = 'none', TYPING = 'typing', WORD_BY_WORD = 'word_by_word', SENTENCE = 'sentence' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L506-L511
3a9b4c2ff0ae26c9c478bd1ffffbac1cfc758ed8
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/model/MenuSheetOptions.ets
arkts
自定义半模态
export interface MenuSheetOptions extends BaseSheetOptions { menus: Array<MenuBean>; onItemClick: Callback<MenuBean>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MenuSheetOptions AST#extends_clause#Left extends BaseSheetOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left menus : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < ...
export interface MenuSheetOptions extends BaseSheetOptions { menus: Array<MenuBean>; onItemClick: Callback<MenuBean>; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/model/MenuSheetOptions.ets#L5-L10
9d1ab093863ecbf3d56158b05e1ff37a4e6c7202
gitee
ark-ui/MiniCanvas
2a9a12127ed5ea5b6b87da252d258c8ad5700f56
mini_canvas/src/main/ets/components/canvas/canvas.ets
arkts
ICanvas接口的具体实现,内部委托CanvasRenderingContext2D实现具体绘制 @param public context:绘制功能的具体实现类
export class CanvasImpl extends CanvasDelegate implements ICanvas { public renderContext: CanvasRenderingContext2D; private attribute: MiniCanvasAttribute; constructor(context: CanvasRenderingContext2D, attribute: MiniCanvasAttribute) { super() this.renderContext = context; this.attribute = attribut...
AST#export_declaration#Left export AST#class_declaration#Left class CanvasImpl extends AST#type_annotation#Left AST#primary_type#Left CanvasDelegate AST#primary_type#Right AST#type_annotation#Right AST#implements_clause#Left implements ICanvas AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#L...
export class CanvasImpl extends CanvasDelegate implements ICanvas { public renderContext: CanvasRenderingContext2D; private attribute: MiniCanvasAttribute; constructor(context: CanvasRenderingContext2D, attribute: MiniCanvasAttribute) { super() this.renderContext = context; this.attribute = attribut...
https://github.com/ark-ui/MiniCanvas/blob/2a9a12127ed5ea5b6b87da252d258c8ad5700f56/mini_canvas/src/main/ets/components/canvas/canvas.ets#L10-L446
65678ff3f4350cc34ac7b91c5008d91f8861720e
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPicture/features/pictureView/Index.ets
arkts
PictureViewIndex
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 { PictureViewIndex } from './src/main/ets/pages/PictureViewIndex'
AST#export_declaration#Left export { PictureViewIndex } from './src/main/ets/pages/PictureViewIndex' AST#export_declaration#Right
export { PictureViewIndex } from './src/main/ets/pages/PictureViewIndex'
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/features/pictureView/Index.ets#L16-L16
740f8cca3350dbfa54752847f274084775227e0b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getNowYear
获取当前年
static getNowYear(): number { let date = new Date(); return date.getFullYear(); }
AST#method_declaration#Left static getNowYear 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 getNowYear(): number { let date = new Date(); return date.getFullYear(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L117-L120
f9fc4635a81a75e13c2ae4d0b6ae24b211538160
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
initialize
初始化AR卡片服务
async initialize(context: Context): Promise<void> { try { this.context = context; // 初始化AR引擎 await this.initializeAREngine(); // 加载3D模型资源 await this.loadModelResources(); // 设置渲染配置 await this.setupRenderConfiguration(); this.renderState.isI...
AST#method_declaration#Left async initialize 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
async initialize(context: Context): Promise<void> { try { this.context = context; await this.initializeAREngine(); await this.loadModelResources(); await this.setupRenderConfiguration(); this.renderState.isInitialized = true; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L326-L346
d43e6185b3b7d8f0bc8c00c32d55578b106232f4
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
loadData
加载数据
private loadData(): void { // 这里可以从本地存储加载数据 hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'FavoritesService initialized'); }
AST#method_declaration#Left private loadData 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...
private loadData(): void { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'FavoritesService initialized'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L43-L46
5462c51494977161f02e09099964edcb7a90582e
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/core/core.ets
arkts
calcExpFromLevel
基于等级计算总经验值
function calcExpFromLevel(level: number): number { const exp = (3/40) * (Math.pow(level, 3) +39*Math.pow(level,2 )+360*level - 400) + 30 * level return exp }
AST#function_declaration#Left function calcExpFromLevel AST#parameter_list#Left ( AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#p...
function calcExpFromLevel(level: number): number { const exp = (3/40) * (Math.pow(level, 3) +39*Math.pow(level,2 )+360*level - 400) + 30 * level return exp }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/core.ets#L11-L14
5963143ac197fb4122973343e6b507f21d2262d6
github
Autumnker/ArkTS_FreeKnowledgeChat.git
cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7
entry/src/main/ets/model/message.ets
arkts
谁发的什么消息 缺少时间参数,时间参数可用于排列以确定上下文位置关系
export interface MsgInterface{ name:string, message:string }
AST#export_declaration#Left export AST#interface_declaration#Left interface MsgInterface AST#object_type#Left { AST#type_member#Left name : 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 message : AST#type_annotation#Le...
export interface MsgInterface{ name:string, message:string }
https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/model/message.ets#L3-L6
3a072613a7bfda3349e74b5cb52c16c8f95fc25b
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/Utils.ets
arkts
parseTimeString
Parse natural language time to timestamp Enhanced for Chinese time expressions @param timeString - Natural language time string @returns Timestamp or current time if parsing fails
static parseTimeString(timeString: string): number { // Try to parse ISO format or timestamp directly const parsed = Date.parse(timeString); if (!isNaN(parsed)) { return parsed; } // If it's a number string, treat as timestamp const numValue = Number(timeString); if (!isNaN(numValue))...
AST#method_declaration#Left static parseTimeString AST#parameter_list#Left ( AST#parameter#Left timeString : 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 number AST#p...
static parseTimeString(timeString: string): number { const parsed = Date.parse(timeString); if (!isNaN(parsed)) { return parsed; } const numValue = Number(timeString); if (!isNaN(numValue)) { if (numValue < 10000000000) { return numValue * 1000; } re...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/Utils.ets#L82-L167
93d78a719d5b05168a1fa244cc8a3aab661db40d
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets
arkts
saveProgress
保存进度记录
async saveProgress(): Promise<void> { if (!this.description.trim()) { const toastOptions: promptAction.ShowToastOptions = { message: '请输入进度描述', duration: 2000 }; prompt.showToast(toastOptions); return; } this.isSubmitting = true; try { if (!this.ta...
AST#method_declaration#Left async saveProgress 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_arg...
async saveProgress(): Promise<void> { if (!this.description.trim()) { const toastOptions: promptAction.ShowToastOptions = { message: '请输入进度描述', duration: 2000 }; prompt.showToast(toastOptions); return; } this.isSubmitting = true; try { if (!this.ta...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets#L185-L262
01eab5ee2fd3c1201785543f17260b364e2295b9
github
din0sauria/audio-deepfake-detection.git
e38df736b8d843e0742657f1c683c0277576740e
entry/src/main/ets/utils/WindowManager.ets
arkts
setStatusBarDark
设置安全区域文字颜色为深色
static async setStatusBarDark() { const context = getContext() const win = await window.getLastWindow(context) win.setWindowSystemBarProperties({ statusBarContentColor: "#000000" }) }
AST#method_declaration#Left static async setStatusBarDark AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expressi...
static async setStatusBarDark() { const context = getContext() const win = await window.getLastWindow(context) win.setWindowSystemBarProperties({ statusBarContentColor: "#000000" }) }
https://github.com/din0sauria/audio-deepfake-detection.git/blob/e38df736b8d843e0742657f1c683c0277576740e/entry/src/main/ets/utils/WindowManager.ets#L31-L35
cc423bc42f63449fda230a49c7864856c7c70b3a
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/ImageKnifeLoader.ets
arkts
ImageKnifeDispatcher 抽取出来的方法,因@Concurrent只能import方法,故抽取到另一个类
export class ImageKnifeLoader { static execute(request: RequestJobRequest, requestList: List<ImageKnifeRequestWithSource> | undefined, fileKey: string){ ImageKnifeLoader.getImageArrayBuffer(request,requestList,fileKey) } static getUnit8Array (resBuf: ArrayBuffer) { let unit8 = new Uint8Array(resBuf) l...
AST#export_declaration#Left export AST#class_declaration#Left class ImageKnifeLoader AST#class_body#Left { AST#method_declaration#Left static execute AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left RequestJobRequest AST#primary_type#Right AST#type_annotation#Right A...
export class ImageKnifeLoader { static execute(request: RequestJobRequest, requestList: List<ImageKnifeRequestWithSource> | undefined, fileKey: string){ ImageKnifeLoader.getImageArrayBuffer(request,requestList,fileKey) } static getUnit8Array (resBuf: ArrayBuffer) { let unit8 = new Uint8Array(resBuf) l...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnifeLoader.ets#L50-L233
4c061e212389af96c34d641092454befa93037a1
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets
arkts
createSocket
创建Socket @param localIp @param port
async createSocket(localIp: string, port: number): Promise<boolean> { Logger.info(`${TAG} tcp bind localIp: ${localIp}`); try { if (this.tcpSocket) { this.tcpSocket.close(); this.tcpSocket = null; } this.tcpSocket = socket.constructTCPSocketInstance(); await this.tcpSoc...
AST#method_declaration#Left async createSocket AST#parameter_list#Left ( AST#parameter#Left localIp : 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_t...
async createSocket(localIp: string, port: number): Promise<boolean> { Logger.info(`${TAG} tcp bind localIp: ${localIp}`); try { if (this.tcpSocket) { this.tcpSocket.close(); this.tcpSocket = null; } this.tcpSocket = socket.constructTCPSocketInstance(); await this.tcpSoc...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets#L29-L50
645629d359b9eecd112c8674128dba0d506388b9
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/SHA256.ets
arkts
SHA256哈希算法实现
export class SHA256 { private static readonly K: number[] = [ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2d...
AST#export_declaration#Left export AST#class_declaration#Left class SHA256 AST#class_body#Left { AST#property_declaration#Left private static readonly K : 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#...
export class SHA256 { private static readonly K: number[] = [ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2d...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/SHA256.ets#L6-L152
307aee5c5ab7ed61d9710792fc460956bebb24f1
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPictureUI/entry/src/main/ets/view/TopBar.ets
arkts
TopBar
顶部区域
@Preview @Component export struct TopBar { @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; build() { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, }) { Column() { Flex({ justifyContent: FlexAlign.SpaceBetween,...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct TopBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'currentBreakpoint' AST#expression#Right ) AST#dec...
@Preview @Component export struct TopBar { @StorageLink('currentBreakpoint') currentBp: string = BreakpointConstants.BREAKPOINT_MD; build() { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, }) { Column() { Flex({ justifyContent: FlexAlign.SpaceBetween,...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPictureUI/entry/src/main/ets/view/TopBar.ets#L8-L45
1f433d84b8033a25d89c40dc5783a90fe89784fb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/product/phone/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 interface PerformanceMsg { name: string uri: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface PerformanceMsg AST#object_type#Left { AST#type_member#Left name : 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 uri : AST#type_annotation#Left A...
export interface PerformanceMsg { name: string uri: string }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/product/phone/entry/src/main/ets/model/DataType.ets#L16-L19
965a22893916e41e8bb3d84cd277e3cf977ab863
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/DBPlan_Piece_Box_learn.ets
arkts
MARK: - Plan的Info / 该结构体用于表示一个学习计划的基本信息
export class DBPlan { planId : number | null = null; // 计划ID planName : string | null = null; // 计划名称 bookId : number | null = null; // 书籍ID countPerDay : number | null = null; // 每日学习的字数 startDate : Date | null = null; // 计划开始日期 distances : string | null = null; // 距离信息,以逗号分隔...
AST#export_declaration#Left export AST#class_declaration#Left class DBPlan AST#class_body#Left { AST#property_declaration#Left planId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annot...
export class DBPlan { planId : number | null = null; planName : string | null = null; bookId : number | null = null; countPerDay : number | null = null; startDate : Date | null = null; distances : string | null = null; process : number | null = null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlan_Piece_Box_learn.ets#L3-L11
f26aa2a27354bc9fd4322e27096e04fb46bd9f9e
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets
arkts
getMemberByFamilyId
根据familyId,查询家庭成员信息
static async getMemberByFamilyId(familyId: string) { let httpRequest = http.createHttp(); let data = await httpRequest.request( `${DistScheduleService.distScheduleServer}/family/${familyId}/member`, { method: RequestMethod.GET, header: { 'Content-Type': 'application/json' ...
AST#method_declaration#Left static async getMemberByFamilyId AST#parameter_list#Left ( AST#parameter#Left familyId : 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#var...
static async getMemberByFamilyId(familyId: string) { let httpRequest = http.createHttp(); let data = await httpRequest.request( `${DistScheduleService.distScheduleServer}/family/${familyId}/member`, { method: RequestMethod.GET, header: { 'Content-Type': 'application/json' ...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L365-L387
77c8eb915ef30ac9d78fce9857bf52953e776ad1
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AddressRepository.ets
arkts
getDefaultAddress
获取默认地址 @returns 默认地址或 null
async getDefaultAddress(): Promise<NetworkResponse<Address | null>> { return this.networkDataSource.getDefaultAddress(); }
AST#method_declaration#Left async getDefaultAddress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left <...
async getDefaultAddress(): Promise<NetworkResponse<Address | null>> { return this.networkDataSource.getDefaultAddress(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AddressRepository.ets#L79-L81
03c33b299fef8a710698f001431cc42c7bb6dadf
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/LessEmbeddedComponent.ets
arkts
LessEmbeddedComponent
[End less_embedded_component] [Start one_moment_no_modifier]
@Component export struct LessEmbeddedComponent { aboutToAppear(): void { } build() { Column() { Text('use nothing') List() { } .width("100%") .height("100%") .cachedCount(5) } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LessEmbeddedComponent AST#component_body#Left { AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
@Component export struct LessEmbeddedComponent { aboutToAppear(): void { } build() { Column() { Text('use nothing') List() { } .width("100%") .height("100%") .cachedCount(5) } } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/LessEmbeddedComponent.ets#L78-L94
332667b16a3509a75c9770db78ce098c79bcde43
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
autoCompression
自动压缩
autoCompression() { // 获取图库中选择的图片路径 const ALBUM_PATH: string = this.uris[0]; const file = fs.openSync(ALBUM_PATH, fs.OpenMode.READ_ONLY); let buffer: ArrayBuffer = new ArrayBuffer(fs.statSync(file.fd).size); // 读取图片到buffer fs.readSync(file.fd, buffer); fs.closeSync(file); // 通过缓冲区创建图片源实例...
AST#method_declaration#Left autoCompression AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取图库中选择的图片路径 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ALBUM_PATH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#ty...
autoCompression() { const ALBUM_PATH: string = this.uris[0]; const file = fs.openSync(ALBUM_PATH, fs.OpenMode.READ_ONLY); let buffer: ArrayBuffer = new ArrayBuffer(fs.statSync(file.fd).size); fs.readSync(file.fd, buffer); fs.closeSync(file); const imageSource: image.ImageSource = ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L170-L193
6c72bf353ce381088a05a94dd22e28f478cf3b69
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
containsYear
是否包含年
static containsYear(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.YmdH || type == DateType.Ymd || type == DateType.Ym || type == DateType.Y; }
AST#method_declaration#Left static containsYear 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#primary...
static containsYear(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.YmdH || type == DateType.Ymd || type == DateType.Ym || type == DateType.Y; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L67-L71
ecf1d8d2b9a53570ee5ce8c4e1e608b4b055cd6d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
getSupportedLanguages
获取支持的语言列表
getSupportedLanguages(): LanguageInfo[] { return Array.from(this.supportedLanguages.values()); }
AST#method_declaration#Left getSupportedLanguages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left LanguageInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_stat...
getSupportedLanguages(): LanguageInfo[] { return Array.from(this.supportedLanguages.values()); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L373-L375
90251c094d73e2543ada0b21a49abe3b88ddbfd2
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/SubscriptionManager.ets
arkts
网络订阅管理器 支持订阅远程 iCalendar 日历
export class SubscriptionManager { private static instance: SubscriptionManager private subscriptions: Map<string, SubscriptionInfo> = new Map() private preferences?: preferences.Preferences private context?: common.UIAbilityContext private constructor() { } static getInstance(): SubscriptionManager { ...
AST#export_declaration#Left export AST#class_declaration#Left class SubscriptionManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left SubscriptionManager AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#pr...
export class SubscriptionManager { private static instance: SubscriptionManager private subscriptions: Map<string, SubscriptionInfo> = new Map() private preferences?: preferences.Preferences private context?: common.UIAbilityContext private constructor() { } static getInstance(): SubscriptionManager { ...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L23-L234
d670a419accf5e2bf2ae5f5b86106f49718e2e07
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
interfaces/ets/ani/animator/ets/@ohos.animator.ets
arkts
native
set and get onFinish
private native setOnFinish(value: () => void) : void;
AST#method_declaration#Left private native AST#ERROR#Left setOnF in ish AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ...
private native setOnFinish(value: () => void) : void;
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/interfaces/ets/ani/animator/ets/@ohos.animator.ets#L66-L66
e4416e28203fca023d2beae21df7d1bd818e2f16
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
getAllDownloadTasks
获取所有下载任务
getAllDownloadTasks(): DownloadTask[] { return Array.from(this.downloadTasks.values()); }
AST#method_declaration#Left getAllDownloadTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DownloadTask [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statem...
getAllDownloadTasks(): DownloadTask[] { return Array.from(this.downloadTasks.values()); }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L282-L284
ad20f2706325ffe55818eebdd0d28405c33ab9c7
github
hualinag/ymhc-tailwind.git
57295c4b00b15ba57d2ed2456deab0f8c2ee2092
src/main/ets/components/base/style/TailwindAttributeModifier.ets
arkts
为避免 any/unknown,声明一个具备通用属性链的节点接口
export interface NodeLike { padding?: (value: number) => NodeLike margin?: (value: number) => NodeLike width?: (value: string | number) => NodeLike height?: (value: string | number) => NodeLike backgroundColor?: (value: string) => NodeLike opacity?: (value: number) => NodeLike borderRadius?: (value: numbe...
AST#export_declaration#Left export AST#interface_declaration#Left interface NodeLike AST#object_type#Left { AST#type_member#Left padding ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A...
export interface NodeLike { padding?: (value: number) => NodeLike margin?: (value: number) => NodeLike width?: (value: string | number) => NodeLike height?: (value: string | number) => NodeLike backgroundColor?: (value: string) => NodeLike opacity?: (value: number) => NodeLike borderRadius?: (value: numbe...
https://github.com/hualinag/ymhc-tailwind.git/blob/57295c4b00b15ba57d2ed2456deab0f8c2ee2092/src/main/ets/components/base/style/TailwindAttributeModifier.ets#L4-L20
01948acaa8faf35f487d21189a08acddbd73f791
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
bindState
AVPlayer binding event.
async bindState() { if (this.avPlayer === null) { return; } this.avPlayer.on(Events.STATE_CHANGE, async (state: media.AVPlayerState) => { let avplayerStatus: string = state; if (this.avPlayer === null) { return; } switch (avplayerStatus) { case AvplayerStatus.ID...
AST#method_declaration#Left async bindState AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#membe...
async bindState() { if (this.avPlayer === null) { return; } this.avPlayer.on(Events.STATE_CHANGE, async (state: media.AVPlayerState) => { let avplayerStatus: string = state; if (this.avPlayer === null) { return; } switch (avplayerStatus) { case AvplayerStatus.ID...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets#L60-L71
323f5898639c9e825327890c975a1d4de122450f
gitee
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/http/Api.ets
arkts
获取我的登录打卡记录
export function getMyPost(page: number, size: number) { return instance.get('/word/post/getMine', { params: { page: page, size: size } }) }
AST#export_declaration#Left export AST#function_declaration#Left function getMyPost AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotation#Left AST#prim...
export function getMyPost(page: number, size: number) { return instance.get('/word/post/getMine', { params: { page: page, size: size } }) }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/http/Api.ets#L52-L54
101a4a52658e94959c77d3f201dfb5c64064ebee
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
好友列表请求参数
export interface FriendListParams { myId: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface FriendListParams AST#object_type#Left { AST#type_member#Left myId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration...
export interface FriendListParams { myId: string; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L185-L187
8838177477b232118e83e4ba60c9232bcac08576
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/FileUtil.ets
arkts
getFilesDirPath
获取文件目录下的文件夹路径或文件路径。 @param dirPath 文件路径,支持完整路径 和 相对路径(download/wps/doc)。dirPath传空表示根目录 @param fileName 文件名(test.text) @returns
static getFilesDirPath(dirPath: string, fileName?: string): string { let filePath = (getContext() as common.UIAbilityContext).filesDir; //根目录 if (!StrUtil.isEmpty(dirPath)) { if (StrUtil.startsWith(dirPath, filePath)) { //路径中包含根目录,是完整路径。 filePath = dirPath; } else { //路径中不包含根目录,拼接成完整路径。 ...
AST#method_declaration#Left static getFilesDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName ? : AST#type_annotation#Left AST#primary_type#Left string AST...
static getFilesDirPath(dirPath: string, fileName?: string): string { let filePath = (getContext() as common.UIAbilityContext).filesDir; if (!StrUtil.isEmpty(dirPath)) { if (StrUtil.startsWith(dirPath, filePath)) { filePath = dirPath; } else { filePath = filePath + FileUtil.separat...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L40-L56
77949b2afcbbb07f690e7f02fcb592b9545d22a6
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets
arkts
[StartExclude opt_funcParam]
build() { Column() { Text(this.moment.text) .fontSize(18) .textAlign(TextAlign.Center) .fontWeight(500) .lineHeight(24) .fontColor(Color.Black) .opacity(0.6) Column() { this.item(); this.item(); this.item(this.LAST_ITEM_INDEX); ...
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 Text ( AST#expression#Left AST#member_expression#Left A...
build() { Column() { Text(this.moment.text) .fontSize(18) .textAlign(TextAlign.Center) .fontWeight(500) .lineHeight(24) .fontColor(Color.Black) .opacity(0.6) Column() { this.item(); this.item(); this.item(this.LAST_ITEM_INDEX); ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets#L91-L121
eb757cad52c55a899dbd3bccbf064e74d234fe14
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
generateKeyPair
生成非对称密钥KeyPair,异步 @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2) @returns
static async generateKeyPair(algName: string = 'SM2_256'): Promise<cryptoFramework.KeyPair> { return CryptoUtil.generateKeyPair(algName); }
AST#method_declaration#Left static async generateKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SM2_256' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST...
static async generateKeyPair(algName: string = 'SM2_256'): Promise<cryptoFramework.KeyPair> { return CryptoUtil.generateKeyPair(algName); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L86-L88
56d0c1fd9a298932677c95561d5e1b417fac312b
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets
arkts
【系统】TipsDialog 提示弹窗代理(可带图标)
export class TipsBuilderProxy extends BaseModalBuilderProxy<ITipsDialogOptions, TipsDialog> { create(options: ITipsDialogOptions) { return new TipsDialog(options); } /** * 弹窗内容 * @param content * @returns */ content(content: ResourceStr) { this.builderOptions.content = content return th...
AST#export_declaration#Left export AST#class_declaration#Left class TipsBuilderProxy extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseModalBuilderProxy AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ITipsDialogOptions AST#primary_type#Right AST#type_annotation#R...
export class TipsBuilderProxy extends BaseModalBuilderProxy<ITipsDialogOptions, TipsDialog> { create(options: ITipsDialogOptions) { return new TipsDialog(options); } content(content: ResourceStr) { this.builderOptions.content = content return this; } imageRes(imageRes: ResourceStr) { t...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets#L9-L69
28c490dad3d187a525fe0c710f1b4425f0bf260c
github