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
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderListener.ets
arkts
朗读控件回调事件
export class TextReaderListener { onStateChange?: Callback<TextReader.ReadState>; //当前正在播放的文章状态变更时,触发该回调执行。 onStop?: Callback<void>; //调用stop接口或用户主动滑动通知栏退出,触发回调。 onRelease?: Callback<void>; //调用release释放资源,触发回调。 onShowPanel?: Callback<void>; //拉起面板,触发回调。 onHidePanel?: Callback<void>; //收回面板,触发回调。 onSetAr...
AST#export_declaration#Left export AST#class_declaration#Left class TextReaderListener AST#class_body#Left { AST#property_declaration#Left onStateChange ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualifie...
export class TextReaderListener { onStateChange?: Callback<TextReader.ReadState>; onStop?: Callback<void>; onRelease?: Callback<void>; onShowPanel?: Callback<void>; onHidePanel?: Callback<void>; onSetArticle?: Callback<string>; onClickArticle?: Callback<string>; onClickAuthor?: Callback<string...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderListener.ets#L5-L22
6ccc8eb94b8ed3c9db9f2807876e98944cacd388
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/FileUtils.ets
arkts
existFolder
判断文件夹是否存在 @param path 文件夹绝对路径
existFolder(path: string): boolean { try { if (fs.accessSync(path)) { let stat = fs.statSync(path) return stat.isDirectory() } else { return false } } catch (error) { let err: BusinessError = error as BusinessError; LogUtil.error('FileUtils existFolder f...
AST#method_declaration#Left existFolder AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Righ...
existFolder(path: string): boolean { try { if (fs.accessSync(path)) { let stat = fs.statSync(path) return stat.isDirectory() } else { return false } } catch (error) { let err: BusinessError = error as BusinessError; LogUtil.error('FileUtils existFolder f...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L235-L249
9480100ef18a00f3679a1c2ae323c7e187cdeefe
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
定义环境数据项接口
export interface EnvironmentDataItem { id: number; name: string; icon: Resource; status: string; unit: string; weatherIcon?: Resource; }
AST#export_declaration#Left export AST#interface_declaration#Left interface EnvironmentDataItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#...
export interface EnvironmentDataItem { id: number; name: string; icon: Resource; status: string; unit: string; weatherIcon?: Resource; }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L4-L11
15ef9b4c0096ac1986ec09dbde41e04a290d7455
github
gouhaoshuang/arkts-booking-software.git
e0254dae0c4cfd3d43c4e3970528d97136fcc69b
demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
datePickerDialog
Date dialog dialog
datePickerDialog(dateCallback: Function) { DatePickerDialog.show({ start: new Date(CommonConstants.START_TIME), end: new Date(), selected: new Date(CommonConstants.SELECT_TIME), lunar: false, onAccept: (value: DatePickerResult) => { let year: number = Number(value.year); ...
AST#method_declaration#Left datePickerDialog AST#parameter_list#Left ( AST#parameter#Left dateCallback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left ...
datePickerDialog(dateCallback: Function) { DatePickerDialog.show({ start: new Date(CommonConstants.START_TIME), end: new Date(), selected: new Date(CommonConstants.SELECT_TIME), lunar: false, onAccept: (value: DatePickerResult) => { let year: number = Number(value.year); ...
https://github.com/gouhaoshuang/arkts-booking-software.git/blob/e0254dae0c4cfd3d43c4e3970528d97136fcc69b/demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets#L57-L71
dee05b3efe8646e0a2932b7f5b8d29d29ee14337
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
用户等级接口
export interface UserLevel { level: number; title: string; description: string; requiredExp: number; nextLevelExp: number; benefits: LevelBenefit[]; icon: string; color: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserLevel AST#object_type#Left { AST#type_member#Left level : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left A...
export interface UserLevel { level: number; title: string; description: string; requiredExp: number; nextLevelExp: number; benefits: LevelBenefit[]; icon: string; color: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L58-L67
8f7c247679ad3408df7679f2b8dc174de71e6560
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/state/BaseNetWorkListUiState.ets
arkts
网络列表 UI 状态枚举 @author Joker.X
export enum BaseNetWorkListUiState { /** * 加载中 */ LOADING = "loading", /** * 请求成功 */ SUCCESS = "success", /** * 请求失败 */ ERROR = "error", /** * 空数据 */ EMPTY = "empty" }
AST#export_declaration#Left export AST#enum_declaration#Left enum BaseNetWorkListUiState AST#enum_body#Left { /** * 加载中 */ AST#enum_member#Left LOADING = AST#expression#Left "loading" AST#expression#Right AST#enum_member#Right , /** * 请求成功 */ AST#enum_member#Left SUCCESS = AST#expression#Left "success" AST#...
export enum BaseNetWorkListUiState { LOADING = "loading", SUCCESS = "success", ERROR = "error", EMPTY = "empty" }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/state/BaseNetWorkListUiState.ets#L5-L22
b6daafbc79e319b090189ac238ddbc9ea8af387c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
updateSettings
更新应用设置 @param params 更新参数 @returns 更新后的设置
async updateSettings(params: UpdateAppSettingsParams): Promise<AppSettings> { try { const currentSettings = await this.getSettings(); // 更新设置对象 const updatedSettings: AppSettings = { version: currentSettings.version, language: params.language ? this.mergeLanguageSettings(currentSe...
AST#method_declaration#Left async updateSettings AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left UpdateAppSettingsParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left A...
async updateSettings(params: UpdateAppSettingsParams): Promise<AppSettings> { try { const currentSettings = await this.getSettings(); const updatedSettings: AppSettings = { version: currentSettings.version, language: params.language ? this.mergeLanguageSettings(currentSettings.la...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L133-L166
69895c3d5c6e5d0d0aea52185a0b61d866a1fe1b
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/dialog/AppDialogUtils.ets
arkts
showDebugPanelDialog
确认 提示弹窗 @param params @returns
static showDebugPanelDialog(params: DebugPanelDialogParams = { dialogId: DEBUG_PANEL_DIALOG_ID, alignment: DialogAlignment.Bottom, autoCancel: true, hasAnimation: true, animationDelay: 500, transition: PromptActionUtils.getInstance().transitionInDown(), }): string { if (PromptActionUtils.g...
AST#method_declaration#Left static showDebugPanelDialog AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left DebugPanelDialogParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_n...
static showDebugPanelDialog(params: DebugPanelDialogParams = { dialogId: DEBUG_PANEL_DIALOG_ID, alignment: DialogAlignment.Bottom, autoCancel: true, hasAnimation: true, animationDelay: 500, transition: PromptActionUtils.getInstance().transitionInDown(), }): string { if (PromptActionUtils.g...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/dialog/AppDialogUtils.ets#L27-L43
edd93329a1f81d0cdf0a0d6a9778066e1399499e
gitee
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
128861bc002adae9c34c6ce8fbf12686c26e51ec
entry/src/main/ets/utils/PreferenceModel.ets
arkts
getPreference
获取 key 对应的 value
async getPreference(key: string): Promise<string | null> { await this.ensurePreferenceInitialized(); if (!preference) { console.error("Preferences not initialized, cannot get value"); return null; } try { const value = await preference.get(key, null); return value !== null ? St...
AST#method_declaration#Left async getPreference AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
async getPreference(key: string): Promise<string | null> { await this.ensurePreferenceInitialized(); if (!preference) { console.error("Preferences not initialized, cannot get value"); return null; } try { const value = await preference.get(key, null); return value !== null ? St...
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L51-L66
0dc879d746f9f76bf398f259b10506d2c62f166c
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FoldableGuilde/entry/src/main/ets/utils/source_add2.ets
arkts
updateWidthBreakpoint
[Start source_add2] Update horizontal breakpoints according to window width
updateWidthBreakpoint(): void { const uiContext: UIContext | undefined = AppStorage.get('uiContext'); let promise = window.getLastWindow(uiContext?.getHostContext()); promise.then((mainWindow: window.Window) => { let windowRect: window.Rect = mainWindow.getWindowProperties().windowRect; let wind...
AST#method_declaration#Left updateWidthBreakpoint AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uiC...
updateWidthBreakpoint(): void { const uiContext: UIContext | undefined = AppStorage.get('uiContext'); let promise = window.getLastWindow(uiContext?.getHostContext()); promise.then((mainWindow: window.Window) => { let windowRect: window.Rect = mainWindow.getWindowProperties().windowRect; let wind...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/utils/source_add2.ets#L21-L43
0c1ce0cb0ed3eb4c728602b5968e82f4b2657d1d
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.0.3';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.0.3' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.0.3';
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/BuildProfile.ets#L4-L4
0c2f4a4701771232072221f94a8a524ffdffdcd5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/AIModelManager.ets
arkts
AI响应接口
export interface AIResponse { success: boolean; content: string; usage?: { promptTokens: number; completionTokens: number; totalTokens: number; };
AST#export_declaration#Left export AST#interface_declaration#Left interface AIResponse AST#ERROR#Left { AST#type_member#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#type_annotation#Left A...
export interface AIResponse { success: boolean; content: string; usage?: { promptTokens: number; completionTokens: number; totalTokens: number; };
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/AIModelManager.ets#L36-L43
5ec715f047203bc4e30d618e52f7a12cec119761
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/TapGesture.ets
arkts
Tap
[Start catch_click_twice_event]
@Entry @Component export struct Tap { @State value: string = ''; build() { NavDestination() { Column({ space: 12 }) { Column() { Text('Click twice').fontSize(28) .gesture( // 绑定count为2的TapGesture TapGesture({ count: 2 }) .onAction(...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Tap AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right value : AST#type_annotation#Left AST#primary_type#Left string A...
@Entry @Component export struct Tap { @State value: string = ''; build() { NavDestination() { Column({ space: 12 }) { Column() { Text('Click twice').fontSize(28) .gesture( TapGesture({ count: 2 }) .onAction((event: GestureEvent|un...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/TapGesture.ets#L17-L50
007cc17ef90235f4366f0b3e390d0c9e768ecdfc
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
工作类型枚举
export enum JobType { FULL_TIME = 'full_time', // 全职 PART_TIME = 'part_time', // 兼职 INTERN = 'intern', // 实习 CONTRACT = 'contract' // 合同工 }
AST#export_declaration#Left export AST#enum_declaration#Left enum JobType AST#enum_body#Left { AST#enum_member#Left FULL_TIME = AST#expression#Left 'full_time' AST#expression#Right AST#enum_member#Right , // 全职 AST#enum_member#Left PART_TIME = AST#expression#Left 'part_time' AST#expression#Right AST#enum_member#Right ,...
export enum JobType { FULL_TIME = 'full_time', PART_TIME = 'part_time', INTERN = 'intern', CONTRACT = 'contract' }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L15-L20
fb98ec4709b7e735650c2c773a7367b3981b7e0b
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DateUtils.ets
arkts
daysBetween
计算两个日期之间的天数差 @param start 开始日期 @param end 结束日期 @returns 天数差(绝对值)
static daysBetween(start: Date, end: Date): number { // 只保留年月日 const s = new Date(start.getFullYear(), start.getMonth(), start.getDate()); const e = new Date(end.getFullYear(), end.getMonth(), end.getDate()); const msPerDay = 24 * 60 * 60 * 1000; return Math.abs(Math.floor((e.getTime() - s.getTime(...
AST#method_declaration#Left static daysBetween AST#parameter_list#Left ( AST#parameter#Left start : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left end : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Rig...
static daysBetween(start: Date, end: Date): number { const s = new Date(start.getFullYear(), start.getMonth(), start.getDate()); const e = new Date(end.getFullYear(), end.getMonth(), end.getDate()); const msPerDay = 24 * 60 * 60 * 1000; return Math.abs(Math.floor((e.getTime() - s.getTime()) / msPe...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L27-L34
85d05886ca9743aad0c8ee53c75f70fc289899b6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/router/AppRouter.ets
arkts
goSearch
跳转到搜索页面 @param searchType 搜索类型
async goSearch(searchType?: string): Promise<void> { const params: RouteParams = { searchType: searchType }; const options: RouteOptions = { params: params }; await this.push(RoutePaths.SEARCH, options); }
AST#method_declaration#Left async goSearch AST#parameter_list#Left ( AST#parameter#Left searchType ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L...
async goSearch(searchType?: string): Promise<void> { const params: RouteParams = { searchType: searchType }; const options: RouteOptions = { params: params }; await this.push(RoutePaths.SEARCH, options); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L319-L323
19361980d94c7f8532b5d873f3f244f65db36829
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
updateDetailAddress
更新详细地址 @param {string} value - 详细地址 @returns {void} 无返回值
updateDetailAddress(value: string): void { this.detailAddress = value; }
AST#method_declaration#Left updateDetailAddress AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
updateDetailAddress(value: string): void { this.detailAddress = value; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L259-L261
ed5c191987623cd39e2096712aed2456f722f52e
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.AlbumPickerComponent.d.ets
arkts
AlbumInfo: include album uri @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare class AlbumInfo { /** * Album uri * * @type { ?string } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ uri?: string; /** * Album name * * @type { ?string } * @syscap SystemCapability.FileM...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class AlbumInfo AST#class_body#Left { /** * Album uri * * @type { ?string } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#propert...
export declare class AlbumInfo { uri?: string; albumName?: string; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.AlbumPickerComponent.d.ets#L101-L120
cf5728eb1e0e90344ebc88c7c8816b4cf4d09caa
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets
arkts
@memo
export function hookToggleContentModifier( receiver: ArkToggleComponent, value?: ContentModifier<ToggleConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const toggleBuilder = (parentNode: KPointer, config: ToggleConfiguration): KPointer => { ...
AST#export_declaration#Left export AST#function_declaration#Left function hookToggleContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkToggleComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value ? ...
export function hookToggleContentModifier( receiver: ArkToggleComponent, value?: ContentModifier<ToggleConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const toggleBuilder = (parentNode: KPointer, config: ToggleConfiguration): KPointer => { ...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L258-L271
8d22b9b106351f5e1405fce569f9b98cdb4d94da
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
productSeries
产品系列
static productSeries(): string { return deviceInfo.productSeries }
AST#method_declaration#Left static productSeries AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp...
static productSeries(): string { return deviceInfo.productSeries }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L50-L52
3a0e764b9e3b872378a2c5c77142c71a0225a5ab
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLP/entry/src/main/ets/feature/FileManager.ets
arkts
closeSync
sync-close
closeSync(fd: number): void { try { fs.closeSync(fd); Logger.info(TAG, 'closeSync file finish.'); } catch (err) { Logger.error(TAG, 'closeSync file error = ' + err); } }
AST#method_declaration#Left closeSync AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#t...
closeSync(fd: number): void { try { fs.closeSync(fd); Logger.info(TAG, 'closeSync file finish.'); } catch (err) { Logger.error(TAG, 'closeSync file error = ' + err); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/FileManager.ets#L51-L58
b383b11403281313bc8c7827035bf71935898e5f
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
取消点赞动态 @param id 动态ID
export function unlikePost(id: number): Promise<void> { try { console.info(`取消点赞动态, id: ${id}`); // 获取当前用户会话 const userSession = UserSession.getInstance(); // 确保用户已登录 if (!userSession.isLoggedIn()) { console.error('用户未登录,无法取消点赞'); return Promise.reject(new Error('用户未登录,请先登录')...
AST#export_declaration#Left export AST#function_declaration#Left function unlikePost 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#prim...
export function unlikePost(id: number): Promise<void> { try { console.info(`取消点赞动态, id: ${id}`); const userSession = UserSession.getInstance(); if (!userSession.isLoggedIn()) { console.error('用户未登录,无法取消点赞'); return Promise.reject(new Error('用户未登录,请先登录')); } ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L866-L896
c3e8e54f19e118fa65c436e8f97699b9f758a21f
github
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/client/listener/PropertyListener.ets
arkts
属性监听器,用于接收平台下发的属性读写操作
export interface PropertyListener { /** * 处理写属性操作 * * @param requestId 请求id * @param services 服务属性列表 */ onPropertiesSet: (requestId: string, services: ServiceProperty[]) => void; /** * 处理读属性操作 * * @param requestId 请求id * @param serviceId 服务id,可选 */ onPropertiesGet: (requestId: st...
AST#export_declaration#Left export AST#interface_declaration#Left interface PropertyListener AST#object_type#Left { /** * 处理写属性操作 * * @param requestId 请求id * @param services 服务属性列表 */ AST#type_member#Left onPropertiesSet : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#par...
export interface PropertyListener { onPropertiesSet: (requestId: string, services: ServiceProperty[]) => void; onPropertiesGet: (requestId: string, serviceId?: string) => void; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/listener/PropertyListener.ets#L20-L36
e7c42f0565b85042034d4c71145f035554ca06fb
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets
arkts
loginByWxApp
微信 APP 授权登录 @param {Record<string, string>} params - 微信授权参数 @returns {Promise<NetworkResponse<Auth>>} 登录结果
async loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Auth>> { const response: AxiosResponse<NetworkResponse<Auth>> = await NetworkClient.http.post("user/login/wxApp", params); return response.data; }
AST#method_declaration#Left async loginByWxApp AST#parameter_list#Left ( AST#parameter#Left params : 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 , AST#type_ann...
async loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Auth>> { const response: AxiosResponse<NetworkResponse<Auth>> = await NetworkClient.http.post("user/login/wxApp", params); return response.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets#L16-L20
4e4e93ec0aebadbc8aa3e63b20a3ca51d40b7051
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getMistakesWithCount
MARK: - Mistake 统计
public getMistakesWithCount(): [number, [Mistake, number][]] { const mistakesCnt: [Mistake, number][] = [ [Mistake.mistake_1_Only, 0], [Mistake.mistake_1_3, 0], [Mistake.mistake_3_5, 0], [Mistake.mistake_5_10, 0], [Mistake.mistake_10_Over,0] ] let words = th...
AST#method_declaration#Left public getMistakesWithCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#ERROR#Left AST#primary_type#Lef...
public getMistakesWithCount(): [number, [Mistake, number][]] { const mistakesCnt: [Mistake, number][] = [ [Mistake.mistake_1_Only, 0], [Mistake.mistake_1_3, 0], [Mistake.mistake_3_5, 0], [Mistake.mistake_5_10, 0], [Mistake.mistake_10_Over,0] ] let words = th...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L604-L629
099c60bef64e9aa989bfec78d488b1f58306dff5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
arkts
每个TAG对应多少个元素 代表自定义类型数据的接口。 @interface @property {string} desc - 描述。 @property {string} tag - 类别。
export interface CustomDataType { desc: string, tag: string, }
AST#export_declaration#Left export AST#interface_declaration#Left interface CustomDataType AST#object_type#Left { AST#type_member#Left desc : 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 tag : AST#type_annotation#Left...
export interface CustomDataType { desc: string, tag: string, }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L37-L40
aef49fdc684e505b81b2a6bf752779f47700ca96
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
$_instantiate
Return to Obtain GestureGroup. @param { function } factory @param { GestureMode } mode @param { GestureType[] } gesture @returns { GestureGroup } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
static $_instantiate(factory: () => GestureGroup, mode: GestureMode, ...gesture: GestureType[]): GestureGroup;
AST#method_declaration#Left static $_instantiate AST#parameter_list#Left ( AST#parameter#Left factory : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left GestureGroup AST#primary_type#Right AST#type_annotation#Right AST...
static $_instantiate(factory: () => GestureGroup, mode: GestureMode, ...gesture: GestureType[]): GestureGroup;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L739-L739
e661995d28197809346c0bb0e901181c01818202
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.FullScreenLaunchComponent.d.ets
arkts
FullScreenLaunchComponent
Declare component FullScreenLaunchComponent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
@Component export declare struct FullScreenLaunchComponent { /** * Sets the component content. * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @BuilderParam content: Callback<void>; /** * Indicates atomic service a...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct FullScreenLaunchComponent AST#component_body#Left { /** * Sets the component content. * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full *...
@Component export declare struct FullScreenLaunchComponent { @BuilderParam content: Callback<void>; appId: string; options?: AtomicServiceOptions; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.FullScreenLaunchComponent.d.ets#L27-L54
8d885fce2473720e1d892f7132ed9021ee332e47
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/ECDSA.ets
arkts
verify
验签 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey 公钥 @returns 验签结果OutDTO对象,其中Msg为验签结果
static async verify(signStr: string, verifyStr: string, pubKey: string): Promise<string> { return CryptoUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 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, 'ECC256', 'ECC256|SHA256', 256); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/ECDSA.ets#L53-L55
f946e6f91d99af7222e9cc6c51ca0aa514fda835
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FullScreenStart/FullScreenStart_Service/entry/src/main/ets/common/util/CalculateUtil.ets
arkts
isSymbol
Determines whether it is an operator. @param value The symbol. @return Is Operator.
isSymbol(value: string) { if (CheckEmptyUtil.isEmpty(value)) { return; } return (CommonConstants.OPERATORS.indexOf(value) !== -1); }
AST#method_declaration#Left isSymbol AST#parameter_list#Left ( AST#parameter#Left value : 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#if_statement#Left if ( AST#exp...
isSymbol(value: string) { if (CheckEmptyUtil.isEmpty(value)) { return; } return (CommonConstants.OPERATORS.indexOf(value) !== -1); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FullScreenStart/FullScreenStart_Service/entry/src/main/ets/common/util/CalculateUtil.ets#L26-L31
696624c4e052308b2304667afc3993b50560c139
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseManager.ets
arkts
createTables
创建所有数据库表
private async createTables(): Promise<void> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { // 执行所有表创建语句 for (const sql of DatabaseSchema.ALL_CREATE_STATEMENTS) { await this.rdbStore.executeSql(sql); console.info('[DatabaseManager] Table create...
AST#method_declaration#Left private async createTables 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#...
private async createTables(): Promise<void> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { for (const sql of DatabaseSchema.ALL_CREATE_STATEMENTS) { await this.rdbStore.executeSql(sql); console.info('[DatabaseManager] Table created successful...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseManager.ets#L74-L89
04e0a29f29c56edd33d04196e1c7940553abfd64
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/schedule/pages/selectMember.ets
arkts
getMemberById
查询家庭成员信息
async getMemberById(familyId: string) { await DistScheduleService.getMemberByFamilyId(familyId) .then((members) => { if (members.length > 0) { for (let member of members) { this.memberList.push(member) } } }).catch((err) => { console.error(`errCode...
AST#method_declaration#Left async getMemberById 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#builder_function_body#Left { AST#expression_statement#Left AST...
async getMemberById(familyId: string) { await DistScheduleService.getMemberByFamilyId(familyId) .then((members) => { if (members.length > 0) { for (let member of members) { this.memberList.push(member) } } }).catch((err) => { console.error(`errCode...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/schedule/pages/selectMember.ets#L128-L139
77bd6fbc54bc6ad4cd9632b04992b2a375ec97d2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/barchart/src/main/ets/view/CustomMarkerView.ets
arkts
自定义MarkerView弹窗。使用三方库中MarkerView源码,修改弹窗中字体大小
export default class CustomMarkerView implements IMarker { private mOffset: MPPointF = new MPPointF(); private mOffset2: MPPointF = new MPPointF(); constructor() { } /** * 获取第一个偏移量对象 */ getOffset(): MPPointF { return this.mOffset; } /** * 根据给定的X和Y位置计算并返回第二个偏移量对象 */ getOffsetForDrawi...
AST#export_declaration#Left export default AST#class_declaration#Left class CustomMarkerView AST#implements_clause#Left implements IMarker AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private mOffset : AST#type_annotation#Left AST#primary_type#Left MPPointF AST#primary_type#Right AST#...
export default class CustomMarkerView implements IMarker { private mOffset: MPPointF = new MPPointF(); private mOffset2: MPPointF = new MPPointF(); constructor() { } getOffset(): MPPointF { return this.mOffset; } getOffsetForDrawingAtPoint(posX: number, posY: number): MPPointF { let offse...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/CustomMarkerView.ets#L20-L100
de03652f099ea6b4af9bdf5fabfe55f73ada2383
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/udp/UdpEchoServer/entry/src/main/ets/pages/Index.ets
arkts
bind2Port
绑定本地端口
async bind2Port() { //本地地址 let localAddress = { address: "0.0.0.0", port: this.localPort, family: 1 } await udpSocket.bind(localAddress) .then(() => { this.msgHistory = 'bind success' + "\r\n"; }) .catch((e) => { this.msgHistory = 'bind fail' + e.message + "\r\n"; })...
AST#method_declaration#Left async bind2Port AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //本地地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localAddress = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name...
async bind2Port() { let localAddress = { address: "0.0.0.0", port: this.localPort, family: 1 } await udpSocket.bind(localAddress) .then(() => { this.msgHistory = 'bind success' + "\r\n"; }) .catch((e) => { this.msgHistory = 'bind fail' + e.message + "\r\n"; }) ...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/udp/UdpEchoServer/entry/src/main/ets/pages/Index.ets#L101-L127
8227dc50d39bb75bf8e6be253568d29032db7341
gitee
queueit/harmony-sdk.git
ba7b4b38c03730bfbe305789acba6db0012d5f5c
entry/src/main/ets/demowithprotectedapi/networking/ProductRepository.ets
arkts
Define the API response structure for the product
export interface Product { name: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Product 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#object_type#Right AST#interface_declaration#Right AS...
export interface Product { name: string; }
https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/entry/src/main/ets/demowithprotectedapi/networking/ProductRepository.ets#L12-L14
bfdf6d94d04b29c7eaaf4232e1939a4d597c594d
github
hackeris/HiSH
6485c7b24ee47727fe464dc3a69484f44689e85b
entry/src/main/ets/entryability/EntryAbility.ets
arkts
getFreeVncPort
获取一个未被占用的随机端口 (用于 VNC WebSocket) @param min 最小端口号 (包含) @param max 最大端口号 (包含) @returns 可用端口号,如果找不到则返回 undefined
function getFreeVncPort(min: number, max: number): number | undefined { const range = max - min + 1; const maxAttempts = 100; // 最大尝试次数 for (let i = 0; i < maxAttempts; i++) { const port = min + Math.floor(Math.random() * range); if (!napi.checkPortUsed(port)) { return port; } } hilog.warn...
AST#function_declaration#Left function getFreeVncPort AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
function getFreeVncPort(min: number, max: number): number | undefined { const range = max - min + 1; const maxAttempts = 100; for (let i = 0; i < maxAttempts; i++) { const port = min + Math.floor(Math.random() * range); if (!napi.checkPortUsed(port)) { return port; } } hilog.warn(DOMAIN, ...
https://github.com/hackeris/HiSH/blob/6485c7b24ee47727fe464dc3a69484f44689e85b/entry/src/main/ets/entryability/EntryAbility.ets#L28-L41
ba557741e19eb1cac3f525c559265bf110a4e20c
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets
arkts
popToName
回退路由栈到由栈底开始第一个名为name的NavDestination页面
public static popToName(name: string, animated?: boolean) { try { RouterModule._stack.popToName(name, animated); } catch (err) { Logger.error(TAG, 'navigation stack pop to name failed::' + JSON.stringify(err)); } }
AST#method_declaration#Left public static popToName 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#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#...
public static popToName(name: string, animated?: boolean) { try { RouterModule._stack.popToName(name, animated); } catch (err) { Logger.error(TAG, 'navigation stack pop to name failed::' + JSON.stringify(err)); } }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/RouterModule.ets#L54-L60
af5cdbe512edc127cdf78ab778485a586d8befaf
github
Million-mo/tree-sitter-arkts.git
2fd0ad75e2d848709edcf4be038f27b178114ef6
examples/custom_builders.ets
arkts
tabBarStyles
本地Styles方法
@Styles tabBarStyles() { .width('100%') .height(70) .backgroundColor(Color.White) .border({ width: { top: 1 }, color: Color.Gray }) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right tabBarStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#e...
@Styles tabBarStyles() { .width('100%') .height(70) .backgroundColor(Color.White) .border({ width: { top: 1 }, color: Color.Gray }) }
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/custom_builders.ets#L266-L275
379394bb698a66b06123ef2d0cee331e2e655864
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
unit8ArrayToStr
Uint8Array转字符串 @param src Uint8Array @returns 字符串
static unit8ArrayToStr(src: Uint8Array, encoding: buffer.BufferEncoding = 'utf-8'): string { const textDecoder = util.TextDecoder.create(encoding, { ignoreBOM: true }) const result = textDecoder.decodeToString(src, { stream: true }); return result; }
AST#method_declaration#Left static unit8ArrayToStr AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left encoding : AST#type_annotation#Left AST#primary_type#Left AST#qualifie...
static unit8ArrayToStr(src: Uint8Array, encoding: buffer.BufferEncoding = 'utf-8'): string { const textDecoder = util.TextDecoder.create(encoding, { ignoreBOM: true }) const result = textDecoder.decodeToString(src, { stream: true }); return result; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L253-L257
44a7ab5dfdc2bd30257c072ef4b39a8fc641adbd
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/MQTTUtil.ets
arkts
isClientConnected
检查连接状态
public isClientConnected(): boolean { // 如果标记为已连接但客户端为null,修正状态 if (this.isConnected && this.mqttAsyncClient === null) { this.isConnected = false; return false; } return this.isConnected && this.mqttAsyncClient !== null; }
AST#method_declaration#Left public isClientConnected 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 { // 如果标记为已连接但客户端为null,修正状态 AST#statement#Left AST#if_statement#Left if ( AST#expre...
public isClientConnected(): boolean { if (this.isConnected && this.mqttAsyncClient === null) { this.isConnected = false; return false; } return this.isConnected && this.mqttAsyncClient !== null; }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/MQTTUtil.ets#L24-L31
d8e4882cf8f67cef3bdb42b519607c53380d8aec
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets
arkts
createTable
创建表 @param createSQL 创建表语句 @returns
createTable(createSQL: string): Promise<void> { return this.executeSql(createSQL) }
AST#method_declaration#Left createTable AST#parameter_list#Left ( AST#parameter#Left createSQL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr...
createTable(createSQL: string): Promise<void> { return this.executeSql(createSQL) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L70-L72
c3efcef61430b582a527be76b57f5026962cd19d
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets
arkts
RegionDataSource For Lazy Loading class RegionDataSource extends BasicDataSource { private regionArray: string[] = []; constructor(regionArray: string[]) { super(); this.regionArray = regionArray; } public totalCount(): number { return this.regionArray.length; } public getData(index: number): string { return this.r...
export class RegionDataSource implements IDataSource { private regionArray: string[] = []; // 数据改变监听器 private listeners: DataChangeListener[] = []; constructor(regionArray: string[]) { this.regionArray = regionArray; } /** * 获取数据源列表长度 */ public totalCount(): number { return this.regionArra...
AST#export_declaration#Left export AST#class_declaration#Left class RegionDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private regionArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#a...
export class RegionDataSource implements IDataSource { private regionArray: string[] = []; private listeners: DataChangeListener[] = []; constructor(regionArray: string[]) { this.regionArray = regionArray; } public totalCount(): number { return this.regionArray.length; } public getData...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets#L188-L277
d4758b4d918c6272be3fa088096420ed40816056
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/JSONUtil.ets
arkts
jsonToBean
JSON字符串转Class对象 @param jsonStr JSON字符串 @param cls 类名 @returns
static jsonToBean<T>(jsonStr: string, clazz?: Constructor<T>, reviver?: JSON.Transformer, options?: JSON.ParseOptions): T | null { try { if (StrUtil.isEmpty(jsonStr)) { return null; } if (!options) { options = { bigIntMode: JSON.BigIntMode.PARSE_AS_BIGINT }; } const bea...
AST#method_declaration#Left static jsonToBean AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left jsonStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parame...
static jsonToBean<T>(jsonStr: string, clazz?: Constructor<T>, reviver?: JSON.Transformer, options?: JSON.ParseOptions): T | null { try { if (StrUtil.isEmpty(jsonStr)) { return null; } if (!options) { options = { bigIntMode: JSON.BigIntMode.PARSE_AS_BIGINT }; } const bea...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/JSONUtil.ets#L37-L54
7802eb198642178e295c29a826eeaa9c3e2e66ba
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/detail/DetailViewModel.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/21 21:08 @Version V1.0 @Description
export class DetailViewModel extends AppViewModel { protected readonly args: DetailArgs protected userItemDto?: FinItemData = undefined constructor
AST#export_declaration#Left export AST#ERROR#Left class DetailViewModel extends AST#type_annotation#Left AST#primary_type#Left AppViewModel AST#primary_type#Right AST#type_annotation#Right { AST#property_declaration#Left protected readonly args : AST#type_annotation#Left AST#primary_type#Left DetailArgs AST#primary_typ...
export class DetailViewModel extends AppViewModel { protected readonly args: DetailArgs protected userItemDto?: FinItemData = undefined constructor
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/detail/DetailViewModel.ets#L12-L18
220f01fabe5a4e80f6b324d267f7c8d993c740c5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
getRelativeTime
获取相对时间描述 @param date 日期 @returns 相对时间描述(如:刚才、5分钟前、昨天等)
static getRelativeTime(date: string | Date): string { const target = typeof date === 'string' ? new Date(date) : date; const now = new Date(); const diffInSeconds = Math.floor((now.getTime() - target.getTime()) / 1000); if (diffInSeconds < 60) { return '刚才'; } else if (diffInSeconds < 360...
AST#method_declaration#Left static getRelativeTime 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 )...
static getRelativeTime(date: string | Date): string { const target = typeof date === 'string' ? new Date(date) : date; const now = new Date(); const diffInSeconds = Math.floor((now.getTime() - target.getTime()) / 1000); if (diffInSeconds < 60) { return '刚才'; } else if (diffInSeconds < 360...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L397-L416
1daa1c9c898f3171b64b52851cf39e8991f53ad0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/accessibility/AccessibilityService.ets
arkts
适老化配置
export interface ElderlyModeConfig { enabled: boolean; extraLargeText: boolean; highContrast: boolean; simplifiedUI: boolean; voiceGuidance: boolean; emergencyFeatures: boolean; quickActions: string[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ElderlyModeConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left extraLargeText : AST#ty...
export interface ElderlyModeConfig { enabled: boolean; extraLargeText: boolean; highContrast: boolean; simplifiedUI: boolean; voiceGuidance: boolean; emergencyFeatures: boolean; quickActions: string[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L122-L130
21794d789a581a6e4e41b67930ad7cefed6db0bc
github
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getResumeTo
Getter and setter for resumeTo
getResumeTo(): number | undefined { return this.resumeTo; }
AST#method_declaration#Left getResumeTo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left...
getResumeTo(): number | undefined { return this.resumeTo; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L137-L139
b3c1280f21ef69464d29737d50b87e1e9d9124ed
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/utils/PermissionHelper.ets
arkts
检查权限并返回未授权权限的数组集合。 @param context @param permissions @returns 未授权的权限集合(如果全部已获授权则返回的是空数组)
export async function checkPermissions(context: Context, permissions: Permissions[]): Promise<Permissions[]> { let ungrantedPermissions: Permissions[] = []; for (let i = 0; i < permissions.length; i++) { let grantStatus: abilityAccessCtrl.GrantStatus = await checkAccessToken(permissions[i]); if ...
AST#export_declaration#Left export AST#function_declaration#Left async function checkPermissions 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#Left permissions : AST#type_...
export async function checkPermissions(context: Context, permissions: Permissions[]): Promise<Permissions[]> { let ungrantedPermissions: Permissions[] = []; for (let i = 0; i < permissions.length; i++) { let grantStatus: abilityAccessCtrl.GrantStatus = await checkAccessToken(permissions[i]); if ...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/PermissionHelper.ets#L51-L60
b10db041df93988cb36fb8cc517ec47839e3203c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/order/OrderNavigator.ets
arkts
toList
跳转到订单列表 @param {string} [tab] - Tab 标签 @returns {void} 无返回值
static toList(tab?: string): void { if (tab) { const params: OrderListParam = { tab }; navigateTo(OrderRoutes.List, params); return; } navigateTo(OrderRoutes.List); }
AST#method_declaration#Left static toList AST#parameter_list#Left ( AST#parameter#Left tab ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
static toList(tab?: string): void { if (tab) { const params: OrderListParam = { tab }; navigateTo(OrderRoutes.List, params); return; } navigateTo(OrderRoutes.List); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderNavigator.ets#L16-L23
5df1e46e146b6f3d097120f83f08812d1be44149
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/components/buttons/linysImageButton.ets
arkts
aboutToAppear(): void { console.log(`[linysImageButton] path=${this.path}`); }
build() { Image(this.path ? path_2_uri(this.path) : '') .brightness(this.isHov ? 1.1 : 1) .animation(animation_default()) .height(fontSize_Icon_Button() + (this.can_hover ? 10 : 0)) .width(fontSize_Icon_Button() + (this.can_hover ? 10 : 0)) .padding(this.can_hover ? 5 : 0) .borde...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . path AST#member_expression#R...
build() { Image(this.path ? path_2_uri(this.path) : '') .brightness(this.isHov ? 1.1 : 1) .animation(animation_default()) .height(fontSize_Icon_Button() + (this.can_hover ? 10 : 0)) .width(fontSize_Icon_Button() + (this.can_hover ? 10 : 0)) .padding(this.can_hover ? 5 : 0) .borde...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/components/buttons/linysImageButton.ets#L19-L38
3096e3380e546b73586cc02c5b128ab0a071480f
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/search/SearchBookList.ets
arkts
getBookList
获取rawfile目录文件
getBookList(){ let context=getContext() as common.UIAbilityContext; let resourceManager=context.resourceManager let values:string="" resourceManager.getRawFileContent("book.json", (error, value) => { if (error != null) { console.log("error is " + error); } else { let decoder ...
AST#method_declaration#Left getBookList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left ...
getBookList(){ let context=getContext() as common.UIAbilityContext; let resourceManager=context.resourceManager let values:string="" resourceManager.getRawFileContent("book.json", (error, value) => { if (error != null) { console.log("error is " + error); } else { let decoder ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/search/SearchBookList.ets#L154-L167
641bd7449935c8c8c7e7ddda85b6c54d5dadf6bc
github
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/UserService.ets
arkts
getUserPlayHistory
获取用户播放历史 @param userId 用户ID
async getUserPlayHistory(userId: number): Promise<PlayHistory[]> { try { const historyData = await this.cloudDBService.getUserPlayHistory(userId); return historyData.map(data => PlayHistory.fromCloudObject(data)); } catch (error) { console.error('获取播放历史失败:', error); return []; } }
AST#method_declaration#Left async getUserPlayHistory AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty...
async getUserPlayHistory(userId: number): Promise<PlayHistory[]> { try { const historyData = await this.cloudDBService.getUserPlayHistory(userId); return historyData.map(data => PlayHistory.fromCloudObject(data)); } catch (error) { console.error('获取播放历史失败:', error); return []; } }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L206-L214
b4733876d4ae5a46ced3a2fb743b669be28399cb
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/Toast.ets
arkts
showActionMenu
显示一个操作菜单(Action Menu),支持最多 6 个选项。 超过 6 个选项时会提示用户限制,并不显示菜单。 @param title 操作菜单的标题,可以是字符串或本地化资源字符串 @param options 操作项数组,每个包含文本、颜色和点击后的操作
static showActionMenu(title: string | ResourceStr, options: ItemOption[]): void { // 如果没有任何选项,直接返回 if (options.length === 0) return; // 如果操作项数量超过 6 个,提示用户,并终止显示菜单 if (options.length > 6) { promptAction.showToast({ message: '最多只能显示 6 个操作项', // 可根据需要替换为本地化文本 duration: 2000 // 提示持续时间...
AST#method_declaration#Left static showActionMenu AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#...
static showActionMenu(title: string | ResourceStr, options: ItemOption[]): void { if (options.length === 0) return; if (options.length > 6) { promptAction.showToast({ message: '最多只能显示 6 个操作项', duration: 2000 }); return; } const buttonsTuple = [ ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/Toast.ets#L123-L159
069e5c491eff6ac858354259c19d68ca7fcc04dc
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
clampAlpha
透明度取值修正 @param {number} alpha - 透明度 @returns {number} 修正后的透明度
private clampAlpha(alpha: number): number { if (alpha < 0) { return 0; } if (alpha > 255) { return 255; } return alpha; }
AST#method_declaration#Left private clampAlpha AST#parameter_list#Left ( AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
private clampAlpha(alpha: number): number { if (alpha < 0) { return 0; } if (alpha > 255) { return 255; } return alpha; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L204-L212
c5d5e13224c45b175fc221831e50a058dd9e3b78
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_animation/ace_ets_module_animation_api11/entry/src/main/ets/MainAbility/pages/RouteType/RouteType2.ets
arkts
pageTransition
自定义方式1:完全自定义转场过程的效果
pageTransition() { PageTransitionEnter({ type: RouteType.Pop, duration: 1200, curve: Curve.Linear }) .onEnter((type: RouteType, progress: number) => { this.scale2 = 1 this.opacity2 = progress }) // 进场过程中会逐帧触发onEnter回调,入参为动效的归一化进度(0% -- 100%) PageTransitionExit({ duration: 1200, curve...
AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Lef...
pageTransition() { PageTransitionEnter({ type: RouteType.Pop, duration: 1200, curve: Curve.Linear }) .onEnter((type: RouteType, progress: number) => { this.scale2 = 1 this.opacity2 = progress }) PageTransitionExit({ duration: 1200, curve: Curve.Ease }) .onExit((type: RouteType...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_animation/ace_ets_module_animation_api11/entry/src/main/ets/MainAbility/pages/RouteType/RouteType2.ets#L37-L48
8024f1c58368e920972eedecd9120f5dddcb4205
gitee
ClozyA/DonateAPPForHarmony.git
8eaf7f25a91137e457d43d438316eacec061c87b
entry/src/main/ets/componet/MyArticle.ets
arkts
MyArticle
@Entry
@Component export default struct MyArticle { @Prop article: ArticleItem build() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center }) { Row() { Image(this.article.icon) .width(100) .height(100) Flex({direction: FlexDirection.Column}){ Flex...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct MyArticle AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right article : AST#type_annotation#Left AST#primary_type#Left ArticleItem AST#primary_type#Right AST#t...
@Component export default struct MyArticle { @Prop article: ArticleItem build() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center }) { Row() { Image(this.article.icon) .width(100) .height(100) Flex({direction: FlexDirection.Column}){ Flex...
https://github.com/ClozyA/DonateAPPForHarmony.git/blob/8eaf7f25a91137e457d43d438316eacec061c87b/entry/src/main/ets/componet/MyArticle.ets#L4-L50
2a1a07af1ac3e0a24afe2c4845539dbc87a8e859
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/PreviewUtil.ets
arkts
@Author csx @DateTime 2024/5/11 09:41:05 @TODO PreviewUtil 预览工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
export class PreviewUtil { /** * 预览文本 * @param uri 预览uri */ static async previewTxt(uri: string): Promise<void> { await PreviewUtil.openPreview('txt', uri); } /** * 预览网页 * @param uri 预览uri */ static async previewHtml(uri: string): Promise<void> { await PreviewUtil.openPreview('html'...
AST#export_declaration#Left export AST#class_declaration#Left class PreviewUtil AST#class_body#Left { /** * 预览文本 * @param uri 预览uri */ AST#method_declaration#Left static async previewTxt AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri...
export class PreviewUtil { static async previewTxt(uri: string): Promise<void> { await PreviewUtil.openPreview('txt', uri); } static async previewHtml(uri: string): Promise<void> { await PreviewUtil.openPreview('html', uri); } static async previewImage(uri: string): Promise<void> { awai...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PreviewUtil.ets#L30-L187
21934acf15a5a37196d22808129e26f40b6db750
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/music-gathering-master/entry/src/main/ets/utils/songManager.ets
arkts
updateSong
更新音乐
static async updateSong(song: string) { const store = SongManager.getStore() store.putSync("song_cache_key", song) await store.flush() }
AST#method_declaration#Left static async updateSong AST#parameter_list#Left ( AST#parameter#Left song : 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_declara...
static async updateSong(song: string) { const store = SongManager.getStore() store.putSync("song_cache_key", song) await store.flush() }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/music-gathering-master/entry/src/main/ets/utils/songManager.ets#L15-L19
c28d6c6e24bf51b81226a00e8d9d2b67b10176bb
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/CombinedChartModel.ets
arkts
getCandleData
@Override
public getCandleData(): CandleData | null { if (this.mData == null) return null; return this.mData.getCandleData(); }
AST#method_declaration#Left public getCandleData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CandleData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statem...
public getCandleData(): CandleData | null { if (this.mData == null) return null; return this.mData.getCandleData(); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L154-L158
589ad9a84414646a59b22dd9b8af8f6a15d328db
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
encodeAsymSegment
非对称分段加密 @param encodeStr 待加密的字符串 @param pubKey 给定秘钥规格公钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格
static async encodeAsymSegment(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> { //将公钥转换 let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName); //生成加密器 let encoder = crypto.createCipher(symEncryptName); //初...
AST#method_declaration#Left static async encodeAsymSegment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST...
static async encodeAsymSegment(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> { let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName); let encoder = crypto.createCipher(symEncryptName); await encode...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L251-L281
7a0281679c6a48eff7140b313670294b25e9c99c
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets
arkts
Class representing the legend of the chart. The legend will contain one entry per color and DataSet. Multiple colors in one DataSet are grouped together. The legend object is NOT available before setting data to the chart.
export default class Legend extends ComponentBase { /** * The legend entries array */ private mEntries: LegendEntry[] = []; /** * Entries that will be appended to the end of the auto calculated entries after calculating the legend. */ private mExtraEntries: LegendEntry[]; /** * Are the legend...
AST#export_declaration#Left export default AST#class_declaration#Left class Legend extends AST#type_annotation#Left AST#primary_type#Left ComponentBase AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * The legend entries array */ AST#property_declaration#Left private mEntries : AST#type...
export default class Legend extends ComponentBase { private mEntries: LegendEntry[] = []; private mExtraEntries: LegendEntry[]; private mIsLegendCustom: boolean = false; private mHorizontalAlignment: LegendHorizontalAlignment = LegendHorizontalAlignment.LEFT; private mVerticalAlignment: LegendVert...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets#L53-L260
4c5bb480e5331d10e41b90a1747dd01457323518
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
strToUint8Array
字符串转Uint8Array @param src 字符串 @returns Uint8Array
public static strToUint8Array(src: string, encoding: buffer.BufferEncoding = 'utf-8'): Uint8Array { let textEncoder = new util.TextEncoder(encoding); let result = textEncoder.encodeInto(src); return result; }
AST#method_declaration#Left public static strToUint8Array AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left encoding : AST#type_annotation#Left AST#primary_type#Left AST#quali...
public static strToUint8Array(src: string, encoding: buffer.BufferEncoding = 'utf-8'): Uint8Array { let textEncoder = new util.TextEncoder(encoding); let result = textEncoder.encodeInto(src); return result; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L204-L208
06aa352d076b65eaffbc91717e26683eecec02e6
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/BufferModel.ets
arkts
startWorkTask
确认服务端和AudioCapturer以及AudioRenderer都正常后,就可以正常通话了
public startWorkTask(): void { try { if (this.mCapturerWorker && this.mRendererWorker) { this.mCapturerWorker.postMessage({ 'code': Constants.WORK_MESSAGE_CAPTURER_START }); this.mRendererWorker.postMessage({ 'code': Constants.WORK_MESSAGE_RENDERER_START }); } } catch (err) { L...
AST#method_declaration#Left public startWorkTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#L...
public startWorkTask(): void { try { if (this.mCapturerWorker && this.mRendererWorker) { this.mCapturerWorker.postMessage({ 'code': Constants.WORK_MESSAGE_CAPTURER_START }); this.mRendererWorker.postMessage({ 'code': Constants.WORK_MESSAGE_RENDERER_START }); } } catch (err) { L...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/BufferModel.ets#L67-L76
afc8dcb6aec842b384f6e483169c8315dc366fa9
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/component/OrderCard.ets
arkts
OrderCard
@file 订单卡片组件 @author Joker.X
@ComponentV2 export struct OrderCard { /** * 订单数据 */ @Param order: Order = new Order(); /** * 跳转订单详情 */ @Param toOrderDetail: (orderId: number) => void = () => { }; /** * 跳转商品详情 */ @Param toGoodsDetail: () => void = () => { }; /** * 跳转支付 */ @Param toPay: () => void = ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderCard AST#component_body#Left { /** * 订单数据 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Righ...
@ComponentV2 export struct OrderCard { @Param order: Order = new Order(); @Param toOrderDetail: (orderId: number) => void = () => { }; @Param toGoodsDetail: () => void = () => { }; @Param toPay: () => void = () => { }; @Param toLogistics: () => void = () => { }; @Param ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/component/OrderCard.ets#L13-L237
f2b4b087f934c8f6a99535f8b89b3c3233e4174c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/cache/GlobalContext.ets
arkts
getT
泛型方法
getT<T>(key: string): T { return this._objects.get(key) as T; }
AST#method_declaration#Left getT AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p...
getT<T>(key: string): T { return this._objects.get(key) as T; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/cache/GlobalContext.ets#L46-L48
bcc36122c8b6fa3af392e373ab20251035ab8aa7
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/model/ImageEditModel.ets
arkts
画笔记录数据
export class PaletteData { /** * 画笔路径 */ path: Path2D /** * 颜色 */ color: string /** * 线宽 */ lineWidth: number /** * 剩余记录数据 */ leftTotalPaths?: PaletteData
AST#export_declaration#Left export AST#ERROR#Left class PaletteData { /** * 画笔路径 */ path AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Path2D AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right /** * 颜色 */ AST#ERROR#Left color : string /** * 线宽 */ l in eWidth AST#ERROR#R...
export class PaletteData { path: Path2D color: string lineWidth: number leftTotalPaths?: PaletteData
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/model/ImageEditModel.ets#L117-L133
e6990ebdac4d8d1ee3aabc0fb2a3164917c3bab1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gbktranscoding/src/main/ets/viewModel/BasicDataSource.ets
arkts
IDataSource处理数据监听的基本实现
export abstract class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = [] public abstract totalCount(): number public getData(index: number): T | void { console.info('getData, index:'+index); } registerDataChangeListener(listener: DataChangeListener): void { if ...
AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declarat...
export abstract class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = [] public abstract totalCount(): number public getData(index: number): T | void { console.info('getData, index:'+index); } registerDataChangeListener(listener: DataChangeListener): void { if ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gbktranscoding/src/main/ets/viewModel/BasicDataSource.ets#L19-L70
3eda9122cb0677c0e93d7994b78c8398ecd2e240
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/ReminderScheduler.ets
arkts
提醒配置接口
export interface ReminderConfig { id: string; type: ReminderType; title: string; content: string; triggerTime: Date; repeatType?: reminderAgentManager.ReminderType; contactId?: string; enabled: boolean; snoozeCount?: number; maxSnoozeCount?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ReminderConfig AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left ...
export interface ReminderConfig { id: string; type: ReminderType; title: string; content: string; triggerTime: Date; repeatType?: reminderAgentManager.ReminderType; contactId?: string; enabled: boolean; snoozeCount?: number; maxSnoozeCount?: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L29-L40
d70c0d2eb1ef72e8abf63d64464ae1e6d2272d01
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DataPreferencesUtils.ets
arkts
set
设置数据
set(key: string, value: dataPreferences.ValueType) { if (!this.preferences) { this.initPreferences(); } console.log('setinitPreferences', key, value) this.preferences?.putSync(key, value); this.preferences?.flush(); }
AST#method_declaration#Left set AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataPreference...
set(key: string, value: dataPreferences.ValueType) { if (!this.preferences) { this.initPreferences(); } console.log('setinitPreferences', key, value) this.preferences?.putSync(key, value); this.preferences?.flush(); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DataPreferencesUtils.ets#L18-L25
db49e922635a3b5e3be2cefc3655ae5ed7248f2d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/view/CustomDialog.ets
arkts
CustomDialogComponent
获取当前页面的上下文
@Component export struct CustomDialogComponent { @State visible: boolean = false; @StorageLink('windowStage') windowStage: window.WindowStage | undefined = AppStorage.get('windowStage'); //获取windowStage private SubWindowApi: api.SubWindowApi | null = null; //初始化SubWindowApi对象 aboutToAppear() { if (this...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomDialogComponent AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right visible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_anno...
@Component export struct CustomDialogComponent { @State visible: boolean = false; @StorageLink('windowStage') windowStage: window.WindowStage | undefined = AppStorage.get('windowStage'); private SubWindowApi: api.SubWindowApi | null = null; aboutToAppear() { if (this.windowStage) { this.SubWind...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/view/CustomDialog.ets#L24-L110
69bd81e71ca987f25f9ecf809117bbb7ecac3a49
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
setRatio
Set ratio. @param ratio
setRatio(ratio: CropRatioType) { switch (ratio) { case CropRatioType.RATIO_TYPE_FREE: this.ratio.set(CommonConstants.DEFAULT_RATIO, CommonConstants.DEFAULT_RATIO); break; case CropRatioType.RATIO_TYPE_HORIZONTAL: this.ratio.set(this.screenMaxSide, this.screenMinSide);
AST#method_declaration#Left setRatio AST#parameter_list#Left ( AST#parameter#Left ratio : AST#type_annotation#Left AST#primary_type#Left CropRatioType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#exp...
setRatio(ratio: CropRatioType) { switch (ratio) { case CropRatioType.RATIO_TYPE_FREE: this.ratio.set(CommonConstants.DEFAULT_RATIO, CommonConstants.DEFAULT_RATIO); break; case CropRatioType.RATIO_TYPE_HORIZONTAL: this.ratio.set(this.screenMaxSide, this.screenMinSide);
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L158-L164
0ab080f5a33c906ef3f9976c51a7df7435ce7b02
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets
arkts
系统图标名称常量
export class SystemSymbols { // 常用系统图标 static readonly add: string = 'add'; static readonly search: string = 'search'; static readonly back: string = 'arrow_left'; static readonly close: string = 'close'; static readonly check: string = 'checkmark'; static readonly more: string = 'menu'; static readonly...
AST#export_declaration#Left export AST#class_declaration#Left class SystemSymbols AST#class_body#Left { // 常用系统图标 AST#property_declaration#Left static readonly add : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'add' AST#expression#Right ; ...
export class SystemSymbols { static readonly add: string = 'add'; static readonly search: string = 'search'; static readonly back: string = 'arrow_left'; static readonly close: string = 'close'; static readonly check: string = 'checkmark'; static readonly more: string = 'menu'; static readonly settings...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L87-L103
2f5112c58a94d75be0ed0283b22ca2a19df2e446
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/XorCipher.ets
arkts
XOR密码实现 XOR密码是一种对称加密算法,使用异或运算进行加密和解密
export class XorCipher { /** * 使用密钥对文本进行XOR加密/解密 * @param text 要加密/解密的文本 * @param key 密钥 * @returns 加密/解密后的文本 */ static encrypt(text: string, key: string): string { if (!text || !key) { return ''; } let result = ''; for (let i = 0; i < text.length; i++) { const charCode =...
AST#export_declaration#Left export AST#class_declaration#Left class XorCipher AST#class_body#Left { /** * 使用密钥对文本进行XOR加密/解密 * @param text 要加密/解密的文本 * @param key 密钥 * @returns 加密/解密后的文本 */ AST#method_declaration#Left static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Le...
export class XorCipher { static encrypt(text: string, key: string): string { if (!text || !key) { return ''; } let result = ''; for (let i = 0; i < text.length; i++) { const charCode = text.charCodeAt(i); const keyCharCode = key.charCodeAt(i % key.length); result += String....
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/XorCipher.ets#L5-L35
8cb88496e80f319c8d64b80503d9b35d8c3dfe76
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/init_process.ets
arkts
downloads
Inits downloads. @param t0 Start time of the whole initialization process.
function downloads(storage: LocalStorage) { let downloads = new bunch_of_downloads(); AppStorage.setOrCreate('bunch_of_downloads', downloads); // Timer console.log('[init] Downloads OK. (' + run_time(storage) + ' ms)'); }
AST#function_declaration#Left function downloads AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_d...
function downloads(storage: LocalStorage) { let downloads = new bunch_of_downloads(); AppStorage.setOrCreate('bunch_of_downloads', downloads); console.log('[init] Downloads OK. (' + run_time(storage) + ' ms)'); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L563-L569
06bcdd32d3693838b8d07df83e0b4dec1d8ac363
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets
arkts
缓存记录对象
export class DiskCacheEntry { // 缓存的key private key: string = ''; // 缓存文件大小 private size: number = 0; constructor(key: string, size?: number) { this.key = key; this.size = size ?? 0; } /** * 设置缓存文件key值 * * @param key 键值 */ setKey(key: string) { this.key = key; } /** * 返...
AST#export_declaration#Left export AST#class_declaration#Left class DiskCacheEntry AST#class_body#Left { // 缓存的key AST#property_declaration#Left private key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#proper...
export class DiskCacheEntry { private key: string = ''; private size: number = 0; constructor(key: string, size?: number) { this.key = key; this.size = size ?? 0; } setKey(key: string) { this.key = key; } getKey(): string { return this.key; } setSize(size: number) { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets#L17-L59
5f3920dc0d1ea696d56b1993af75c2b530f9b33e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets
arkts
aboutToDisappear
在自定义组件生命周期aboutToDisappear中,重置导航栏的背景色避免影响其它页面的导航栏为红色。
aboutToDisappear(): void { const applicationContext = getContext(this).getApplicationContext(); applicationContext.setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); setStatusBar(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left applicat...
aboutToDisappear(): void { const applicationContext = getContext(this).getApplicationContext(); applicationContext.setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); setStatusBar(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets#L59-L63
a70b8369fd33c15ff090989e1ff33f76d9a70dd8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/common/resource.ets
arkts
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...
export class ResourceManager { public resourceToString(resource: Resource): string { return getContext(this).resourceManager.getStringSync(resource); } }
AST#export_declaration#Left export AST#class_declaration#Left class ResourceManager AST#class_body#Left { AST#method_declaration#Left public resourceToString 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 A...
export class ResourceManager { public resourceToString(resource: Resource): string { return getContext(this).resourceManager.getStringSync(resource); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/common/resource.ets#L16-L20
b5e736bfb08e61eb97c39d8769e81edf1311a212
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ListBeExchange/ListExchange/src/main/ets/model/MockData.ets
arkts
Mock数据
export const MEMO_DATA: ListInfo[] = [ new ListInfo($r('app.media.list_exchange_ic_public_cards_filled'), '账户余额'), new ListInfo($r('app.media.list_exchange_ic_public_cards_filled2'), 'xx银行储蓄卡(1234)'), new ListInfo($r('app.media.list_exchange_ic_public_cards_filled3'), 'xx银行储蓄卡(1238)'), new ListInfo($r('app.medi...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MEMO_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ListInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#express...
export const MEMO_DATA: ListInfo[] = [ new ListInfo($r('app.media.list_exchange_ic_public_cards_filled'), '账户余额'), new ListInfo($r('app.media.list_exchange_ic_public_cards_filled2'), 'xx银行储蓄卡(1234)'), new ListInfo($r('app.media.list_exchange_ic_public_cards_filled3'), 'xx银行储蓄卡(1238)'), new ListInfo($r('app.medi...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ListBeExchange/ListExchange/src/main/ets/model/MockData.ets#L19-L24
c6dca2ddef8a73365031618f604566c9739a396a
gitee
Jolin-Kan/HarmonyOS-App.git
5b2c84ed90d89d721bc107f2100a64d0203a6e72
entry/src/main/components/ComponentTypeA.ets
arkts
toggleState
private src:string = `"app.media.${this.name}"`
private toggleState() { this.isOn = !this.isOn; }
AST#method_declaration#Left private toggleState AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOn AST#member_expression#Rig...
private toggleState() { this.isOn = !this.isOn; }
https://github.com/Jolin-Kan/HarmonyOS-App.git/blob/5b2c84ed90d89d721bc107f2100a64d0203a6e72/entry/src/main/components/ComponentTypeA.ets#L12-L14
cea322b2194f3bb50e1f8f8b2ef29fdb68f65f2a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webcustompressmenu/src/main/ets/components/mainpage/MainPage.ets
arkts
menuBuilder
构建自定义菜单及触发功能接口。
@Builder menuBuilder() { //以垂直列表形式显示的菜单。 Menu() { // 如果元素存在图片 if (this.isExistImage) { MenuItem({ content: $r('app.string.web_press_copy_image'), }) .width(MENU_ITEM_WIDTH_LEVEL1) .height(MENU_ITEM_HEIGHT) .onClick(() => { this.re...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right menuBuilder 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 Menu ( ) AST#container_content_body#Left { // ...
@Builder menuBuilder() { Menu() { if (this.isExistImage) { MenuItem({ content: $r('app.string.web_press_copy_image'), }) .width(MENU_ITEM_WIDTH_LEVEL1) .height(MENU_ITEM_HEIGHT) .onClick(() => { this.result?.copyImage(); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webcustompressmenu/src/main/ets/components/mainpage/MainPage.ets#L77-L192
6985bf2a10f886804e856b0c565a61fcb060e232
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/Start/StartDialogPage.ets
arkts
openLink
打开链接
private openLink(url: string) { const params = new WebViewParams(this.agree.statement_info[0].title, url); this.contentNode = new ComponentContent(this.getUIContext(), wrapBuilder(WebViewPageBuilder), params); PromptActionClass.setContext(this.getUIContext()); PromptActionClass.setContentNode(this.conte...
AST#method_declaration#Left private openLink AST#parameter_list#Left ( AST#parameter#Left url : 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...
private openLink(url: string) { const params = new WebViewParams(this.agree.statement_info[0].title, url); this.contentNode = new ComponentContent(this.getUIContext(), wrapBuilder(WebViewPageBuilder), params); PromptActionClass.setContext(this.getUIContext()); PromptActionClass.setContentNode(this.conte...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/Start/StartDialogPage.ets#L76-L93
b7cec1fbf1a2dbf6ceda26ec4cddf7889c1b55aa
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语排序字段枚举
export enum GreetingSortField { CREATED_AT = 'createdAt', SENT_AT = 'sentAt', RATING = 'rating', USAGE = 'usage', RELEVANCE = 'relevance' }
AST#export_declaration#Left export AST#enum_declaration#Left enum GreetingSortField AST#enum_body#Left { AST#enum_member#Left CREATED_AT = AST#expression#Left 'createdAt' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SENT_AT = AST#expression#Left 'sentAt' AST#expression#Right AST#enum_member#Right ,...
export enum GreetingSortField { CREATED_AT = 'createdAt', SENT_AT = 'sentAt', RATING = 'rating', USAGE = 'usage', RELEVANCE = 'relevance' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/GreetingTypes.ets#L232-L238
878b7d179889b5874b87d25dc5610ec0e006fb35
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets
arkts
MARK: - String Extension
export class CMetaInfoHelper { /// 获取纯主文件名(第一个点之前的内容) /// - "Book.sqlite" → "Book" /// - "Book.sqlite.zip" → "Book" static baseName(value: string): string { const dotIndex: number = value.indexOf("."); if (dotIndex === -1) { return value; } return value.substring(0, dotIndex); } /// 获...
AST#export_declaration#Left export AST#class_declaration#Left class CMetaInfoHelper AST#class_body#Left { /// 获取纯主文件名(第一个点之前的内容) /// - "Book.sqlite" → "Book" /// - "Book.sqlite.zip" → "Book" AST#method_declaration#Left static baseName AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#pri...
export class CMetaInfoHelper { static baseName(value: string): string { const dotIndex: number = value.indexOf("."); if (dotIndex === -1) { return value; } return value.substring(0, dotIndex); } static baseNameWithInnerExtension(value: string): string { const parts: st...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L34-L56
1a8144ec17f77b58c740abcc16b5c8ef5fd3b9fb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowFunction.ets
arkts
隐藏弹窗 @param { api.SubWindowApi | null } SubWindowApi - SubWindowApi对象
export function hideApiSubWindow(SubWindowApi: api.SubWindowApi | null) { SubWindowApi?.hideSubWindow(); }
AST#export_declaration#Left export AST#function_declaration#Left function hideApiSubWindow AST#parameter_list#Left ( AST#parameter#Left SubWindowApi : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left api . SubWindowApi AST#qualified_type#Right AST#primary_type#Right | AST#prima...
export function hideApiSubWindow(SubWindowApi: api.SubWindowApi | null) { SubWindowApi?.hideSubWindow(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowFunction.ets#L49-L51
e2a71f61b37b31702161c441469594f67984e2b7
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/map/MapManager.ets
arkts
planRoute
规划路线
async planRoute(start: Location, end: Location): Promise<Location[] | null> { try { Logger.info('MapManager', 'Planning route'); // Mock 路线规划 return [start, end]; } catch (error) { Logger.error('MapManager', `Failed to plan route: ${String(error)}`); return null; } }
AST#method_declaration#Left async planRoute AST#parameter_list#Left ( AST#parameter#Left start : AST#type_annotation#Left AST#primary_type#Left Location AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left end : AST#type_annotation#Left AST#primary_type#Left Location AST#primary_typ...
async planRoute(start: Location, end: Location): Promise<Location[] | null> { try { Logger.info('MapManager', 'Planning route'); return [start, end]; } catch (error) { Logger.error('MapManager', `Failed to plan route: ${String(error)}`); return null; } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/map/MapManager.ets#L55-L64
e0094b654f69c486c5fe468e1e348470c1672c60
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
generateGiftSuggestions
生成礼物建议
private async generateGiftSuggestions(): Promise<SmartSuggestion[]> { const suggestions: SmartSuggestion[] = []; const upcomingBirthdays = await this.getUpcomingBirthdays(); for (const item of upcomingBirthdays) { if (item.daysUntil <= 7 && item.daysUntil > 0) { const giftIdeas = this.getGift...
AST#method_declaration#Left private async generateGiftSuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SmartSuggestion [ ] AST#array...
private async generateGiftSuggestions(): Promise<SmartSuggestion[]> { const suggestions: SmartSuggestion[] = []; const upcomingBirthdays = await this.getUpcomingBirthdays(); for (const item of upcomingBirthdays) { if (item.daysUntil <= 7 && item.daysUntil > 0) { const giftIdeas = this.getGift...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L403-L430
8a53635604e33af08aeb9e6f4f68edafa1cca4fc
github
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/common/AliYunTaskPollingUtil.ets
arkts
轮询任务结果
export interface PollResult<T> { success: boolean; // 是否成功 taskId: string; // 任务ID data?: T; // 任务结果数据 error?: string; // 错误信息 }
AST#export_declaration#Left export AST#interface_declaration#Left interface PollResult AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R...
export interface PollResult<T> { success: boolean; taskId: string; data?: T; error?: string; }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/AliYunTaskPollingUtil.ets#L19-L24
9fdba6c10b86233678f8d92347b72e59216ac395
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/map_lib_func_003_T.ets
arkts
Introduction 库函数-map_get
export function map_lib_func_003_T(taint_src : string) { let map = new Map<string,string>(); map.set("t",taint_src); taint.Sink(map.get("t")!); }
AST#export_declaration#Left export AST#function_declaration#Left function map_lib_func_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function map_lib_func_003_T(taint_src : string) { let map = new Map<string,string>(); map.set("t",taint_src); taint.Sink(map.get("t")!); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/map_lib_func_003_T.ets#L7-L11
3c0e9b4c02c982d0c7f44a3e8cf0b4b9404bb664
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/CategoryPage.ets
arkts
buildCategoryItem
构建分类项 @param {CategoryTree} category - 分类数据 @returns {void} 无返回值
@Builder private buildCategoryItem(category: CategoryTree): void { Column() { NetWorkImage({ model: category.pic ?? null, sizeValue: bp({ sm: 56, md: 64, lg: 72 }), showBackground: false, backgroundColorValue: $r("app.color.bg_grey") }); SpaceVerticalXSmall(); ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildCategoryItem AST#parameter_list#Left ( AST#parameter#Left category : AST#type_annotation#Left AST#primary_type#Left CategoryTree AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST...
@Builder private buildCategoryItem(category: CategoryTree): void { Column() { NetWorkImage({ model: category.pic ?? null, sizeValue: bp({ sm: 56, md: 64, lg: 72 }), showBackground: false, backgroundColorValue: $r("app.color.bg_grey") }); SpaceVerticalXSmall(); ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CategoryPage.ets#L169-L193
4d4779869c650aa164633c835e4fb5f4b22ab5f2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/BundleManagerDocsSample/HspSample/library/src/main/ets/Index.ets
arkts
Log
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 { Log, add, minus } from './utils/test';
AST#export_declaration#Left export { Log , add , minus } from './utils/test' ; AST#export_declaration#Right
export { Log, add, minus } from './utils/test';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/BundleManagerDocsSample/HspSample/library/src/main/ets/Index.ets#L16-L16
38fed5f9536cef50e3cd1d81ec3369d177258b19
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
SelectMode. include SINGLE_SELECT and MULTI_SELECT @enum { number } SelectMode @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare enum SelectMode { /** * SINGLE_SELECT. single select * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ SINGLE_SELECT = 0, /** * MULTI_SELECT. multi select * * @syscap SystemCapability.FileManagement....
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum SelectMode AST#enum_body#Left { /** * SINGLE_SELECT. single select * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member#Lef...
export declare enum SelectMode { SINGLE_SELECT = 0, MULTI_SELECT = 1 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L611-L628
68f6b908288bdf7681c7a5b973976122f264d8bb
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/OrderRepository.ets
arkts
cancelOrder
取消订单 @param params 取消订单参数 @returns 是否取消成功
async cancelOrder(params: CancelOrderRequest): Promise<NetworkResponse<boolean>> { return this.networkDataSource.cancelOrder(params); }
AST#method_declaration#Left async cancelOrder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CancelOrderRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
async cancelOrder(params: CancelOrderRequest): Promise<NetworkResponse<boolean>> { return this.networkDataSource.cancelOrder(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L83-L85
09eafca237d61eb21a9db5928851f2e6cddc2e90
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/common/util/ArrayUtil.ets
arkts
equalTo
根据数组中的每一对值而不是数组的地址判断数组是否相等。 @param one 被比较的数组。 @param other 被比较的数组。 @returns 相等则返回 true,不相等则返回 false。
static equalTo<value_type>(one: Array<value_type>, other: Array<value_type>): boolean { if (one.length != other.length) { return false; } else { let n = one.length; for (let i = 0; i < n; ++ i) { if (one[i] !== other[i]) { return false; } } return true; ...
AST#method_declaration#Left static equalTo AST#type_parameters#Left < AST#type_parameter#Left value_type AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left one : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_a...
static equalTo<value_type>(one: Array<value_type>, other: Array<value_type>): boolean { if (one.length != other.length) { return false; } else { let n = one.length; for (let i = 0; i < n; ++ i) { if (one[i] !== other[i]) { return false; } } return true; ...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/common/util/ArrayUtil.ets#L30-L42
efc2f27b0f9d3162073155184e4a8f541a1b5a6c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets
arkts
getInstance
静态方法,用于获取数据库连接实例 @returns 数据库实例
public static getInstance(): DatabaseConnection { if (!DatabaseConnection.instance) { DatabaseConnection.instance = new DatabaseConnection(); } return DatabaseConnection.instance; }
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DatabaseConnection AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expr...
public static getInstance(): DatabaseConnection { if (!DatabaseConnection.instance) { DatabaseConnection.instance = new DatabaseConnection(); } return DatabaseConnection.instance; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L40-L45
e8b16e9ac33814f1a287bc712c86d224d22f3a72
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIService.ets
arkts
AI服务主类
export class AIService { private static instance: AIService; private modelConfigs: AIModelConfig[] = []; private defaultConfig: AIModelConfig | null = null; private generationSessions: Map<string, GenerationSession> = new Map(); private streamStates: Map<string, StreamState> = new Map(); private generationH...
AST#export_declaration#Left export AST#class_declaration#Left class AIService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left AIService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#...
export class AIService { private static instance: AIService; private modelConfigs: AIModelConfig[] = []; private defaultConfig: AIModelConfig | null = null; private generationSessions: Map<string, GenerationSession> = new Map(); private streamStates: Map<string, StreamState> = new Map(); private generationH...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIService.ets#L32-L185
e66d3e3280c2074d86bf8bc125c3fba6c59a3185
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/PrivateChatComponent.ets
arkts
subscribePrivateChatMessage
订阅Text类型消息
subscribePrivateChatMessage() { EmitterUtil.subscribe(VHRoomEventType.IM_PRIVATE_TEXT, (msgData: EmitterMsgData) => { console.log(`收到私聊消息,类型:${VHRoomEventType.IM_PRIVATE_TEXT}`); let messageModel: VHIMMessageModel = msgData as VHIMMessageModel; if (messageModel.data!) { // 实际业务:将消息添加到列表、更新...
AST#method_declaration#Left subscribePrivateChatMessage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EmitterUtil AST#expression#Right . s...
subscribePrivateChatMessage() { EmitterUtil.subscribe(VHRoomEventType.IM_PRIVATE_TEXT, (msgData: EmitterMsgData) => { console.log(`收到私聊消息,类型:${VHRoomEventType.IM_PRIVATE_TEXT}`); let messageModel: VHIMMessageModel = msgData as VHIMMessageModel; if (messageModel.data!) { this.handl...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L126-L139
3ba534ea086593c3b6760fced63cce8f3deaa3d4
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/phoneView/LoadingDialog.ets
arkts
LoadingDialog
Copyright (c) 2022-2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
@CustomDialog export struct LoadingDialog { private controller: CustomDialogController = {} as CustomDialogController build() { Row() { Text($r('app.string.phoneMain_loading')).width('50%') .fontSize(14) Image($r('app.media.icon_loading')) .width(50) .height(50) .bac...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct LoadingDialog AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right = AS...
@CustomDialog export struct LoadingDialog { private controller: CustomDialogController = {} as CustomDialogController build() { Row() { Text($r('app.string.phoneMain_loading')).width('50%') .fontSize(14) Image($r('app.media.icon_loading')) .width(50) .height(50) .bac...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/phoneView/LoadingDialog.ets#L16-L35
a8077f88c7597fdd8f31810202f04f0778b8dbd6
gitee
longchenxu123/HongmengDemoPandaCommunity.git
331aee32e89ac94764e63aa6d0c8c458201b7df8
entry/src/main/ets/pages/ContactSummary/Login.ets
arkts
commonStyle
@Builder function ItemList(item) { Row() { Text(item + '') }.width('100%').height(300).border({width: 2}).borderColor('red') }
@Styles function commonStyle() { .width('100%') .border({width: 5}) .borderColor('green') .height('100%') .layoutWeight(1) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function commonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#L...
@Styles function commonStyle() { .width('100%') .border({width: 5}) .borderColor('green') .height('100%') .layoutWeight(1) }
https://github.com/longchenxu123/HongmengDemoPandaCommunity.git/blob/331aee32e89ac94764e63aa6d0c8c458201b7df8/entry/src/main/ets/pages/ContactSummary/Login.ets#L22-L28
bfb33c7547546f24b3463bff8dba2d0ee4dadbfe
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Spacer.ets
arkts
SpaceHorizontalXXLarge
创建一个超大水平间距(32vp) @returns {void} 无返回值
@Builder export function SpaceHorizontalXXLarge(): void { Blank().width($r("app.float.space_horizontal_large_xx")); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceHorizontalXXLarge 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#a...
@Builder export function SpaceHorizontalXXLarge(): void { Blank().width($r("app.float.space_horizontal_large_xx")); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L64-L67
3362d08f31c85adb940d4efdea90624cda69a351
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/BarLineScatterCandleBubbleRenderer.ets
arkts
set
Calculates the minimum and maximum x values as well as the range between them. @param chart @param dataSet
public set( chart: BarLineScatterCandleBubbleDataProvider, dataSet: IBarLineScatterCandleBubbleDataSet<any>, mAnimator: ChartAnimator ) { let phaseX: number = Math.max(0, Math.min(1, mAnimator.getPhaseX())); let low: number = chart.getLowestVisibleX(); let high: number = chart.getHighestVisib...
AST#method_declaration#Left public set AST#parameter_list#Left ( AST#parameter#Left chart : AST#type_annotation#Left AST#primary_type#Left BarLineScatterCandleBubbleDataProvider AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#...
public set( chart: BarLineScatterCandleBubbleDataProvider, dataSet: IBarLineScatterCandleBubbleDataSet<any>, mAnimator: ChartAnimator ) { let phaseX: number = Math.max(0, Math.min(1, mAnimator.getPhaseX())); let low: number = chart.getLowestVisibleX(); let high: number = chart.getHighestVisib...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/BarLineScatterCandleBubbleRenderer.ets#L54-L70
6fad30b02310004890e5e1f7edae704644b5246c
gitee