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
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/model/DeviceModel.ets
arkts
updateDevice
更新设备
static async updateDevice(device: DeviceItem): Promise<DeviceItem> { device.status = DeviceService.determineStatus(device.value, device.threshold); // 调用 PUT 接口更新数据 return await Request.put<DeviceItem>(`${CommonConstants.DEVICE_URL}/${device.id}`, device); }
AST#method_declaration#Left static async updateDevice AST#parameter_list#Left ( AST#parameter#Left device : AST#type_annotation#Left AST#primary_type#Left DeviceItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
static async updateDevice(device: DeviceItem): Promise<DeviceItem> { device.status = DeviceService.determineStatus(device.value, device.threshold); return await Request.put<DeviceItem>(`${CommonConstants.DEVICE_URL}/${device.id}`, device); }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/model/DeviceModel.ets#L45-L50
f790c9823c0976aacccd6c7d66476640a3886568
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets
arkts
resourceToString
用于获取资源字符串
function resourceToString(resource: Resource): string { let result: string = ''; try { result = getContext().resourceManager.getStringSync(resource); } catch (error) { const err: BusinessError = error as BusinessError; Logger.error(`catch error. Code is ${err?.code}, message is ${err?.message}`); } ...
AST#function_declaration#Left function resourceToString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string ...
function resourceToString(resource: Resource): string { let result: string = ''; try { result = getContext().resourceManager.getStringSync(resource); } catch (error) { const err: BusinessError = error as BusinessError; Logger.error(`catch error. Code is ${err?.code}, message is ${err?.message}`); } ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L25-L38
be7b2a0d010da213fb547e0c2db4186776614dbd
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets
arkts
getFriendMomentByTaskPool
task任务池
async function getFriendMomentByTaskPool(jsonUrl: string): Promise<void> { // 初始化Task对象,传入待执行的方法和参数 let task: taskpool.Task = new taskpool.Task(getWebData, jsonUrl); // 向任务池中添加新对象 let friendMomentArray: Array<FriendMoment> = await taskpool.execute(task, taskpool.Priority.MEDIUM) as Array<FriendMoment>; let mo...
AST#function_declaration#Left async function getFriendMomentByTaskPool AST#parameter_list#Left ( AST#parameter#Left jsonUrl : 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#...
async function getFriendMomentByTaskPool(jsonUrl: string): Promise<void> { let task: taskpool.Task = new taskpool.Task(getWebData, jsonUrl); let friendMomentArray: Array<FriendMoment> = await taskpool.execute(task, taskpool.Priority.MEDIUM) as Array<FriendMoment>; let momentData: FriendMomentsData | undefin...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets#L324-L337
40d1628e053586435fab3fe66aa395e0992ea108
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
onEvent
事件回调,由SDK自动调用 @param deviceEvents 设备事件
public onEvent(deviceEvents: DeviceEvents): void { }
AST#method_declaration#Left public onEvent AST#parameter_list#Left ( AST#parameter#Left deviceEvents : AST#type_annotation#Left AST#primary_type#Left DeviceEvents 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#pri...
public onEvent(deviceEvents: DeviceEvents): void { }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L198-L200
ab19a652dbaed3f159d7a83dcc3d49029eb089a5
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/view/IndexSwiper.ets
arkts
SwiperVideo
Picture carousel component
@Component export struct SwiperVideo { build() { Column() { Swiper() { ForEach(SWIPER_VIDEOS, (item: SwiperVideoItem) => { SwiperItem({ imageSrc: item.image, source: $rawfile('videoTest.mp4') }) }, (item: SwiperVideoItem) => JSON.stringify(item)) } .autoPlay(true) }...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SwiperVideo AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left...
@Component export struct SwiperVideo { build() { Column() { Swiper() { ForEach(SWIPER_VIDEOS, (item: SwiperVideoItem) => { SwiperItem({ imageSrc: item.image, source: $rawfile('videoTest.mp4') }) }, (item: SwiperVideoItem) => JSON.stringify(item)) } .autoPlay(true) }...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/view/IndexSwiper.ets#L24-L44
6991087a12fe231f191d9ccb9afd1f90ea7faaba
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/keyAgree/ECDHSync.ets
arkts
@Author csx @DateTime 2024/3/20 20:21 @TODO ECDHSync 动态协商共享密钥-同步 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class ECDHSync { /** * ecdh动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @...
AST#export_declaration#Left export AST#class_declaration#Left class ECDHSync AST#class_body#Left { /** * ecdh动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择u...
export class ECDHSync { static ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'ECC256', 256, keyCoding, resultCoding); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/keyAgree/ECDHSync.ets#L26-L39
3a4276d5951ae15a88edd7dd44a2576d3a73095f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/ai/AIAssistantService.ets
arkts
AI意图识别结果接口
export interface IntentResult { intent: string; confidence: number; entities: Record<string, any>; sentiment: SentimentAnalysis; suggestedActions: SuggestedAction[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IntentResult AST#object_type#Left { AST#type_member#Left intent : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left confidence : AST#type_annotati...
export interface IntentResult { intent: string; confidence: number; entities: Record<string, any>; sentiment: SentimentAnalysis; suggestedActions: SuggestedAction[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/ai/AIAssistantService.ets#L172-L178
c3b4d38e1027641292d0a92a6a51b300bc9f31c9
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/model/EventModel.ets
arkts
日程事件数据模型
export class EventModel { id: string = '' title: string = '' date: string = '' // 格式: YYYY-MM-DD startTime: string = '' // 格式: HH:mm endTime: string = '' // 格式: HH:mm description: string = '' location: string = '' reminder: boolean = false reminderMinutes: number = 15 // 提前提醒时间(分钟) reminderId: numbe...
AST#export_declaration#Left export AST#ERROR#Left class EventModel { id AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right title : string = '' date : AST#type_annotation#Left AST#primary_type#Left string A...
export class EventModel { id: string = '' title: string = '' date: string = '' startTime: string = '' endTime: string = '' description: string = '' location: string = '' reminder: boolean = false reminderMinutes: number = 15 reminderId: number = -1 reminded: boolean = false color: string...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/model/EventModel.ets#L2-L18
5fc0361196aaa4e2174fc9e9e1a9fdaf2913bb9e
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderDetailPage.ets
arkts
getRefundStatusText
获取退款状态文案 @returns {ResourceStr} 退款状态文案
private getRefundStatusText(order: Order): ResourceStr { switch (order.refundStatus) { case 0: return $r("app.string.refund_status_applying"); case 1: return $r("app.string.refund_status_refunded"); case 2: return $r("app.string.refund_status_rejected"); default: ...
AST#method_declaration#Left private getRefundStatusText AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr A...
private getRefundStatusText(order: Order): ResourceStr { switch (order.refundStatus) { case 0: return $r("app.string.refund_status_applying"); case 1: return $r("app.string.refund_status_refunded"); case 2: return $r("app.string.refund_status_rejected"); default: ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L464-L475
59a601fd54df7332a7265f519faebb29f2218dfa
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
fetchCookie
以Promise方式异步获取指定url对应cookie的值。 @param url 要获取的cookie所属的url,建议使用完整的url。 @returns
static async fetchCookie(url: string): Promise<string> { return await webview.WebCookieManager.fetchCookie(url); }
AST#method_declaration#Left static async fetchCookie AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
static async fetchCookie(url: string): Promise<string> { return await webview.WebCookieManager.fetchCookie(url); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L106-L108
cec88e0df1061041a012171dbe8169c4dee00bf2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
deleteRdbStore
删除rdbStore
deleteRdbStore(): void { if (store === undefined) { return; } relationalStore.deleteRdbStore(CONTEXT, Constants.DB_FILE_NAME, (err) => { if (err) { logger.error('delete rdbStore failed'); } store = undefined; }); }
AST#method_declaration#Left deleteRdbStore AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left A...
deleteRdbStore(): void { if (store === undefined) { return; } relationalStore.deleteRdbStore(CONTEXT, Constants.DB_FILE_NAME, (err) => { if (err) { logger.error('delete rdbStore failed'); } store = undefined; }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L56-L66
fc45929186ef92e8a1319de79b43588dc7af189a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/model/DragToSwitchPicturesModule.ets
arkts
瀑布流列表信息
export class WaterFlowModule { // 列表图片 imageSrc: ResourceStr; // 列表介绍 name: string; // 面积 area: string; constructor(imageSrc: ResourceStr, name: string, area: string) { this.imageSrc = imageSrc; this.name = name; this.area = area; } }
AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowModule AST#class_body#Left { // 列表图片 AST#property_declaration#Left imageSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 列表介绍 AST#property_dec...
export class WaterFlowModule { imageSrc: ResourceStr; name: string; area: string; constructor(imageSrc: ResourceStr, name: string, area: string) { this.imageSrc = imageSrc; this.name = name; this.area = area; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/model/DragToSwitchPicturesModule.ets#L45-L58
229ab6fdf76f4780e3d2e0b9ba9a62194cc4fb8b
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
notEqual
判断两个传入的数值或者是字符串是否不相等 @param source @param target @returns
static notEqual(source: string | number, target: string | number): boolean { return false == StringUtils.equal(source, target); }
AST#method_declaration#Left static notEqual AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AS...
static notEqual(source: string | number, target: string | number): boolean { return false == StringUtils.equal(source, target); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L194-L196
c2243e6b5a0149bb7e15ff31188a43918f24e44f
gitee
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/datasource/BasicDataSource.ets
arkts
notifyDataDelete
通知数据删除
notifyDataDelete(index: number) { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
AST#method_declaration#Left notifyDataDelete 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#builder_function_body#Left { AST#expression_statement#Left AST#expre...
notifyDataDelete(index: number) { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L71-L75
5b6b4b378ed000ec2a8bf99dd162cec42e4ca11f
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets
arkts
isValidPhoneNumber
校验是否为合法手机号
isValidPhoneNumber(phoneNumber: string): boolean { // 定义手机号的正则表达式 const phoneRegex = /^1[3456789]\d{9}$/; // 使用正则表达式进行校验 return phoneRegex.test(phoneNumber); }
AST#method_declaration#Left isValidPhoneNumber AST#parameter_list#Left ( AST#parameter#Left phoneNumber : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#pri...
isValidPhoneNumber(phoneNumber: string): boolean { const phoneRegex = /^1[3456789]\d{9}$/; return phoneRegex.test(phoneNumber); }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets#L36-L42
44fbd8fa8375c6baa8b4afb089d107c67a2bb80e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Progress change event when the page loading progress changes. @typedef OnProgressChangeEvent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare interface OnProgressChangeEvent { /** * The new progress of the page. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ newProgress: number; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnProgressChangeEvent AST#object_type#Left { /** * The new progress of the page. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#ty...
export declare interface OnProgressChangeEvent { newProgress: number; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L324-L334
6950420cab02302daf2daf1769a6d99544246d37
gitee
ChangweiZhang/chardet-arkts.git
3a214882ec6a2753c0fed84162952aa659341c19
src/main/ets/components/encoding/sbcs.ets
arkts
search
Binary search for value in table, which must have exactly 64 entries.
search(table: number[], value: number) { let index = 0; if (table[index + 32] <= value) index += 32; if (table[index + 16] <= value) index += 16; if (table[index + 8] <= value) index += 8; if (table[index + 4] <= value) index += 4; if (table[index + 2] <= value) index += 2; if (table[index ...
AST#method_declaration#Left search AST#parameter_list#Left ( AST#parameter#Left table : 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 value : AST#type_annotation#Left AST#primar...
search(table: number[], value: number) { let index = 0; if (table[index + 32] <= value) index += 32; if (table[index + 16] <= value) index += 16; if (table[index + 8] <= value) index += 8; if (table[index + 4] <= value) index += 4; if (table[index + 2] <= value) index += 2; if (table[index ...
https://github.com/ChangweiZhang/chardet-arkts.git/blob/3a214882ec6a2753c0fed84162952aa659341c19/src/main/ets/components/encoding/sbcs.ets#L31-L45
2bd9f567278e2d30f223e7939014cdd2f70a3ae9
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Page end event at the end of web page loading. @typedef OnPageEndEvent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare interface OnPageEndEvent { /** * The url of page. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ url: string; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnPageEndEvent AST#object_type#Left { /** * The url of page. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#type_mem...
export declare interface OnPageEndEvent { url: string; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L263-L273
2b59068c5df4fbe581d94fca416259c938fe0cfb
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FormatUtil.ets
arkts
getFormatFileSize
格式化文件大小 @param bytes 文件大小(字节) @param decimals 保留的小数位数,默认为 2 @returns 格式化后的文件大小字符串
static getFormatFileSize(bytes: number, decimals: number = 2): string { return FileUtil.getFormatFileSize(bytes, decimals); }
AST#method_declaration#Left static getFormatFileSize AST#parameter_list#Left ( AST#parameter#Left bytes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left decimals : AST#type_annotation#Left AST#primary_type#Left number AST#p...
static getFormatFileSize(bytes: number, decimals: number = 2): string { return FileUtil.getFormatFileSize(bytes, decimals); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L123-L125
2d161c550131796c422a66159d79474f86bfcae0
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/components/basicUI/KeyMenu.ets
arkts
KeyMenu
key键盘
@Component export struct KeyMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; @Provide keyState: number = KeyState.LOWER_CASE; @State public keyList: keySourceListType[] = keySourceListData; private spaceWidth: Resource = this.inputSty...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct KeyMenu AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Left AST#...
@Component export struct KeyMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; @Provide keyState: number = KeyState.LOWER_CASE; @State public keyList: keySourceListType[] = keySourceListData; private spaceWidth: Resource = this.inputSty...
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/components/basicUI/KeyMenu.ets#L34-L126
4031716c952dc8b87ff450607503c2e7a3262ffc
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets
arkts
线条宽度
build() { Column() { TitleBar({ title: $r('app.string.System_icon') }) Stack() { // 亮度条件组件 Stack() { Slider({ value: this.sliderValue, style: SliderStyle.InSet, direction: Axis.Vertical, reverse: true }) .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 TitleBar ( AST#component_parameters#Left { AST#componen...
build() { Column() { TitleBar({ title: $r('app.string.System_icon') }) Stack() { Stack() { Slider({ value: this.sliderValue, style: SliderStyle.InSet, direction: Axis.Vertical, reverse: true }) .id('systemIc...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets#L33-L99
eb91373239d557bcad862674ff40766202e546ef
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/WantUtil.ets
arkts
toNotificationSetting
跳转通知设置页面
static toNotificationSetting(): Promise<void> { return WantUtil.toSetting(WantUtil.URI_NOTIFICATION); }
AST#method_declaration#Left static toNotificationSetting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS...
static toNotificationSetting(): Promise<void> { return WantUtil.toSetting(WantUtil.URI_NOTIFICATION); }
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/WantUtil.ets#L119-L121
b4a27eb16aad860e2fba018e9a2eb27d59444cca
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
状态--搜包成功 @since 2022-06-10
export class CheckSuccess extends BaseState { constructor() { super(); this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); this.actionSet.push(UpdateAction.CHECK_NEW_VERSION); this.actionSet.push(UpdateAction.DOWNLOAD); this.state = UpdateState.CHECK_SUCCESS; this.buttonClickAction = UpdateAct...
AST#export_declaration#Left export AST#class_declaration#Left class CheckSuccess extends AST#type_annotation#Left AST#primary_type#Left BaseState AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#b...
export class CheckSuccess extends BaseState { constructor() { super(); this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); this.actionSet.push(UpdateAction.CHECK_NEW_VERSION); this.actionSet.push(UpdateAction.DOWNLOAD); this.state = UpdateState.CHECK_SUCCESS; this.buttonClickAction = UpdateAct...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L276-L300
86f55240dd39fce353328160e40716f25f7c20f8
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/Base64Utils.ets
arkts
encodeToStr
编码,通过输入参数编码后输出对应文本。 @param array @returns
static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> { let base64 = new util.Base64Helper(); return base64.encodeToString(array, options); }
AST#method_declaration#Left static encodeToStr AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified...
static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> { let base64 = new util.Base64Helper(); return base64.encodeToString(array, options); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/Base64Utils.ets#L62-L65
2d809816567a06dd324d0d6470c38fe08b4542fc
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/viewmodel/ParamItem.ets
arkts
ParamItem
Navigator params class.
@Observed export class ParamItem { source: Resource = $r('app.string.empty'); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ParamItem AST#class_body#Left { AST#property_declaration#Left source : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expressi...
@Observed export class ParamItem { source: Resource = $r('app.string.empty'); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/viewmodel/ParamItem.ets#L19-L22
874b57076abdc6ade9ceaa85bc9413da3cd16ed8
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/DiskStorage.ets
arkts
tryGetGlobalContext
尝试从全局获取上下文
private static tryGetGlobalContext(): common.Context | undefined { try { // 方法1: UIAbility 标准方式 if (globalThis.abilityContext) { console.log("DiskStorage: Got context from abilityContext"); return globalThis.abilityContext; } // 方法...
AST#method_declaration#Left private static tryGetGlobalContext AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#primary_type#Left undefined AST#primary_...
private static tryGetGlobalContext(): common.Context | undefined { try { if (globalThis.abilityContext) { console.log("DiskStorage: Got context from abilityContext"); return globalThis.abilityContext; } if (globalThis...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/DiskStorage.ets#L30-L67
91e23d305c5d6d3c86e6cfea8ebcf7e8f7fc830b
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/EmojiTool.ets
arkts
codePointToUtf16
官方 https://unicode.org/emoji/charts/emoji-list.html#face-neutral-skeptical codePointToUtf16("1F600") 输出 ”\uxxx\uxxx“ 在EMOJI_MAP增加。
static codePointToUtf16(codePoint: string): string { // 转换为十六进制数字 const u = parseInt(codePoint, 16); // 检查是否为基本平面字符(无需代理对) if (u <= 0xFFFF) { return `\\u${u.toString(16).padStart(4, '0').toUpperCase()}`; } // 应用转换公式 const o = u - 0x10000; const h = 0xD800 + (o >> 10); const l...
AST#method_declaration#Left static codePointToUtf16 AST#parameter_list#Left ( AST#parameter#Left codePoint : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#p...
static codePointToUtf16(codePoint: string): string { const u = parseInt(codePoint, 16); if (u <= 0xFFFF) { return `\\u${u.toString(16).padStart(4, '0').toUpperCase()}`; } const o = u - 0x10000; const h = 0xD800 + (o >> 10); const l = 0xDC00 + (o & 0x3FF); return ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/EmojiTool.ets#L111-L127
ca5de9ebf6ce56e883754d6f3cc7131537dc171f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets
arkts
getDefaultNetwork
[End get_all_registered_networks] 根据数据网络查询网络的能力信息及连接信息
getDefaultNetwork() { // 调用getDefaultNet方法,获取默认的数据网络(NetHandle) connection.getDefaultNet().then((data: connection.NetHandle) => { if (data.netId == 0) { // 当前无默认网络时,获取的netHandler的netid为0,属于异常情况,需要额外处理 return; } if (data) { this.defaultNetworkStatus = 'Retrieved successf...
AST#method_declaration#Left getDefaultNetwork AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 调用getDefaultNet方法,获取默认的数据网络(NetHandle) AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#...
getDefaultNetwork() { connection.getDefaultNet().then((data: connection.NetHandle) => { if (data.netId == 0) { return; } if (data) { this.defaultNetworkStatus = 'Retrieved successfully' Logger.info('getDefaultNet get data: ' + JSON.stringify(data)); Gl...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets#L362-L417
637f60c3e320aa0789509bd04a1ef71dedc60b16
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsItem.ets
arkts
NewsItem
The news list item component.
@Component export default struct NewsItem { private newsData: NewsData = new NewsData(); build() { Column() { Row() { Image($r('app.media.news')) .width(Const.NewsTitle_IMAGE_WIDTH) .height($r('app.float.news_title_image_height')) .objectFit(ImageFit.Fill) Te...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct NewsItem AST#component_body#Left { AST#property_declaration#Left private newsData : AST#type_annotation#Left AST#primary_type#Left NewsData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Lef...
@Component export default struct NewsItem { private newsData: NewsData = new NewsData(); build() { Column() { Row() { Image($r('app.media.news')) .width(Const.NewsTitle_IMAGE_WIDTH) .height($r('app.float.news_title_image_height')) .objectFit(ImageFit.Fill) Te...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/NewsItem.ets#L22-L86
a1c8f07948402c5d7a9d668453fe07afe0170ca5
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/Index.d.ets
arkts
LicensePlateView
@keepTs @ts-nocheck
export { LicensePlateView } from './src/main/ets/components/LicensePlateView';
AST#export_declaration#Left export { LicensePlateView } from './src/main/ets/components/LicensePlateView' ; AST#export_declaration#Right
export { LicensePlateView } from './src/main/ets/components/LicensePlateView';
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/Index.d.ets#L3-L3
582567ddf5ca31ae8494f0929d9ac711c70365c2
github
from-north-to-north/OpenHarmony_p7885
f6ea526c039db535a7c958fa154ccfcb3668b37c
hap/easy_demo/window_demo/window_demo0/entry/src/main/ets/pages/Index.ets
arkts
SetWindowBackgroundColor
通过window来获取当前窗口的示例,再通过setWindowBackgroundColor方法来设置窗口的背景色。
async SetWindowBackgroundColor() { let windowClass = await window.getLastWindow(this.context) let color: string = '#00ff33'; windowClass.setWindowBackgroundColor(color); }
AST#method_declaration#Left async SetWindowBackgroundColor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left windowClass = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expressio...
async SetWindowBackgroundColor() { let windowClass = await window.getLastWindow(this.context) let color: string = '#00ff33'; windowClass.setWindowBackgroundColor(color); }
https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/window_demo/window_demo0/entry/src/main/ets/pages/Index.ets#L111-L115
c606f98debedbec8be837cddc91485a0c2071ec0
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/model/ImageEditModel.ets
arkts
裁剪数据接口
export class CropData { /** * 裁剪状态恢复矩阵 */ cropMatrix: matrix4.Matrix4Transit /** * 裁剪框区域 */ initCropRect: EditRect /** * 变换步骤集合 */ steps: MatrixRecord[] constructor
AST#export_declaration#Left export AST#ERROR#Left class CropData { /** * 裁剪状态恢复矩阵 */ cropMatrix AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left matrix4 . Matrix4Transit AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right /** * 裁剪框区域 ...
export class CropData { cropMatrix: matrix4.Matrix4Transit initCropRect: EditRect steps: MatrixRecord[] constructor
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/model/ImageEditModel.ets#L70-L84
7afd55b1ce4870200386022b6a9062f8ca17699e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
getNumerator
Gets the numerator of the current object. @returns { number } Returns the numerator of the current object. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
getNumerator(): number;
AST#method_declaration#Left getNumerator 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#method_declaration#Right
getNumerator(): number;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L992-L992
2a92d5392bb58fc7f0bc1a941a3bef9c98103791
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets
arkts
isConnected
判断是否连接
async isConnected(): Promise<boolean> { if (!this.tlsSocket) { return false; } try { let state = await this.tlsSocket.getState(); if (state.isConnected) { return true; } } catch (e) { Logger.error(`${TAG} tls getState error ${JSON.stringify(e)}}`); } return...
AST#method_declaration#Left async isConnected 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_a...
async isConnected(): Promise<boolean> { if (!this.tlsSocket) { return false; } try { let state = await this.tlsSocket.getState(); if (state.isConnected) { return true; } } catch (e) { Logger.error(`${TAG} tls getState error ${JSON.stringify(e)}}`); } return...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets#L198-L212
9c5821c7db0873faf774b42ab73c12a54d6c03a8
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets
arkts
lineComponent
线条组件
@Builder lineComponent(angle: number) { Row({ space: 20 }) { Text() .animatableWidth(this.lineWidth) .animation({ duration: 500, curve: "ease" }) .height(1) .backgroundColor($r('app.color.COLOR_8C9BA2')) Text() .animatableWidth(this.lineWidth) .animation...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right lineComponent AST#parameter_list#Left ( AST#parameter#Left angle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#...
@Builder lineComponent(angle: number) { Row({ space: 20 }) { Text() .animatableWidth(this.lineWidth) .animation({ duration: 500, curve: "ease" }) .height(1) .backgroundColor($r('app.color.COLOR_8C9BA2')) Text() .animatableWidth(this.lineWidth) .animation...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets#L102-L120
eb69de30cb5d47d41859d640e8402f60a9c8881c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
getLightTheme
获取浅色主题
private getLightTheme(): ColorTheme | null { return this.colorThemes.find(t => !t.isDark) || null; }
AST#method_declaration#Left private getLightTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ColorTheme AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_state...
private getLightTheme(): ColorTheme | null { return this.colorThemes.find(t => !t.isDark) || null; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L804-L806
f17d286abe22363cf344663afdc3315fc5bb5cb5
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/Rect.ets
arkts
isEmpty
Returns true if the rectangle is empty (left >= right or top >= bottom)
public isEmpty(): boolean { return this.left >= this.right || this.top >= this.bottom; }
AST#method_declaration#Left public isEmpty 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#member_expressi...
public isEmpty(): boolean { return this.left >= this.right || this.top >= this.bottom; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L86-L88
9b74019962e181297e28d60ce6c47691900ea8dc
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
getSm4EnryptProperties
SM4 加密密钥属性
function getSm4EnryptProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_SM4 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128, ...
AST#function_declaration#Left function getSm4EnryptProperties AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Rig...
function getSm4EnryptProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_SM4 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128, ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L234-L261
34ef1de7dfeb3b968f50eede92e55749fe7e6bd0
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/util/VersionUtils.ets
arkts
获取新版本名称 @param info 新版本信息 @return 新版本名称
export async function obtainNewVersionName(info: update.NewVersionInfo | update.TaskBody): Promise<string> { let component: update.VersionComponent = sortComponents(info?.versionComponents)?.[0]; return component?.displayVersion ?? ''; }
AST#export_declaration#Left export AST#function_declaration#Left async function obtainNewVersionName AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left update . NewVersionInfo AST#qualified_type#Right AST#primary_type#Right | AS...
export async function obtainNewVersionName(info: update.NewVersionInfo | update.TaskBody): Promise<string> { let component: update.VersionComponent = sortComponents(info?.versionComponents)?.[0]; return component?.displayVersion ?? ''; }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/util/VersionUtils.ets#L54-L57
60fdd64a27239d5c6fc4b66270dc9c0954189182
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
请求超时时间
export const TIMEOUT = 30000;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TIMEOUT = AST#expression#Left 30000 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const TIMEOUT = 30000;
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L99-L99
30b89cad762e36f317f2ba3e810efe0da36d5bde
github
openharmony/base_location
724370a03f6f23ddc07c8eb9f49dfc61ab716bdb
services/location_ui/entry/src/main/ets/pages/BluetoothShare.ets
arkts
closeSheetPage
关闭、退出蓝牙分享页面
private closeSheetPage(session: UIExtensionContentSession, code: number, message?: string) { if (!session) { console.log(TAG, `invalid session`); return; } console.log(TAG, `closeSheetPage start`); let result: common.AbilityResult = { resultCode: code }; if (message) { re...
AST#method_declaration#Left private closeSheetPage AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#primary_type#Left UIExtensionContentSession AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Le...
private closeSheetPage(session: UIExtensionContentSession, code: number, message?: string) { if (!session) { console.log(TAG, `invalid session`); return; } console.log(TAG, `closeSheetPage start`); let result: common.AbilityResult = { resultCode: code }; if (message) { re...
https://github.com/openharmony/base_location/blob/724370a03f6f23ddc07c8eb9f49dfc61ab716bdb/services/location_ui/entry/src/main/ets/pages/BluetoothShare.ets#L112-L137
c8fc112c9e7ea47b720c8854dadce5ce4bf5f645
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/loop_stmt/for_body_002_F.ets
arkts
Introduction 循环结构-body语句
export function for_body_002_F(taint_src : string) { let clean = "" let _t = taint_src; for (let i = 0; i < 2; i++) { clean = "_" } taint.Sink(clean) }
AST#export_declaration#Left export AST#function_declaration#Left function for_body_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left...
export function for_body_002_F(taint_src : string) { let clean = "" let _t = taint_src; for (let i = 0; i < 2; i++) { clean = "_" } taint.Sink(clean) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/for_body_002_F.ets#L6-L13
3732789c1408f0aa857f00d7757a247bbdc718fd
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets
arkts
字体大小
export enum FontSize { MINI = 14, SMALL = 16, MIDDLE = 18, LARGE = 20 } ;
AST#export_declaration#Left export AST#enum_declaration#Left enum FontSize AST#enum_body#Left { AST#enum_member#Left MINI = AST#expression#Left 14 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SMALL = AST#expression#Left 16 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MIDDLE = A...
export enum FontSize { MINI = 14, SMALL = 16, MIDDLE = 18, LARGE = 20 } ;
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets#L33-L39
07d4441950d9985ff9093876655c8e9e665d91ae
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/OneWayTls.ets
arkts
sendMsg2Server
发送消息到服务端
sendMsg2Server() { if (!this.sendMsg.trim()) { return; } workerPort.postMessage({ type: 'sendMessage', message: this.sendMsg }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsOneWayMessage = e.data; if (response.type === 'sendMessageSuccess') { this.msgHis...
AST#method_declaration#Left sendMsg2Server AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi...
sendMsg2Server() { if (!this.sendMsg.trim()) { return; } workerPort.postMessage({ type: 'sendMessage', message: this.sendMsg }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsOneWayMessage = e.data; if (response.type === 'sendMessageSuccess') { this.msgHis...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/OneWayTls.ets#L192-L207
1530233970452a71e7ff379b7d5c522e8372d38f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/PublishMultimediaUpdate/publishmultimediaupdate/src/main/ets/model/mockdata.ets
arkts
模拟评论数据
export function mockData(): CommentData { const commentList: CommentData = new CommentData(); commentList.pushData(new FriendMoment('0', 'Zoologist', $r('app.media.Zoologist'), '好可爱的小鸟啊', $r('app.media.publish_photo_bird'))); commentList.pushData(new FriendMoment('1', 'Scientist', $r('app.media.Scientist'), '...
AST#export_declaration#Left export AST#function_declaration#Left function mockData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CommentData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef...
export function mockData(): CommentData { const commentList: CommentData = new CommentData(); commentList.pushData(new FriendMoment('0', 'Zoologist', $r('app.media.Zoologist'), '好可爱的小鸟啊', $r('app.media.publish_photo_bird'))); commentList.pushData(new FriendMoment('1', 'Scientist', $r('app.media.Scientist'), '...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/PublishMultimediaUpdate/publishmultimediaupdate/src/main/ets/model/mockdata.ets#L20-L35
2a5339a8f859ad00b836362485f7d7389414928d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
enableShortcut
启用快捷方式
async enableShortcut(shortcutId: string): Promise<void> { try { await shortcutManager.enableShortcut(shortcutId); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Shortcut enabled: ${shortcutId}`); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed t...
AST#method_declaration#Left async enableShortcut AST#parameter_list#Left ( AST#parameter#Left shortcutId : 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_ty...
async enableShortcut(shortcutId: string): Promise<void> { try { await shortcutManager.enableShortcut(shortcutId); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Shortcut enabled: ${shortcutId}`); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed t...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L296-L303
c52c2d8893c88e242231859a59c060d6be3d44bc
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/pages/TaskReviewView.ets
arkts
openRemarkDialog
打开缺陷描述编辑对话框
openRemarkDialog(flaw: FlawInfo) { console.log('[TaskReviewView] 📝 打开缺陷描述编辑对话框,ID:', flaw.id); this.selectedFlaw = flaw; this.editingRemark = flaw.flawDesc || ''; // 回显当前的缺陷描述 this.remarkDialogController.open(); console.log('[TaskReviewView] 📝 缺陷描述编辑对话框已打开,当前描述:', this.editingRemark); }
AST#method_declaration#Left openRemarkDialog AST#parameter_list#Left ( AST#parameter#Left flaw : AST#type_annotation#Left AST#primary_type#Left FlawInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expr...
openRemarkDialog(flaw: FlawInfo) { console.log('[TaskReviewView] 📝 打开缺陷描述编辑对话框,ID:', flaw.id); this.selectedFlaw = flaw; this.editingRemark = flaw.flawDesc || ''; this.remarkDialogController.open(); console.log('[TaskReviewView] 📝 缺陷描述编辑对话框已打开,当前描述:', this.editingRemark); }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L276-L283
44e9e7cb02279d8488e95386c3c8d7cd0c62d935
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
验证结果接口
export interface ValidationResult { isValid: boolean; errors: string[]; warnings?: string[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ValidationResult AST#object_type#Left { AST#type_member#Left isValid : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left errors : AST#type_annota...
export interface ValidationResult { isValid: boolean; errors: string[]; warnings?: string[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L139-L143
8af201b9d5dcde8f686a393e42c83ee09457cbd6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/immersive/src/main/ets/view/FullScreenImmersive.ets
arkts
FullScreenImmersive
窗口全屏布局方案示例 1、设置窗口强制全屏布局 2、获取状态栏和导航条的高度手动进行避让
@Component export struct FullScreenImmersive { @State topHeight: number = 0; @State bottomHeight: number = 0; windowClass?: window.Window; aboutToAppear(): void { window.getLastWindow(getContext(), (err, windowClass) => { this.windowClass = windowClass; // 设置窗口强制全屏布局 windowClass.setWindow...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FullScreenImmersive AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right topHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#t...
@Component export struct FullScreenImmersive { @State topHeight: number = 0; @State bottomHeight: number = 0; windowClass?: window.Window; aboutToAppear(): void { window.getLastWindow(getContext(), (err, windowClass) => { this.windowClass = windowClass; windowClass.setWindowLayoutFullScr...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/immersive/src/main/ets/view/FullScreenImmersive.ets#L24-L132
b870ed961ae2b92493b030e755cbad4c5be890b5
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/AVSession/VideoPlayer/entry/src/main/ets/common/CommonUtils.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 default class CommonUtils { public static millSecond2Minutes(time: number) { const min = Math.floor(time / 1000 / 60); const sec = Math.ceil(time / 1000 % 60); return `${CommonUtils.paddingString(min)}:${CommonUtils.paddingString(sec)}`; } static paddingString(value: number) { if (value < ...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonUtils AST#class_body#Left { AST#method_declaration#Left public static millSecond2Minutes AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#...
export default class CommonUtils { public static millSecond2Minutes(time: number) { const min = Math.floor(time / 1000 / 60); const sec = Math.ceil(time / 1000 % 60); return `${CommonUtils.paddingString(min)}:${CommonUtils.paddingString(sec)}`; } static paddingString(value: number) { if (value < ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AVSession/VideoPlayer/entry/src/main/ets/common/CommonUtils.ets#L16-L30
b16f5869b8f03b00907e3c9c3120633de31f3009
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
restartApp
应用重启并拉起自身指定UIAbility。重启时不会收到onDestroy回调。仅支持主线程调用,且待重启的应用需要处于获焦状态。 @param want Want类型参数,传入需要启动的UIAbility的信息,Bundle名称不做校验。
static restartApp(want?: Want) { if (want === undefined) { want = { bundleName: AppUtil.getBundleName(), //设置应用bundleName abilityName: AppUtil.getContext().abilityInfo.name, //设置应用abilityName } } AppUtil.getApplicationContext().restartApp(want); }
AST#method_declaration#Left static restartApp AST#parameter_list#Left ( AST#parameter#Left want ? : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_stat...
static restartApp(want?: Want) { if (want === undefined) { want = { bundleName: AppUtil.getBundleName(), abilityName: AppUtil.getContext().abilityInfo.name, } } AppUtil.getApplicationContext().restartApp(want); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L233-L241
98df2aa6da2088b5244bff1c4a14f2897262d469
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/searchPage.ets
arkts
makeViewData
make data for view @param result Search result @return Data for show to view
makeViewData(result: SearchData[]): SearchData[][] { let list: SearchData[][] = []; let group: SearchData[] = []; let lastUri: string = ''; for (let i = 0; i < result.length; i++) { let data = result[i]; if (data.uri !== lastUri) { if (group) { let g = group; li...
AST#method_declaration#Left makeViewData AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SearchData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left...
makeViewData(result: SearchData[]): SearchData[][] { let list: SearchData[][] = []; let group: SearchData[] = []; let lastUri: string = ''; for (let i = 0; i < result.length; i++) { let data = result[i]; if (data.uri !== lastUri) { if (group) { let g = group; li...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/searchPage.ets#L183-L206
ab18b5612f78be3d249cddd405e62850e979c0fd
gitee
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
setDecorators
添加自定义绘制
setDecorators(decorators: BaseAxisDecorator[]) { // 解绑旧装饰器 if (this.decorators && this.decorators.length > 0) { this.decorators.forEach(oldDecorator => { // 如果新列表中包含这个装饰器,其实也可以不解绑, // 但为了逻辑简单,统一先解绑再重新绑定也不会有性能问题。 unbindDecoratorInvalidate(oldDec...
AST#method_declaration#Left setDecorators AST#parameter_list#Left ( AST#parameter#Left decorators : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left BaseAxisDecorator [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu...
setDecorators(decorators: BaseAxisDecorator[]) { if (this.decorators && this.decorators.length > 0) { this.decorators.forEach(oldDecorator => { unbindDecoratorInvalidate(oldDecorator); }); } this.decorators = dec...
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L411-L431
462b5cb2697b5424a70683dd4213f0b04078ed8b
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ObjectPool.ets
arkts
An object pool for recycling of object instances extending Poolable. Cost/Benefit : Cost - The pool can only contain objects extending Poolable. Benefit - The pool can very quickly determine if an object is elligable for storage without iteration. Benefit - The pool can also know if an instance of Poolable is already...
export abstract class ObjectPool<T extends Poolable> { private static ids = 0; private poolId: number; private desiredCapacity: number; private objects: Object[]; private objectsPointer: number; private modelObject: T; private replenishPercentage: number; /** * Returns the id of the given pool insta...
AST#export_declaration#Left export AST#class_declaration#Left abstract class ObjectPool AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Poolable AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#class_bod...
export abstract class ObjectPool<T extends Poolable> { private static ids = 0; private poolId: number; private desiredCapacity: number; private objects: Object[]; private objectsPointer: number; private modelObject: T; private replenishPercentage: number; public getPoolId(): number { return this...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ObjectPool.ets#L29-L110
3ed6e16884fced117e06a6356d116e9ef3f40d0e
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Paint.ets
arkts
画笔属性类,用于绘制时使用画笔属性 @param value
export default class Paint { public color: Color | number | string | Resource = Color.Black; public textSize: number = 10; public fill: Color | number | string | Resource = null; public stroke: Color | number | string | Resource = null; public strokeWidth: number = 0; public strokeRadius: number = 0; publ...
AST#export_declaration#Left export default AST#class_declaration#Left class Paint AST#class_body#Left { AST#property_declaration#Left public color : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Color AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Le...
export default class Paint { public color: Color | number | string | Resource = Color.Black; public textSize: number = 10; public fill: Color | number | string | Resource = null; public stroke: Color | number | string | Resource = null; public strokeWidth: number = 0; public strokeRadius: number = 0; publ...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Paint.ets#L24-L110
6528c3beebfcdc17722c055ce9b3ed860c87136f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolistautoplay/src/main/ets/model/NewsItemModel.ets
arkts
详情
constructor(newsName: string, newsVideoSrc: string, newsImage: ResourceStr, newsDetails: ResourceStr) { this.newsName = newsName; this.newsVideoSrc = newsVideoSrc; this.newsImage = newsImage; this.newsDetails = newsDetails; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left newsName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newsVideoSrc : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
constructor(newsName: string, newsVideoSrc: string, newsImage: ResourceStr, newsDetails: ResourceStr) { this.newsName = newsName; this.newsVideoSrc = newsVideoSrc; this.newsImage = newsImage; this.newsDetails = newsDetails; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/model/NewsItemModel.ets#L25-L30
ff25cd7504173158fd90052bf389764de666dc3a
gitee
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/types/world.ets
arkts
挖矿事件排序
export enum EnumEventTypeSort { default = 0, normal = 1, middle = 2, advance = 3 }
AST#export_declaration#Left export AST#enum_declaration#Left enum EnumEventTypeSort AST#enum_body#Left { AST#enum_member#Left default = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left normal = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left...
export enum EnumEventTypeSort { default = 0, normal = 1, middle = 2, advance = 3 }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/types/world.ets#L34-L39
17cabb43e65f84cfd7ae673c1465fc4f1058bb1b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets
arkts
getHomeData
获取首页数据 @returns {Promise<NetworkResponse<Home>>} 首页聚合数据
async getHomeData(): Promise<NetworkResponse<Home>> { const resp: AxiosResponse<NetworkResponse<Home>> = await NetworkClient.http.get("page/home"); return resp.data; }
AST#method_declaration#Left async getHomeData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#t...
async getHomeData(): Promise<NetworkResponse<Home>> { const resp: AxiosResponse<NetworkResponse<Home>> = await NetworkClient.http.get("page/home"); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets#L15-L19
ce10123899cef7afce39f6f989f7b7b5f7a4e5c1
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTSUtilsDocModule/entry/src/main/ets/managers/sync-task-development.ets
arkts
func
返回静态句柄 步骤1: 定义并发函数,内部调用同步方法
@Concurrent function func(num: number): number { // 调用静态类对象中实现的同步等待调用 // 先调用syncSet方法并将其结果作为syncSet2的参数,模拟同步调用逻辑 let tmpNum: number = Handle.syncSet(num); console.info('this is Child_Thread'); return Handle.syncSet2(tmpNum); }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function func AST#parameter_list#Left ( AST#parameter#Left num : 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_an...
@Concurrent function func(num: number): number { let tmpNum: number = Handle.syncSet(num); console.info('this is Child_Thread'); return Handle.syncSet2(tmpNum); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTSUtilsDocModule/entry/src/main/ets/managers/sync-task-development.ets#L20-L27
cf34b10a760c06c37f27d0f0dc5bbd3e58087f5f
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
700ms
export const DURATION_100: number = 100;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DURATION_100 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaratio...
export const DURATION_100: number = 100;
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L101-L101
05bd34a51486b354ef9bd659d2fd86341be7308b
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/models/ThemeModel.ets
arkts
getContrastColor
获取主题对比色
getContrastColor(backgroundColor: string): string { // 简单的对比度计算,实际应用中可以使用更复杂的算法 const rgb = this.hexToRgb(backgroundColor); if (!rgb) return '#000000'; const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255; return luminance > 0.5 ? '#000000' : '#FFFFFF'; }
AST#method_declaration#Left getContrastColor AST#parameter_list#Left ( AST#parameter#Left backgroundColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
getContrastColor(backgroundColor: string): string { const rgb = this.hexToRgb(backgroundColor); if (!rgb) return '#000000'; const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255; return luminance > 0.5 ? '#000000' : '#FFFFFF'; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L269-L276
584694d8e638edd78914409e94ca027416ab9688
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SHA.ets
arkts
digest
SHA256摘要 @param str 带摘要的字符串 @returns 摘要后的字符串
static async digest(str: string): Promise<OutDTO<string>> { return CryptoUtil.digest(str, 'SHA256'); }
AST#method_declaration#Left static async digest 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#primary_type#Left AST#generic_type#Left ...
static async digest(str: string): Promise<OutDTO<string>> { return CryptoUtil.digest(str, 'SHA256'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHA.ets#L51-L53
263139a73b89146cf1a1b1fd8a00ee2ece7d58b6
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/LogService.ets
arkts
getInstance
获取单例实例
static getInstance(): LogService { if (!LogService.instance) { LogService.instance = new LogService(); } return LogService.instance; }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LogService 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#Left AST...
static getInstance(): LogService { if (!LogService.instance) { LogService.instance = new LogService(); } return LogService.instance; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/LogService.ets#L31-L36
4161039b714198beab7aae4aa706e42af27af888
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/BasicDataSource.ets
arkts
发布动态视频
constructor(id: string, userName: string, avatar: ResourceStr, text: string, image?: ResourceStr, video?: ResourceStr) { this.id = id; this.userName = userName; this.avatar = avatar; this.text = text; if (image !== undefined) { this.image = image; } ; if (video !== undefined) {...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
constructor(id: string, userName: string, avatar: ResourceStr, text: string, image?: ResourceStr, video?: ResourceStr) { this.id = id; this.userName = userName; this.avatar = avatar; this.text = text; if (image !== undefined) { this.image = image; } ; if (video !== undefined) {...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/BasicDataSource.ets#L82-L95
ee59a959ee94bde97f51edcc9ebad89d292c8e3f
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/AiAssistantComponent.ets
arkts
AiAssistant
AI 智能向导组件 - "小溪" AI Assistant Component - Xiaoxi Source: 溪村园区 AI 问答模块 (内嵌在 MainPage Tab 中)
@Component export struct AiAssistant { @State messages: ChatMessage[] = []; @State inputText: string = ''; @State isLoading: boolean = false; private scroller: Scroller = new Scroller(); aboutToAppear() { // 添加欢迎消息 if (this.messages.length === 0) { this.messages.push({ role: 'assistant'...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AiAssistant AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ChatMessage [ ] AST#arra...
@Component export struct AiAssistant { @State messages: ChatMessage[] = []; @State inputText: string = ''; @State isLoading: boolean = false; private scroller: Scroller = new Scroller(); aboutToAppear() { if (this.messages.length === 0) { this.messages.push({ role: 'assistant', ...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/AiAssistantComponent.ets#L50-L254
906cc00eff8ba9c72bee0bb2ffeee930855e9a20
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets
arkts
addPreferencesListener
Get all data in PreferencesHandler. @return data public async getAll() { let data; if (this.preferences != null) { data = await this.preferences.getAll(); } return data; } Add preferences listener in PreferencesHandler. @param listener PreferencesListener
public addPreferencesListener(listener: PreferencesListener) { this.listeners.push(listener); }
AST#method_declaration#Left public addPreferencesListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left PreferencesListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expres...
public addPreferencesListener(listener: PreferencesListener) { this.listeners.push(listener); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets#L114-L116
03362f9a751483209744d0eee1c1bd41698551c8
gitee
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
请求首页Banner @param date @returns
export function getHomeBanner() { return axiosClient.get<Banner[]>({ url: "banner/json", }) }
AST#export_declaration#Left export AST#function_declaration#Left function getHomeBanner AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expr...
export function getHomeBanner() { return axiosClient.get<Banner[]>({ url: "banner/json", }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L18-L22
7eb0ff2d269810d496b8b17cec277bee06c3c056
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
getGanZhi
获取干支纪年 @param year 农历年份 @returns 干支
getGanZhi(year: number): string { return LunarUtils.getGanZhi(year); }
AST#method_declaration#Left getGanZhi AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right A...
getGanZhi(year: number): string { return LunarUtils.getGanZhi(year); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L401-L403
3248976a1432bce9076be68eae87a20c4ec96a30
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets
arkts
自定义日历控制器。用于控制年、月、周视图间切换场景下刷新日期数据。
export class CalendarController { // 视图刷新接口 swiperRefresh = (value: CalendarViewType) => { }; // 视图刷新接口(仅用于在年视图上点击月份切换到月视图时刷新) swiperYearToMonthRefresh = (year: number, month: number) => { }; // 日程点数据刷新接口 schedulePointRefresh = () => { }; }
AST#export_declaration#Left export AST#class_declaration#Left class CalendarController AST#class_body#Left { // 视图刷新接口 AST#property_declaration#Left swiperRefresh = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left CalendarVie...
export class CalendarController { swiperRefresh = (value: CalendarViewType) => { }; (仅用于在年视图上点击月份切换到月视图时刷新) swiperYearToMonthRefresh = (year: number, month: number) => { }; schedulePointRefresh = () => { }; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets#L242-L252
75bef191dd0dff6cd3bee17f8cce4ad3230234d3
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
stop_onWorkingTab
Stops the load on current main tab.
stop_onWorkingTab() { this.Tabs[this.main_tab_idx].controller?.stop(); }
AST#method_declaration#Left stop_onWorkingTab 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 AST#member_expression#Left AST#expression#Left...
stop_onWorkingTab() { this.Tabs[this.main_tab_idx].controller?.stop(); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L94-L96
dc25bda3c3ab5953d1bc706ea84bdaba872daaf2
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseModalBuilderProxy.ets
arkts
actionCancel
点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。 @default 默认值:true。 @param actionCancel 默认值:true。 @returns
actionCancel(actionCancel: boolean) { this.builderOptions.actionCancel = actionCancel; return this; }
AST#method_declaration#Left actionCancel AST#parameter_list#Left ( AST#parameter#Left actionCancel : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_stateme...
actionCancel(actionCancel: boolean) { this.builderOptions.actionCancel = actionCancel; return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseModalBuilderProxy.ets#L36-L39
da877a86ae94889ebab4a2bddac2430034c3d98c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/utils/Constrain.ets
arkts
isToggle
查询图片是否需要切换图片 @param offset -- 当前偏移量 @param winSize -- 视口大小 @param imageSize -- 图片大小 @param scale -- 缩放 @param TogglePercent -- 移动视口多少时候需要切换图片
function isToggle(offset: number, winSize: number, imageSize: number, scale: number, togglePercent: number): boolean { let maxAllowedOffset: number = getMaxAllowedOffset(winSize, imageSize, scale); const deviation: number = Math.abs(offset) - maxAllowedOffset; const switchThreshold: number = winSize * togglePerce...
AST#function_declaration#Left function isToggle AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left winSize : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
function isToggle(offset: number, winSize: number, imageSize: number, scale: number, togglePercent: number): boolean { let maxAllowedOffset: number = getMaxAllowedOffset(winSize, imageSize, scale); const deviation: number = Math.abs(offset) - maxAllowedOffset; const switchThreshold: number = winSize * togglePerce...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/utils/Constrain.ets#L91-L100
9f3bdbd3c8d6ec160894d1aa015be46ea84f4b73
gitee
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
common/src/main/ets/utils/LocalDataManager.ets
arkts
insertOrder
Insert order to orderData. @param props: insert props @returns orderId
insertOrder(props: InsertOrderProps): string | undefined { if (props.order !== undefined) { const orderId = props.order.orderId; const newOrder: Order = props.order; newOrder.orderId = (orderId !== undefined ? orderId : ''); newOrder.uid = '1'; newOrder.status = props.status; new...
AST#method_declaration#Left insertOrder AST#parameter_list#Left ( AST#parameter#Left props : AST#type_annotation#Left AST#primary_type#Left InsertOrderProps 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...
insertOrder(props: InsertOrderProps): string | undefined { if (props.order !== undefined) { const orderId = props.order.orderId; const newOrder: Order = props.order; newOrder.orderId = (orderId !== undefined ? orderId : ''); newOrder.uid = '1'; newOrder.status = props.status; new...
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L149-L162
8622a534829830764d34397eae065d9de58e3924
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
alipayAppPay
发起支付宝 App 支付 @param {Record<string, number>} params - 支付参数 @returns {Promise<NetworkResponse<string>>} 支付签名结果
async alipayAppPay(params: Record<string, number>): Promise<NetworkResponse<string>> { const resp: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.post("order/pay/alipayAppPay", params); return resp.data; }
AST#method_declaration#Left async alipayAppPay AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_ann...
async alipayAppPay(params: Record<string, number>): Promise<NetworkResponse<string>> { const resp: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.post("order/pay/alipayAppPay", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L27-L31
7989c71a375e135ab7eba9973216576806df17b8
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets
arkts
Numbers.ets
export const One: number = 1;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left One : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST...
export const One: number = 1;
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets#L30-L30
716483d46d5c36aa8a7ecb9d3c4d81278f6ee3c3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment6.ets
arkts
applyNormalAttribute
2.Implement the applyNormalAttribute method of the AttributeModifier interface to customize the logic of attribute setting.
applyNormalAttribute(instance: RowAttribute) { if (this.customImage) { instance.backgroundImage(this.customImage); instance.backgroundImageSize(ImageSize.Cover); } else { instance.backgroundColor(Color.Blue); instance.justifyContent(FlexAlign.Center); // instance.padding(2) /...
AST#method_declaration#Left applyNormalAttribute AST#parameter_list#Left ( AST#parameter#Left instance : AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left A...
applyNormalAttribute(instance: RowAttribute) { if (this.customImage) { instance.backgroundImage(this.customImage); instance.backgroundImageSize(ImageSize.Cover); } else { instance.backgroundColor(Color.Blue); instance.justifyContent(FlexAlign.Center); ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment6.ets#L50-L78
0433f748c3c15edefadc84ccf13d70538e850120
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets
arkts
获取用户即将到期的任务列表 @param userId 用户ID @param days 天数 @param page 页码 @param size 每页大小 @returns 即将到期的任务列表
export function getUpcomingTasks(userId: number, days: number = 7, page: number = 0, size: number = 5): Promise<PageResponse<Task>> { const params: TaskQueryParams = { days, page, size }; try { return request<PageResponse<Task>>( RequestMethod.GET, `/tasks/user/${userId}/upcoming`, params ...
AST#export_declaration#Left export AST#function_declaration#Left function getUpcomingTasks AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left days : AST#type_annotation#Left...
export function getUpcomingTasks(userId: number, days: number = 7, page: number = 0, size: number = 5): Promise<PageResponse<Task>> { const params: TaskQueryParams = { days, page, size }; try { return request<PageResponse<Task>>( RequestMethod.GET, `/tasks/user/${userId}/upcoming`, params ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L100-L112
ed312c2a515ad904cf122bfeeb2543799d1e7e74
github
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/pages/EnvironmentInfoPage.ets
arkts
getCardColor
获取卡片背景色
private getCardColor(status: number): string { switch (status) { case 0: return '#E8F5E9'; // 安全-浅绿色 case 1: return '#FFF3E0'; // 警告-浅橙色 case 2: return '#FFEBEE'; // 危险-浅红色 default: return '#F5F5F5'; // 未知-浅灰色 } }
AST#method_declaration#Left private getCardColor AST#parameter_list#Left ( AST#parameter#Left status : 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 string AST#primary...
private getCardColor(status: number): string { switch (status) { case 0: return '#E8F5E9'; case 1: return '#FFF3E0'; case 2: return '#FFEBEE'; default: return '#F5F5F5'; } }
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/EnvironmentInfoPage.ets#L236-L247
b3ce1ccf079b5b371da6903cfe25613b6c8901df
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets
arkts
@memo
export function hookTextClockContentModifier( receiver: ArkTextClockComponent, value?: ContentModifier<TextClockConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const textClockBuilder = (parentNode: KPointer, config: TextClockConfiguration): KPoi...
AST#export_declaration#Left export AST#function_declaration#Left function hookTextClockContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkTextClockComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left va...
export function hookTextClockContentModifier( receiver: ArkTextClockComponent, value?: ContentModifier<TextClockConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const textClockBuilder = (parentNode: KPointer, config: TextClockConfiguration): KPoi...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L226-L239
558a446260dc3d3951239d24a965f1531400fb2a
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/EditSchedule.ets
arkts
getRemindButtonText
获取提醒时间字符串。
private getRemindButtonText(): void { if (this.schedule.remindTime.length === 0) { this.remindButtonText = '提醒我'; } else if (this.remindTime.getDate() === this.currentTime.getDate()) { this.remindButtonText = '在今日' + (this.remindTime.getHours() < 10 ? '0' : '') + this.remindTime.getHours() + ...
AST#method_declaration#Left private getRemindButtonText 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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left ...
private getRemindButtonText(): void { if (this.schedule.remindTime.length === 0) { this.remindButtonText = '提醒我'; } else if (this.remindTime.getDate() === this.currentTime.getDate()) { this.remindButtonText = '在今日' + (this.remindTime.getHours() < 10 ? '0' : '') + this.remindTime.getHours() + ...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/EditSchedule.ets#L1018-L1047
ffb861ba71c04995888ef220243592a56f874c95
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
toPay
跳转支付页面 @returns {void} 无返回值
toPay(): void { const order: Order = this.data ?? new Order(); const payPrice: number = order.price - order.discountPrice; OrderNavigator.toPay(order.id, payPrice); }
AST#method_declaration#Left toPay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left order : AST#type_an...
toPay(): void { const order: Order = this.data ?? new Order(); const payPrice: number = order.price - order.discountPrice; OrderNavigator.toPay(order.id, payPrice); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L103-L107
3d13fe0fe72737afebf57e1b09b1f388756634d4
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/ime/keyboard/IncognitoMode.ets
arkts
定义标签和描述信息的类型
export interface IncognitoModeLabel { label: string; description: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IncognitoModeLabel AST#object_type#Left { AST#type_member#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left description : AST#type_an...
export interface IncognitoModeLabel { label: string; description: string; }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/ime/keyboard/IncognitoMode.ets#L9-L12
e8e8a67344f48d3fda47294779530704c9fb03c9
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionControllerPCode.ets
arkts
setLaunchAbility
[StartExclude session_controller1]
setLaunchAbility() {}
AST#method_declaration#Left setLaunchAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
setLaunchAbility() {}
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionControllerPCode.ets#L49-L49
2aca574079273faf57ec49a0700630871cf5d29f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/animation/AnimBounce.ets
arkts
执行跳动动画 @param options BounceOptions 类型参数,用于配置跳动行为
export function bounce(options: BounceOptions): void { const times = options.times ?? 2 const duration = options.duration ?? 50 const distance = options.distance ?? 3 const isHorizontal = options.isHorizontal ?? true const setOffset = options.set let count = 0 let dir...
AST#export_declaration#Left export AST#function_declaration#Left function bounce AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BounceOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ...
export function bounce(options: BounceOptions): void { const times = options.times ?? 2 const duration = options.duration ?? 50 const distance = options.distance ?? 3 const isHorizontal = options.isHorizontal ?? true const setOffset = options.set let count = 0 let dir...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/animation/AnimBounce.ets#L17-L53
21e2007d83651c17cdee8195b71aa824d9386ab5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets
arkts
createRecordSoundFromRs
MARK: - 结果集转换 从结果集创建 RecordSound 对象 @param rs - 关系型数据库结果集 @returns RecordSound 对象
private createRecordSoundFromRs(rs: relationalStore.ResultSet): RecordSound { const sound = new RecordSound(); // 获取文本列(解密) sound.name = ResultSetTool.decodeString(rs, Tables.Record.Col.text); // 获取声音数据 const soundIndex = rs.getColumnIndex(Tables.Record.Col.sound); sound.pronData = rs....
AST#method_declaration#Left private createRecordSoundFromRs AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_l...
private createRecordSoundFromRs(rs: relationalStore.ResultSet): RecordSound { const sound = new RecordSound(); sound.name = ResultSetTool.decodeString(rs, Tables.Record.Col.text); const soundIndex = rs.getColumnIndex(Tables.Record.Col.sound); sound.pronData = rs.getBlob(soundIndex); ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L184-L196
09476cba1cb2c56884a953e6dd9cf853e7022266
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AssetUtil.ets
arkts
remove
删除关键资产 @param key @returns
static async remove(key: string): Promise<boolean> { try { if (!AssetUtil.canIUse()) { LogUtil.error(`AssetStore-当前设备不支持该模块`); return false; } let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, StrUtil.strToUint8Array(key)); await asset.remove(query); ...
AST#method_declaration#Left static async remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
static async remove(key: string): Promise<boolean> { try { if (!AssetUtil.canIUse()) { LogUtil.error(`AssetStore-当前设备不支持该模块`); return false; } let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, StrUtil.strToUint8Array(key)); await asset.remove(query); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AssetUtil.ets#L160-L175
0015c213e6a72ac41b19b67a745dfc43f0408c54
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
showRingtonePickerDialog
显示铃声选择器对话框
private showRingtonePickerDialog(): void { this.showRingtoneListDialog = true; }
AST#method_declaration#Left private showRingtonePickerDialog 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_expre...
private showRingtonePickerDialog(): void { this.showRingtoneListDialog = true; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6288-L6290
0dc2992eac5f70f4b81661b9411804d81f00a489
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/passwordCheck.ets
arkts
getRouterParam
Get the params from router
getRouterParam() { let param = Router.getParams(); if (!param) { return; } this.pageRequestCode = param.pageRequestCode as number; this.prevPageUri = param.prevPageUri as string; this.pinChallenge = param.pinChallenge as string; this.passwordType = param.passwordType as number; }
AST#method_declaration#Left getRouterParam AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left param = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#...
getRouterParam() { let param = Router.getParams(); if (!param) { return; } this.pageRequestCode = param.pageRequestCode as number; this.prevPageUri = param.prevPageUri as string; this.pinChallenge = param.pinChallenge as string; this.passwordType = param.passwordType as number; }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/passwordCheck.ets#L83-L92
142ba7a7698523f47f75f9a76fb492222a770860
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
processAlipayResult
处理支付宝支付结果 @param {Map<string, string>} result - 支付结果 @returns {void} 无返回值
processAlipayResult(result: Map<string, string>): void { const resultStatus: string | undefined = result.get("resultStatus"); if (resultStatus === "9000") { ToastUtils.showSuccess($r("app.string.payment_success")); this.handleBackAfterPayment(true); return; } if (resultStatus === "6001...
AST#method_declaration#Left processAlipayResult AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annot...
processAlipayResult(result: Map<string, string>): void { const resultStatus: string | undefined = result.get("resultStatus"); if (resultStatus === "9000") { ToastUtils.showSuccess($r("app.string.payment_success")); this.handleBackAfterPayment(true); return; } if (resultStatus === "6001...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets#L97-L111
26d70b30118db1da4dfe0516e95fd5417dd4c828
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getMediaContent
用户获取指定资源ID对应的媒体文件内容/获取指定资源ID对应的默认或指定的屏幕密度媒体文件内容 @param resId 资源ID值/资源信息。 @param density 资源获取需要的屏幕密度,0或缺省表示默认屏幕密度。 @returns
static async getMediaContent(resId: number | Resource, density?: number): Promise<Uint8Array> { if (density !== undefined) { if (typeof resId === 'number') { return ResUtil.getResourceManager().getMediaContent(resId, density); } else { return ResUtil.getResourceManager().getMediaContent(...
AST#method_declaration#Left static async getMediaContent AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parame...
static async getMediaContent(resId: number | Resource, density?: number): Promise<Uint8Array> { if (density !== undefined) { if (typeof resId === 'number') { return ResUtil.getResourceManager().getMediaContent(resId, density); } else { return ResUtil.getResourceManager().getMediaContent(...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L305-L319
e5b5db54f1889eca3e65c2819a4be78570e68ab7
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
arkts
convertImageToBase64
将图片转换为Base64
private async convertImageToBase64(imageUri: string): Promise<string | null> { try { // 直接文件路径读取 if (imageUri.startsWith('file://') && !imageUri.startsWith('file://media/')) { try { const realPath: string = imageUri.replace('file://', ''); await fileIo.access(realPath); ...
AST#method_declaration#Left private async convertImageToBase64 AST#parameter_list#Left ( AST#parameter#Left imageUri : 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 AS...
private async convertImageToBase64(imageUri: string): Promise<string | null> { try { if (imageUri.startsWith('file://') && !imageUri.startsWith('file://media/')) { try { const realPath: string = imageUri.replace('file://', ''); await fileIo.access(realPath); const ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L753-L845
8b27e5a71b67ec913f6e4e7466cdec23c6609eb3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SimpleBirthdayApp.ets
arkts
loadBirthdayData
加载生日数据
private async loadBirthdayData(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[SimpleBirthdayApp] loadBirthdayData - starting'); console.log('[SimpleBirthdayApp] Loading birthday data...'); // 获取今日生日 this.todayBirthdays = await this.contactService.getTod...
AST#method_declaration#Left private async loadBirthdayData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > ...
private async loadBirthdayData(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[SimpleBirthdayApp] loadBirthdayData - starting'); console.log('[SimpleBirthdayApp] Loading birthday data...'); this.todayBirthdays = await this.contactService.getTodayBirthda...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L108-L128
1b0d1cdc83312449be773054fdc0481b7be7fc74
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/Constants.ets
arkts
图片加载的各个阶段
export enum LoadPhase { // 图片加载阶段 PHASE_LOAD = 'load', // 网络请求下载阶段 PHASE_NET = 'net', //获取图片格式阶段 PHASE_GET_FORMAT = 'parse_format', //自定义下载阶段 customGetImage PHASE_CUSTOM_LOAD = 'customGetImage', // createPixelMap 阶段 PHASE_CREATE_SOURCE = 'createImageSource', //createPixelMap 阶段 PHASE_CREATE_PIXE...
AST#export_declaration#Left export AST#enum_declaration#Left enum LoadPhase AST#enum_body#Left { // 图片加载阶段 AST#enum_member#Left PHASE_LOAD = AST#expression#Left 'load' AST#expression#Right AST#enum_member#Right , // 网络请求下载阶段 AST#enum_member#Left PHASE_NET = AST#expression#Left 'net' AST#expression#Right AST#enum_member...
export enum LoadPhase { PHASE_LOAD = 'load', PHASE_NET = 'net', PHASE_GET_FORMAT = 'parse_format', PHASE_CUSTOM_LOAD = 'customGetImage', PHASE_CREATE_SOURCE = 'createImageSource', PHASE_CREATE_PIXEL_MAP = 'createPixelMap', PHASE_THREAD_QUEUE = 'thread_queue', PHASE_PARSE_IAMGE = ...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/Constants.ets#L51-L74
8f4965e76bd1fc1bcb2e2c2183ee0be22b7e5af0
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/Shangpingsousuoyoujieguo.ets
arkts
navigateToSearchResult
跳转到搜索结果页
navigateToSearchResult() { if (this.searchText.trim()) { router.pushUrl({ url: 'pages/SearchResultPage', params: { keyword: this.searchText } }); } }
AST#method_declaration#Left navigateToSearchResult AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expre...
navigateToSearchResult() { if (this.searchText.trim()) { router.pushUrl({ url: 'pages/SearchResultPage', params: { keyword: this.searchText } }); } }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Shangpingsousuoyoujieguo.ets#L34-L41
80bb457f8d1d2fc99a4089f018a4352a512a989d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets
arkts
modifyAllData
改变数组数据 @param data:新数组
public modifyAllData(data: SceneModuleInfo[]): void { this.dataArray = data; this.notifyDataReload(); }
AST#method_declaration#Left public modifyAllData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SceneModuleInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_anno...
public modifyAllData(data: SceneModuleInfo[]): void { this.dataArray = data; this.notifyDataReload(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L179-L182
fccacbc8d1ca2598a6f81cb2e8e8673a15a3e082
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets
arkts
encodingPictureJs
多图图片编码 @param pushStatus 编码入参(0:source, 1:obj) @param jpegFileName 图片类型(jpeg) @param outStatus 编码出参(0:buffer, 1:file) @returns
async encodingPictureJs(pushStatus: number, outStatus: number): Promise<void> { logger.info(TAG, 'encodingPicture start'); this.pixelMap = await EncodingPicture(pushStatus, this.jpegFileName, outStatus); if (!this.pixelMap) { logger.info(TAG, `encodingPicture no pixelMap`); return; } let...
AST#method_declaration#Left async encodingPictureJs AST#parameter_list#Left ( AST#parameter#Left pushStatus : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outStatus : AST#type_annotation#Left AST#primary_type#Left number ...
async encodingPictureJs(pushStatus: number, outStatus: number): Promise<void> { logger.info(TAG, 'encodingPicture start'); this.pixelMap = await EncodingPicture(pushStatus, this.jpegFileName, outStatus); if (!this.pixelMap) { logger.info(TAG, `encodingPicture no pixelMap`); return; } let...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets#L157-L173
121192e127c0ac9814e9320f2851885ba976f15d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
getMonthDays
获取每个月的天数 @param year 年 @param month 月 @returns 返回对应天数
static getMonthDays(year: number, month: number): number { switch (month) { // 1月、3月、5月、7月、8月、10月和12月各有31天。 case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31;
AST#method_declaration#Left static getMonthDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
static getMonthDays(year: number, month: number): number { switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31;
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L226-L236
4387a69951ce604443d6d7f34038b6e7f3105c06
gitee
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
rdbplus/src/main/ets/core/MyWrapper.ets
arkts
getSelect
获取select
getSelect(): string { return this.selectSql }
AST#method_declaration#Left getSelect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Lef...
getSelect(): string { return this.selectSql }
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/MyWrapper.ets#L26-L28
3cfa3853c971f830dcdac54bb2af817d795bb8d5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/VolumeChecker.ets
arkts
checkVolume
检查设备音量是否低于阈值(修正版本) @param threshold 音量阈值 (默认 0.12) @param message 提示信息 (默认提示文本) 关键修正:正确处理 getVolumeGroupManager() 返回的 Promise 对象 Swift 类比:类似处理 Swift 的 async/await 异步操作 Kotlin 类比:类似 Kotlin 协程中的挂起函数
static async checkVolume( threshold: number = 0.12, message: ResourceStr = $r('app.string.sys_msg_volume_small') ) { try { // 1. 获取音频管理器实例 const audioManager: audio.AudioManager = audio.getAudioManager(); // 2. 获取音量管理器 [2,7](@ref) const audioVolumeManager = audioManager.getVolumeM...
AST#method_declaration#Left static async checkVolume AST#parameter_list#Left ( AST#parameter#Left threshold : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.12 AST#expression#Right AST#parameter#Right , AST#parameter#Left message : AST#type...
static async checkVolume( threshold: number = 0.12, message: ResourceStr = $r('app.string.sys_msg_volume_small') ) { try { const audioManager: audio.AudioManager = audio.getAudioManager(); const audioVolumeManager = audioManager.getVolumeManager(); const groupManag...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/VolumeChecker.ets#L15-L51
ee7a0785c7063c87ee69ddbeb54f0efdb80f1290
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_downloads.ets
arkts
A class to handle download tasks. Will ENSURE there is a downloads directory in the sandbox directory on creation. @param no_init Will not check directory existence nor do anything else. Usually set true if this object is only created to sit the place of StorageLink initialization.
constructor() { console.log('[Meow][bunch_of_downloads] Init success!'); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log...
constructor() { console.log('[Meow][bunch_of_downloads] Init success!'); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_downloads.ets#L29-L31
7903a38f7c74ad40a6d58ce869916baf035588b0
gitee