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/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/common/CommonNavigator.ets
arkts
toUserAgreement
跳转到用户协议 @returns {void} 无返回值
static toUserAgreement(): void { navigateTo(CommonRoutes.UserAgreement); }
AST#method_declaration#Left static toUserAgreement AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#memb...
static toUserAgreement(): void { navigateTo(CommonRoutes.UserAgreement); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonNavigator.ets#L30-L32
3e5b6decd0bef394c883e5534a344914f17d2a97
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
formatLunarDate
格式化农历日期为字符串 @param lunarDate 农历日期 @returns 格式化的农历日期字符串
static formatLunarDate(lunarDate: LunarDate): string { const festival = LunarCalendar.getLunarFestival(lunarDate.month, lunarDate.day, lunarDate.isLeapMonth); if (festival) { return festival; } return `${lunarDate.monthName}${lunarDate.dayName}`; }
AST#method_declaration#Left static formatLunarDate AST#parameter_list#Left ( AST#parameter#Left lunarDate : AST#type_annotation#Left AST#primary_type#Left LunarDate AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST...
static formatLunarDate(lunarDate: LunarDate): string { const festival = LunarCalendar.getLunarFestival(lunarDate.month, lunarDate.day, lunarDate.isLeapMonth); if (festival) { return festival; } return `${lunarDate.monthName}${lunarDate.dayName}`; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L512-L519
ed96b66eaa6149375877bc0ad28b9b01ec43a9a2
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api13/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlowDataSource.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class WaterFlowDataSource implements IDataSource { private dataArray: number[] = [] private listeners: DataChangeListener[] = [] constructor
AST#export_declaration#Left export AST#ERROR#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_typ...
export class WaterFlowDataSource implements IDataSource { private dataArray: number[] = [] private listeners: DataChangeListener[] = [] constructor
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api13/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlowDataSource.ets#L15-L19
a4abc4339f49df2eff78052c28acda662e11cdf9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
备份位置枚举
export enum BackupLocation { LOCAL = 'local', ICLOUD = 'icloud', GOOGLE_DRIVE = 'google_drive', CUSTOM = 'custom' }
AST#export_declaration#Left export AST#enum_declaration#Left enum BackupLocation AST#enum_body#Left { AST#enum_member#Left LOCAL = AST#expression#Left 'local' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ICLOUD = AST#expression#Left 'icloud' AST#expression#Right AST#enum_member#Right , AST#enum_mem...
export enum BackupLocation { LOCAL = 'local', ICLOUD = 'icloud', GOOGLE_DRIVE = 'google_drive', CUSTOM = 'custom' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L307-L312
fadac7a711c24d7b3939dce84df6802a1d0cfbb4
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/model/MessagesProvider.ets
arkts
clear
清空所有消息。
clear(): void { this.messages = []; }
AST#method_declaration#Left clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expre...
clear(): void { this.messages = []; }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/MessagesProvider.ets#L130-L132
4d2f3ff8943b1b62d76ddec585a2e8c3f7130da6
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
getOrderInfo
获取订单详情 @param {number} id - 订单 ID @returns {Promise<NetworkResponse<Order>>} 订单详情
async getOrderInfo(id: number): Promise<NetworkResponse<Order>> { const resp: AxiosResponse<NetworkResponse<Order>> = await NetworkClient.http.get("order/info/info", { params: { id } }); return resp.data; }
AST#method_declaration#Left async getOrderInfo AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr...
async getOrderInfo(id: number): Promise<NetworkResponse<Order>> { const resp: AxiosResponse<NetworkResponse<Order>> = await NetworkClient.http.get("order/info/info", { params: { id } }); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L114-L118
e310427c3c9823c3ac358ca5cbf4dc360b0a4029
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/server/LocalMockServer.ets
arkts
createKey
生成证书
async createKey() { sendProcessMessage("模拟服务端开始生成证书", MessagePosition.Left); let rsaKey: RsaKey | undefined = await generateRsaKey() if (rsaKey) { this.publicKey = rsaKey.publicKey; this.privateKey = rsaKey.privateKey; sendProcessMessage("模拟服务端生成证书成功,公钥:" + this.publicKey, MessagePosition....
AST#method_declaration#Left async createKey AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left sendProcessMessage ( AST#expression#Left "模拟服务端开始生成证书" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Messag...
async createKey() { sendProcessMessage("模拟服务端开始生成证书", MessagePosition.Left); let rsaKey: RsaKey | undefined = await generateRsaKey() if (rsaKey) { this.publicKey = rsaKey.publicKey; this.privateKey = rsaKey.privateKey; sendProcessMessage("模拟服务端生成证书成功,公钥:" + this.publicKey, MessagePosition....
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/server/LocalMockServer.ets#L39-L47
684c2767626b0973659cbb57127fe2be6677facf
gitee
queyun123/weatherApp-ArkTS.git
6beee6640db32ae70c342866b24fc643a9c512bf
entry/src/main/ets/utils/HttpUtil.ets
arkts
get
===================== 基础GET请求(优化版) =====================
static async get<T>(url: string): Promise<BaseResponse<T> | null> { console.log('HTTP GET 请求URL:', url); const httpRequest = http.createHttp(); try { const response = await httpRequest.request(url, { method: http.RequestMethod.GET, connectTimeout: 10000, // 10秒连接超时 readTimeout...
AST#method_declaration#Left static async get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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#R...
static async get<T>(url: string): Promise<BaseResponse<T> | null> { console.log('HTTP GET 请求URL:', url); const httpRequest = http.createHttp(); try { const response = await httpRequest.request(url, { method: http.RequestMethod.GET, connectTimeout: 10000, readTimeout: 10000 ...
https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/HttpUtil.ets#L21-L49
edb8ac5eee382ba022076abbc73dcf2756625c84
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
语言枚举
export enum Language { ZH_CN = 'zh_CN', EN_US = 'en_US' }
AST#export_declaration#Left export AST#enum_declaration#Left enum Language AST#enum_body#Left { AST#enum_member#Left ZH_CN = AST#expression#Left 'zh_CN' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left EN_US = AST#expression#Left 'en_US' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right ...
export enum Language { ZH_CN = 'zh_CN', EN_US = 'en_US' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L45-L48
f20d27751ca44ea0964778b704e0f140d723be4e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/skeletondiagram/src/main/ets/view/ListView.ets
arkts
刚加载完成无选中状态
build() { Column() { List({ space: CommonConstants.SPACE_12 }) { LazyForEach(this.listData, (item: Model) => { ListItem() { ItemView({ item: item, isSelected: this.selectedId === item.id }) } .onClick(() => { this.selectedId = item.id; ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_pa...
build() { Column() { List({ space: CommonConstants.SPACE_12 }) { LazyForEach(this.listData, (item: Model) => { ListItem() { ItemView({ item: item, isSelected: this.selectedId === item.id }) } .onClick(() => { this.selectedId = item.id; ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/skeletondiagram/src/main/ets/view/ListView.ets#L27-L49
074b509416a432063a1d6a7f679ae83b52e3aaf4
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/controller/EditController.ets
arkts
addRecord
添加一条记录 @param record 操作记录
addRecord(record: OperateRecord): void { this.operateRecords.push(record); this.onRecordsChanged(); }
AST#method_declaration#Left addRecord AST#parameter_list#Left ( AST#parameter#Left record : AST#type_annotation#Left AST#primary_type#Left OperateRecord 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#...
addRecord(record: OperateRecord): void { this.operateRecords.push(record); this.onRecordsChanged(); }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/controller/EditController.ets#L144-L147
6bf54a456ac9086444fc15ed440f831bb83c1442
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets
arkts
drawLineButton
Draw line. @param ctx @param crop @param vp3 @param padding @param cornerLength
private static drawLineButton(ctx: CanvasRenderingContext2D, crop: RectF, vp3: number, padding: number, cornerLength: number) { vp3 = vp3 / 2; // top button let startX = crop.getCenterX() - cornerLength / 2; let startY = crop.top - vp3; let stopX = startX + cornerLeng...
AST#method_declaration#Left private static drawLineButton AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left crop : AST#type_annotation#Left AST#primary_type#...
private static drawLineButton(ctx: CanvasRenderingContext2D, crop: RectF, vp3: number, padding: number, cornerLength: number) { vp3 = vp3 / 2; let startX = crop.getCenterX() - cornerLength / 2; let startY = crop.top - vp3; let stopX = startX + cornerLength; let s...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets#L178-L208
cdcac6ac6480fbf73de0c170ff506ae7d545582b
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/util.ets
arkts
Decode base64 string to bytes; throws on invalid length/alphabet
export function decodeBase64(str: string): Uint8Array { const s = str.replace(/\s+/g, '') if (s.length % 4 !== 0) throw new Error('invalid base64') const len = s.endsWith('==') ? (s.length / 4) * 3 - 2 : s.endsWith('=') ? (s.length / 4) * 3 - 1 : (s.length / 4) * 3 const out = new Uint8Array(len) let o = 0 ...
AST#export_declaration#Left export AST#function_declaration#Left function decodeBase64 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_list#Right : AST#type_annotation#Left AST#p...
export function decodeBase64(str: string): Uint8Array { const s = str.replace(/\s+/g, '') if (s.length % 4 !== 0) throw new Error('invalid base64') const len = s.endsWith('==') ? (s.length / 4) * 3 - 2 : s.endsWith('=') ? (s.length / 4) * 3 - 1 : (s.length / 4) * 3 const out = new Uint8Array(len) let o = 0 ...
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/util.ets#L86-L109
015f79340e5a2bd7eca19b136346b119b5dcb139
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
主题设置接口(为ThemeSettings别名)
export interface ThemeSettings extends ThemeConfig { // 继承ThemeConfig的所有属性 }
AST#export_declaration#Left export AST#interface_declaration#Left interface ThemeSettings AST#extends_clause#Left extends ThemeConfig AST#extends_clause#Right AST#object_type#Left { // 继承ThemeConfig的所有属性 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ThemeSettings extends ThemeConfig { }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L41-L43
e3344d2c737532762ae8f35c273ff955aa727ad3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/ChatListDataSource.ets
arkts
deleteDataByIndex
删除列表中处于index位置的对象
public deleteDataByIndex(index: number): void { Logger.info(TAG, `delete data , index = ${index}}`); this.chatList.splice(index, 1); this.notifyDataDelete(index); }
AST#method_declaration#Left public deleteDataByIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar...
public deleteDataByIndex(index: number): void { Logger.info(TAG, `delete data , index = ${index}}`); this.chatList.splice(index, 1); this.notifyDataDelete(index); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/ChatListDataSource.ets#L49-L53
a5bcd3c0d4670783377670cfe38a737596cd7c78
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseEntry.ets
arkts
getY
Returns the y value of this Entry. @return
public getY(): number { return this.y; }
AST#method_declaration#Left public getY 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#L...
public getY(): number { return this.y; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseEntry.ets#L42-L44
436a370706a18e18d87163215e88ca98e1617e0c
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
subscribeCollectUrlEvent
收藏Url事件 @param key @param callback
subscribeCollectUrlEvent(key: string, callback: (eventData: emitter.EventData) => void) { EventBus.getInstance().regist(WanEventId.EVENT_COLLECT_URL, key, callback) }
AST#method_declaration#Left subscribeCollectUrlEvent 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 callback : AST#type_annotation#Left AST#function_type#Left AST#parameter...
subscribeCollectUrlEvent(key: string, callback: (eventData: emitter.EventData) => void) { EventBus.getInstance().regist(WanEventId.EVENT_COLLECT_URL, key, callback) }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets#L112-L114
57106c4eab38b65cad2ff9fb5f5cd2744c46f020
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/view/TopArea.ets
arkts
TopArea
Top area.
@Component export struct TopArea { @State isEdit: boolean = false; build() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { Row() { Image($r('app.media.ic_public_cancel')) .width($r('app.integer.cancel_icon_size')) .heigh...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TopArea AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isEdit : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation...
@Component export struct TopArea { @State isEdit: boolean = false; build() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { Row() { Image($r('app.media.ic_public_cancel')) .width($r('app.integer.cancel_icon_size')) .heigh...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/view/TopArea.ets#L22-L76
b20c8feff6b21515417084d278d045407a5cc129
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement3.ets
arkts
ConcurrentTaskManagement3
[End image_processing]
@Component export struct ConcurrentTaskManagement3 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.task_set_title')) .buttonStyles() .margin({ bottom: 16 }) .onCli...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ConcurrentTaskManagement3 AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right buttonStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_bod...
@Component export struct ConcurrentTaskManagement3 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.task_set_title')) .buttonStyles() .margin({ bottom: 16 }) .onCli...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement3.ets#L66-L97
d942afb1fe5e55cd36491e61cdb3ffc43baf6cc2
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_010_F.ets
arkts
Introduction 库函数-string_slice
export function string_lib_func_010_F(taint_src : string) { let clean = "clean"; let t = clean.slice(0,1); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_010_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function string_lib_func_010_F(taint_src : string) { let clean = "clean"; let t = clean.slice(0,1); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_010_F.ets#L7-L11
f7f85f6ef861d22a07cff52fee86762b991e96aa
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/DFXStateManagement/Index.ets
arkts
DFXStateManagementHome
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 { DFXStateManagementHome } from './src/main/ets/view/DFXStateManagementHome'
AST#export_declaration#Left export { DFXStateManagementHome } from './src/main/ets/view/DFXStateManagementHome' AST#export_declaration#Right
export { DFXStateManagementHome } from './src/main/ets/view/DFXStateManagementHome'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/DFXStateManagement/Index.ets#L16-L16
9df3a63ed66deb957a979c444e0b697b96918e9c
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/events/customEventSample/CustomScrollingEvent.ets
arkts
aboutToAppear
0代表滚动到List顶部,1代表中间值,2代表滚动到List底部。
aboutToAppear() { for (let i = 1; i <= 30; i++) { let file: string = "file" + i.toString(); this.files.push(file); } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#vari...
aboutToAppear() { for (let i = 1; i <= 30; i++) { let file: string = "file" + i.toString(); this.files.push(file); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/events/customEventSample/CustomScrollingEvent.ets#L33-L38
ef336daafbc9801a07d552af1d859a736b09d69f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/GreetingsPage.ets
arkts
buildFilterMenu
构建筛选菜单
@Builder buildFilterMenu() { Column() { // 背景遮罩 Row() .width('100%') .layoutWeight(1) .backgroundColor('rgba(0,0,0,0.3)') .onClick(() => { this.showFilterMenu = false; }) // 菜单内容 Column({ space: 16 }) { // 样式筛选 Column...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilterMenu 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 buildFilterMenu() { Column() { Row() .width('100%') .layoutWeight(1) .backgroundColor('rgba(0,0,0,0.3)') .onClick(() => { this.showFilterMenu = false; }) Column({ space: 16 }) { Column({ space: 8 }) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L486-L555
7fd0f2dc3a8360217c227a991157b3f4ba1c015b
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/QuickLoginPage.ets
arkts
handleLoginWithHuaweiIDButton
Method that processes a tap on the one-tap sign-in button.
handleLoginWithHuaweiIDButton(error: BusinessError | undefined, response: loginComponentManager.HuaweiIDCredential) { this.enableStatus = false; if (error) { hilog.error(this.domainId, this.logTag, `Failed to login with LoginWithHuaweiIDButton. errCode is ${error.code}, errMessage is ${error.messa...
AST#method_declaration#Left handleLoginWithHuaweiIDButton AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BusinessError AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right A...
handleLoginWithHuaweiIDButton(error: BusinessError | undefined, response: loginComponentManager.HuaweiIDCredential) { this.enableStatus = false; if (error) { hilog.error(this.domainId, this.logTag, `Failed to login with LoginWithHuaweiIDButton. errCode is ${error.code}, errMessage is ${error.messa...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/QuickLoginPage.ets#L95-L136
e2443e768e236c9c615253e7579ec83843fd81a9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ApplicationModels/StageModelAbilityDevelop/entry/src/main/ets/pages/Page_UIAbilityComponentsBasicUsage.ets
arkts
页面展示
build() { Column() { Row() { Text($r('app.string.UIAbilityComponentsBasicUsage')) .fontSize(24) .fontWeight(700) .textAlign(TextAlign.Start) .margin({ top: 12, bottom: 11, right: 24, left: 24 }) } .width('100%') .height(56) .justifyConten...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_...
build() { Column() { Row() { Text($r('app.string.UIAbilityComponentsBasicUsage')) .fontSize(24) .fontWeight(700) .textAlign(TextAlign.Start) .margin({ top: 12, bottom: 11, right: 24, left: 24 }) } .width('100%') .height(56) .justifyConten...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ApplicationModels/StageModelAbilityDevelop/entry/src/main/ets/pages/Page_UIAbilityComponentsBasicUsage.ets#L60-L88
a54362b1c8a97a7b58de8ad46da4f17f5e406531
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyCenter.ets
arkts
night_onclick
切换夜间模式
night_onclick(){ }
AST#method_declaration#Left night_onclick AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
night_onclick(){ }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyCenter.ets#L161-L163
7bf6843e07bfbda76f774e4101dcfb696c2eef86
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/formatter/DefaultValueFormatter.ets
arkts
Constructor that specifies to how many digits the value should be formatted. @param digits
constructor(digits: number) { this.setup(digits); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left digits : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#...
constructor(digits: number) { this.setup(digits); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/DefaultValueFormatter.ets#L40-L42
3ace9cf48dcd9760361189f9483204d144b2d86a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语统计接口
export interface GreetingStats { totalGenerated: number; totalFavorited: number; averageRating: number; mostUsedStyle: GreetingStyle; styleDistribution: Record<GreetingStyle, number>; occasionDistribution: Record<GreetingOccasion, number>; monthlyTrend: MonthlyGreetingStats[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingStats AST#object_type#Left { AST#type_member#Left totalGenerated : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalFavorited : AST#...
export interface GreetingStats { totalGenerated: number; totalFavorited: number; averageRating: number; mostUsedStyle: GreetingStyle; styleDistribution: Record<GreetingStyle, number>; occasionDistribution: Record<GreetingOccasion, number>; monthlyTrend: MonthlyGreetingStats[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L617-L625
4d2e7dfa568fac3084222925c1de28941587fc91
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
insertMemo
==================== MEMO OPERATIONS ==================== Insert a new memo @param memo - Memo object to insert @returns Row ID of inserted memo
async insertMemo(memo: Memo): Promise<number> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { const valueBucket: relationalStore.ValuesBucket = { 'content': memo.content, 'created_at': memo.createdAt }; const rowId = await this.rdbStore.i...
AST#method_declaration#Left async insertMemo AST#parameter_list#Left ( AST#parameter#Left memo : AST#type_annotation#Left AST#primary_type#Left Memo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom...
async insertMemo(memo: Memo): Promise<number> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { const valueBucket: relationalStore.ValuesBucket = { 'content': memo.content, 'created_at': memo.createdAt }; const rowId = await this.rdbStore.i...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L325-L343
c2666cdfa559a903fffd844b001fdeb4c9cafd26
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AuthRepository.ets
arkts
loginByQqApp
QQ APP 授权登录 @param {QQLoginRequest} params - QQ 授权参数 @returns {Promise<NetworkResponse<Auth>>} 认证结果
async loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>> { return this.networkDataSource.loginByQqApp(params); }
AST#method_declaration#Left async loginByQqApp AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left QQLoginRequest 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_...
async loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>> { return this.networkDataSource.loginByQqApp(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AuthRepository.ets#L36-L38
466f33c06a59385ea42254c6b461840d81373584
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/PreferencesUtils.ets
arkts
has
检查缓存的Preferences实例中是否包含名为给定Key的存储键值对 @param key @param preferenceName @returns
static async has(key: string, preferenceName: string = defaultPreferenceName) { let preferences = await PreferencesUtils.getPreferences(preferenceName) //获取实例 return await preferences.has(key) }
AST#method_declaration#Left static async has 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 preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static async has(key: string, preferenceName: string = defaultPreferenceName) { let preferences = await PreferencesUtils.getPreferences(preferenceName) return await preferences.has(key) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PreferencesUtils.ets#L129-L132
ef2f956cb78cf72e9496211208cc87e5d67bfa98
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider26.ets
arkts
buildSlider26
Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
@Builder function buildSlider26(config: SliderConfiguration) { Row() { Column({space: 30}) { Button('增加').onClick(() => { config.value = config.value + config.step config.triggerChange(config.value, SliderChangeMode.Click) }) .width(100) .height(25) .fontSize(10...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildSlider26 AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left SliderConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li...
@Builder function buildSlider26(config: SliderConfiguration) { Row() { Column({space: 30}) { Button('增加').onClick(() => { config.value = config.value + config.step config.triggerChange(config.value, SliderChangeMode.Click) }) .width(100) .height(25) .fontSize(10...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider26.ets#L16-L67
42bc0526840e13424bd60d540450cc5cc973c3c3
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/mock/InterviewArticleMockData.ets
arkts
getAllArticles
获取所有文章
static getAllArticles(): InterviewArticleModel[] { return InterviewArticleMockData.articles; }
AST#method_declaration#Left static getAllArticles AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left InterviewArticleModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#re...
static getAllArticles(): InterviewArticleModel[] { return InterviewArticleMockData.articles; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/mock/InterviewArticleMockData.ets#L957-L959
a854575ce0659f7acaf7f244da059da43bff108b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/storage/PreferencesService.ets
arkts
getArray
获取数组值(从JSON字符串解析) @param key 键 @param defaultValue 默认值 @returns 数组值
async getArray<T>(key: string, defaultValue: T[] = []): Promise<T[]> { try { const jsonString = await this.getString(key, ''); if (!jsonString) { return defaultValue; } return JSON.parse(jsonString) as T[]; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants...
AST#method_declaration#Left async getArray AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Rig...
async getArray<T>(key: string, defaultValue: T[] = []): Promise<T[]> { try { const jsonString = await this.getString(key, ''); if (!jsonString) { return defaultValue; } return JSON.parse(jsonString) as T[]; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L183-L194
8fadfd38b74c6c5bfbb70f16b1ef421cea1484bf
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/RandomUtil.ets
arkts
randomBoolean
获得随机Boolean值 @return true or false
static randomBoolean(): boolean { return Math.random() < 0.5; }
AST#method_declaration#Left static randomBoolean AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_ex...
static randomBoolean(): boolean { return Math.random() < 0.5; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/RandomUtil.ets#L32-L34
c994c68cf08aa7f357e97be3084a34eba08d21a5
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.Popup.d.ets
arkts
Defines the popup options. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Defines the popup options. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface PopupOptions { /** * The icon of Popup. * * @type { ?PopupIconOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The icon of Popup. * * @type { ?PopupIconOptions } * @syscap SystemCapability.ArkUI.ArkUI....
AST#export_declaration#Left export AST#interface_declaration#Left interface PopupOptions AST#object_type#Left { /** * The icon of Popup. * * @type { ?PopupIconOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * The icon of Popup. * *...
export interface PopupOptions { icon?: PopupIconOptions; title?: PopupTextOptions; message: PopupTextOptions; showClose?: boolean | Resource; onClose?: () => void; buttons?: [ PopupButtonOptions?, PopupButtonOptions? ...
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Popup.d.ets#L285-L407
17100a810da72211d4416fcfa956a55271329f35
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/ConfigService.ets
arkts
hasUserConfig
检查是否有用户配置(区分于默认配置)
async hasUserConfig(): Promise<boolean> { if (!this.dataPreferences) { return false; } try { return await this.dataPreferences.get(ConfigService.KEY_HAS_CONFIG, false) as boolean; } catch (error) { return false; } }
AST#method_declaration#Left async hasUserConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type...
async hasUserConfig(): Promise<boolean> { if (!this.dataPreferences) { return false; } try { return await this.dataPreferences.get(ConfigService.KEY_HAS_CONFIG, false) as boolean; } catch (error) { return false; } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/ConfigService.ets#L258-L268
b92449b1f2eb868be1a233cc4182d36de9139234
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/PermissionOverwrites.ets
arkts
约束18:构造函数中不能声明字段,需在类中声明
constructor(guildChannel: any, data?: PermissionOverwriteData) { // 约束1:需替换any为具体类型 // 约束2:使用属性赋值替代Object.defineProperty this.channel = guildChannel; if (data) { this.setup(data); } }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left guildChannel : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left PermissionOverwrit...
constructor(guildChannel: any, data?: PermissionOverwriteData) { this.channel = guildChannel; if (data) { this.setup(data); } }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/PermissionOverwrites.ets#L26-L33
466b585ddfc9a4d5d6b42680aceaeab3be152ae3
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/storage/StorageManager.ets
arkts
getBoolean
获取布尔值
static async getBoolean(key: string, defaultValue: boolean = false): Promise<boolean> { const instance = StorageManager.getInstance(); if (!instance.dataPreferences) { await instance.init(); if (!instance.dataPreferences) { return defaultValue; } } try { const value = awa...
AST#method_declaration#Left static async getBoolean 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 boolean AST...
static async getBoolean(key: string, defaultValue: boolean = false): Promise<boolean> { const instance = StorageManager.getInstance(); if (!instance.dataPreferences) { await instance.init(); if (!instance.dataPreferences) { return defaultValue; } } try { const value = awa...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L124-L139
25e753fad9bb42b40e9f1992e113f206e09ba1c8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/DataFactory.ets
arkts
加载动态列表数据,到参数传入的懒加载数据列表中 @param listData 懒加载数据列表
export async function makeDataLocal(listData: TrendsData): Promise<void> { Logger.info(TAG, 'makeDataLocal'); for (let i = 0; i < trendsList[0].length; i++) { listData.pushData(trendsList[0][i]); } }
AST#export_declaration#Left export AST#function_declaration#Left async function makeDataLocal AST#parameter_list#Left ( AST#parameter#Left listData : AST#type_annotation#Left AST#primary_type#Left TrendsData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annot...
export async function makeDataLocal(listData: TrendsData): Promise<void> { Logger.info(TAG, 'makeDataLocal'); for (let i = 0; i < trendsList[0].length; i++) { listData.pushData(trendsList[0][i]); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/DataFactory.ets#L28-L33
d14a988d93564f24d67257a1d06c34f01f889e7d
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets
arkts
deleteById
MARK: - 删除操作
async deleteById(idxx: number): Promise<void> { if (!this.db) return; const sql = `DELETE FROM ${Tables.CSound.name} WHERE ${Tables.CSound.Col.idxx} = ?`; await this.db.updateDb(sql, [idxx]); }
AST#method_declaration#Left async deleteById AST#parameter_list#Left ( AST#parameter#Left idxx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr...
async deleteById(idxx: number): Promise<void> { if (!this.db) return; const sql = `DELETE FROM ${Tables.CSound.name} WHERE ${Tables.CSound.Col.idxx} = ?`; await this.db.updateDb(sql, [idxx]); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L109-L116
5a6d1e8107fa184c2afffcda1261f03680134674
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
access
检查文件是否存在,使用Promise异步回调。 @param path 文件应用沙箱路径。 @returns
static access(path: string): Promise<boolean> { return fs.access(path); }
AST#method_declaration#Left static access AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promi...
static access(path: string): Promise<boolean> { return fs.access(path); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L381-L383
21c53db6bd281bba9c2def24afe098d8c34ce2c5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets
arkts
this
设置显示画面,当播放的资源为纯音频时无需设置
this.avPlayer.prepare();
AST#method_declaration#Left this AST#ERROR#Left . avPlayer . prepare AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
this.avPlayer.prepare();
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets#L208-L208
97d1dbc5153646cd1479389e7541b68cb9ab9445
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/utils/RegexUtil.ets
arkts
isMatch
给定内容是否匹配正则(配合RegexUtil里的正则常量一起使用) @param content 内容 @param regex 正则
static isMatch(content: string, pattern: string): boolean { if (content === undefined || content === null) { return false; } else { return new RegExp(pattern).test(content); } }
AST#method_declaration#Left static isMatch AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static isMatch(content: string, pattern: string): boolean { if (content === undefined || content === null) { return false; } else { return new RegExp(pattern).test(content); } }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/utils/RegexUtil.ets#L197-L203
9d77a31b579303cba4b3ad9be45178f5aa04249f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothAdvertiser.ets
arkts
toggleAdvertiser
开启或关闭心率广播
toggleAdvertiser(): void { Log.showInfo(TAG, `toggleAdvertiser: startAdvertiserState = ${this.startAdvertiserState}`) if (this.startAdvertiserState) { // TODO: 知识点 关闭蓝牙服务 advertiserBluetoothViewModel.stopAdvertiser(); this.toggleHeartRate(false); this.startAdvertiserState = false; }...
AST#method_declaration#Left toggleAdvertiser AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express...
toggleAdvertiser(): void { Log.showInfo(TAG, `toggleAdvertiser: startAdvertiserState = ${this.startAdvertiserState}`) if (this.startAdvertiserState) { advertiserBluetoothViewModel.stopAdvertiser(); this.toggleHeartRate(false); this.startAdvertiserState = false; } else { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothAdvertiser.ets#L86-L105
000b0b077ead1cc7528633562ff9096db98c09dc
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets
arkts
initWeb
This function is a user-defined function and can be used as an initialization function. Initialize builderNode through UIContext, and then initialize the contents in @Builder through the Build interface in BuilderNode.
initWeb(url: string, uiContext: UIContext, control: WebviewController): void { if (this.rootNode != null) { return; } // Bind the pre-created WebviewController this.rootWebviewController = control; // Creating a node requires uiContext. this.rootNode = new BuilderNode(uiContext); // Cr...
AST#method_declaration#Left initWeb 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#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Rig...
initWeb(url: string, uiContext: UIContext, control: WebviewController): void { if (this.rootNode != null) { return; } this.rootWebviewController = control; this.rootNode = new BuilderNode(uiContext); this.rootNode.build(wrapBuilder<Data[]>(webBuilder), { url: url, controller: co...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L80-L90
c5053bb3bcc55bf662e9fe4b19da41b96c7b249a
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
Declare class of main view model.
export default class MainViewModel { static instant: MainViewModel = new MainViewModel(); private reminderService: ReminderService; private alarms: Array<AlarmItem>; private constructor() { this.alarms = new Array(); this.reminderService = new ReminderService(); this.reminderService.openNotificatio...
AST#export_declaration#Left export default AST#class_declaration#Left class MainViewModel AST#class_body#Left { AST#property_declaration#Left static instant : AST#type_annotation#Left AST#primary_type#Left MainViewModel AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#...
export default class MainViewModel { static instant: MainViewModel = new MainViewModel(); private reminderService: ReminderService; private alarms: Array<AlarmItem>; private constructor() { this.alarms = new Array(); this.reminderService = new ReminderService(); this.reminderService.openNotificatio...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets#L28-L165
24a5b836897693107ae3df6c3f7a555bfc9f3958
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
redirectForResult2
@deprecated @see {ZRouter.getInstance().redirectForResult2} @param name @param param @param callback
public static redirectForResult2<T>(name: string, param?: ObjectOrNull, callback?: OnPopResultCallback<T>) { ZRouter.getRouterMgr().redirectForResult2(name, param, callback) }
AST#method_declaration#Left public static redirectForResult2 AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Righ...
public static redirectForResult2<T>(name: string, param?: ObjectOrNull, callback?: OnPopResultCallback<T>) { ZRouter.getRouterMgr().redirectForResult2(name, param, callback) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L418-L420
64d86fee449099e8c1546cbbd681897cd1c992ae
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
onActionStart
Rotation gesture recognition success callback. @param { Callback<GestureEvent> } event @returns { RotationGesture } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
onActionStart(event: Callback<GestureEvent>): RotationGesture;
AST#method_declaration#Left onActionStart AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
onActionStart(event: Callback<GestureEvent>): RotationGesture;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L677-L677
043baa36e0cc1e10d2d542b1738bd5224296bc54
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/datatype/function/function_002_F.ets
arkts
Introduction 函数类型
export function function_002_F(taint_src : Function) { let _t = taint_src; let _clean = f; taint.Sink(_clean) }
AST#export_declaration#Left export AST#function_declaration#Left function function_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Le...
export function function_002_F(taint_src : Function) { let _t = taint_src; let _clean = f; taint.Sink(_clean) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/function/function_002_F.ets#L5-L9
637ba6809bb756b7412e98810e9aaa6b4a38de6a
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/AnimateRefresh/entry/src/main/ets/viewmodel/CardModel.ets
arkts
Card model.
export default class CardModel { selectedIcon: Resource; defaultIcon: Resource; content: string; constructor(selectedIcon: Resource, defaultIcon: Resource, content: string) { this.selectedIcon = selectedIcon; this.defaultIcon = defaultIcon; this.content = content; } }
AST#export_declaration#Left export default AST#class_declaration#Left class CardModel AST#class_body#Left { AST#property_declaration#Left selectedIcon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left...
export default class CardModel { selectedIcon: Resource; defaultIcon: Resource; content: string; constructor(selectedIcon: Resource, defaultIcon: Resource, content: string) { this.selectedIcon = selectedIcon; this.defaultIcon = defaultIcon; this.content = content; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/viewmodel/CardModel.ets#L19-L29
b1d09f6cde3deee67cacbbc6398806b3b935c3f4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
getGameSession
获取游戏会话
getGameSession(sessionId: string): GameSession | null { return this.activeSessions.get(sessionId) || null; }
AST#method_declaration#Left getGameSession AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left G...
getGameSession(sessionId: string): GameSession | null { return this.activeSessions.get(sessionId) || null; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L354-L356
7bb657e2d1eaf81ae97c45db4c544434cd248047
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
showBottomSheetDialog
显示动作面板
static showBottomSheetDialog(options: BottomSheetOptions): string { ActionParameter.initBaseDefault(options); ActionParameter.initBottomSheetDefault(options, true); const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(BottomSheetDialogBuilder), options); return dialogId; }
AST#method_declaration#Left static showBottomSheetDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BottomSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Le...
static showBottomSheetDialog(options: BottomSheetOptions): string { ActionParameter.initBaseDefault(options); ActionParameter.initBottomSheetDefault(options, true); const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(BottomSheetDialogBuilder), options); return dialogId; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L234-L239
ef7cd79cc625dacf62d8c92eb979ce2c81321e31
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/listener/ChartTouchListener.ets
arkts
startAction
Calls the OnChartGestureListener to do the start callback @param me
public startAction(isTouchEvent: boolean, me: TouchEvent | GestureEvent) { let l: OnChartGestureListener | null = this.mChart.getOnChartGestureListener(); if (l != null) { l.onChartGestureStart(isTouchEvent, me, this.mLastGesture); } }
AST#method_declaration#Left public startAction AST#parameter_list#Left ( AST#parameter#Left isTouchEvent : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left me : AST#type_annotation#Left AST#union_type#Left AST#primary_type#L...
public startAction(isTouchEvent: boolean, me: TouchEvent | GestureEvent) { let l: OnChartGestureListener | null = this.mChart.getOnChartGestureListener(); if (l != null) { l.onChartGestureStart(isTouchEvent, me, this.mLastGesture); } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/ChartTouchListener.ets#L75-L82
f07d09b1b83185c72623da8c6b78913d35abea34
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/model/CommonModel.ets
arkts
requestPhoneNumber
绑定手机号
public requestPhoneNumber() { RouterModule.openDialog(DialogMap.BIND_PHONE_DIALOG,); }
AST#method_declaration#Left public requestPhoneNumber AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . op...
public requestPhoneNumber() { RouterModule.openDialog(DialogMap.BIND_PHONE_DIALOG,); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/model/CommonModel.ets#L61-L63
2a34a50c97b0459b37b376580a62027fd94990df
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/treeview/source/treeview.ets
arkts
getInstance
Get instance of treeListenerManager. @return treeListenerManager instance. @static @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Get instance of treeListenerManager. @return treeListenerManager instance. @static @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
static getInstance(): TreeListenerManager { if (AppStorage.Get('app_key_event_bus') === undefined) { AppStorage.SetOrCreate('app_key_event_bus', new TreeListenerManager()) } return AppStorage.Get('app_key_event_bus') as TreeListenerManager; }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TreeListenerManager AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression...
static getInstance(): TreeListenerManager { if (AppStorage.Get('app_key_event_bus') === undefined) { AppStorage.SetOrCreate('app_key_event_bus', new TreeListenerManager()) } return AppStorage.Get('app_key_event_bus') as TreeListenerManager; }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L947-L952
d6b72a1ad52b3427deb80fdcf2831e3110f6b75f
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/entryability/EntryAbility.ets
arkts
用于存储UIAbility上下文的静态引用
export class AppContext { private static context: common.Context | null = null; // 设置上下文引用 static setContext(context: common.Context): void { AppContext.context = context; hilog.info(DOMAIN, TAG, 'AppContext: 已保存UIAbility上下文引用'); } // 获取上下文引用 static getContext(): common.Context | null { return...
AST#export_declaration#Left export AST#class_declaration#Left class AppContext AST#class_body#Left { AST#property_declaration#Left private static context : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right | AST#pr...
export class AppContext { private static context: common.Context | null = null; static setContext(context: common.Context): void { AppContext.context = context; hilog.info(DOMAIN, TAG, 'AppContext: 已保存UIAbility上下文引用'); } static getContext(): common.Context | null { return AppContext.context;...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/entryability/EntryAbility.ets#L10-L23
c962635d5ed6617b92f8c4fee0930c7dc29e6d98
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/views/DotSheetBind.ets
arkts
languageChange
监听语言模式变化
@Monitor('appGeneralData.languageId') languageChange() { if (this.appGeneralData.languageId === 0) { application.getApplicationContext().setLanguage(i18n.System.getSystemLanguage()); } else if (this.appGeneralData.languageId === 1) { application.getApplicationContext().setLanguage('zh-Hans'); ...
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'appGeneralData.languageId' AST#expression#Right ) AST#decorator#Right languageChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression...
@Monitor('appGeneralData.languageId') languageChange() { if (this.appGeneralData.languageId === 0) { application.getApplicationContext().setLanguage(i18n.System.getSystemLanguage()); } else if (this.appGeneralData.languageId === 1) { application.getApplicationContext().setLanguage('zh-Hans'); ...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/views/DotSheetBind.ets#L89-L98
576d4a76838fa32d9be581ef957dd7bfbd3b6caa
github
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/models/CommentModel.ets
arkts
Comments
export interface CommentResponse { code: number data: CommentData message: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface CommentResponse AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left data : AST#type_annotation#Left...
export interface CommentResponse { code: number data: CommentData message: string }
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/models/CommentModel.ets#L4-L8
7cc507aac9c1dd115660d73eb50f8760dbe5f405
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/accessibility/AccessibilityService.ets
arkts
对比度级别
export enum ContrastLevel { LOW = 'low', NORMAL = 'normal', HIGH = 'high', MAXIMUM = 'maximum' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ContrastLevel AST#enum_body#Left { AST#enum_member#Left LOW = AST#expression#Left 'low' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NORMAL = AST#expression#Left 'normal' AST#expression#Right AST#enum_member#Right , AST#enum_member#L...
export enum ContrastLevel { LOW = 'low', NORMAL = 'normal', HIGH = 'high', MAXIMUM = 'maximum' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L39-L44
8a6b5c7aeab162ce46337936f107688645451651
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
Q1/grammar/entry/src/main/ets/pages/LifeCycle1.ets
arkts
aboutToDisappear
组件析构销毁时触发: 删除 移出
aboutToDisappear() { console.log('LifeCycle1_son....aboutToDisappear') }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_e...
aboutToDisappear() { console.log('LifeCycle1_son....aboutToDisappear') }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/grammar/entry/src/main/ets/pages/LifeCycle1.ets#L75-L77
4e89c13e71cb4cd76388e3396d48274c3c2a7b1f
gitee
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/api/MessageApi.type.ets
arkts
最新消息
export interface MessageInfoNew extends BaseTime { /** * 消息id */ id: number /** * 消息标题 */ title: string /** * 消息内容 */ content: string /** * 消息类型'1' 系统消息 '2' 通知公告 */ type: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface MessageInfoNew AST#extends_clause#Left extends BaseTime AST#extends_clause#Right AST#object_type#Left { /** * 消息id */ AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotati...
export interface MessageInfoNew extends BaseTime { id: number title: string content: string type: string }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/MessageApi.type.ets#L4-L22
f6d45b0b4c6c003a9708d2a514e858dbf7d2086c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
addressSelectPage
地址选择半模态弹窗页面
@Builder addressSelectPage() { Column() { // 自定义TabBar this.customTabBar() Divider() .width($r('app.string.custom_address_picker_percent_ninety')) .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) // 自定义Tabs ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right addressSelectPage 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 { // 自定义TabBa...
@Builder addressSelectPage() { Column() { this.customTabBar() Divider() .width($r('app.string.custom_address_picker_percent_ninety')) .strokeWidth(Constants.SIZE_ONE) .color($r('app.color.custom_address_picker_area_name_divider_color')) this.customTabs() ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L511-L527
158f3bbb28be039be8942f7cc9195e5c50d5c5c8
gitee
from-north-to-north/OpenHarmony_p7885
f6ea526c039db535a7c958fa154ccfcb3668b37c
hap/easy_demo/tcp_demo/tcp/entry/src/main/ets/pages/Index.ets
arkts
resolveArrayBuffer
解析标准系统开发板接收到的 对端TCP socket设备发送的数据
resolveArrayBuffer(message: ArrayBuffer): string { if (message instanceof ArrayBuffer) { let dataView = new DataView(message) console.info(`length ${dataView.byteLength}`) let str = ""; for (let i = 0; i < dataView.byteLength; ++i) { let c = String.fromCharCode(dataView.getUint8(i)) ...
AST#method_declaration#Left resolveArrayBuffer AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
resolveArrayBuffer(message: ArrayBuffer): string { if (message instanceof ArrayBuffer) { let dataView = new DataView(message) console.info(`length ${dataView.byteLength}`) let str = ""; for (let i = 0; i < dataView.byteLength; ++i) { let c = String.fromCharCode(dataView.getUint8(i)) ...
https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/tcp_demo/tcp/entry/src/main/ets/pages/Index.ets#L44-L59
a7bb183d4ac657ca826bf4715488f18d63638bbd
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
loadLanguageTranslations
加载指定语言的翻译
private async loadLanguageTranslations(language: SupportedLanguage): Promise<void> { try { // TODO: 从资源文件或网络加载翻译 // 这里应该根据语言代码加载相应的翻译文件 hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Loading translations for ${language}`); } catch (error) { hilog.error(LogConstants.D...
AST#method_declaration#Left private async loadLanguageTranslations AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prima...
private async loadLanguageTranslations(language: SupportedLanguage): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Loading translations for ${language}`); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L705-L715
0017c6b4adf1fd2e81792faeab59dcc02f4995f1
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/ToastOptions.ets
arkts
TODO Toast基本参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export interface ToastOptions { uiContext?: UIContext; //UIContext上下文 message?: string | Resource; //显示的文本信息。默认字体为'Harmony Sans',不支持设置其他字体。 duration?: number //默认值1500ms,取值区间:1500ms-10000ms。若小于1500ms则取默认值,若大于10000ms则取上限值10000ms。 fontColor?: ResourceColor; // 文本提示框文本颜色。默认值:Color.Black bottom?: string | numbe...
AST#export_declaration#Left export AST#interface_declaration#Left interface ToastOptions AST#object_type#Left { AST#type_member#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //UIContext上下文 AST#type_member#Left message...
export interface ToastOptions { uiContext?: UIContext; message?: string | Resource; duration?: number fontColor?: ResourceColor; bottom?: string | number; alignment?: Alignment; offset?: Offset; backgroundColor?: ResourceColor; backgroundBlurStyle?: BlurStyle; shadow?: ShadowOptions | Sha...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/ToastOptions.ets#L23-L40
e60122d46b64f48d774356116ce12a2a602815fb
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/components/MusicControlComponent.ets
arkts
getImageColor
Get largest proportion color of an image.
getImageColor() { if (!this.context) { return; } this.context.resourceManager.getMediaContent(this.songList[this.selectIndex].label) .then((value: Uint8Array) => { let buffer = value.buffer as ArrayBuffer; image.createImageSource(buffer).createPixelMap().then((pixelMap) => { ...
AST#method_declaration#Left getImageColor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_e...
getImageColor() { if (!this.context) { return; } this.context.resourceManager.getMediaContent(this.songList[this.selectIndex].label) .then((value: Uint8Array) => { let buffer = value.buffer as ArrayBuffer; image.createImageSource(buffer).createPixelMap().then((pixelMap) => { ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/components/MusicControlComponent.ets#L252-L284
8030f3e0bc706d2f8e0e0f1e46f285fb4cee8bfa
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/viewmodel/HorizontalVideoItem.ets
arkts
HorizontalVideoItem
Horizontal picture class.
@Observed export class HorizontalVideoItem { id: number; image: Resource; name: string; constructor(id: number, image: Resource, name: string) { this.id = id; this.image = image; this.name = name; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class HorizontalVideoItem AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#pr...
@Observed export class HorizontalVideoItem { id: number; image: Resource; name: string; constructor(id: number, image: Resource, name: string) { this.id = id; this.image = image; this.name = name; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/viewmodel/HorizontalVideoItem.ets#L19-L30
37a0e3cc46ade361bd5e15b9ca909be23a7e3f2f
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationContentUtil.ets
arkts
initBasicNotificationContent
init basic notification content @param basicContent @return return the created NotificationContent
initBasicNotificationContent(basicContent: notification.NotificationBasicContent) { let result: NotificationContentUtilResultType = { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // 通知内容类型 normal: basicContent // 基本类型通知内容 } return result; }
AST#method_declaration#Left initBasicNotificationContent AST#parameter_list#Left ( AST#parameter#Left basicContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationBasicContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Righ...
initBasicNotificationContent(basicContent: notification.NotificationBasicContent) { let result: NotificationContentUtilResultType = { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: basicContent } return result; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationContentUtil.ets#L33-L39
2ae0c9dbcb1fb98e1beeac2046e286fe5002573a
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment6.ets
arkts
getUserData
[EndExclude Case3_start] Getting server-side user information in a business class
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { // 1.Storing user information data into AppStorage AppStorage.setOrCreate('userData', data); }); }
AST#method_declaration#Left getUserData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#L...
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { AppStorage.setOrCreate('userData', data); }); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment6.ets#L42-L47
26a4f6f4384def64a49c45905f67664631427e3a
gitee
buqiuz/game-puzzle.git
605dc0fac0738466db308a8ba255b5e9094c52ac
entry/src/main/ets/model/PuzzleSolver.ets
arkts
manhattanDistance
计算曼哈顿距离
manhattanDistance(state: number[], goalPos: Map<number, [number, number]>): number { let distance = 0; for (let index = 0; index < state.length; index++) { const value = state[index]; if (value !== 0) { // 空白块不计算距离 const goalPosition = goalPos.get(value)!; const goalX = goalPosition[...
AST#method_declaration#Left manhattanDistance AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left goalPos : AST#type_annotation#Le...
manhattanDistance(state: number[], goalPos: Map<number, [number, number]>): number { let distance = 0; for (let index = 0; index < state.length; index++) { const value = state[index]; if (value !== 0) { const goalPosition = goalPos.get(value)!; const goalX = goalPosition[0]; ...
https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/src/main/ets/model/PuzzleSolver.ets#L18-L32
40ea5241a35165c6ee7f2a833fd22ca14b1aaafc
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
defaultAnimateBuilder
全局转场动画构造器,构造后还是需要给页面设置NavAnimationModifier,不然不生效 @returns
defaultAnimateBuilder() { const builder = NavAnimParamBuilder.builder() this._defaultCallback = builder.getCallback() return builder }
AST#method_declaration#Left defaultAnimateBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left builder = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Lef...
defaultAnimateBuilder() { const builder = NavAnimParamBuilder.builder() this._defaultCallback = builder.getCallback() return builder }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L290-L294
c9a67528eba7396115beb0647313e2f5a6ca37e0
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/sns/qq/QQLoginManager.ets
arkts
/////////////////////////////////////////////////////////////////////// / / QQ登录官方文档 /https://wiki.connect.qq.com/harmonyos_sdk环境搭建 https://wiki.connect.qq.com/使用authorization_code获取access_token#:~:text=Step2:通过Authorization%20Code获取Access%20Token / 关键步骤: / 1.在华为AppGallery Connect上 / 创建AppLinks: 如: htt...
export class QQLoginManager { private static instance: QQLoginManager | null = null; // 从应用配置中获取,这里需要替换为实际的AppId private APP_ID: number = Number(AppSettings.CfgQQ.AppId); private iQQOpenApi: IQQOpenApi | null = null; private SnsOneLoginCallback: SnsOneLoginCallback | null = null; // 单例模式 public static ...
AST#export_declaration#Left export AST#class_declaration#Left class QQLoginManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left QQLoginManager AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AS...
export class QQLoginManager { private static instance: QQLoginManager | null = null; private APP_ID: number = Number(AppSettings.CfgQQ.AppId); private iQQOpenApi: IQQOpenApi | null = null; private SnsOneLoginCallback: SnsOneLoginCallback | null = null; public static get shared(): QQLoginManager { ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/sns/qq/QQLoginManager.ets#L43-L164
ff8e022bdf61fd7afb1f500a0af1ceef09e9b466
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
clearUndefined
判断位置坐标值
clearUndefined(num: number | undefined) { if (num == undefined) { return 0; } return num; }
AST#method_declaration#Left clearUndefined AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST...
clearUndefined(num: number | undefined) { if (num == undefined) { return 0; } return num; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L474-L479
23b8bd0787392b8b46d00205bdcf7a7f5b616a83
gitee
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
rdbplus/src/main/ets/core/MyWrapper.ets
arkts
getWhere
获取where后的条件
getWhere(): string { let sql = '1=1 ' + this.whereList.join(" ") return sql }
AST#method_declaration#Left getWhere AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sql = AST#expres...
getWhere(): string { let sql = '1=1 ' + this.whereList.join(" ") return sql }
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/MyWrapper.ets#L33-L36
6901da74ad5bb6e471b8a075179b1b2c69336c96
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/LocalStoragePage.ets
arkts
构建本地存储示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_local_storage_title"), viewModel: this.vm }) { this.LocalStorageContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_loc...
build() { AppNavDestination({ title: $r("app.string.demo_local_storage_title"), viewModel: this.vm }) { this.LocalStorageContent(); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/LocalStoragePage.ets#L24-L31
9392546dbda53b0be744823b6305cf411b2ca47a
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/CropUtil.ets
arkts
Crop 4:3. @param pixelMap. @param width. @param height.
export async function banner(pixelMap: PixelMap, width: number, height: number) { if (width <= height) { const cropWidth = width; const cropHeight = Math.floor(width * CommonConstants.CROP_RATE_4_3); const cropPosition: RegionItem = { x: 0, y: Math.floor((height - cropHeight) / CommonConstants...
AST#export_declaration#Left export AST#function_declaration#Left async function banner AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left width : AST#type_annotation#Lef...
export async function banner(pixelMap: PixelMap, width: number, height: number) { if (width <= height) { const cropWidth = width; const cropHeight = Math.floor(width * CommonConstants.CROP_RATE_4_3); const cropPosition: RegionItem = { x: 0, y: Math.floor((height - cropHeight) / CommonConstants...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/CropUtil.ets#L74-L103
9ee1b0db25a5190a66bfa5e91a0539c99eaa25ff
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/DES.ets
arkts
decryptECB
解密(ECB模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。 @returns
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = '3DES192|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> { return DES.decrypt(data, symKey, null, transformation); }
AST#method_declaration#Left static async decryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym...
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, transformation: string = '3DES192|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> { return DES.decrypt(data, symKey, null, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L61-L64
955f450c6f42bbed896a06aa3f8dd65e2ac05ba3
gitee
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git
3b5fa45c650dcae2773a19f122161935e0c0e2bc
entry/src/main/ets/pages/customScan/pages/ScanPage.ets
arkts
GlobalThisUtil
Not access the gallery for code recognition.
GlobalThisUtil.setProperty(CommonConstants.GLOBAL_SCAN_IS_DECODING_GALLERY, false);
AST#method_declaration#Left GlobalThisUtil AST#ERROR#Left . set Prop erty AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left CommonConstants AST#parameter#Right AST#ERROR#Left . GLOBAL_SCAN_IS_DECODING_GALLERY AST#ERROR#Right , AST#parameter#Left false AST#parameter#Right ) AST#parameter_list#Right ; AST#meth...
GlobalThisUtil.setProperty(CommonConstants.GLOBAL_SCAN_IS_DECODING_GALLERY, false);
https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/pages/customScan/pages/ScanPage.ets#L125-L125
cc7f6c0fb94c22fe0913660606d2b3a75b034679
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/notify/NotificationHelper.ets
arkts
showUpgradeSuccess
弹安装成功通知 @param context 实上下文
async showUpgradeSuccess(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_success_message')....
AST#method_declaration#Left async showUpgradeSuccess AST#parameter_list#Left ( AST#parameter#Left versionName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qua...
async showUpgradeSuccess(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_success_message')....
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/notify/NotificationHelper.ets#L179-L197
e4eed96c5ff6b85d6c5e3a328d03a0ca05b7b8d5
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/entry/src/main/ets/model/HmsTime.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class HmsTime { hour: number minute: number second: number constructor
AST#export_declaration#Left export AST#ERROR#Left default class HmsTime { hour AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Left m in ute AST#ERROR#Right : number second : number AST#ERROR#Right AST#variable_declaration...
export default class HmsTime { hour: number minute: number second: number constructor
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/entry/src/main/ets/model/HmsTime.ets#L16-L21
2a42278b7fb925f56ac2ab8c29f8ff54035fff1b
gitee
softfatgay/harmony-netease.git
5f3d226b72ba8579cacfbd229e4eb0054d63abef
entry/src/main/ets/base/Api.ets
arkts
/热销榜名单
export const SUBMIT_ORDER_INFO = baseUrl + '/xhr/item/getSubmitOrderInfo.json';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SUBMIT_ORDER_INFO = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/item/getSubmitOrderInfo.json' AST#expression#Right AST#binary_expression#Rig...
export const SUBMIT_ORDER_INFO = baseUrl + '/xhr/item/getSubmitOrderInfo.json';
https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L28-L28
2aa607301b25475da583553826a3d7b1f4925301
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/default/app.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
export default { onCreate() { console.info('Application onCreate') }, onDestroy() { console.info('Application onDestroy') }, }
AST#export_declaration#Left export default AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onCreate AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Le...
export default { onCreate() { console.info('Application onCreate') }, onDestroy() { console.info('Application onDestroy') }, }
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/app.ets#L15-L22
07a45a3c1cfd6a3eecea77fde68ab89bfc08cab8
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/OtaPage.ets
arkts
getNewVersionPageInfo
取新版本数据 @param versionComponents 升级包 @param componentDescriptions 更新日志 @return Promise<VersionPageInfo> 具体的新版本数据
public async getNewVersionPageInfo(versionComponents: Array<update.VersionComponent>, componentDescriptions?: Array<update.ComponentDescription>): Promise<VersionPageInfo> { let component: update.VersionComponent = versionComponents.filter((component: update.VersionComponent) => { return component.compone...
AST#method_declaration#Left public async getNewVersionPageInfo AST#parameter_list#Left ( AST#parameter#Left versionComponents : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left update . VersionComp...
public async getNewVersionPageInfo(versionComponents: Array<update.VersionComponent>, componentDescriptions?: Array<update.ComponentDescription>): Promise<VersionPageInfo> { let component: update.VersionComponent = versionComponents.filter((component: update.VersionComponent) => { return component.compone...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/OtaPage.ets#L36-L67
95e66267cb2ede7db647726d537a4998eb64494c
gitee
MUYS/imagePreview
96212a51e8c5d6c37b9b9fb94e7d6d76047cdeb0
library/src/main/ets/image_preview/ImagePreviewViewModel.ets
arkts
日期:2025/6/7
export class ImagePreviewViewModel { private readonly state: ImagePreviewState constructor
AST#export_declaration#Left export AST#ERROR#Left class ImagePreviewViewModel { private readonly state : ImagePreviewState 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 ImagePreviewViewModel { private readonly state: ImagePreviewState constructor
https://github.com/MUYS/imagePreview/blob/96212a51e8c5d6c37b9b9fb94e7d6d76047cdeb0/library/src/main/ets/image_preview/ImagePreviewViewModel.ets#L8-L11
eadaf91745883e3539fb6b308b7f5c7107fb2211
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets
arkts
notifyDataAdd
通知控制器数据增加 @param index 数组索引
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L53-L57
ca959ee2d2ee381386490d708b35221444d738e3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
parseDate
解析日期字符串 @param dateString 日期字符串 @returns Date对象,如果解析失败返回null
static parseDate(dateString: string): Date | null { if (!dateString || dateString.trim() === '') { return null; } const date = new Date(dateString); if (isNaN(date.getTime())) { return null; } return date; }
AST#method_declaration#Left static parseDate AST#parameter_list#Left ( AST#parameter#Left dateString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Lef...
static parseDate(dateString: string): Date | null { if (!dateString || dateString.trim() === '') { return null; } const date = new Date(dateString); if (isNaN(date.getTime())) { return null; } return date; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L80-L91
25934e47a1a7f9c3f9e823886fb72e1bcbfd0742
github
Nuist666/Alzheimer.git
c171b8e739357bfc5a3fc71c90aaea6ce5d463d1
entry/src/main/ets/view/VideoPlayer.ets
arkts
VideoPlayer
video controller component
@Component export struct VideoPlayer { private source: string | Resource = ''; private controller: VideoController = new VideoController(); private previewUris: Resource = $r('app.media.preview'); @Provide currentTime: number = 0; @Provide durationTime: number = 0; @Provide durationStringTime: string = STAR...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoPlayer AST#component_body#Left { AST#property_declaration#Left private source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AS...
@Component export struct VideoPlayer { private source: string | Resource = ''; private controller: VideoController = new VideoController(); private previewUris: Resource = $r('app.media.preview'); @Provide currentTime: number = 0; @Provide durationTime: number = 0; @Provide durationStringTime: string = STAR...
https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/view/VideoPlayer.ets#L21-L91
60ea4698fe12197dc3863f65d4af92e106375acc
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyGenerationImport/KeyImport/DevelopmentGuidelines/ImportKeyPlainText/entry/src/main/ets/pages/RSA2048.ets
arkts
importRSA2048
3.明文导入密钥
function importRSA2048() { try { huks.importKeyItem(keyAlias, options, (error, data) => { if (error) { console.error(`callback: importKeyItem failed` + error); } else { console.info(`callback: importKeyItem success`); } }); } catch (error) { console.error(`callback: imp...
AST#function_declaration#Left function importRSA2048 AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left ...
function importRSA2048() { try { huks.importKeyItem(keyAlias, options, (error, data) => { if (error) { console.error(`callback: importKeyItem failed` + error); } else { console.info(`callback: importKeyItem success`); } }); } catch (error) { console.error(`callback: imp...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyGenerationImport/KeyImport/DevelopmentGuidelines/ImportKeyPlainText/entry/src/main/ets/pages/RSA2048.ets#L95-L108
f78ea0498f56bc701c679cf8fe6bdf28080a2135
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NumberUtil.ets
arkts
isNaN
检查值是否为NaN @param value @returns
static isNaN(value: Any): boolean { return Number.isNaN(value); }
AST#method_declaration#Left static isNaN AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right...
static isNaN(value: Any): boolean { return Number.isNaN(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L35-L37
7ed23459679ea014fe3598f2028afc99d04dbb87
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/SearchHistoryRepository.ets
arkts
@file 搜索历史本地仓库,封装数据库数据源并提供业务方法。 @author Joker.X
export class SearchHistoryRepository { /** * 本地数据源实例 */ private dataSource: SearchHistoryLocalDataSource; /** * 构造函数 * @param {SearchHistoryLocalDataSource} dataSource 可选的数据源实例 */ constructor(dataSource: SearchHistoryLocalDataSource = new SearchHistoryLocalDataSourceImpl()) { this.dataSource...
AST#export_declaration#Left export AST#class_declaration#Left class SearchHistoryRepository AST#class_body#Left { /** * 本地数据源实例 */ AST#property_declaration#Left private dataSource : AST#type_annotation#Left AST#primary_type#Left SearchHistoryLocalDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#p...
export class SearchHistoryRepository { private dataSource: SearchHistoryLocalDataSource; constructor(dataSource: SearchHistoryLocalDataSource = new SearchHistoryLocalDataSourceImpl()) { this.dataSource = dataSource; } async addSearchHistory(keyword: string): Promise<void> { const trimmed: str...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/SearchHistoryRepository.ets#L8-L91
553c176b36ca16ae1d664c501f345ca289338661
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/model/homeModel.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 TabTitleModel { public id: number public uri: string public selectedUri: string public title: string constructor
AST#export_declaration#Left export AST#ERROR#Left class TabTitleModel { AST#property_declaration#Left public id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left public uri : AST#type_annotation#Left AST...
export class TabTitleModel { public id: number public uri: string public selectedUri: string public title: 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/homeModel.ets#L16-L21
82a321cfa2d141e1a5365cbf9ccf8ec39408b42a
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template2/PageTwo.ets
arkts
PageTwoBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function PageTwoBuilder(name: string, param: Object) { PageTwo() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function PageTwoBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ...
@Builder export function PageTwoBuilder(name: string, param: Object) { PageTwo() }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template2/PageTwo.ets#L15-L18
d5bdb94587c2cfee1ec94d0afd8e86f9fddcedef
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/widget/utils/CaseCardUtils.ets
arkts
卡片展示最大案例数
export class CaseCardUtils { // 案例字符串格式化 public static formatData(data: string) { let result: CASES[] = []; if (data.indexOf('**下面是详细的案例列表:**') > -1) { let casesArray: string[] = data.split('**下面是详细的案例列表:**')[1].split('####'); for (let i = 1; i <= CASES_MAX_LENGTH; i++) { const cases: CA...
AST#export_declaration#Left export AST#class_declaration#Left class CaseCardUtils AST#class_body#Left { // 案例字符串格式化 AST#method_declaration#Left public static formatData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Ri...
export class CaseCardUtils { public static formatData(data: string) { let result: CASES[] = []; if (data.indexOf('**下面是详细的案例列表:**') > -1) { let casesArray: string[] = data.split('**下面是详细的案例列表:**')[1].split('####'); for (let i = 1; i <= CASES_MAX_LENGTH; i++) { const cases: CASES = { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/widget/utils/CaseCardUtils.ets#L26-L54
b7649ba6adf9839efe4d5ca1271fad39c07fc8d5
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ComposeListItem.d.ets
arkts
Declare type OperateButton @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare type OperateButton @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare type OperateButton @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export declare class OperateButton { /** * The text on the button. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The text on the button. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class OperateButton AST#class_body#Left { /** * The text on the button. * @type { ?ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The text on the button. * @type { ?...
export declare class OperateButton { text?: ResourceStr; accessibilityText?: ResourceStr; accessibilityDescription?: ResourceStr; accessibilityLevel?: string; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L484-L566
61a1d587e3bb6979c66ffe6c2397b906530a24ad
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
roundOutRect
Round out rect. @param rect
static roundOutRect(rect: RectF): void { rect.set(Math.round(rect.left), Math.round(rect.top), Math.round(rect.right), Math.round(rect.bottom)); }
AST#method_declaration#Left static roundOutRect AST#parameter_list#Left ( AST#parameter#Left rect : AST#type_annotation#Left AST#primary_type#Left RectF 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#...
static roundOutRect(rect: RectF): void { rect.set(Math.round(rect.left), Math.round(rect.top), Math.round(rect.right), Math.round(rect.bottom)); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L27-L29
572feb8ec80e2b4cebbcb49bd1d86e9b5d5787c2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
arkts
reload
重新加载数据
public reload(): void { this.dataArray.splice(1, 1); this.dataArray.splice(3, 2); this.notifyDataReload(); }
AST#method_declaration#Left public reload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
public reload(): void { this.dataArray.splice(1, 1); this.dataArray.splice(3, 2); this.notifyDataReload(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L137-L141
5120beaacd832bfd3559313ee16a5b1a3468ff43
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarSolarMappingService.ets
arkts
getLunarMonthName
获取农历月份名称
private getLunarMonthName(month: number, isLeapMonth: boolean): string { const monthNames = ['', '正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']; const name = monthNames[month] || month.toString(); return isLeapMonth ? `闰${name}` : name; }
AST#method_declaration#Left private getLunarMonthName AST#parameter_list#Left ( AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : AST#type_annotation#Left AST#primary_type#Left boolean ...
private getLunarMonthName(month: number, isLeapMonth: boolean): string { const monthNames = ['', '正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']; const name = monthNames[month] || month.toString(); return isLeapMonth ? `闰${name}` : name; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L292-L297
0644cc01050e993c3436c769a3f8b78ba86217a2
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
UseSendable/entry/src/main/ets/pages/ConcurrencyCapabilitySelection1.ets
arkts
ConcurrencyCapabilitySelection1
[End taskpool]
@Component export struct ConcurrencyCapabilitySelection1 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.time_consuming_task_title')) .buttonStyles() .margin({ bottom: 16 })...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ConcurrencyCapabilitySelection1 AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right buttonStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_functi...
@Component export struct ConcurrencyCapabilitySelection1 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.time_consuming_task_title')) .buttonStyles() .margin({ bottom: 16 })...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrencyCapabilitySelection1.ets#L45-L76
1906e48ada51c8a2f4e33a0fecb4f520dae6c4f7
gitee
lentozi/DailyPlan.git
96ce0bec8f545511c51b577c4aa8327c2c5bb0c8
entry/src/main/ets/databaseability/DatabaseAbility.ets
arkts
insertData
添加数据
insertData(data: relationalStore.ValuesBucket, callback: Function = () => {}) { if (!callback || typeof callback === 'undefined' || callback === undefined) { hilog.info(0x0000, '[Debug.Rdb]', 'insertData() has no callback!'); return; } let resFlag: boolean = false; const valueBucket: relatio...
AST#method_declaration#Left insertData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : A...
insertData(data: relationalStore.ValuesBucket, callback: Function = () => {}) { if (!callback || typeof callback === 'undefined' || callback === undefined) { hilog.info(0x0000, '[Debug.Rdb]', 'insertData() has no callback!'); return; } let resFlag: boolean = false; const valueBucket: relatio...
https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/DatabaseAbility.ets#L51-L72
3c36f06e393ebd1622cc8dc86cd3f4b9fa926b85
github