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
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/entity/Auth.ets
arkts
isExpired
检查访问令牌是否过期 @returns {boolean} 是否过期
isExpired(): boolean { const currentTime: number = Date.now(); const expirationTime: number = this.createdAt + this.expire * 1000; return currentTime >= expirationTime; }
AST#method_declaration#Left isExpired AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentTime ...
isExpired(): boolean { const currentTime: number = Date.now(); const expirationTime: number = this.createdAt + this.expire * 1000; return currentTime >= expirationTime; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/entity/Auth.ets#L56-L60
bedab43316a9f03e5a7ed5c0656652f0b1961175
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/accessibility/AccessibilityService.ets
arkts
颜色主题配置
export interface ColorThemeConfig { primary: string; secondary: string; background: string; surface: string; textPrimary: string; textSecondary: string; accent: string; error: string; success: string; warning: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ColorThemeConfig AST#object_type#Left { AST#type_member#Left primary : 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 secondary : AST#type_anno...
export interface ColorThemeConfig { primary: string; secondary: string; background: string; surface: string; textPrimary: string; textSecondary: string; accent: string; error: string; success: string; warning: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L135-L146
f7a53eed7fa5d3f5465d5207ee48c1b51d651e32
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets
arkts
parseSpecs
解析规格 JSON 字符串为规格列表 @param {string | undefined} specJson 规格 JSON @returns {CartGoodsSpec[]} 规格列表
private parseSpecs(specJson?: string): CartGoodsSpec[] { if (!specJson) { return []; } try { const raw: CartGoodsSpec[] | undefined = JSON.parse(specJson) as CartGoodsSpec[]; if (Array.isArray(raw)) { return raw.map((item: CartGoodsSpec) => new CartGoodsSpec(item as Partial<CartGoo...
AST#method_declaration#Left private parseSpecs AST#parameter_list#Left ( AST#parameter#Left specJson ? : 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#array_type#L...
private parseSpecs(specJson?: string): CartGoodsSpec[] { if (!specJson) { return []; } try { const raw: CartGoodsSpec[] | undefined = JSON.parse(specJson) as CartGoodsSpec[]; if (Array.isArray(raw)) { return raw.map((item: CartGoodsSpec) => new CartGoodsSpec(item as Partial<CartGoo...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets#L194-L207
2a08dfb5803637a0fa9e87a6039c8691feaa11c0
github
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/pages/component/FiveDayMinuteKLineComponent.ets
arkts
_handlerCanvasTouchEvent
处理触摸事件
_handlerCanvasTouchEvent(event?: TouchEvent) { }
AST#method_declaration#Left _handlerCanvasTouchEvent AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_bo...
_handlerCanvasTouchEvent(event?: TouchEvent) { }
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/FiveDayMinuteKLineComponent.ets#L150-L152
4f91564f62a5740e083b3c7df2b961732c953c36
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets
arkts
getData
根据index获取具体项
public getData(index: number): FlowItemContent { return this.momentList[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FlowItemContent AST#prima...
public getData(index: number): FlowItemContent { return this.momentList[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets#L80-L82
f84d19d94a11615947ac22b62f137d4fcbf8ad2b
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/Constants.ets
arkts
6; (中文版暂时不做截取)// 翻译最大部分数
export const wordsMaxPartLong : number = 100;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left wordsMaxPartLong : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar...
export const wordsMaxPartLong : number = 100;
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/Constants.ets#L10-L10
846d91e7de49fae84d904a6b1d03702d55e598a4
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets
arkts
requestListData
子类必须实现此方法,返回分页请求 Promise @returns {Promise<NetworkResponse<NetworkPageData<T>>>} 网络请求 Promise
protected abstract requestListData(): Promise<NetworkResponse<NetworkPageData<T>>>;
AST#method_declaration#Left protected abstract requestListData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_argum...
protected abstract requestListData(): Promise<NetworkResponse<NetworkPageData<T>>>;
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L52-L52
f34eba2dc80e4de3639f321b2e6aabc56d37bfbe
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets
arkts
decodePKCS1
解密 @param decodeStr 待解密的字符串 @param priKey RSA私钥
static async decodePKCS1(str: string, priKey: string): Promise<OutDTO<string>> { return CryptoUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024); }
AST#method_declaration#Left static async decodePKCS1 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 priKey : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static async decodePKCS1(str: string, priKey: string): Promise<OutDTO<string>> { return CryptoUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L87-L89
784e442457074a13083cd651ffcff9dcc1dd06cd
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
showSelectDialog
显示选择类弹出框 @param options
static showSelectDialog(options: SelectOptions): string { ActionParameter.initBaseDefault(options); ActionParameter.initDialogDefault(options); ActionParameter.initSelect(options); const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(SelectDialogBuilder), options); return dialo...
AST#method_declaration#Left static showSelectDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left SelectOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string ...
static showSelectDialog(options: SelectOptions): string { ActionParameter.initBaseDefault(options); ActionParameter.initDialogDefault(options); ActionParameter.initSelect(options); const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(SelectDialogBuilder), options); return dialo...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L179-L185
cb10ca8533c659d4ca2b8362679a0c9b44ff590a
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/references_object/field_len_002_F.ets
arkts
Introduction 路径长度
export function field_len_002_F(taint_src : string) { class A { b: B constructor () { this.b = new B() }
AST#export_declaration#Left export AST#function_declaration#Left function field_len_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Lef...
export function field_len_002_F(taint_src : string) { class A { b: B constructor () { this.b = new B() }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/references_object/field_len_002_F.ets#L7-L12
6ff90c86d6072f7cc725776965e89141f680c7c0
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/@xvideos_alerts/585.2.14/package/app.ets
arkts
应用约束60:改用import/export语法
export function printMsg(): void {}
AST#export_declaration#Left export AST#function_declaration#Left function printMsg 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#block_statement#Right AST#function_declaration#R...
export function printMsg(): void {}
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/@xvideos_alerts/585.2.14/package/app.ets#L2-L2
d960ffbdf5c94af86389106bd45613f6f8501ad3
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/pages/VideoCoursePage.ets
arkts
updateVideoState
更新指定视频的状态
updateVideoState(videoId: number, updates: Partial<VideoState>) { const currentState = this.getVideoState(videoId); const newState: VideoState = { isPlaying: updates.isPlaying !== undefined ? updates.isPlaying : currentState.isPlaying, currentTime: updates.currentTime !== undefined ? updates.current...
AST#method_declaration#Left updateVideoState AST#parameter_list#Left ( AST#parameter#Left videoId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
updateVideoState(videoId: number, updates: Partial<VideoState>) { const currentState = this.getVideoState(videoId); const newState: VideoState = { isPlaying: updates.isPlaying !== undefined ? updates.isPlaying : currentState.isPlaying, currentTime: updates.currentTime !== undefined ? updates.current...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/pages/VideoCoursePage.ets#L65-L80
3b5990532e7bd29fd972c8acaaba5d8386f0845e
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/StorageUtils.ets
arkts
getNumber
获取数值数据 @param key 存储键 @param defaultValue 默认值 @returns 存储的数值
static async getNumber(key: string, defaultValue: number = 0): Promise<number> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return defaultValue; } try { const result = await dataPreferences.get(key, defau...
AST#method_declaration#Left static async getNumber 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 defaultValue : AST#type_annotation#Left AST#primary_type#Left number AST#p...
static async getNumber(key: string, defaultValue: number = 0): Promise<number> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return defaultValue; } try { const result = await dataPreferences.get(key, defau...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L87-L101
8d00772675e93a2191f7fb5e53ee8c1d8f4cdbec
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/AgentService.ets
arkts
initSystemPrompt
Initialize system prompt for the AI agent
private initSystemPrompt(): void { const systemMessage: ChatMessage = { role: 'system', content: `你是Lumos,用户的AI伙伴。你既是生活助手,也是陪伴者。 【性格特点】 - 温暖、有趣、真诚 - 说话简洁自然,像朋友聊天 - 不啰嗦、不说教、不用客套话开头 - 直接回应,不要说"好的,我来..."之类的铺垫 【CRITICAL:模式识别与切换 - 必须严格遵守!】 **第一步:判断用户意图,选择模式** 🔧 助手模式 = 必须调用工具函数 触发条件(满足任一即可): 1. 包含时间词:明天、...
AST#method_declaration#Left private initSystemPrompt 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 ...
private initSystemPrompt(): void { const systemMessage: ChatMessage = { role: 'system', content: `你是Lumos,用户的AI伙伴。你既是生活助手,也是陪伴者。 【性格特点】 - 温暖、有趣、真诚 - 说话简洁自然,像朋友聊天 - 不啰嗦、不说教、不用客套话开头 - 直接回应,不要说"好的,我来..."之类的铺垫 【CRITICAL:模式识别与切换 - 必须严格遵守!】 **第一步:判断用户意图,选择模式** 🔧 助手模式 = 必须调用工具函数 触发条件(满足任一即可): 1. 包含时间词:明天、...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/AgentService.ets#L155-L228
db713ecb927b7ec8465ce4195e22e8584b082ea7
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/decodeheifimage/src/main/ets/components/ReusableFlowItem.ets
arkts
aboutToReuse
TODO:知识点:从复用缓存中加入到组件树之前调用,可在此处更新组件的状态变量以展示正确的内容
aboutToReuse(params: ESObject) { this.item = params.item; }
AST#method_declaration#Left aboutToReuse AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left ESObject 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#expres...
aboutToReuse(params: ESObject) { this.item = params.item; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decodeheifimage/src/main/ets/components/ReusableFlowItem.ets#L24-L26
ccfc8e2ef0c3d249a957cc374ab21ef151791d4d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets
arkts
getGoodsCommentPage
分页查询商品评论 @param params 评论分页请求参数 @returns 评论分页数据响应
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<Comment>>> = await NetworkClient.http.post("goods/comment/page", params); return resp.data; }
AST#method_declaration#Left async getGoodsCommentPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsCommentPageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L...
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<Comment>>> = await NetworkClient.http.post("goods/comment/page", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets#L92-L96
59b16a99f9552791e154ce465f049da3efd16c04
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
updateNotificationSettings
更新通知设置 @param notificationSettings 通知设置 @returns 更新后的通知设置
async updateNotificationSettings(notificationSettings: Partial<NotificationSettings>): Promise<NotificationSettings> { const updatedSettings = await this.updateSettings({ notification: notificationSettings }); return updatedSettings.notification; }
AST#method_declaration#Left async updateNotificationSettings AST#parameter_list#Left ( AST#parameter#Left notificationSettings : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NotificationSettings AST#primary_type#Rig...
async updateNotificationSettings(notificationSettings: Partial<NotificationSettings>): Promise<NotificationSettings> { const updatedSettings = await this.updateSettings({ notification: notificationSettings }); return updatedSettings.notification; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L201-L204
784b9ec716ae6ef70b0d665c16c4e9299a05b9af
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/pages/LoginPage.ets
arkts
isLoginClickable
通过输入用户名和密码来计算可点击的登录按钮。
function isLoginClickable(account: string, password: string): boolean { return account !== '' && password !== ''; }
AST#function_declaration#Left function isLoginClickable AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string ...
function isLoginClickable(account: string, password: string): boolean { return account !== '' && password !== ''; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/pages/LoginPage.ets#L116-L118
abee92deaacfa68d699fd14b6d76e7a69d6894ec
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/ProfilePage.ets
arkts
ProfilePage
@file 个人中心页面视图 @author Joker.X
@ComponentV2 export struct ProfilePage { /** * 个人中心页面 ViewModel */ @Local private vm: ProfileViewModel = new ProfileViewModel(); /** * 构建个人中心页面 * @returns {void} 无返回值 */ build() { AppNavDestination({ title: $r("app.string.profile_title"), viewModel: this.vm }) { this....
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ProfilePage AST#component_body#Left { /** * 个人中心页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left ProfileV...
@ComponentV2 export struct ProfilePage { @Local private vm: ProfileViewModel = new ProfileViewModel(); build() { AppNavDestination({ title: $r("app.string.profile_title"), viewModel: this.vm }) { this.ProfileContent(); IBestDialog({ visible: this.vm.showLogoutDialog...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L17-L258
8834cb1168a0ae93ba8f5fdbf70f15e3d3103853
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/pages/Index.ets
arkts
startJJchessAbility
拉起 JJchessAbility
startJJchessAbility(wechatName: string) { // 拉起指定的 JJchessAbility 需要一个哥们 Context 帮我在两个 Ability 之间 共享 let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; // 需要want对象 说清楚目标是谁 let wantInfo: Want = { deviceId: '', // 本设备 // bundleName:context....
AST#method_declaration#Left startJJchessAbility AST#parameter_list#Left ( AST#parameter#Left wechatName : 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 { // 拉起指定的 JJchessAbility 需要一个哥们 Conte...
startJJchessAbility(wechatName: string) { let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; let wantInfo: Want = { deviceId: '', bundleName: 'com.dxin.wechat', moduleName: '', abilityName: 'JJchessAbility', p...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/pages/Index.ets#L64-L80
3b836045b79250a384ecbcca696da58c1401a8d0
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.DownloadFileButton.d.ets
arkts
Enum for DownloadDescription @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export declare enum DownloadDescription { /** * Description is DOWNLOAD. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ DOWNLOAD = 1, /** * Description is DOWNLOAD_FILE. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatfor...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum DownloadDescription AST#enum_body#Left { /** * Description is DOWNLOAD. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#enum_member#Left DOWNLO...
export declare enum DownloadDescription { DOWNLOAD = 1, DOWNLOAD_FILE = 2, SAVE = 3, SAVE_IMAGE = 4, SAVE_FILE = 5, DOWNLOAD_AND_SHARE = 6, RECEIVE = 7, CONTINUE_TO_RECEIVE = 8 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L61-L142
e72c604b6d4f7395af02446f72eea84e0321d05d
gitee
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/component/Logger.ets
arkts
构造函数 @param prefix - 日志前缀 @param domain - 日志分类域,默认为 0xFF00
constructor(prefix: string, domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
constructor(prefix: string, domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Logger.ets#L16-L19
3dc04a1877e2fd91bbd6c69706e58b970788d7ee
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets
arkts
getStatusBarHeight
获取主窗口顶部导航栏高度 @returns {callback((statusBarHeight: number) => void))}
getStatusBarHeight(callback: ((statusBarHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain ...
AST#method_declaration#Left getStatusBarHeight AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left statusBarHeight : AST#type_annotation#Left AST#...
getStatusBarHeight(callback: ((statusBarHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets#L59-L80
72e5c1aaf4f83c051f3ef8d94f0157356a61660d
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/net/src/main/ets/rcp/NetClientApi.ets
arkts
@author open_9527 @date 2025/5/15 @desc 描述信息
export class NetClientApi { private static async buildRequest(config: RequestConfig): Promise<rcp.Request> { Logger.debug(`NetClientApi buildRequest config: ${JSON.stringify(config)}`) let request = new rcp.Request(config.url, config.method, config.headers, config.content, config.cookies, config.transfe...
AST#export_declaration#Left export AST#class_declaration#Left class NetClientApi AST#class_body#Left { AST#method_declaration#Left private static async buildRequest AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotati...
export class NetClientApi { private static async buildRequest(config: RequestConfig): Promise<rcp.Request> { Logger.debug(`NetClientApi buildRequest config: ${JSON.stringify(config)}`) let request = new rcp.Request(config.url, config.method, config.headers, config.content, config.cookies, config.transfe...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/net/src/main/ets/rcp/NetClientApi.ets#L12-L67
4274e0c0331f38bfc5026efad0f39743685c2136
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/CartService.ets
arkts
getCartCount
获取购物车商品数量(种类数)
getCartCount(): number { return this.cartItems.length; }
AST#method_declaration#Left getCartCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#...
getCartCount(): number { return this.cartItems.length; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L111-L113
9f128a9e5f5429502937c96bb2a5b14d54b212d2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/UIExtensionComponent/Extension.ets
arkts
pageOneTmp
pageOne
@Component export struct pageOneTmp { pathStack: NavPathStack = new NavPathStack() build() { NavDestination() { Column() { Text('Hello World') }.width('100%').height('100%') }.title('pageOne') .onBackPressed(() => { const popDestinationInfo = this.pathStack.pop() console...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct pageOneTmp AST#component_body#Left { AST#property_declaration#Left pathStack : AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#cal...
@Component export struct pageOneTmp { pathStack: NavPathStack = new NavPathStack() build() { NavDestination() { Column() { Text('Hello World') }.width('100%').height('100%') }.title('pageOne') .onBackPressed(() => { const popDestinationInfo = this.pathStack.pop() console...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/UIExtensionComponent/Extension.ets#L90-L109
b3eeb86d1c04fe390788187f33ecbd133e02678d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/BluetoothAdvertising.ets
arkts
disableAdvertising
4 临时停止广播,该广播资源仍然存在
public async disableAdvertising() { // 4.1 构造临时停止广播参数 console.info('disableAdvertising 4.1') let advertisingDisableParams: ble.AdvertisingDisableParams = { advertisingId: this.advHandle // 使用首次启动广播时获取到的广播标识ID } // 4.2 临时停止 console.info('disableAdvertising 4.2') try { await ble.di...
AST#method_declaration#Left public async disableAdvertising AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 4.1 构造临时停止广播参数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left c...
public async disableAdvertising() { console.info('disableAdvertising 4.1') let advertisingDisableParams: ble.AdvertisingDisableParams = { advertisingId: this.advHandle } console.info('disableAdvertising 4.2') try { await ble.disableAdvertising(advertisingDisableParams); ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/BluetoothAdvertising.ets#L128-L144
734886211fc1b141c8b810815938098f6fdf92f8
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Index.ets
arkts
listBuilder
列表展示(自定义builder渲染)
@Builder listBuilder() { List() { // 标题 ListItem() { Column() { Text(this.title) .fontSize(20) .fontWeight(FontWeight.Bold) .width('90%') .margin({ top: 30, bottom: 10}) Text(this.subTitle) .fontSize(14) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right listBuilder 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 List ( ) AST#container_content_body#Left { // 标题 AST#arkts_ui_...
@Builder listBuilder() { List() { ListItem() { Column() { Text(this.title) .fontSize(20) .fontWeight(FontWeight.Bold) .width('90%') .margin({ top: 30, bottom: 10}) Text(this.subTitle) .fontSize(14) .widt...
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Index.ets#L32-L70
ddd1727989f797971f986c029e5d3898261a760c
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
A class holding a controller and statuses of a tab. @param title A string, the initial title when the tab is created. @param link A string, the initial link when the tab is created. @param restore_on_creation A boolean, optional, will restore web state on creation if the index in valid.
constructor(title: string, url: string, storage: LocalStorage, index: number, init_state: boolean) { this.storage = storage; this.index = index; this.title = title; this.url = url; this.is_loading = url.substring(0, 7) != 'meow://'; this.loading_progress = 0; if (init_state) { console....
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
constructor(title: string, url: string, storage: LocalStorage, index: number, init_state: boolean) { this.storage = storage; this.index = index; this.title = title; this.url = url; this.is_loading = url.substring(0, 7) != 'meow://'; this.loading_progress = 0; if (init_state) { console....
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L783-L796
688bb3e71eaa32e4e9f4d4c08e87cb614c7a2a80
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
verifySync
对数据进行验签,同步 @param dataBlob 待验签数据 @param signDataBlob 签名数据 @param pubKey 公钥 @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。 @returns
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string): boolean { let verifier = cryptoFramework.createVerify(algName); verifier.initSync(pubKey); let res = verifier.verifySync(dataBlob, signDataBlob); return res...
AST#method_declaration#Left static verifySync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signD...
static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string): boolean { let verifier = cryptoFramework.createVerify(algName); verifier.initSync(pubKey); let res = verifier.verifySync(dataBlob, signDataBlob); return res...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L336-L342
8b7c1c8cdc5b735e44ab8b3cbb8ee6fcad819cf0
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/network/RCPUtils.ets
arkts
getRCPRequest
The method of initiating a GET request through RCP.
async getRCPRequest(cacheDir: string): Promise<string> { let responsePictureUri: string = ''; await this.rcpSession.get('https://developer.huawei.com/system/modules/org.opencms.portal.template.core/' + 'resources/harmony/img/jiantou_right.svg') .then((response) => { let filePath = cacheDir +...
AST#method_declaration#Left async getRCPRequest AST#parameter_list#Left ( AST#parameter#Left cacheDir : 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#...
async getRCPRequest(cacheDir: string): Promise<string> { let responsePictureUri: string = ''; await this.rcpSession.get('https://developer.huawei.com/system/modules/org.opencms.portal.template.core/' + 'resources/harmony/img/jiantou_right.svg') .then((response) => { let filePath = cacheDir +...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/RCPUtils.ets#L27-L41
7f00f50b19972c2fbe4643728fde61d0b8fd85c1
gitee
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/utils/GestureUtils.ets
arkts
getSwipeDirection
判断滑动方向 @param state - 手势状态 @returns 滑动方向
static getSwipeDirection(state: GestureState): SwipeDirection { const absX: number = Math.abs(state.deltaX); const absY: number = Math.abs(state.deltaY); if (absX > absY) { return state.deltaX > 0 ? SwipeDirection.RIGHT : SwipeDirection.LEFT; } else { return state.deltaY > 0 ? SwipeDirectio...
AST#method_declaration#Left static getSwipeDirection AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left GestureState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SwipeDire...
static getSwipeDirection(state: GestureState): SwipeDirection { const absX: number = Math.abs(state.deltaX); const absY: number = Math.abs(state.deltaY); if (absX > absY) { return state.deltaX > 0 ? SwipeDirection.RIGHT : SwipeDirection.LEFT; } else { return state.deltaY > 0 ? SwipeDirectio...
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L98-L107
688e20364eeae2af9ec340d34a5ad0538de5b670
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets
arkts
@Author csx @DateTime 2024/3/18 10:15:03 @TODO SM4
export class SM4 { /** * 生成SM4的对称密钥 * @returns SM4密钥 */ static async generateSM4Key(): Promise<OutDTO<string>> { return CryptoUtil.generateSymKey('SM4_128'); } /** * 加密-ECB模式 * @param str 待加密的字符串 * @param sm4Key SM4密钥 * @returns */ static async encodeECB(str: string, sm4Key: s...
AST#export_declaration#Left export AST#class_declaration#Left class SM4 AST#class_body#Left { /** * 生成SM4的对称密钥 * @returns SM4密钥 */ AST#method_declaration#Left static async generateSM4Key AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
export class SM4 { static async generateSM4Key(): Promise<OutDTO<string>> { return CryptoUtil.generateSymKey('SM4_128'); } static async encodeECB(str: string, sm4Key: string): Promise<OutDTO<string>> { return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128); } static ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets#L25-L76
37095e7284ff2a233cd93dab7400b451d3eb948f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/NotificationTypes.ets
arkts
通知搜索结果
export interface NotificationSearchResult { notifications: NotificationItem[]; totalCount: number; hasMore: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationSearchResult AST#object_type#Left { AST#type_member#Left notifications : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NotificationItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right A...
export interface NotificationSearchResult { notifications: NotificationItem[]; totalCount: number; hasMore: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/NotificationTypes.ets#L118-L122
b66bacb555822323a0f71dd965f4f0c4b59a4bc1
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
buildSearchAndFilter
构建搜索和筛选栏
@Builder buildSearchAndFilter() { Column({ space: 12 }) { // 搜索框 Row({ space: 12 }) { TextInput({ placeholder: '搜索祝福语内容或标签' }) .fontSize(16) .backgroundColor('#ffffff') .borderRadius(8) .padding({ left: 16, right: 16 }) .layoutWeight(1) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchAndFilter AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#componen...
@Builder buildSearchAndFilter() { Column({ space: 12 }) { Row({ space: 12 }) { TextInput({ placeholder: '搜索祝福语内容或标签' }) .fontSize(16) .backgroundColor('#ffffff') .borderRadius(8) .padding({ left: 16, right: 16 }) .layoutWeight(1) .on...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L210-L264
d0eead16d0f73cf83f5431da5061ffb01bc920b2
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
clearSync
清空缓存的Preferences实例中的所有数据 @param preferenceName @returns
static clearSync(preferenceName: string = PreferencesUtil.defaultPreferenceName) { let preferences = PreferencesUtil.getPreferencesSync(preferenceName); //获取实例 preferences.clearSync(); preferences.flush() //此处一定要flush,要不然不能永久序列化到本地 }
AST#method_declaration#Left static clearSync AST#parameter_list#Left ( AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left PreferencesUtil AST#expression#Right . de...
static clearSync(preferenceName: string = PreferencesUtil.defaultPreferenceName) { let preferences = PreferencesUtil.getPreferencesSync(preferenceName); preferences.clearSync(); preferences.flush() }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L240-L244
75b35fb869c874149f2668f3c2bbfd0d3240a919
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/interface_class/simple_class/simple_class_005_T.ets
arkts
Introduction 函数内部类
export function simple_class_005_T(taint_src : string) { class A { data: string; clean: string; constructor() { this.data = taint_src; this.clean = "_"; }
AST#export_declaration#Left export AST#function_declaration#Left function simple_class_005_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 simple_class_005_T(taint_src : string) { class A { data: string; clean: string; constructor() { this.data = taint_src; this.clean = "_"; }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/interface_class/simple_class/simple_class_005_T.ets#L6-L13
20a5d400b8dfa65306c097613b3435ee3409c1e6
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/AddressDetailPage.ets
arkts
AddressDetailPage
@file 地址详情页面视图 @author Joker.X
@ComponentV2 export struct AddressDetailPage { /** * 地址详情页面 ViewModel */ @Local private vm: AddressDetailViewModel = new AddressDetailViewModel(); /** * 表单 ID */ private formId: string = "address-detail-form"; /** * 当前窗口安全区状态 */ @Param windowSafeAreaState: WindowSafeAreaState = getWind...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct AddressDetailPage AST#component_body#Left { /** * 地址详情页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Ad...
@ComponentV2 export struct AddressDetailPage { @Local private vm: AddressDetailViewModel = new AddressDetailViewModel(); private formId: string = "address-detail-form"; @Param windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); build(): void { AppNavDestination({ titl...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressDetailPage.ets#L23-L211
020abd57f1c6603239e933dab1f484169807791a
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/model/detailModel.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class SwiperModel { public src: string constructor
AST#export_declaration#Left export AST#ERROR#Left class SwiperModel { public src : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class SwiperModel { public src: string constructor
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/model/detailModel.ets#L16-L18
da585ed7a0676788c1c93e9eb9e6b5ca7f334273
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/pages/Index.ets
arkts
safeCloseSwipeActions
安全关闭左滑菜单 防止列表没有条目时闪退
private safeCloseSwipeActions(): void { try { if (this.listViewModel.commandEntries.length > 0) { this.scrollerForList.closeAllSwipeActions(); } } catch (err) { Logger.debug(this.LOG_TAG, `关闭左滑菜单失败, ${err}`); } }
AST#method_declaration#Left private safeCloseSwipeActions 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#st...
private safeCloseSwipeActions(): void { try { if (this.listViewModel.commandEntries.length > 0) { this.scrollerForList.closeAllSwipeActions(); } } catch (err) { Logger.debug(this.LOG_TAG, `关闭左滑菜单失败, ${err}`); } }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L166-L174
58b159a112ced339347a56ee3da5bb7da784cda1
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
推荐结果接口
export interface RecommendationResult { items: RecommendationItem[]; algorithm: string; confidence: number; diversity: number; // 推荐多样性 novelty: number; // 新颖性 explainability: string[]; // 推荐解释 metadata: Record<string, string | number | boolean>; generatedAt: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RecommendationResult AST#object_type#Left { AST#type_member#Left items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RecommendationItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_me...
export interface RecommendationResult { items: RecommendationItem[]; algorithm: string; confidence: number; diversity: number; novelty: number; explainability: string[]; metadata: Record<string, string | number | boolean>; generatedAt: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L207-L216
5a57d6b6acdc4b3af63e452f24a8bb93f25147c5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/mediafullscreen/src/main/ets/view/XComponentVideo.ets
arkts
animateTo
设置全屏播放展开动画
animateTo({ duration: ANIMATE_DURATION, onFinish: () => { this.isLandscape = !this.isLandscape; // 设置横屏 }
AST#method_declaration#Left animateTo AST#parameter_list#Left ( AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left duration AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left ANIMATE_DURATION AST#p...
animateTo({ duration: ANIMATE_DURATION, onFinish: () => { this.isLandscape = !this.isLandscape; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mediafullscreen/src/main/ets/view/XComponentVideo.ets#L264-L268
0a69aaa01f021023de7e1be9fcf639f1cb8dbef1
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/SetAppFontSize/entry/src/main/ets/viewmodel/HomeViewModel.ets
arkts
Home view model, providing page display data.
export class HomeViewModel { settingArr: Array<SettingData> = []; initSettingData(): Array<SettingData> { if (this.settingArr.length === 0) { this.settingArr = new Array(); let settingData = new SettingData(); settingData.settingName = $r('app.string.home_display_and_brightness'); setti...
AST#export_declaration#Left export AST#class_declaration#Left class HomeViewModel AST#class_body#Left { AST#property_declaration#Left settingArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SettingData AST#primary_t...
export class HomeViewModel { settingArr: Array<SettingData> = []; initSettingData(): Array<SettingData> { if (this.settingArr.length === 0) { this.settingArr = new Array(); let settingData = new SettingData(); settingData.settingName = $r('app.string.home_display_and_brightness'); setti...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/viewmodel/HomeViewModel.ets#L21-L54
05d3f62f736c3e40fa2954546e7e11b581749f93
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/constraint.ets
arkts
2025年01月05日 14时06分55秒
export const DATE_FORMAT13: string = "yyyy年MM月dd日 HH时mm分";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT13 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "yyyy年MM月dd日 HH时mm分" AST#expression#Right AST#variable_declarator#Right ; AST#v...
export const DATE_FORMAT13: string = "yyyy年MM月dd日 HH时mm分";
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L28-L28
8f8a03d455f05715e428de0207d0b778677d27c5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
节日信息接口
export interface FestivalInfo { id: string; name: string; type: FestivalType; month: number; day: number; isLunar: boolean; // 是否农历日期 isLegal: boolean; // 是否法定节假日 emoji: string; // 节日图标 color: string; // 节日颜色 description?: string; // 节日描述 english...
AST#export_declaration#Left export AST#interface_declaration#Left interface FestivalInfo 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 name : AST#type_annotation#Left AS...
export interface FestivalInfo { id: string; name: string; type: FestivalType; month: number; day: number; isLunar: boolean; isLegal: boolean; emoji: string; color: string; description?: string; englishName?: string; alias?: string[]...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L23-L36
ca0376bd2b5fb0e003b7ffd5ad2c4e6dddf5e283
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/UserProfileComponent.ets
arkts
EditDialogBuilder
编辑弹窗
@Builder EditDialogBuilder() { Column() { // 标题 Text(`编辑${this.editingItem?.title || ''}`) .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333') .margin({ bottom: 20 }) // 输入区域 if (this.editingItem?.key === 'gender') { // 性别选择 Row({ ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right EditDialogBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 标题 AST#a...
@Builder EditDialogBuilder() { Column() { Text(`编辑${this.editingItem?.title || ''}`) .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333') .margin({ bottom: 20 }) if (this.editingItem?.key === 'gender') { Row({ space: 20 }) { ...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L307-L400
97930546a75274fa42215d4ebcd168cbc4e4d77c
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the hardware model represented by a string. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get hardwareModel(): string;
AST#method_declaration#Left static get AST#ERROR#Left hardwareModel AST#ERROR#Right 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#method_declaration#Right
static get hardwareModel(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L131-L131
52321e19f6611f617afde6e43bc853137d711cc1
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/url_tools.ets
arkts
is_legal_port
Determines if a port is legal. @param port the port @returns true if the port is legal
function is_legal_port(port: string) { if (!is_pure_number(port)) { return false; } let port_int = Number.parseInt(port); if (!(0 <= port_int && port_int <= 65535)) { // if any part not in legal range [0, 255] // or port not in legal range [0, 65535] return false; } return true; }
AST#function_declaration#Left function is_legal_port AST#parameter_list#Left ( AST#parameter#Left port : 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#Le...
function is_legal_port(port: string) { if (!is_pure_number(port)) { return false; } let port_int = Number.parseInt(port); if (!(0 <= port_int && port_int <= 65535)) { return false; } return true; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L81-L92
81dc1ff0a69612776e060b0cbacecd0886e55f9c
gitee
Neptune-EX/OS_System_Design.git
c728a82d48079ae0c52d50c4a2e2586b69f4ce55
entry/src/main/ets/common/utils/FileManager.ets
arkts
fileExists
重命名 重命名文件 @param oldName 原文件名 @param newName 新文件名 @returns 是否重命名成功 7. 检查文件是否存在 async fileExists(filename: string): Promise<boolean> { try { const filePath = this.getFilesDir() + '/' + filename; await fs.access(filePath); return true; } catch { return false; } } 检查文件是否存在 - 修正版本
async fileExists(filename: string): Promise<boolean> { try { const filePath = `${this.filesDir}/${filename}`; // 使用 fileIo.statSync 同步方式检查,或者使用异步方式 try { fileIo.statSync(filePath); return true; } catch (error) { // 如果文件不存在,statSync 会抛出错误 return false; }...
AST#method_declaration#Left async fileExists AST#parameter_list#Left ( AST#parameter#Left filename : 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#Lef...
async fileExists(filename: string): Promise<boolean> { try { const filePath = `${this.filesDir}/${filename}`; try { fileIo.statSync(filePath); return true; } catch (error) { return false; } } catch { return false; }...
https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/FileManager.ets#L259-L278
75f77b77115ae6e11720890a9ec8d4fb3cb80139
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets
arkts
toModel
将数据库实体转换为领域模型 @param {FootprintEntity} entity 数据库实体 @returns {Footprint} 领域模型
private toModel(entity: FootprintEntity): Footprint { const footprint: Footprint = new Footprint(); footprint.goodsId = entity.goodsId ?? 0; footprint.goodsName = entity.goodsName ?? ""; footprint.goodsSubTitle = entity.goodsSubTitle ?? null; footprint.goodsMainPic = entity.goodsMainPic ?? ""; f...
AST#method_declaration#Left private toModel AST#parameter_list#Left ( AST#parameter#Left entity : AST#type_annotation#Left AST#primary_type#Left FootprintEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Footprint AST#...
private toModel(entity: FootprintEntity): Footprint { const footprint: Footprint = new Footprint(); footprint.goodsId = entity.goodsId ?? 0; footprint.goodsName = entity.goodsName ?? ""; footprint.goodsSubTitle = entity.goodsSubTitle ?? null; footprint.goodsMainPic = entity.goodsMainPic ?? ""; f...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L127-L137
ba0dda386feab597d1442734af3ab26c9c58c0c6
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
strContent2Uint8Array
将字符串转换成uint8Array-加解密内容 @param str 字符串 @param keyLen 编码长度 @returns
static strContent2Uint8Array(str: string, coding: buffer.BufferEncoding): Uint8Array { //判断编码类型 if (coding === 'base64') { //base64 return Base64Util.decodeSync(str); } if (coding === 'hex') { return StrAndUintUtil.str2Uint8Array(str, 'hex'); } if (coding === 'utf8') { re...
AST#method_declaration#Left static strContent2Uint8Array 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 coding : AST#type_annotation#Left AST#primary_type#Left AST#qualifie...
static strContent2Uint8Array(str: string, coding: buffer.BufferEncoding): Uint8Array { if (coding === 'base64') { return Base64Util.decodeSync(str); } if (coding === 'hex') { return StrAndUintUtil.str2Uint8Array(str, 'hex'); } if (coding === 'utf8') { return StrAndUintU...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L136-L149
dccc310ee236ee0f89a819069b7d29a35348294a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/SpeechRecognizerHelper.ets
arkts
startListening
启动语音识别。 @param startParams 启动语音识别的相关参数,用于设置会话ID、音频配置信息等。
static startListening(startParams: speechRecognizer.StartParams): void { SpeechRecognizerHelper.recognitionEngine?.startListening(startParams); }
AST#method_declaration#Left static startListening AST#parameter_list#Left ( AST#parameter#Left startParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . StartParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter...
static startListening(startParams: speechRecognizer.StartParams): void { SpeechRecognizerHelper.recognitionEngine?.startListening(startParams); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/SpeechRecognizerHelper.ets#L46-L48
d6147bbda987bdd2c84359283fea40d6de6bf73e
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/data_operation_tools.ets
arkts
Array ops Constructs a boolean array of a specific length that contains only false values. @param length The length of the array. @returns The boolean array.
export function all_false(length: number) { let result: boolean[] = []; for (let index = 0; index < length; index++) { result.push(false); } return result; }
AST#export_declaration#Left export AST#function_declaration#Left function all_false AST#parameter_list#Left ( AST#parameter#Left length : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#s...
export function all_false(length: number) { let result: boolean[] = []; for (let index = 0; index < length; index++) { result.push(false); } return result; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L127-L133
6087705ffac75c653fd7e4ee4f5fcd3fd68d0ae7
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/auth/AuthUtil.ets
arkts
reqPermissionsFromUser
发起授权 @param permissions 需要授权的权限 @param callBack 授权成功后的回调 @returns
static async reqPermissionsFromUser(permissions: Permissions, callBack: (index: number) => void): Promise<void> { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); // requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 let request = await atManager.requestPermissionsFromUser(getCon...
AST#method_declaration#Left static async reqPermissionsFromUser AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callBack : AST#type_annotation#Left AST#function...
static async reqPermissionsFromUser(permissions: Permissions, callBack: (index: number) => void): Promise<void> { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); let request = await atManager.requestPermissionsFromUser(getContext() as common.UIAbilityContext, [permissions]...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/auth/AuthUtil.ets#L83-L99
acfa61af81257e41ad66395177fca9590e52ab5b
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/scrollingCharts/viewPageItems/frag_simple_line_circle_index.ets
arkts
initCurveData
初始化数据 @param count 曲线图点的个数 @param range y轴范围
private initCurveData(count: number, range: number): LineData { let valuesN = new JArrayList<EntryOhos>(); let n: number[] = new N().data; for (let i = 0; i < n.length; i++) { valuesN.add(new EntryOhos(i, n[i])); } let valuesNlogn = new JArrayList<EntryOhos>(); let nlogn: number[] = new ...
AST#method_declaration#Left private initCurveData AST#parameter_list#Left ( AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left range : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
private initCurveData(count: number, range: number): LineData { let valuesN = new JArrayList<EntryOhos>(); let n: number[] = new N().data; for (let i = 0; i < n.length; i++) { valuesN.add(new EntryOhos(i, n[i])); } let valuesNlogn = new JArrayList<EntryOhos>(); let nlogn: number[] = new ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/viewPageItems/frag_simple_line_circle_index.ets#L84-L166
824e54011dfd0e4857a2cb4265e3e081a814f411
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
pushByTopName
@deprecated @param remove
public static pushByTopName(remove: boolean = true) { ZRouter.getRouterMgr().pushByTopName(remove) }
AST#method_declaration#Left public static pushByTopName AST#parameter_list#Left ( AST#parameter#Left remove : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#par...
public static pushByTopName(remove: boolean = true) { ZRouter.getRouterMgr().pushByTopName(remove) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L605-L607
4239fa77ace39b58aad850678602b1dc0680c981
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
killAllProcesses
终止应用的所有进程,进程退出时不会正常走完应用生命周期。使用Promise异步回调。仅支持主线程调用。 @param clearPageStack 表示是否清除页面堆栈。true表示清除,false表示不清除。<API14+> @returns
static async killAllProcesses(clearPageStack: boolean = true): Promise<void> { if (AppUtil.isApiSupported(14)) { return AppUtil.getApplicationContext().killAllProcesses(clearPageStack); } else { return AppUtil.getApplicationContext().killAllProcesses(); } }
AST#method_declaration#Left static async killAllProcesses AST#parameter_list#Left ( AST#parameter#Left clearPageStack : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Rig...
static async killAllProcesses(clearPageStack: boolean = true): Promise<void> { if (AppUtil.isApiSupported(14)) { return AppUtil.getApplicationContext().killAllProcesses(clearPageStack); } else { return AppUtil.getApplicationContext().killAllProcesses(); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L220-L226
60cacae7fb3c42df28dbcb0f93111e2dc7ab76fc
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/SettingsTypes.ets
arkts
更新设置参数接口
export interface UpdateAppSettingsParams { theme?: Partial<ThemeSettings>; notification?: Partial<NotificationSettings>; reminder?: Partial<ReminderSettings>; privacy?: Partial<PrivacySettings>; ai?: Partial<AISettings>; data?: Partial<DataSettings>; security?: Partial<SecuritySettings>; accessibility?:...
AST#export_declaration#Left export AST#interface_declaration#Left interface UpdateAppSettingsParams AST#object_type#Left { AST#type_member#Left theme ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ThemeSettings AS...
export interface UpdateAppSettingsParams { theme?: Partial<ThemeSettings>; notification?: Partial<NotificationSettings>; reminder?: Partial<ReminderSettings>; privacy?: Partial<PrivacySettings>; ai?: Partial<AISettings>; data?: Partial<DataSettings>; security?: Partial<SecuritySettings>; accessibility?:...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L609-L619
fdac09e6258509802e0439021254e424bb228335
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.router.d.ets
arkts
@typedef NamedRouterOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 10 @typedef NamedRouterOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 11
export interface NamedRouterOptions { /** * Name of the destination named route. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Name of the destination named route. * * @type { string } * @syscap Syste...
AST#export_declaration#Left export AST#interface_declaration#Left interface NamedRouterOptions AST#object_type#Left { /** * Name of the destination named route. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Name of the dest...
export interface NamedRouterOptions { name: string; params?: Object; recoverable?: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.router.d.ets#L972-L1020
5346b0f5a73d49f7514f0c68da0db8a36859e27f
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Save (Copy) any file from a uri (file://...) to a selected position, pulling up a DocumentViewPicker. @param from the uri.
export async function document_save_from_uri(from: string, file_name_overwrite?: string) { // Save try { // Get file name const split_result = from.split('/'); let file_name = decodeURI(split_result[split_result.length-1]); if (file_name_overwrite) { file_name = file_name_overwrite; } ...
AST#export_declaration#Left export AST#function_declaration#Left async function document_save_from_uri AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left file_name_overwrite ?...
export async function document_save_from_uri(from: string, file_name_overwrite?: string) { try { const split_result = from.split('/'); let file_name = decodeURI(split_result[split_result.length-1]); if (file_name_overwrite) { file_name = file_name_overwrite; } let documentSaveOption...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L76-L118
89d334152a192bb02c6aa46cd517120e09afc76c
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SM4Sync.ets
arkts
generateSM4Key
生成SM4的对称密钥 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns SM4密钥
static generateSM4Key(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.generateSymKey('SM4_128', resultCoding); }
AST#method_declaration#Left static generateSM4Key AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expres...
static generateSM4Key(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.generateSymKey('SM4_128', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4Sync.ets#L32-L34
ea50b0a81856a321b9c4a110605f2d0e95229812
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/ReviewPage.ets
arkts
ReviewPage
==================== P3: 回顾分析页面 ====================
@Component export struct ReviewPage { @State selectedTab: number = 0; // 0: 成就, 1: 历史 // 监听任务更新信号 - 改用@Consume从父组件接收 @Consume('taskUpdateSignal') @Watch('onUpdateSignalChange') taskUpdateSignal: number; // 本地响应式统计数据 @State totalTime: string = '0.0'; @State completedCount: number = 0; @State average...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ReviewPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right selectedTab : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_ann...
@Component export struct ReviewPage { @State selectedTab: number = 0; @Consume('taskUpdateSignal') @Watch('onUpdateSignalChange') taskUpdateSignal: number; @State totalTime: string = '0.0'; @State completedCount: number = 0; @State averageTime: string = '0'; @State efficiencyRate: string = '0'...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/ReviewPage.ets#L13-L511
29da1c79b5a23ec577f2e524686e179a199a10d7
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
common/src/main/ets/manager/UpgradeInterface.ets
arkts
界面数据 @since 2022-12-01
export interface VersionPageInfo { /** * 版本号 */ version: string; /** * 版本大小 */ size?: number; /** * 生效模式 */ effectiveMode?: update.EffectiveMode; /** * 升级模式 */ otaMode?:update.OtaMode; /** * 更新日志 */ changelog: ChangelogInfo; /** * 倒计时弹框显示内容 */ countDownDial...
AST#export_declaration#Left export AST#interface_declaration#Left interface VersionPageInfo AST#object_type#Left { /** * 版本号 */ AST#type_member#Left version : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 版本大小 */ AST#type...
export interface VersionPageInfo { version: string; size?: number; effectiveMode?: update.EffectiveMode; otaMode?:update.OtaMode; changelog: ChangelogInfo; countDownDialogInfo?: CountDownDialogInfo; }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/manager/UpgradeInterface.ets#L101-L129
89d55c6abb8282a173e0d2461188e2191f41aa99
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/positive/src/main/ets/model/TitleDataSource.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 TitleDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private originDataArray: string[] = []; totalCount(): number { return this.originDataArray.length; } getData(index: number): string { return this.originDataArray[index]; } public addItem(title: s...
AST#export_declaration#Left export AST#class_declaration#Left class TitleDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener ...
export class TitleDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private originDataArray: string[] = []; totalCount(): number { return this.originDataArray.length; } getData(index: number): string { return this.originDataArray[index]; } public addItem(title: s...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/positive/src/main/ets/model/TitleDataSource.ets#L16-L51
0a573f26c0633361d2e0097ff7a42424b1ed8c46
gitee
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
setScrollCoefficient
设置左右滑动系数 @param coefficient 0.1 ~ 10
setScrollCoefficient(coefficient: number) { if (coefficient < 0.1) { coefficient = 0.1 } if (coefficient > 10) { coefficient = 10 } this.scrollCoefficient = coefficient }
AST#method_declaration#Left setScrollCoefficient AST#parameter_list#Left ( AST#parameter#Left coefficient : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#...
setScrollCoefficient(coefficient: number) { if (coefficient < 0.1) { coefficient = 0.1 } if (coefficient > 10) { coefficient = 10 } this.scrollCoefficient = coefficient }
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L273-L281
02e9493757eb5d80f81ea180d1bc7f8711f0b563
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/ImageEditInterface.ets
arkts
图片编辑结果回调
export interface ImageEditResult { /** * 编辑后的像素图 */ pixelMap: PixelMap }
AST#export_declaration#Left export AST#interface_declaration#Left interface ImageEditResult AST#object_type#Left { /** * 编辑后的像素图 */ AST#type_member#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right...
export interface ImageEditResult { pixelMap: PixelMap }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L74-L79
849006d8972c77b72c887579427d9651dd2d1787
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/models/ThemeModel.ets
arkts
主题模型定义
export enum ThemeType { MINIMAL = 'minimal', BUSINESS = 'business', VIBRANT = 'vibrant', TECH = 'tech' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ThemeType AST#enum_body#Left { AST#enum_member#Left MINIMAL = AST#expression#Left 'minimal' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left BUSINESS = AST#expression#Left 'business' AST#expression#Right AST#enum_member#Right , AST#enum_...
export enum ThemeType { MINIMAL = 'minimal', BUSINESS = 'business', VIBRANT = 'vibrant', TECH = 'tech' }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L2-L7
6d4d2f1033be8a3a4f68b61e76373e6025c742e9
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/lottie/LottieView.ets
arkts
setFrameRate
设置当前动画的播放帧率不超过该值,范围1~120。 当动画源帧率高于该值时,该动画的播放帧率会被强制降到该值,否则默认以动画源帧率进行播放,除非另有全局设置; 可通过设置0帧率来取消该限制。 @param frameRate 播放帧率 @since 12
setFrameRate(frameRate: number): void { this.animationItem?.setFrameRate(frameRate) }
AST#method_declaration#Left setFrameRate AST#parameter_list#Left ( AST#parameter#Left frameRate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
setFrameRate(frameRate: number): void { this.animationItem?.setFrameRate(frameRate) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L365-L367
5ae02e8ff93045f37d158b603a79316bf19306cd
gitee
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets
arkts
The Typeface class specifies the typeface and intrinsic style of a font. @syscap SystemCapability.Graphics.Drawing @since 11
export class Typeface { static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); }
AST#export_declaration#Left export AST#class_declaration#Left class Typeface AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parameter_lis...
export class Typeface { static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L761-L762
07f24743f1efd2dc12b282a67a8f413920063933
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/DragAndExchange/casesfeature/dragandexchange/src/main/ets/view/GridSceneView.ets
arkts
GridSceneView
示例Grid中子组件数目 实现Grid场景,拖拽交换子组件位置: 通过editMode()打开编辑模式、通过onItemDragStart() 指定拖拽时样式、通过onItemDrop()指定拖拽释放时的行为
@Component export struct GridSceneView { @State movedItem: AppInfo = new AppInfo(); @State dataSource: DataSource = new DataSource(); aboutToAppear() { for (let index = 1; index <= ICON_NUM_IN_GRID; index++) { this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_app${index}`),...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GridSceneView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right movedItem : AST#type_annotation#Left AST#primary_type#Left AppInfo AST#primary_type#Right AST#type_a...
@Component export struct GridSceneView { @State movedItem: AppInfo = new AppInfo(); @State dataSource: DataSource = new DataSource(); aboutToAppear() { for (let index = 1; index <= ICON_NUM_IN_GRID; index++) { this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_app${index}`),...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/DragAndExchange/casesfeature/dragandexchange/src/main/ets/view/GridSceneView.ets#L25-L98
2976e5e826dde2cd06419c9625e389358aaf649d
gitee
Delsin-Yu/JustPDF.git
d53f566e02820dac46e1752151750144acbed50a
entry/src/main/ets/components/PageInfo.ets
arkts
notifyPageChanged
Notifies both PageGroup and PageInfoDataSource listeners about a page change. This is the preferred method for notifying changes to a specific page. @param group The PageGroup containing the page @param pageInfo The PageInfo that changed @param groupIndex The index of the group in pageGroups
private notifyPageChanged(group: PageGroup, pageInfo: PageInfo, groupIndex: number): void { group.markChanged(pageInfo); this.notifyPageGroupChanged(groupIndex); }
AST#method_declaration#Left private notifyPageChanged AST#parameter_list#Left ( AST#parameter#Left group : AST#type_annotation#Left AST#primary_type#Left PageGroup AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pageInfo : AST#type_annotation#Left AST#primary_type#Left PageInfo...
private notifyPageChanged(group: PageGroup, pageInfo: PageInfo, groupIndex: number): void { group.markChanged(pageInfo); this.notifyPageGroupChanged(groupIndex); }
https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L649-L652
47e7a010f7fc7d10854e255b1eaa091fc3548c72
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/listener/EventControl.ets
arkts
setEventEnable
根据事件类型启用事件
public setEventEnable(evType: EventType) { this.setEvent(evType, true); return this; }
AST#method_declaration#Left public setEventEnable AST#parameter_list#Left ( AST#parameter#Left evType : AST#type_annotation#Left AST#primary_type#Left EventType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_st...
public setEventEnable(evType: EventType) { this.setEvent(evType, true); return this; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/EventControl.ets#L58-L61
dbf9c6a37e29c3001ba88ffd418381556619f6d1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/StorageManager.ets
arkts
getItem
获取数据 @param key 键 @param defaultValue 默认值 @param config 存储配置 @returns 操作结果
static async getItem<T>(key: string, defaultValue?: T, config?: StorageConfig): Promise<StorageResult<T>> { try { if (!this.isInitialized) { throw new Error('StorageManager 未初始化'); } const storageName = config?.name || AppConstants.STORAGE_NAME; const prefs = this.preferences.get(st...
AST#method_declaration#Left static async getItem 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#paramet...
static async getItem<T>(key: string, defaultValue?: T, config?: StorageConfig): Promise<StorageResult<T>> { try { if (!this.isInitialized) { throw new Error('StorageManager 未初始化'); } const storageName = config?.name || AppConstants.STORAGE_NAME; const prefs = this.preferences.get(st...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L105-L142
6cadf0740f0bd5fd76441507d30b213ca77c3ff4
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/MultiDeviceAppDev/MultiColumns/entry/src/main/ets/common/SettingItem.ets
arkts
MainItem
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct MainItem { itemDesc: Resource = $r("app.string.nonSense") src: Resource = $r("app.media.icon") isUserItem: boolean = false itemStatusDesc: Resource = $r("app.string.nonSense") build() { Row() { Image(this.src).width(32).aspectRatio(1) if (this.isUserItem) { C...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainItem AST#component_body#Left { AST#property_declaration#Left itemDesc AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left...
@Component export struct MainItem { itemDesc: Resource = $r("app.string.nonSense") src: Resource = $r("app.media.icon") isUserItem: boolean = false itemStatusDesc: Resource = $r("app.string.nonSense") build() { Row() { Image(this.src).width(32).aspectRatio(1) if (this.isUserItem) { C...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/MultiColumns/entry/src/main/ets/common/SettingItem.ets#L16-L63
7ba2513694a3a016684f4bcd6bcf592d99844431
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/NotificationUtils.ets
arkts
publishTemplate
发布模板的通知 @param options
static async publishTemplate(options: NotificationTemplateOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtils.generateNotificationId(); //通知ID。 const basicContent: notificationManager.NotificationBasicContent = { title: options.title, text: options.text } ...
AST#method_declaration#Left static async publishTemplate AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationTemplateOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primar...
static async publishTemplate(options: NotificationTemplateOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtils.generateNotificationId(); const basicContent: notificationManager.NotificationBasicContent = { title: options.title, text: options.text } if (...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L257-L282
4f7998581cf512149062a746c2916a6f36565a98
gitee
Nuist666/Alzheimer.git
c171b8e739357bfc5a3fc71c90aaea6ce5d463d1
entry/src/main/ets/utils/Recorder.ets
arkts
startRecord
开始录制
async startRecord(audioPath: string) { // 1.创建录制实例 this.avRecorder = await media.createAVRecorder(); this.setAudioRecorderCallback(); // 创建并打开录音文件 this.audioFile = fs.openSync(audioPath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); // 2.获取录制文件fd赋予avConfig里的url this.avConfig.url = `fd://${th...
AST#method_declaration#Left async startRecord AST#parameter_list#Left ( AST#parameter#Left audioPath : 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 { // 1.创建录制实例 AST#expression_stateme...
async startRecord(audioPath: string) { this.avRecorder = await media.createAVRecorder(); this.setAudioRecorderCallback(); this.audioFile = fs.openSync(audioPath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); this.avConfig.url = `fd://${this.audioFile.fd}` await this.avRecorder.pr...
https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/utils/Recorder.ets#L33-L46
d0291752c6e814593923241b76a807bd6a542cc8
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/RankingDemo/entry/src/main/ets/viewmodel/RankViewModel.ets
arkts
loadRankDataSource2
Load data from the rankData2 of the Mock file,but rankData2 is different from rankData1.
loadRankDataSource2(): RankData[] { return rankData2; }
AST#method_declaration#Left loadRankDataSource2 AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RankData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#...
loadRankDataSource2(): RankData[] { return rankData2; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/RankingDemo/entry/src/main/ets/viewmodel/RankViewModel.ets#L26-L28
f7afae0c8ab4b83f165ba216d73cb7261e44b2c2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets
arkts
initCamera
初始化相机功能 @param cameraDeviceIndex - 相机设备索引 @returns 无返回值
async initCamera(cameraDeviceIndex: number, xComponentSurfaceId: string): Promise<void> { logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`); try { await this.releaseCamera(); // 获取相机管理器实例 this.cameraManager = this.getCameraManagerFn(); if (this.cameraManager === und...
AST#method_declaration#Left async initCamera AST#parameter_list#Left ( AST#parameter#Left cameraDeviceIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left xComponentSurfaceId : AST#type_annotation#Left AST#primary_type#Le...
async initCamera(cameraDeviceIndex: number, xComponentSurfaceId: string): Promise<void> { logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`); try { await this.releaseCamera(); this.cameraManager = this.getCameraManagerFn(); if (this.cameraManager === undefined) { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets#L53-L105
03ed0d5907c7e69807126022a28c6a398e14b403
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/pages/PictureBeautification.ets
arkts
isMove
判断操作类型
isMove(area: Area, touch: TouchObject) { let touchW = 20 if (this.cropRatio === 0) { if (touch.x < touchW && touch.y < touchW) { // 左上角 this.actionType = ActionType.topLeft } else if (touch.x < touchW && touch.y > (Number(area.height) - touchW)) { // 左下 this.actionType = ActionType.b...
AST#method_declaration#Left isMove AST#parameter_list#Left ( AST#parameter#Left area : AST#type_annotation#Left AST#primary_type#Left Area AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left touch : AST#type_annotation#Left AST#primary_type#Left TouchObject AST#primary_type#Right A...
isMove(area: Area, touch: TouchObject) { let touchW = 20 if (this.cropRatio === 0) { if (touch.x < touchW && touch.y < touchW) { this.actionType = ActionType.topLeft } else if (touch.x < touchW && touch.y > (Number(area.height) - touchW)) { this.actionType = ActionType.bottomLeft ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/pages/PictureBeautification.ets#L354-L396
66675d760fcab8de797207a5494b208e67ac6e56
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/vipplan.ets
arkts
title
****************************30天免费适用****************************
@Builder title() { // 标题 Column({ space: 8 }) { Text('30天免费试用') .fontSize(28) .fontColor('#333333') .fontWeight(FontWeight.Bold) Text('或者购买无限套餐') .fontSize(16) .fontColor('#999999') } .alignItems(HorizontalAlign.Start) .width('100%') .marg...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right title AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 标题 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_paramet...
@Builder title() { Column({ space: 8 }) { Text('30天免费试用') .fontSize(28) .fontColor('#333333') .fontWeight(FontWeight.Bold) Text('或者购买无限套餐') .fontSize(16) .fontColor('#999999') } .alignItems(HorizontalAlign.Start) .width('100%') .margin({t...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/vipplan.ets#L82-L99
fded5f07fb3c2551d77ec9a630c9b7cf429fbf87
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/SubscriptionManager.ets
arkts
syncSubscription
同步订阅(下载并解析日历数据)
async syncSubscription(id: string): Promise<EventModel[]> { const subscription = this.subscriptions.get(id) if (!subscription) { console.error('❌ 订阅不存在:', id) return [] } if (!subscription.enabled) { console.warn('⚠️ 订阅已禁用:', subscription.name) return [] } console.info(...
AST#method_declaration#Left async syncSubscription AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
async syncSubscription(id: string): Promise<EventModel[]> { const subscription = this.subscriptions.get(id) if (!subscription) { console.error('❌ 订阅不存在:', id) return [] } if (!subscription.enabled) { console.warn('⚠️ 订阅已禁用:', subscription.name) return [] } console.info(...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L104-L175
f151cde5fcd7cc59ba69e000d3232f12f4b93d1f
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/dialog/GuideDialog.ets
arkts
initGuideDefault
------------------------- 保护、私有方法 protected | private methods ------------------------- 引导弹窗 初始设置 @param options
private initGuideDefault(options: IGuideDialogOptions): IGuideDialogOptions | undefined { options._dialogType = 'guide' options.actionCancel = options.actionCancel ?? DialogHub.config.actionCancel; //点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。默认值:true。 options.transitionType = options.transitionType ?? NavigationSy...
AST#method_declaration#Left private initGuideDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IGuideDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AS...
private initGuideDefault(options: IGuideDialogOptions): IGuideDialogOptions | undefined { options._dialogType = 'guide' options.actionCancel = options.actionCancel ?? DialogHub.config.actionCancel; options.transitionType = options.transitionType ?? NavigationSystemTransitionType.FADE if (options...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/GuideDialog.ets#L24-L79
796b91c72a0aeb3ad6cc610af92b3b8d75c79730
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/viewModel/IconListViewModel.ets
arkts
Bottom menu icon.
export const menuIconList: Array<IconStatus> = [ new IconStatus($r('app.media.ic_crop_rotate_white'), $r('app.media.ic_crop_rotate_blue')), new IconStatus($r('app.media.ic_rotate'), $r('app.media.ic_rotate_filled')), new IconStatus($r('app.media.ic_adjust'), $r('app.media.ic_adjust_filled')) ] /** * Crop icon. ...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left menuIconList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left IconStatus AST#primary_type#Right AST#type_annotation#Rig...
export const menuIconList: Array<IconStatus> = [ new IconStatus($r('app.media.ic_crop_rotate_white'), $r('app.media.ic_crop_rotate_blue')), new IconStatus($r('app.media.ic_rotate'), $r('app.media.ic_rotate_filled')), new IconStatus($r('app.media.ic_adjust'), $r('app.media.ic_adjust_filled')) ]
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/viewModel/IconListViewModel.ets#L32-L40
b6bd210f44a13b526cf20eee2ad1649138eb69ae
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreviewUtil.ets
arkts
openPreviewEasy
通过传入文件的uri,打开预览窗口。1秒内重复调用无效。 @param uri 文件的uri @returns
static async openPreviewEasy(uri: string): Promise<void> { const previewInfo = PreviewUtil.generatePreviewInfo(uri); return filePreview.openPreview(AppUtil.getContext(), previewInfo); }
AST#method_declaration#Left static async openPreviewEasy AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t...
static async openPreviewEasy(uri: string): Promise<void> { const previewInfo = PreviewUtil.generatePreviewInfo(uri); return filePreview.openPreview(AppUtil.getContext(), previewInfo); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L44-L47
eeac0b450fb960a5da8dd22c99cf3342a90a874a
gitee
zhuanyongtester/Cpay_arkts.git
4402a8a06963d0757952513d3cbf7d5919ceb74f
entry/src/main/ets/pages/musicView/MusicPage.ets
arkts
recommendation
自定义首页推荐
@Builder recommendation() { Scroll() { Column() { Search({ placeholder: $r('app.string.mini_player_animation_search') }) .width($r('app.string.mini_player_animation_common_width')) .height($r('app.string.mini_player_animation_music_common_height')) .backgroundColor(Colo...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right recommendation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_e...
@Builder recommendation() { Scroll() { Column() { Search({ placeholder: $r('app.string.mini_player_animation_search') }) .width($r('app.string.mini_player_animation_common_width')) .height($r('app.string.mini_player_animation_music_common_height')) .backgroundColor(Colo...
https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/pages/musicView/MusicPage.ets#L258-L290
bea1d8f1e395425ce9936b431502a563df875a68
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/base/src/main/ets/default/components/RemoveDialog.ets
arkts
RemoveDialog
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@CustomDialog export struct RemoveDialog { private cardName: string = '' private controller: CustomDialogController private confirm: () => void = () => { } build() { Column() { Row() { Text($r('app.string.whether_to_remove')) .fontSize(17) .fontColor(Color.Black) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct RemoveDialog AST#component_body#Left { AST#property_declaration#Left private cardName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '...
@CustomDialog export struct RemoveDialog { private cardName: string = '' private controller: CustomDialogController private confirm: () => void = () => { } build() { Column() { Row() { Text($r('app.string.whether_to_remove')) .fontSize(17) .fontColor(Color.Black) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/base/src/main/ets/default/components/RemoveDialog.ets#L16-L75
6e80b7f60071d79d95ffdf96f97efa045fe1510c
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
initialize
Initialize the ViewModel Must be called before using the ViewModel
async initialize(): Promise<void> { try { // 首先初始化日志服务 await this.logService.initialize(this.context); this.logService.info('MainViewModel', '开始初始化...'); // Initialize config service (for secure API key storage) await this.configService.initialize(this.context); this.logService....
AST#method_declaration#Left async initialize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
async initialize(): Promise<void> { try { await this.logService.initialize(this.context); this.logService.info('MainViewModel', '开始初始化...'); await this.configService.initialize(this.context); this.logService.info('MainViewModel', 'ConfigService初始化完成'); await this...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L85-L131
d73c1985ff6ef54ddb42542cc0d3922e046010d5
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
setLoadingImg
更改全局默认loading的图片- 全局builder,内容业务自行传入,只支持gif动图,不支持内部使用状态变量 @param builder 全局构造builder @returns
setLoadingImg(builder: WrappedBuilder<[]>): EfRcp { efRcpConfig.loading.imgBuilder = builder; return this; }
AST#method_declaration#Left setLoadingImg AST#parameter_list#Left ( AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ ] AST#tuple_type#Right AST#primary_type#Righ...
setLoadingImg(builder: WrappedBuilder<[]>): EfRcp { efRcpConfig.loading.imgBuilder = builder; return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L409-L412
c66b6da2c3a65ef69f26b637f4da6f7705889ebd
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textexpand/src/main/ets/utils/TextExpandView.ets
arkts
TextExpandView
省略符 功能描述: 1. 点击"展开"按钮文本展开,点击"收起"按钮,文本收起。 实现原理: 1. 使用measure.measureTextSize方法来判断总体文字的高度 2. 使用measure.measureTextSize方法来判断两行文字的高度,当前为两行文字的高度 3. 减少接收文字字符数。当接收文字高度小于指定行数高度时,使文字显示两行,达到实现收起状态的目的。否则继续计算直到小于指定行数的高度 @param {ResourceStr} rawTitle - 初始化文本内容 @param {TextSectionAttribute} textSectionAttribute - 文本章节属性类 @param ...
@Component export struct TextExpandView { // ---------------对外暴露变量-------------------- // 文本章节属性类 textSectionAttribute: TextSectionAttribute = new TextSectionAttribute(); // 控制文本折叠的文本或者图片属性 @Prop lastSpanAttribute: LastSpanAttribute; // ----------------私有变量---------------------- // 是否展开 @State expanded:...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextExpandView AST#component_body#Left { // ---------------对外暴露变量-------------------- // 文本章节属性类 AST#property_declaration#Left textSectionAttribute : AST#type_annotation#Left AST#primary_type#Left TextSectionAttribute...
@Component export struct TextExpandView { textSectionAttribute: TextSectionAttribute = new TextSectionAttribute(); @Prop lastSpanAttribute: LastSpanAttribute; @State expanded: boolean = true; @State textModifier: TextExpandModel = new TextExpandModel(); private lastSpan: string = ''; a...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textexpand/src/main/ets/utils/TextExpandView.ets#L39-L138
4b495a8df677c6430a26a2b25ccb40c5dcedc51c
gitee
Leeson-Wong/ark-layer.git
9efa3553414a6b1eee890e3858c8cdcb308535d7
core/PhaseExample.ets
arkts
示例 2: 创建自定义阶段
export async function example2_CustomPhases() { console.log('========== Example 2: Using Custom Phases ==========') // 创建自定义阶段 const CUSTOM_PHASE = createPhase({ name: 'CUSTOM', priority: 25, // 在 BUSINESS(20) 和 FEATURE(30) 之间 waitForComplete: false, // 并行触发 description: '自定义阶段示例' }) servi...
AST#export_declaration#Left export AST#function_declaration#Left async function example2_CustomPhases AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Le...
export async function example2_CustomPhases() { console.log('========== Example 2: Using Custom Phases ==========') const CUSTOM_PHASE = createPhase({ name: 'CUSTOM', priority: 25, waitForComplete: false, description: '自定义阶段示例' }) serviceManager.load({ phase: GLOBAL_PHASE, scene...
https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseExample.ets#L210-L253
4635cd5dd4ab7879857408b718b6845e5d93c2b4
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/SignIn.ets
arkts
renderDay
渲染日历中的某一天(保持不变,数据从数据库获取)
@Builder renderDay(day: number, isCurrentMonth: boolean) { Column() { if (isCurrentMonth) { if (this.signedDates.has(day)) { // 使用从数据库获取的签到记录 Text(day.toString()) .fontSize(14) .fontColor('#FFFFFF') .backgroundColor('#2BCDDC') .borderRadius(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right renderDay AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isCurrentMonth : AST#type_annotation#L...
@Builder renderDay(day: number, isCurrentMonth: boolean) { Column() { if (isCurrentMonth) { if (this.signedDates.has(day)) { Text(day.toString()) .fontSize(14) .fontColor('#FFFFFF') .backgroundColor('#2BCDDC') .borderRadius(15) ...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/SignIn.ets#L320-L354
74ef768e1d428a3db9c19b4319370edf5f8424e4
github
kaikaiGit/chatAI.git
2a9244d932d3463125dc9f83bf424a1e1153cb2c
entry/src/main/APIs/requestAI.ets
arkts
向AI对话api发送请求
export default function requestAI(question: string): Promise<Message> { // 创建http请求对象 const httpRequest = http.createHttp(); data.messages[data.messages.length-1].content = question; // 更新请求内容,替换为提问内容 return new Promise( (resolve,reject) => { httpRequest.request( url, { method: http.Requ...
AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function requestAI AST#parameter_list#Left ( AST#parameter#Left question : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : A...
export default function requestAI(question: string): Promise<Message> { const httpRequest = http.createHttp(); data.messages[data.messages.length-1].content = question; return new Promise( (resolve,reject) => { httpRequest.request( url, { method: http.RequestMethod.POST, header...
https://github.com/kaikaiGit/chatAI.git/blob/2a9244d932d3463125dc9f83bf424a1e1153cb2c/entry/src/main/APIs/requestAI.ets#L30-L62
6aac65fd3fa8f5a36820567fae28eef877d49215
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets
arkts
insertForm
Insert form data. @param {Form} form Form entity. @param {DataRdb.RdbStore} rdbStore RDB database. @return Return the operation information.
insertForm(form: Form, rdbStore: DataRdb.RdbStore) { rdbStore.insert(CommonConstants.TABLE_FORM, form.toValuesBucket()).catch((error: Error) => { Logger.error(CommonConstants.DATABASE_TAG, 'insertForm error ' + JSON.stringify(error)); }); }
AST#method_declaration#Left insertForm AST#parameter_list#Left ( AST#parameter#Left form : AST#type_annotation#Left AST#primary_type#Left Form AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DataR...
insertForm(form: Form, rdbStore: DataRdb.RdbStore) { rdbStore.insert(CommonConstants.TABLE_FORM, form.toValuesBucket()).catch((error: Error) => { Logger.error(CommonConstants.DATABASE_TAG, 'insertForm error ' + JSON.stringify(error)); }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets#L68-L72
297627ee19035773a2b744c719468492c3ebdd7e
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/quiz/running/FadeInOutMov.ets
arkts
startAnimation
内部动画方法
private startAnimation(image: Resource) { this.currentImage = image; this.isVisible = true; this.opacityValue = 0; // 立即刷新状态 animateToImmediately({ duration: 0 }, () => {}); // 渐变出现 animateTo({ duration: this.duration, curve: Curve.EaseInOut, onFinish: () => this.startFad...
AST#method_declaration#Left private startAnimation AST#parameter_list#Left ( AST#parameter#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_sta...
private startAnimation(image: Resource) { this.currentImage = image; this.isVisible = true; this.opacityValue = 0; animateToImmediately({ duration: 0 }, () => {}); animateTo({ duration: this.duration, curve: Curve.EaseInOut, onFinish: () => this.startFadeOutAnimation() ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/quiz/running/FadeInOutMov.ets#L46-L60
12cefc2dd7065485f65b46b88651c1b7e601415a
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/Index.ets
arkts
PermissionUtil
权限管理工具
export { PermissionUtil } from './src/main/ets/utils/PermissionUtil';
AST#export_declaration#Left export { PermissionUtil } from './src/main/ets/utils/PermissionUtil' ; AST#export_declaration#Right
export { PermissionUtil } from './src/main/ets/utils/PermissionUtil';
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/Index.ets#L11-L11
995c266caefb4241a83cd58300b4f1b4bfb6ee27
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
input
添加输入文件
public input(path: string): FFmpegCommandBuilder { this.inputFiles.push(path); return this; }
AST#method_declaration#Left public input 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 FFmpegCommandBuilder AST#pri...
public input(path: string): FFmpegCommandBuilder { this.inputFiles.push(path); return this; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L44-L47
7b2d62ab8c5b78dbfc3ade9032c10e83ee0e35ff
github
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/view/model/ImageResources.ets
arkts
默认可选择的图片
export const imageResources: Array<Resource> = [$r('app.media.img'), $r('app.media.img_1'), $r('app.media.img_2'), $r('app.media.img_3'), $r('app.media.img_4'), $r('app.media.img_5'), $r('app.media.img_6'), $r('app.media.img_7'), $r('app.media.img_8'), $r('app.media.img_9'), $r('app.media.img_10')...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left imageResources : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Rig...
export const imageResources: Array<Resource> = [$r('app.media.img'), $r('app.media.img_1'), $r('app.media.img_2'), $r('app.media.img_3'), $r('app.media.img_4'), $r('app.media.img_5'), $r('app.media.img_6'), $r('app.media.img_7'), $r('app.media.img_8'), $r('app.media.img_9'), $r('app.media.img_10')...
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/view/model/ImageResources.ets#L2-L16
c9eac1a431bb158b9ea5e7c5756b2f4fdc7c6568
github
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/common/utils/ColorUtil.ets
arkts
@param url @returns
export function createNetworkImagePixelMap(url: string): Promise<image.PixelMap> { let httpRequest = http.createHttp(); return new Promise(async (resolve, reject) => { httpRequest.request(url, {}, (err, data: http.HttpResponse) => { if (!err && data.responseCode === 200) { let imageSource = image....
AST#export_declaration#Left export AST#function_declaration#Left function createNetworkImagePixelMap 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#type_annotat...
export function createNetworkImagePixelMap(url: string): Promise<image.PixelMap> { let httpRequest = http.createHttp(); return new Promise(async (resolve, reject) => { httpRequest.request(url, {}, (err, data: http.HttpResponse) => { if (!err && data.responseCode === 200) { let imageSource = image....
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/common/utils/ColorUtil.ets#L32-L52
c67f732a56cf23b35ccb75e803cba87dac4359de
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/view/tabcontent/PageGame.ets
arkts
PageGame
Tab content of game.
@Component export struct PageGame { build() { Column() { Text($r('app.string.game')) .height(CommonConstants.FULL_HEIGHT) .fontSize(CommonConstants.FONT_SIZE_PAGE_CONTENT) .fontWeight(CommonConstants.FONT_WEIGHT_LIGHT) } .width(CommonConstants.FULL_WIDTH) .height(CommonCo...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageGame AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { ...
@Component export struct PageGame { build() { Column() { Text($r('app.string.game')) .height(CommonConstants.FULL_HEIGHT) .fontSize(CommonConstants.FONT_SIZE_PAGE_CONTENT) .fontWeight(CommonConstants.FONT_WEIGHT_LIGHT) } .width(CommonConstants.FULL_WIDTH) .height(CommonCo...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/tabcontent/PageGame.ets#L21-L33
90a9b63eb6c1d10b6052b934d03cc62f6ddf7d49
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets
arkts
ListSection
列表布局示例(小屏一列,大屏两列) @returns {void} 无返回值
@Builder private ListSection(): void { Grid() { ForEach(this.listItems, (item: number) => { GridItem() { this.ListItemCard(item + 1); } }, (item: number) => `${item}`); } .columnsTemplate(bp({ sm: "1fr", md: "1fr 1fr", lg: "1fr 1fr" })) .columnsGap($r("app.float.s...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ListSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e...
@Builder private ListSection(): void { Grid() { ForEach(this.listItems, (item: number) => { GridItem() { this.ListItemCard(item + 1); } }, (item: number) => `${item}`); } .columnsTemplate(bp({ sm: "1fr", md: "1fr 1fr", lg: "1fr 1fr" })) .columnsGap($r("app.float.s...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L125-L138
a243dfc8f4c697c4960912c1a744196f2889f15f
github