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
Duke_Bit/ElfRefresh
56faf5431c1643ec5ae227dc854a31b391778b2c
library/src/main/ets/model/ElfTwoLevelHeader.ets
arkts
@author duke @description 自定义二级表头
export interface ElfTwoLevelHeader{ builderHeader:WrappedBuilder<[ElfRefreshHeader,ElfRefreshController]> }
AST#export_declaration#Left export AST#interface_declaration#Left interface ElfTwoLevelHeader AST#object_type#Left { AST#type_member#Left builderHeader : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple...
export interface ElfTwoLevelHeader{ builderHeader:WrappedBuilder<[ElfRefreshHeader,ElfRefreshController]> }
https://github.com/Duke_Bit/ElfRefresh/blob/56faf5431c1643ec5ae227dc854a31b391778b2c/library/src/main/ets/model/ElfTwoLevelHeader.ets#L8-L10
c842189f31241a067534e15108a2585a9ca9ff30
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
联系人排序字段枚举
export enum ContactSortField { NAME = 'name', BIRTHDAY = 'birthday', CREATED_AT = 'createdAt', UPDATED_AT = 'updatedAt', INTIMACY_LEVEL = 'intimacyLevel', DAYS_UNTIL_BIRTHDAY = 'daysUntilBirthday' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ContactSortField AST#enum_body#Left { AST#enum_member#Left NAME = AST#expression#Left 'name' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left BIRTHDAY = AST#expression#Left 'birthday' AST#expression#Right AST#enum_member#Right , AST#enum...
export enum ContactSortField { NAME = 'name', BIRTHDAY = 'birthday', CREATED_AT = 'createdAt', UPDATED_AT = 'updatedAt', INTIMACY_LEVEL = 'intimacyLevel', DAYS_UNTIL_BIRTHDAY = 'daysUntilBirthday' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L208-L215
4b040e29069fb42bfc220f43c5a15e23599285d3
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/utils/DateUtils.ets
arkts
获取本月的日期范围
export function getDateRangeOfThisMonth(date: Date | number) { // 获取本月的第一天和下个月的第一天 const beginDate = getFirstDateOfThisMonth(date) const nextMonth = new Date(beginDate.getTime()) nextMonth.setMonth(nextMonth.getMonth() + 1) // 返回日期范围对象 return { beginDate: beginDate.getTime(), endDate: nextMonth.getTime() - ...
AST#export_declaration#Left export AST#function_declaration#Left function getDateRangeOfThisMonth AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right ...
export function getDateRangeOfThisMonth(date: Date | number) { const beginDate = getFirstDateOfThisMonth(date) const nextMonth = new Date(beginDate.getTime()) nextMonth.setMonth(nextMonth.getMonth() + 1) return { beginDate: beginDate.getTime(), endDate: nextMonth.getTime() - 1 }; }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L126-L133
1708f84743aaefa2eb9207d28f599d368e2e2049
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
requestEnableNotification
应用需要获取用户授权才能发送通知。在通知发布前调用该接口,可以拉起通知授权弹窗,让用户选择是否允许发送通知。使用Promise异步回调。 @param context @returns
static async requestEnableNotification(context: common.UIAbilityContext = AppUtil.getContext()):Promise<void> { return await notificationManager.requestEnableNotification(context) }
AST#method_declaration#Left static async requestEnableNotification AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#c...
static async requestEnableNotification(context: common.UIAbilityContext = AppUtil.getContext()):Promise<void> { return await notificationManager.requestEnableNotification(context) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L75-L77
81d823bbd255ceebf8747d91cc15ad9bed82bd1e
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Native/DataConversionDemo/conversion/src/main/ets/common/constants/CommonContants.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 CommonConstants { /** * Height and width is 100%. * */ static readonly FULL_PARENT: string = '100%'; /** * Height and width is 80%. * */ static readonly EIGHTY_PARENT: string = '80%'; /** * Height and width is 90%. * */ static readonly NINETY_PARENT: string = '90%';...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Height and width is 100%. * */ AST#property_declaration#Left static readonly FULL_PARENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ...
export default class CommonConstants { static readonly FULL_PARENT: string = '100%'; static readonly EIGHTY_PARENT: string = '80%'; static readonly NINETY_PARENT: string = '90%'; static readonly FONT_WEIGHT: number = 500; static readonly SPACE: number = 12; static readonly MAX_LINES:...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Native/DataConversionDemo/conversion/src/main/ets/common/constants/CommonContants.ets#L16-L87
585b5faf389dfffc0d34995dbda00288ea203efc
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
getGoodsCommentPage
分页查询商品评论 @param params 评论分页请求参数 @returns 评论分页数据
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { return this.networkDataSource.getGoodsCommentPage(params); }
AST#method_declaration#Left async getGoodsCommentPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsCommentPageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L...
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { return this.networkDataSource.getGoodsCommentPage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/GoodsRepository.ets#L91-L93
5e20cb7f93526ac7fb07cb03b7a5f2f375f340b4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
CustomAddressPicker
自定义地址选择组件CustomAddressPicker 功能描述: 1.提供省市区选择功能 2.支持传入有效的省市区名后,拉起地址选择弹窗时,显示对应的省市区 实现思路 1.使用getRawFileContentSync从rawfile目录下读取省市区json文件数据,使用util.TextDecoder进行解码。 2.使用bindSheet绑定地址选择半模态弹窗页面。 3.使用changeIndex控制省市区列表TabContent切换。 4.使用组件区域变化回调onAreaChange获取选择的省市区Text组件宽度,存入textInfos数组,用于后续计算选择省市区名后下方下滑线动画水平偏移量leftMargin。 5....
@Component export struct CustomAddressPicker { // 底部导航条区域高度 @State bottomHeight: number = 0; // 选择的省市区 @State provinceCityRegion: string = '省、市、区'; // 地址选择半模态弹窗显隐标志位 @State @Watch('isShowChange') isShow: boolean = false; // 当前选择的省、市、区tab页签的index。0表示省,1表示市,2表示区 @State currentIndex: number = AddressType.P...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomAddressPicker AST#component_body#Left { // 底部导航条区域高度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bottomHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
@Component export struct CustomAddressPicker { @State bottomHeight: number = 0; @State provinceCityRegion: string = '省、市、区'; @State @Watch('isShowChange') isShow: boolean = false; @State currentIndex: number = AddressType.Province; @State animationDuration: number = Constants.ANIMATION_DURATION...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L50-L587
f8a233116b50634ee651dfbe98266c1506b12100
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
adaptDimension
Obtains the screen horizontal adaptation value. @return number
static adaptDimension(value: number): number { let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN...
AST#method_declaration#Left static adaptDimension AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
static adaptDimension(value: number): number { let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets#L39-L46
6adb979c8ded276fa06b4d374ee3909a1730a110
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/components/common/src/main/ets/components/index.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export * from './ColorBlock';
AST#export_declaration#Left export * from './ColorBlock' ; AST#export_declaration#Right
export * from './ColorBlock';
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/components/common/src/main/ets/components/index.ets#L16-L16
702df22dc101415ac4cbe5242128eccf646e6e31
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
getLunarHolidays
获取农历节日 @param year 年份(公历) @returns 该年的农历节日列表
async getLunarHolidays(year: number): Promise<LunarHoliday[]> { try { const holidays: LunarHoliday[] = []; for (const holiday of LunarService.LUNAR_HOLIDAYS) { // 处理除夕特殊情况(腊月二十九或三十) let targetDay = holiday.day; if (holiday.name === '除夕') { // 检查腊月是大月还是小月 cons...
AST#method_declaration#Left async getLunarHolidays 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 AST#generic_type#L...
async getLunarHolidays(year: number): Promise<LunarHoliday[]> { try { const holidays: LunarHoliday[] = []; for (const holiday of LunarService.LUNAR_HOLIDAYS) { let targetDay = holiday.day; if (holiday.name === '除夕') { const monthDays = LunarUtils.getLunarMo...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L295-L332
633e318486b248162bb5e2fdb38d4f6e758b45c5
github
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/entryability/EntryAbility.ets
arkts
requestSecret
------------------ Secret Manager ------------------//
private async requestSecret(otpType: OtpSchemaSupport, secret: SecretSchema, authToken?: Uint8Array): Promise<Uint8Array> { let encodedSecret = secret.secret; // case 1: secret needs decryption if (secret.encrypted) { // case 1.1: deprecated master key info if (this._decM...
AST#method_declaration#Left private async requestSecret AST#parameter_list#Left ( AST#parameter#Left otpType : AST#type_annotation#Left AST#primary_type#Left OtpSchemaSupport AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left secret : AST#type_annotation#Left AST#primary_type#Left...
private async requestSecret(otpType: OtpSchemaSupport, secret: SecretSchema, authToken?: Uint8Array): Promise<Uint8Array> { let encodedSecret = secret.secret; if (secret.encrypted) { if (this._decMasterKeyInfo?.version!==LATEST_KDF_VERSION) { AppStorage....
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/entryability/EntryAbility.ets#L197-L223
f5ff11a87a9bc7f37ee113709737da48d9d24d29
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/PixelMapUtils.ets
arkts
createPixelMapFromBuffer
从内存数据创建PixelMap
static async createPixelMapFromBuffer( buffer: ArrayBuffer, options?: image.DecodingOptions ): Promise<image.PixelMap | null> { try { const imageSource = image.createImageSource(buffer); return await imageSource.createPixelMap(options); } catch (error) { console.error('从内存创建PixelMap失...
AST#method_declaration#Left static async createPixelMapFromBuffer AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_ty...
static async createPixelMapFromBuffer( buffer: ArrayBuffer, options?: image.DecodingOptions ): Promise<image.PixelMap | null> { try { const imageSource = image.createImageSource(buffer); return await imageSource.createPixelMap(options); } catch (error) { console.error('从内存创建PixelMap失...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PixelMapUtils.ets#L39-L50
f9bbd95e1bf6cda331d9191a96b6edceff26d4f8
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_json/src/main/ets/json/JSONValue.ets
arkts
@Author csx @DateTime 2024/4/25 19:17:04 @TODO JSONValue 定义json值的类型 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_json
export type JSONValue = string | number | boolean | Date | Object | JSONObject | JSONArray | JSONArrayList | null;
AST#export_declaration#Left export AST#type_declaration#Left type JSONValue = 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#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left Date AST#pri...
export type JSONValue = string | number | boolean | Date | Object | JSONObject | JSONArray | JSONArrayList | null;
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONValue.ets#L28-L28
94c0cf70dc379c4bbc59e025fa31e1ea82d8e1e2
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
generateCryptoKey
生成非对称密钥 @param symAlgName 秘钥规格 @returns 指定秘钥规格的非对称公私
static async generateCryptoKey(symAlgName: string): Promise<CryptoKey> { // 创建非对称密钥生成器 let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName); // 通过非对称密钥生成器,随机生成非对称密钥 let promiseKeyPair = await rsaGenerator.generateKeyPair(); // 转换成可以读懂的公私钥字符串 let pubKey = StrAndUintUtil.unitArray2String(pr...
AST#method_declaration#Left static async generateCryptoKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : 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#...
static async generateCryptoKey(symAlgName: string): Promise<CryptoKey> { let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName); let promiseKeyPair = await rsaGenerator.generateKeyPair(); let pubKey = StrAndUintUtil.unitArray2String(promiseKeyPair.pubKey.getEncoded().data); let priKe...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L101-L110
25ebaba5ede6831d25020c39bf259f8665387702
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
parseNonStreamResponse
解析非流式响应
private parseNonStreamResponse(parsedResponse: Record<string, Object>, provider: string): string { let aiResponse: string = ''; if (provider === 'anthropic') { // Anthropic响应格式 if (parsedResponse.content && Array.isArray(parsedResponse.content) && parsedResponse.content.length > 0) { const ...
AST#method_declaration#Left private parseNonStreamResponse AST#parameter_list#Left ( AST#parameter#Left parsedResponse : 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#...
private parseNonStreamResponse(parsedResponse: Record<string, Object>, provider: string): string { let aiResponse: string = ''; if (provider === 'anthropic') { if (parsedResponse.content && Array.isArray(parsedResponse.content) && parsedResponse.content.length > 0) { const content = parsed...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L547-L586
d49c0f6fedc604e4a56fccd3b170a002f2df2145
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
set
Called when setting. @since 10
static set<T>(propName: string, newValue: T): boolean { return StorageMap.shared.set(propName, newValue, false) }
AST#method_declaration#Left static set AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri...
static set<T>(propName: string, newValue: T): boolean { return StorageMap.shared.set(propName, newValue, false) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L156-L158
0845b21ed9243a889c16fe1fb28b5edcce056bb6
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/IdUtil.ets
arkts
fastSimpleUUID
获取随机32位UUID,带-
static fastSimpleUUID(): string { const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); const uuid = new Array<string>(32); let rand = 0; let index = 0; for (let i = 0; i < 32; i++) { if (i === 8 || i === 12 || i === 16 || i === 20) { uuid[i] = '-';...
AST#method_declaration#Left static fastSimpleUUID AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left c...
static fastSimpleUUID(): string { const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); const uuid = new Array<string>(32); let rand = 0; let index = 0; for (let i = 0; i < 32; i++) { if (i === 8 || i === 12 || i === 16 || i === 20) { uuid[i] = '-';...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdUtil.ets#L68-L88
68ec40c36363164fb598903a1647afd9832d131a
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/net/wanAPI/response/IWanCommonResponse.ets
arkts
玩安卓公共响应格式
export interface IWanCommonResponse<T> { data: T errorCode: number, errorMsg: string, }
AST#export_declaration#Left export AST#interface_declaration#Left interface IWanCommonResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Ri...
export interface IWanCommonResponse<T> { data: T errorCode: number, errorMsg: string, }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/net/wanAPI/response/IWanCommonResponse.ets#L6-L10
e76c213234f43ae27a6ea8da3b49c34d7ba3f835
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_016_F.ets
arkts
Introduction 库函数-string_trim
export function string_lib_func_016_F(taint_src : string) { let clean = "clean"; let t = clean.trim(); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_016_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function string_lib_func_016_F(taint_src : string) { let clean = "clean"; let t = clean.trim(); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_016_F.ets#L7-L11
d955b5eac299ae88e0e191412ef3eb98dda3bf1e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/Scroller.ets
arkts
customBuilder1
检测Web组件是否滚动到边界
@Builder customBuilder1() {}
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customBuilder1 AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
@Builder customBuilder1() {}
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/Scroller.ets#L43-L43
1abd7380ae008c5f543539d153afd5f17e99cb1e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/Index.ets
arkts
FunctionalScenes
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { FunctionalScenes } from './src/main/ets/FunctionalScenes';
AST#export_declaration#Left export { FunctionalScenes } from './src/main/ets/FunctionalScenes' ; AST#export_declaration#Right
export { FunctionalScenes } from './src/main/ets/FunctionalScenes';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/Index.ets#L16-L16
12e5e55c49430839bb144d85fee040cf1647af57
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/SketchTransformation.ets
arkts
SketchTransformation
图片变换:素描效果
@Sendable export class SketchTransformation extends PixelMapTransformation { constructor() { super(); } async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> { let imageInfo: image.ImageInfo = await toTransform.getImageInfo(); if (!imageInfo.size) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class SketchTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#...
@Sendable export class SketchTransformation extends PixelMapTransformation { constructor() { super(); } async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> { let imageInfo: image.ImageInfo = await toTransform.getImageInfo(); if (!imageInfo.size) ...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/SketchTransformation.ets#L22-L46
5620a327cbe1b74f42bc64abd0a3075ee7920a7b
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
MaxSelected @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare class MaxSelected { /** * data. support to set max_total_count, max_photo_count and max_video_count. * * @type { ?Map<MaxCountType, number> } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ data?: Map<MaxCountType...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class MaxSelected AST#class_body#Left { /** * data. support to set max_total_count, max_photo_count and max_video_count. * * @type { ?Map<MaxCountType, number> } * @syscap SystemCapability.FileManage...
export declare class MaxSelected { data?: Map<MaxCountType, number>; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L488-L498
b925c267739004f0ffdac684d912c96a68ce7d47
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/buffer/AbstractBuffer.ets
arkts
size
Returns the size (length) of the buffer array. @return
public size(): number { return this.buffer.length; }
AST#method_declaration#Left public size AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#L...
public size(): number { return this.buffer.length; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/buffer/AbstractBuffer.ets#L68-L70
70c40bd3b37999ea5f8ffdf33fb1daf1e9cf8eaa
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/datasource/auth/AuthNetworkDataSource.ets
arkts
@file 认证相关网络数据源接口 定义认证模块所需的所有网络请求操作 @author Joker.X
export interface AuthNetworkDataSource { /** * 刷新 Token * @param {Record<string, string>} params - 刷新参数,包含 refresh_token * @returns {Promise<NetworkResponse<Auth>>} 刷新后的认证信息 */ refreshToken(params: Record<string, string>): Promise<NetworkResponse<Auth>>; /** * 密码登录 * @param params 登录参数,包含用户名、密码...
AST#export_declaration#Left export AST#interface_declaration#Left interface AuthNetworkDataSource AST#object_type#Left { /** * 刷新 Token * @param {Record<string, string>} params - 刷新参数,包含 refresh_token * @returns {Promise<NetworkResponse<Auth>>} 刷新后的认证信息 */ AST#type_member#Left refreshToken AST#parameter_lis...
export interface AuthNetworkDataSource { refreshToken(params: Record<string, string>): Promise<NetworkResponse<Auth>>; loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>>; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/datasource/auth/AuthNetworkDataSource.ets#L8-L22
014277b7be5efbdf3a937ac546a3955e001d9631
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/SettingsTypes.ets
arkts
备份位置枚举
export enum BackupLocation { LOCAL = 'local', CLOUD = 'cloud', EXTERNAL = 'external' }
AST#export_declaration#Left export AST#enum_declaration#Left enum BackupLocation AST#enum_body#Left { AST#enum_member#Left LOCAL = AST#expression#Left 'local' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CLOUD = AST#expression#Left 'cloud' AST#expression#Right AST#enum_member#Right , AST#enum_membe...
export enum BackupLocation { LOCAL = 'local', CLOUD = 'cloud', EXTERNAL = 'external' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L648-L652
f21970133d7d503abc07b3f62c70ca3e2e383fb1
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setCenterTextTypeface
sets the typeface for the center-text paint @param t
public setCenterTextTypeface(t: FontFamily): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintCenterText().setFontFamily(t); }
AST#method_declaration#Left public setCenterTextTypeface AST#parameter_list#Left ( AST#parameter#Left t : AST#type_annotation#Left AST#primary_type#Left FontFamily 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#pr...
public setCenterTextTypeface(t: FontFamily): void { ( this.mRenderer as PieChartRenderer).getPaintCenterText().setFontFamily(t); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L561-L564
ae0cc75a4cdd472ccba3e8bc74a28878ecfa8461
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets
arkts
connect2Server
连接服务端
connect2Server() { workerPort.postMessage({ type: 'connectServer', serverIp: this.serverIp, serverPort: this.serverPort, ca: this.ca, cert: this.cert, privateKey: this.privateKey }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsTwoWayMessage = e...
AST#method_declaration#Left connect2Server 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 workerPort AST#expression#Right . postMessage AST...
connect2Server() { workerPort.postMessage({ type: 'connectServer', serverIp: this.serverIp, serverPort: this.serverPort, ca: this.ca, cert: this.cert, privateKey: this.privateKey }); workerPort.onmessage = (e: MessageEvents) => { const response: TlsTwoWayMessage = e...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets#L332-L350
eab3a36dc7dec160fb93af095de9283a1781b0c5
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
unregisterAnim
取消注册路由转场动画 @param modifier
unregisterAnim(component: object) { const navId = this.navContextMap.get(this.getKey(component))?.pageId if (navId) { this.customTransitionMap.delete(navId); } this.navContextMap.delete(this.getKey(this)) }
AST#method_declaration#Left unregisterAnim AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration...
unregisterAnim(component: object) { const navId = this.navContextMap.get(this.getKey(component))?.pageId if (navId) { this.customTransitionMap.delete(navId); } this.navContextMap.delete(this.getKey(this)) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L357-L363
d5ffe2fb116f623315e8741218fa60e0228dedcb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
trackEvent
记录使用事件
trackEvent(eventType: 'app_launch' | 'app_close' | 'contact_add' | 'contact_edit' | 'greeting_generate' | 'greeting_use' | 'feature_use', eventData?: EventData): void { const event: UsageEvent = { eventType, eventData, timestamp: new Date().toISOString(), sessionId: this.currentSessionId ...
AST#method_declaration#Left trackEvent AST#parameter_list#Left ( AST#parameter#Left eventType AST#parameter#Right AST#ERROR#Left : 'app_launch' | 'app_close' | 'contact_add' | 'contact_edit' | 'greeting_generate' | 'greeting_use' | 'feature_use' AST#ERROR#Right , AST#parameter#Left eventData ? : AST#type_annotation#Lef...
trackEvent(eventType: 'app_launch' | 'app_close' | 'contact_add' | 'contact_edit' | 'greeting_generate' | 'greeting_use' | 'feature_use', eventData?: EventData): void { const event: UsageEvent = { eventType, eventData, timestamp: new Date().toISOString(), sessionId: this.currentSessionId ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L327-L339
52129068ba9d1c9261d4ac5d47322ff3c4843793
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard2x4.ets
arkts
getBirthdayTextColor
获取生日文本颜色
private getBirthdayTextColor(item: any): ResourceColor { if (item.isToday) { return '#FF5722'; } else if (item.isTomorrow) { return '#2196F3'; } return $r('app.color.text_secondary'); }
AST#method_declaration#Left private getBirthdayTextColor AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceColor A...
private getBirthdayTextColor(item: any): ResourceColor { if (item.isToday) { return '#FF5722'; } else if (item.isTomorrow) { return '#2196F3'; } return $r('app.color.text_secondary'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L247-L254
b03159ff12b7e943dfc56dc2b500fb4eb2d1f619
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
decryptData
模拟使用HUKS生成的新密钥进行解密
async decryptData(resultCallback: Function): Promise<void> { let decryptOptions: HuksProperties[] = new Array(); getAesDecryptProperties(decryptOptions); let aesKeyAlias = 'test_aesKeyAlias'; let handle: number = 0; let options: huks.HuksOptions = { properties: decryptOptions, inData: ci...
AST#method_declaration#Left async decryptData AST#parameter_list#Left ( AST#parameter#Left resultCallback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic...
async decryptData(resultCallback: Function): Promise<void> { let decryptOptions: HuksProperties[] = new Array(); getAesDecryptProperties(decryptOptions); let aesKeyAlias = 'test_aesKeyAlias'; let handle: number = 0; let options: huks.HuksOptions = { properties: decryptOptions, inData: ci...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L339-L373
28cedce6ee0c2c62f41854f9214cabd8c58e94b5
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/casesfeature/swipercomponent/src/main/ets/components/mainpage/SwiperMainPage.ets
arkts
SwiperMainPage
功能说明: 通过Stack组件堆叠图片,实现多层级效果,配合手势滑动和显式动画实现切换的动画效果。同时通过改变数据中间值currentIndex来改变组件zIndex层级和高度来实现切换的效果。 推荐场景: 购物类、资讯类应用的首页轮播 核心组件: 1. SwiperSection: 自定义轮播图 实现步骤: 1. 数据准备。设置SwiperItemViewType(轮播图属性配置)以及初始化轮播图数据。其中SwiperItemViewType包含SwiperData(轮播项数据类)以及 contentBuilder(轮播项视图)两个属性。 @example class SwiperItemViewType { data:...
@Component export struct SwiperMainPage { // 轮播模块列表 swiperListView: SwiperItemViewType[] = []; dynamicsRouterPush:(swiperItemData:SwiperData) => void = (swiperItemData:SwiperData)=>{}; // 当前索引 @State currentIndex: number = 0; aboutToAppear(): void { let swiperData: SwiperData[] = [ new SwiperData...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SwiperMainPage AST#component_body#Left { // 轮播模块列表 AST#property_declaration#Left swiperListView : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SwiperItemViewType [ ] AST#array_type#Right AST#prim...
@Component export struct SwiperMainPage { swiperListView: SwiperItemViewType[] = []; dynamicsRouterPush:(swiperItemData:SwiperData) => void = (swiperItemData:SwiperData)=>{}; @State currentIndex: number = 0; aboutToAppear(): void { let swiperData: SwiperData[] = [ new SwiperData($r('app.media.r...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/casesfeature/swipercomponent/src/main/ets/components/mainpage/SwiperMainPage.ets#L83-L147
be97ecad8258d57438ca5c05b6c6e20c878ddb95
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/entry/src/main/ets/pages/ScenariosExample.ets
arkts
transcodePixelMap
Use createPixelMap to replace pictures of ArrayBuffer type with PixelMap type @param data:Resources obtained from the network
transcodePixelMap(data: http.HttpResponse): void { if (http.ResponseCode.OK === data.responseCode) { const imageData: ArrayBuffer = data.result as ArrayBuffer; // Create a picture source instance through ArrayBuffer const imageSource: image.ImageSource = image.createImageSource(imageData); c...
AST#method_declaration#Left transcodePixelMap AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type...
transcodePixelMap(data: http.HttpResponse): void { if (http.ResponseCode.OK === data.responseCode) { const imageData: ArrayBuffer = data.result as ArrayBuffer; const imageSource: image.ImageSource = image.createImageSource(imageData); const options: image.InitializationOptions = { '...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ScenariosExample.ets#L60-L83
dc150b3f3f62309b102b333666f9ae2b2c8ddccb
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets
arkts
resume
恢复倒计时
resume(): void { if (this.paused && !this.active) { this.paused = false; this.active = true; this.timerId = setInterval(() => { if (!this.active) return; this.remainMs = Math.max(0, this.remainMs - this.refreshFrequency); this.callback?.(this.remainMs); if (this....
AST#method_declaration#Left resume 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 AST#member_expression...
resume(): void { if (this.paused && !this.active) { this.paused = false; this.active = true; this.timerId = setInterval(() => { if (!this.active) return; this.remainMs = Math.max(0, this.remainMs - this.refreshFrequency); this.callback?.(this.remainMs); if (this....
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L84-L100
d74cf2bf414d0292a6d693ff43ea2505ca0f19fc
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets
arkts
clearSound
清除铃声
clearSound(): void { SoundUtil.release(); }
AST#method_declaration#Left clearSound AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Le...
clearSound(): void { SoundUtil.release(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets#L178-L180
dbc8c06be72c06d02833886877dce9b5a7d83b12
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets
arkts
getFilesInDir
获取目录中的文件名列表 @param path 文件绝对路径
static getFilesInDir(path: string) { const fileNames = fs.listFileSync(path); return fileNames; }
AST#method_declaration#Left static getFilesInDir AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaratio...
static getFilesInDir(path: string) { const fileNames = fs.listFileSync(path); return fileNames; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets#L29-L32
134a85c964284b7200517693706458b3d5796483
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
分页响应接口
export interface PagedResponse<T> extends ApiResponse<T[]> { total: number; page: number; pageSize: number; hasMore: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PagedResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#extends_clause#Left extends AST#generic_type#Left ApiResponse AST#type_arguments#Left < AST#type_annotation#Left AST#pri...
export interface PagedResponse<T> extends ApiResponse<T[]> { total: number; page: number; pageSize: number; hasMore: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L21-L26
556cf82ce2c81c392041a65a98466127ced01fbc
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/dialogv2/source/dialogv2.ets
arkts
getTitleAreaMinHeight
get title area min height @returns min height
private getTitleAreaMinHeight(): ResourceStr | number { if (this.secondaryTitle) { return $r('sys.float.alert_title_secondary_height'); } else if (this.primaryTitle) { return $r('sys.float.alert_title_primary_height'); } else { return 0; } }
AST#method_declaration#Left private getTitleAreaMinHeight AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#...
private getTitleAreaMinHeight(): ResourceStr | number { if (this.secondaryTitle) { return $r('sys.float.alert_title_secondary_height'); } else if (this.primaryTitle) { return $r('sys.float.alert_title_primary_height'); } else { return 0; } }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1344-L1352
8885cfbe08dece5de8e164c73210d08760b525af
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_bookmarks.ets
arkts
move_bookmark
Moves a bookmark to another directory @param bookmark_path directory of bookmark to be moved @param to_path directory of destination @returns 0 if success @returns 1 if no bookmark selected @returns 2 if name crash
move_bookmark(bookmark_path: string, to_path: string) { if (bookmark_path == "") { console.log("[ERROR][Meow][bunch_of_bookmarks] Empty bookmark_path!") return 1; } // Get objects let item_bookmark = this.get_bookmark(bookmark_path); let target_folder: bookmark | undefined; if (to_pa...
AST#method_declaration#Left move_bookmark AST#parameter_list#Left ( AST#parameter#Left bookmark_path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to_path : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
move_bookmark(bookmark_path: string, to_path: string) { if (bookmark_path == "") { console.log("[ERROR][Meow][bunch_of_bookmarks] Empty bookmark_path!") return 1; } let item_bookmark = this.get_bookmark(bookmark_path); let target_folder: bookmark | undefined; if (to_path == "") { ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L262-L296
5bc7d0ead731fa1e94b70c88065911d6a462d027
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/navigation/LocalStorageNav.ets
arkts
LocalStorageNav
@file 本地存储示例页导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function LocalStorageNav(): void { LocalStoragePage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LocalStorageNav 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_custo...
@Builder export function LocalStorageNav(): void { LocalStoragePage(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/navigation/LocalStorageNav.ets#L8-L11
b3ed0d75b2e3425a8468dfc7530ccf12713cfc13
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/utils/ColorPickerUtil.ets
arkts
setRgba
创建RGBA颜色字符串 @param red 红色分量 (0-255) @param green 绿色分量 (0-255) @param blue 蓝色分量 (0-255) @param opacity 透明度 (0.0-1.0) @returns 格式化的RGBA字符串
public static setRgba(red: number, green: number, blue: number, opacity: number): string { return `rgba(${red},${green},${blue},${opacity})`; }
AST#method_declaration#Left public static setRgba AST#parameter_list#Left ( AST#parameter#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left green : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
public static setRgba(red: number, green: number, blue: number, opacity: number): string { return `rgba(${red},${green},${blue},${opacity})`; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/utils/ColorPickerUtil.ets#L38-L40
0a05a5e2760d11425bb1fad9a45945b8f3a81f6b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
startContinuousTask
启动后台任务 @returns {void}
startContinuousTask(): void { // 避免重新启动后台任务 if (this.isBackgroundTaskRunning) { return; } // TODO:知识点:创建WantAgent实例,在后台任务时拉起应用 let wantAgentInfo: wantAgent.WantAgentInfo = { // 点击通知后,将要执行的动作列表 // 添加需要被拉起应用的bundleName和abilityName wants: [ { bundleName: "com....
AST#method_declaration#Left startContinuousTask 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#membe...
startContinuousTask(): void { if (this.isBackgroundTaskRunning) { return; } let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: "com.north.cases", abilityName: "com.north.cases.EntryAbility" } ], ac...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L279-L314
ca420195602bf9c6bebe9bf17d4f32e776fbbe7b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets
arkts
setAVPlayState
Setting the Playback Status of the Playback Control Center. @param state Status of the Playback Control Center.
public static setAVPlayState(state: avSession.PlaybackState) { if (state === undefined) { Logger.info(TAG, 'setAVPlayState fail,state is empty.'); return; } let currentSession = GlobalContext.getContext().getObject('currentSession') as avSession.AVSession; currentSession.setAVPlaybackState({...
AST#method_declaration#Left public static setAVPlayState AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left avSession . PlaybackState AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_lis...
public static setAVPlayState(state: avSession.PlaybackState) { if (state === undefined) { Logger.info(TAG, 'setAVPlayState fail,state is empty.'); return; } let currentSession = GlobalContext.getContext().getObject('currentSession') as avSession.AVSession; currentSession.setAVPlaybackState({...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets#L77-L90
97b88f31797f2fa06540c3ca0e17b4a9add3e446
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ApplicationServices/OAID/entry/src/main/ets/common/CommonConstants.ets
arkts
Constants for components.
export class CommonConstants { /** * Text width percentage: 100%. */ static readonly TEXT_WIDTH: string = '100%'; /** * TextArea width percentage: 100%. */ static readonly TEXTAREA_WIDTH: string = '100%'; /** * Bottom width percentage: 85%. */ static readonly BOTTOM_WIDTH: string = '85%'; ...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Text width percentage: 100%. */ AST#property_declaration#Left static readonly TEXT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#ex...
export class CommonConstants { static readonly TEXT_WIDTH: string = '100%'; static readonly TEXTAREA_WIDTH: string = '100%'; static readonly BOTTOM_WIDTH: string = '85%'; static readonly COLUMN_HEIGHT: string = '100%'; static readonly DESC_STYLE_WIDTH: string = '100%'; static readonly WIND...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ApplicationServices/OAID/entry/src/main/ets/common/CommonConstants.ets#L19-L52
024c14a826c1909dd3998964512b626b6a48e1b4
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/NotificationUtil.ets
arkts
cancelNotice
取消通知 @param noticeId 通知id @param callBack 回调函数 @returns
static cancelNotice(noticeId: number, callBack?: () => void): void { notificationManager.cancel(noticeId, (err: Base.BusinessError) => { if (err) { ToastUtil.showToast('取消通知出错,原因为:' + err.message); } else { if (callBack) { callBack(); } } }); }
AST#method_declaration#Left static cancelNotice AST#parameter_list#Left ( AST#parameter#Left noticeId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callBack ? : AST#type_annotation#Left AST#function_type#Left AST#paramet...
static cancelNotice(noticeId: number, callBack?: () => void): void { notificationManager.cancel(noticeId, (err: Base.BusinessError) => { if (err) { ToastUtil.showToast('取消通知出错,原因为:' + err.message); } else { if (callBack) { callBack(); } } }); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L381-L391
e9ae63a244d92f04082a291d3b92c16609509a6e
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/userModel.ets
arkts
存储多个用户
constructor() { this.initializePreferences(); // 初始化时加载用户 }
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 this AST#expression#Right . initia...
constructor() { this.initializePreferences(); }
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L25-L27
05805cece660228763ddc8c3790b92595aff6340
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/Index.ets
arkts
buildQuickActions
构建快捷操作
@Builder buildQuickActions() { Column({ space: 16 }) { Text('快捷操作') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Row({ space: 16 }) { this.buildQuickActionItem('添加联系人', $r('app.media.ic_add'), () => { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildQuickActions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_p...
@Builder buildQuickActions() { Column({ space: 16 }) { Text('快捷操作') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Row({ space: 16 }) { this.buildQuickActionItem('添加联系人', $r('app.media.ic_add'), () => { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L340-L379
e3471f81c9d959671e6d7a8640411c572ada4646
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets
arkts
useSocket
[End monitor_default_network_change] 原网络连接使用Socket模块建立连接
async function useSocket() { let tcpConnectOptions: socket.TCPConnectOptions = { address: netAddress, timeout: 6000 // 连接超时时间 }; /* 建立socket连接 */ sock.connect(tcpConnectOptions, (err: BusinessError) => { if (err) { Logger.error('connect fail'); promptAction.showToast({ message: ...
AST#function_declaration#Left async function useSocket AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tcpConnectOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . TCP...
async function useSocket() { let tcpConnectOptions: socket.TCPConnectOptions = { address: netAddress, timeout: 6000 }; sock.connect(tcpConnectOptions, (err: BusinessError) => { if (err) { Logger.error('connect fail'); promptAction.showToast({ message: 'Connect fail!', ...
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#L49-L88
7b2fc546ce710a6b79c31f13eb497f92aa7125d8
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
hash
计算哈希值
private hash(key: K): number { const keyStr = String(key); let hash = 0; for (let i = 0; i < keyStr.length; i++) { hash = ((hash << 5) - hash) + keyStr.charCodeAt(i); hash = hash & hash; // Convert to 32bit integer } return Math.abs(hash) % this.capacity; }
AST#method_declaration#Left private hash AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#...
private hash(key: K): number { const keyStr = String(key); let hash = 0; for (let i = 0; i < keyStr.length; i++) { hash = ((hash << 5) - hash) + keyStr.charCodeAt(i); hash = hash & hash; } return Math.abs(hash) % this.capacity; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L34-L42
f3d992102b075c3458692a0e53bb7ed5d95f29b3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
needsHighlight
Checks if the given index is set to be highlighted. @param index @return
public needsHighlight(index: number): boolean { // no highlight if (!this.valuesToHighlight()) return false; if (this.mIndicesToHighlight) { for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { // check if the xvalue for the given dataset needs highlight if ( /*(...
AST#method_declaration#Left public needsHighlight AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primar...
public needsHighlight(index: number): boolean { if (!this.valuesToHighlight()) return false; if (this.mIndicesToHighlight) { for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { if ( Math.round(this.mIndicesToHighlight[i].getX()) == index) ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L317-L333
7184be5cb3929bf0eb3756e9ba7659f78944874a
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/ArticleNode.ets
arkts
数据类型(开发者可以自行扩展数据属性) @param {number} type - 数据类型 @param {string} title - 数据标题 @param {string} url - 文章地址 @param {ArticleNode[]} children - 子数据列表
export class ArticleNode { public type: number = 0 public title: string = '' public url?: string = '' public children?:ArticleNode[] = [] }
AST#export_declaration#Left export AST#class_declaration#Left class ArticleNode AST#class_body#Left { AST#property_declaration#Left public type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#property_declaration#...
export class ArticleNode { public type: number = 0 public title: string = '' public url?: string = '' public children?:ArticleNode[] = [] }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/ArticleNode.ets#L25-L30
337cae7044884737f8ab5ab4c9cbd2416bb07988
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/WindowUtil.ets
arkts
findWindow
查找name所对应的窗口。 @param name 窗口名字,即Configuration中的name。 @returns
static findWindow(name: string): window.Window { return window.findWindow(name); }
AST#method_declaration#Left static findWindow AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left...
static findWindow(name: string): window.Window { return window.findWindow(name); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/WindowUtil.ets#L432-L434
ab556c03472c0af0b12a4c60b8ea6b461a9b7bca
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets
arkts
clear
只有退出和重启会调用
clear() { this._navigatorDelegateStack.clear(); this.globalPageRecordStack.clear(); }
AST#method_declaration#Left clear 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 this AST#ex...
clear() { this._navigatorDelegateStack.clear(); this.globalPageRecordStack.clear(); }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets#L66-L69
768d257fa2dab7d97d29a41698d668d7cef2c382
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/guide/GuideService.ets
arkts
getGuideShowCount
获取引导显示次数
async getGuideShowCount(key: string): Promise<number> { try { const guideKey = `${this.GUIDE_PREFIX}${key}`; return await StorageManager.getNumber(`${guideKey}_count`, 0); } catch (error) { Logger.error('GuideService', `Failed to get guide show count: ${String(error)}`); return 0; } ...
AST#method_declaration#Left async getGuideShowCount 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#L...
async getGuideShowCount(key: string): Promise<number> { try { const guideKey = `${this.GUIDE_PREFIX}${key}`; return await StorageManager.getNumber(`${guideKey}_count`, 0); } catch (error) { Logger.error('GuideService', `Failed to get guide show count: ${String(error)}`); return 0; } ...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/guide/GuideService.ets#L63-L71
8cd1f0e6678e4b53b104db4d8509c3297418a368
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/view/CardComponent.ets
arkts
CardComponent
CardComponent is a container with round corner.
@Component export default struct CardComponent { @BuilderParam children: () => void = () => {}; paddingValue: Padding | Length = { top: CardStyle.CARD_PADDING_VERTICAL, bottom: CardStyle.CARD_PADDING_VERTICAL, left: CardStyle.CARD_PADDING_HORIZONTAL, right: CardStyle.CARD_PADDING_HORIZONTAL }; m...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CardComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right children : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ...
@Component export default struct CardComponent { @BuilderParam children: () => void = () => {}; paddingValue: Padding | Length = { top: CardStyle.CARD_PADDING_VERTICAL, bottom: CardStyle.CARD_PADDING_VERTICAL, left: CardStyle.CARD_PADDING_HORIZONTAL, right: CardStyle.CARD_PADDING_HORIZONTAL }; m...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/view/CardComponent.ets#L21-L56
0e413dd730b54f474b6eba05d5ff9c914ba9ee64
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/references_object/constructor_field_001_T.ets
arkts
Introduction 构造函数
export function constructor_field_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a.data); }
AST#export_declaration#Left export AST#function_declaration#Left function constructor_field_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_state...
export function constructor_field_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/references_object/constructor_field_001_T.ets#L6-L9
cbef10d53f91dd909c4014c5ec1612a0493f81c8
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets
arkts
setListener
设置回调
private static setListener(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => { }) { // 创建回调对象 let setListener: speechRecognizer.RecognitionListener = { // 开始识别成功回调 onStart(sessionId: string, eventMessage: string) { }, // 事件回调 onEvent(sessionId: string, eve...
AST#method_declaration#Left private static setListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left srr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionRes...
private static setListener(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => { }) { let setListener: speechRecognizer.RecognitionListener = { onStart(sessionId: string, eventMessage: string) { }, onEvent(sessionId: string, eventCode: number, eventMessag...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets#L46-L72
6dbbfa0307b5e64d6e7bc105146d25f1dbfbab1f
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/RadarChartRenderer.ets
arkts
drawDataSet
Draws the RadarDataSet @param c @param dataSet @param mostEntries the entry count of the dataset with the most entries
protected drawDataSet(c: CanvasRenderingContext2D, dataSet: IRadarDataSet, mostEntries: number): void { if (!this.mAnimator) { return; } let phaseX: number = this.mAnimator.getPhaseX(); let phaseY: number = this.mAnimator.getPhaseY(); let sliceangle: number = this.mChart.getSliceAngle(); ...
AST#method_declaration#Left protected drawDataSet AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left IR...
protected drawDataSet(c: CanvasRenderingContext2D, dataSet: IRadarDataSet, mostEntries: number): void { if (!this.mAnimator) { return; } let phaseX: number = this.mAnimator.getPhaseX(); let phaseY: number = this.mAnimator.getPhaseY(); let sliceangle: number = this.mChart.getSliceAngle(); ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/RadarChartRenderer.ets#L93-L164
8b8ee561c2c85e860183e418626aaf772acaa3b6
gitee
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
体系分类 @param date @returns
export function systemCategory() { return axiosClient.get<SystemModel[]>({ url: `tree/json`, showLoading:true }) }
AST#export_declaration#Left export AST#function_declaration#Left function systemCategory 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#exp...
export function systemCategory() { return axiosClient.get<SystemModel[]>({ url: `tree/json`, showLoading:true }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L193-L198
359ac77a7401de5a4553bf97f9458be9e7eebb85
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
pauseTask
暂停任务
async pauseTask(id: number): Promise<boolean> { return await this.updateTask(id, { status: 'pending' }); }
AST#method_declaration#Left async pauseTask AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promi...
async pauseTask(id: number): Promise<boolean> { return await this.updateTask(id, { status: 'pending' }); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L347-L351
795a59e2415d5f7b15d42c39bc4cefc674f94ab3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets
arkts
getChartPoint
Get chart point. @param {number} stepsValue Value of steps. @return {ChartPoint} chartPoint.
getChartPoint(stepsValue: number) { let chartPoint: ChartPoint = new ChartPoint(); // Value of a chart point. if the value exceeds 1000, only 1000 is displayed. chartPoint.value = Math.min(CommonConstants.TARGET_STEPS, stepsValue); chartPoint.description = stepsValue.toString(); // Display position ...
AST#method_declaration#Left getChartPoint AST#parameter_list#Left ( AST#parameter#Left stepsValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration...
getChartPoint(stepsValue: number) { let chartPoint: ChartPoint = new ChartPoint(); chartPoint.value = Math.min(CommonConstants.TARGET_STEPS, stepsValue); chartPoint.description = stepsValue.toString(); chartPoint.textLocation = CommonConstants.TEXT_LOCATION; chartPoint.textColor = Com...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets#L76-L92
004391a8cace6b6fc77258995cc47a616cbad95c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List_HDC/entry/src/main/ets/common/utils/Log.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
export class Logger { private static isAppDebugMode: boolean = true; private static appIdentifier: string = 'List'; public static verbose(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().verbose(tag, msg); } } public static debug(tag: ...
AST#export_declaration#Left export AST#class_declaration#Left class Logger AST#class_body#Left { AST#property_declaration#Left private static isAppDebugMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#b...
export class Logger { private static isAppDebugMode: boolean = true; private static appIdentifier: string = 'List'; public static verbose(tag: string, msg: string): void { if (Logger.isAppDebugMode) { Logger.getInstance().verbose(tag, msg); } } public static debug(tag: ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/utils/Log.ets#L16-L82
cafa8dea9a275535a1a639617a8423cf30c31f7f
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/components/feature/src/main/ets/pages/DialogBoxes/BindContentCoverBootcamp.ets
arkts
compEventTriggeredLog
compEvent
compEventTriggeredLog(value: string) { let time = formatDate(new Date(Date.now())) this.listEventTriggeredTagsTemp.push( new BlockTag(time, value) ) setTimeout(() => { if (AppStorage.get('Block')) { this.listEventTriggeredTags = this.listEventTriggeredTags.concat( this.list...
AST#method_declaration#Left compEventTriggeredLog AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declarat...
compEventTriggeredLog(value: string) { let time = formatDate(new Date(Date.now())) this.listEventTriggeredTagsTemp.push( new BlockTag(time, value) ) setTimeout(() => { if (AppStorage.get('Block')) { this.listEventTriggeredTags = this.listEventTriggeredTags.concat( this.list...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/components/feature/src/main/ets/pages/DialogBoxes/BindContentCoverBootcamp.ets#L78-L100
acca9680e44d354432fc20ea6c8b4f550defe67e
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
media/Image/photomodify/index.ets
arkts
logger
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { logger } from './src/main/ets/components/util/Logger'
AST#export_declaration#Left export { logger } from './src/main/ets/components/util/Logger' AST#export_declaration#Right
export { logger } from './src/main/ets/components/util/Logger'
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/media/Image/photomodify/index.ets#L16-L16
5ab8e21ac4640dbda2a3fedf6b56295081b111f9
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
openExtensionServiceManagementApplicationListener
listen extensionService application
openExtensionServiceManagementApplicationListener() { try { bundleMonitor.on('add', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Add bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exce...
AST#method_declaration#Left openExtensionServiceManagementApplicationListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#...
openExtensionServiceManagementApplicationListener() { try { bundleMonitor.on('add', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Add bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exce...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L104-L129
e771ec4e7acc3f7041aa0e37fdfd7d2c482f9278
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
convertSM2PubKey
将服务器端生成的16进制的长度为130位的04开头的C1C3C2格式的SM2公钥转换为前端所需的ASN.1格式公钥字符串 @param pubKey 04开头的16进制的130位的公钥字符串 @returns 转换后的公钥字符串
static async convertSM2PubKey(pubKey: string): Promise<string> { if (pubKey.length != 130) { return '服务器端SM2公钥长度不正确~'; } //截取x参数 let px = pubKey.substring(2, 66); //截取y参数 let py = pubKey.substring(66); //转16进制放入对应的位置 04+x+y let pk: cryptoFramework.Point = { x: BigInt("0x" + p...
AST#method_declaration#Left static async convertSM2PubKey AST#parameter_list#Left ( AST#parameter#Left pubKey : 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#gener...
static async convertSM2PubKey(pubKey: string): Promise<string> { if (pubKey.length != 130) { return '服务器端SM2公钥长度不正确~'; } let px = pubKey.substring(2, 66); let py = pubKey.substring(66); let pk: cryptoFramework.Point = { x: BigInt("0x" + px), y: BigInt("0x" + py) ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L80-L106
15b44c0378dbc3b2379f8dbf443b10af202272c3
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets
arkts
MARK: - PlanHelper
export class DBPlanHelper { private plan: DBPlan; constructor(plan: DBPlan) { this.plan = plan; } // MARK: - Private Helpers /** 获取此 DBPlan 的 DBPieces */ async dbPieces(): Promise<DBPiece[]> { if (this.plan.planId) { return await PlanDbAccess.shared.getPieces(this.plan.planId) ?? []; }...
AST#export_declaration#Left export AST#class_declaration#Left class DBPlanHelper AST#class_body#Left { AST#property_declaration#Left private plan : AST#type_annotation#Left AST#primary_type#Left DBPlan AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left con...
export class DBPlanHelper { private plan: DBPlan; constructor(plan: DBPlan) { this.plan = plan; } async dbPieces(): Promise<DBPiece[]> { if (this.plan.planId) { return await PlanDbAccess.shared.getPieces(this.plan.planId) ?? []; } return []; } async dbBoxes(pieceNo?: numb...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets#L8-L135
4592c351c125c56039c6d41dfebd487b4c4cf72d
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/common/AppTheme.ets
arkts
主题管理器
export class ThemeManager { private static instance: ThemeManager; private currentTheme: AppTheme = lightTheme; private listeners: ((theme: AppTheme) => void)[] = []; private constructor() {} static getInstance(): ThemeManager { if (!ThemeManager.instance) { ThemeManager.instance = new ThemeManage...
AST#export_declaration#Left export AST#class_declaration#Left class ThemeManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left ThemeManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declar...
export class ThemeManager { private static instance: ThemeManager; private currentTheme: AppTheme = lightTheme; private listeners: ((theme: AppTheme) => void)[] = []; private constructor() {} static getInstance(): ThemeManager { if (!ThemeManager.instance) { ThemeManager.instance = new ThemeManage...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/AppTheme.ets#L68-L110
f135ab598b78f6a37745a317a2cd0e1e303d5bc9
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.inputMethodList.d.ets
arkts
@file @kit IMEKit Define pattern options of keyboard. @interface PatternOptions @syscap SystemCapability.MiscServices.InputMethodFramework @since 11
export interface PatternOptions { /** * The default selected pattern, The defaultSelected will default to 0 if left blank * * @type { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ defaultSelected?: number; /** * the patterns of input ...
AST#export_declaration#Left export AST#interface_declaration#Left interface PatternOptions AST#object_type#Left { /** * The default selected pattern, The defaultSelected will default to 0 if left blank * * @type { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11...
export interface PatternOptions { defaultSelected?: number; patterns: Array<Pattern>; action: (index: number) => void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.inputMethodList.d.ets#L26-L51
ccb7726d25a40051d3d6bb01fe86861d0d268817
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/lineCharts/LineChartNotAxisConfigPage.ets
arkts
menuCallback
标题栏菜单回调
@Monitor("titleModel.index") menuCallback() { if (this.titleModel === null || this.titleModel === undefined) { return } let index: number = this.titleModel.getIndex() if (index === undefined || index === null || index === -1) { return } if (this.model === null || this.model === u...
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left "titleModel.index" AST#expression#Right ) AST#decorator#Right menuCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST...
@Monitor("titleModel.index") menuCallback() { if (this.titleModel === null || this.titleModel === undefined) { return } let index: number = this.titleModel.getIndex() if (index === undefined || index === null || index === -1) { return } if (this.model === null || this.model === u...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/lineCharts/LineChartNotAxisConfigPage.ets#L46-L89
ecce945e55890daa883cf2decd99ad55f23eac7f
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/IconListViewModel.ets
arkts
Icon status.
export interface IconStatus { normal: Resource, chosen: Resource }
AST#export_declaration#Left export AST#interface_declaration#Left interface IconStatus AST#object_type#Left { AST#type_member#Left normal : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left chosen : AST#type_annotation#L...
export interface IconStatus { normal: Resource, chosen: Resource }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/IconListViewModel.ets#L19-L22
3b29ee485033a865ae7ed38ab95733858a9fbf05
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Rdb/RdbUtils.ets
arkts
isCreateTable
确认创建
isCreateTable(tableName: string, columns: Array<ColumnInfo>): Promise<boolean> { return this.createTable(tableName, columns).then(() => { return true; }).catch((error: Error) => { return false; }); }
AST#method_declaration#Left isCreateTable AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left columns : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
isCreateTable(tableName: string, columns: Array<ColumnInfo>): Promise<boolean> { return this.createTable(tableName, columns).then(() => { return true; }).catch((error: Error) => { return false; }); }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbUtils.ets#L55-L61
8a05b6e8dbeb9fb85563cef4cdda374bded46905
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets
arkts
detachWeb
卸载Webview
detachWeb() : void { this.rootNode = null; }
AST#method_declaration#Left detachWeb AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_e...
detachWeb() : void { this.rootNode = null; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets#L80-L82
e5136a558b9f6eab3081f2410bae6d07892c808b
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/model/Memo.ets
arkts
Memo insert/update data
export interface MemoData { content: string; created_at: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MemoData AST#object_type#Left { AST#type_member#Left content : 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 created_at : AST#type_annotation#...
export interface MemoData { content: string; created_at: number; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/Memo.ets#L18-L21
ccf5e08cd432e319d865d7a5882b939816c2b478
github
AIxiaoHanBao/ArkTs-Study.git
31abbb6f91dd2333c8b7650d8f6010f39be846b9
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * The index page message. */ static readonly INDEX_MESSAGE: string = 'Index Page'; /** * The src msg. */ static readonly SECOND_SRC_MSG: string = 'Index页面传来的数据'; /** * The second page url. */ static readonly SECOND_URL: string = 'pages/Test2'; ...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The index page message. */ AST#property_declaration#Left static readonly INDEX_MESSAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = ...
export default class CommonConstants { static readonly INDEX_MESSAGE: string = 'Index Page'; static readonly SECOND_SRC_MSG: string = 'Index页面传来的数据'; static readonly SECOND_URL: string = 'pages/Test2'; static readonly SECOND_MESSAGE: string = 'Second Page'; static readonly SECOND_SRC_PARAM:...
https://github.com/AIxiaoHanBao/ArkTs-Study.git/blob/31abbb6f91dd2333c8b7650d8f6010f39be846b9/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L89
86754871a105e3d97502212440c37df1157032b1
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/view/Home.ets
arkts
Home
"首页"内容
@Component export default struct Home { private swiperController: SwiperController = new SwiperController(); build() { Scroll() { Column({ space: CommonConstants.COMMON_SPACE }) { Column() { Text($r('app.string.mainPage_tabTitles_home')) .fontWeight(FontWeight.Medium) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Home AST#component_body#Left { AST#property_declaration#Left private swiperController : AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right = AST#ex...
@Component export default struct Home { private swiperController: SwiperController = new SwiperController(); build() { Scroll() { Column({ space: CommonConstants.COMMON_SPACE }) { Column() { Text($r('app.string.mainPage_tabTitles_home')) .fontWeight(FontWeight.Medium) ...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/view/Home.ets#L8-L97
895cb85d583e2594025a536684ab7064cf3e1ed4
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
loadQueue
加载待听队列
async loadQueue() { try { this.queueEpisodes = await this.dbService.getQueueEpisodes(); console.info(`[MainPage] Loaded ${this.queueEpisodes.length} queue items`); } catch (error) { console.error('[MainPage] Failed to load queue:', error); } }
AST#method_declaration#Left async loadQueue AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#L...
async loadQueue() { try { this.queueEpisodes = await this.dbService.getQueueEpisodes(); console.info(`[MainPage] Loaded ${this.queueEpisodes.length} queue items`); } catch (error) { console.error('[MainPage] Failed to load queue:', error); } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L294-L301
5740e250e37c8158753da6e84630beffe49a4853
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/RequestUserAuthorization/entry/src/main/ets/secondability/SecondAbility.ets
arkts
onCreate
[StartExclude request_permission_in_UIAbility]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
AST#method_declaration#Left onCreate 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#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/RequestUserAuthorization/entry/src/main/ets/secondability/SecondAbility.ets#L59-L61
f4f9475d2f409916b34e077ddea3097512929119
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/GoodsCommentSubmitRequest.ets
arkts
@param {GoodsCommentSubmitRequest} init - 初始化数据
constructor(init: GoodsCommentSubmitRequest) { this.orderId = init.orderId; this.data = new Comment(init.data); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left GoodsCommentSubmitRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expr...
constructor(init: GoodsCommentSubmitRequest) { this.orderId = init.orderId; this.data = new Comment(init.data); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/GoodsCommentSubmitRequest.ets#L20-L23
4e29a70f79a3c745c0c7ed0bff4437b89a6dcded
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
createWindow
创建子窗口或者系统窗口,使用Promise异步回调。 @param config 创建窗口时的参数。 需要权限: 当创建窗口类型为window.WindowType.TYPE_FLOAT时,需要ohos.permission.SYSTEM_FLOAT_WINDOW权限 @returns
static async createWindow(config: window.Configuration): Promise<window.Window> { return window.createWindow(config); }
AST#method_declaration#Left static async createWindow AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Configuration AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Rig...
static async createWindow(config: window.Configuration): Promise<window.Window> { return window.createWindow(config); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L505-L507
96194bd47612f2fce2852b05e87122b613cd0f1d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets
arkts
AccountLogout
帐号登出
async AccountLogout() { Logger.info('AccountLogout start'); let accountInfo = await accountAbility.getOsAccountDistributedInfo(); let info: UserInfo = { name: '', id: '1234', event: 'Ohos.account.event.LOGIN', nickname: 'nickname', avatar: 'avatar' } if (accountInfo.nam...
AST#method_declaration#Left async AccountLogout 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 Logger AST#expression#Right . i...
async AccountLogout() { Logger.info('AccountLogout start'); let accountInfo = await accountAbility.getOsAccountDistributedInfo(); let info: UserInfo = { name: '', id: '1234', event: 'Ohos.account.event.LOGIN', nickname: 'nickname', avatar: 'avatar' } if (accountInfo.nam...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L135-L152
f0d0b782f56553b31b36713e0d2183fd7760eae4
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
decryptGCM
解密(GCM模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|GCM|PKCS7、AES192|GCM|PKCS7、AES128|GCM|PKCS7)。 @returns
static async decryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher(transformation); await decoder.init(cryptoFramework.C...
AST#method_declaration#Left static async decryptGCM AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym...
static async decryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher(transformation); await decoder.init(cryptoFramework.C...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L73-L81
3acbf7cf3154fea14554a32af4c589300c21adf1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/groupavatar/src/main/ets/model/SnapShotModel.ets
arkts
setComponentId
设置id @param {string} componentId - 组件id
setComponentId(componentId: string) { this.componentId = componentId; }
AST#method_declaration#Left setComponentId AST#parameter_list#Left ( AST#parameter#Left componentId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#e...
setComponentId(componentId: string) { this.componentId = componentId; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/model/SnapShotModel.ets#L37-L39
75bd34fbe3679efbbe044e964db85102bf58ec7a
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets
arkts
getLayoutInfoCache
getLayoutInfoCache
getLayoutInfoCache() { return this.layoutInfo; }
AST#method_declaration#Left getLayoutInfoCache AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . layoutInfo AST#member_expression#Right AST#exp...
getLayoutInfoCache() { return this.layoutInfo; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L204-L206
7d897d30bda798f4808af689b7bd17ca703798c1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraServiceUint.ets
arkts
sessionFlowFn
会话流
async sessionFlowFn(cameraManager: camera.CameraManager, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput | undefined): Promise<void> { try { // 创建CaptureSession实例 this.session = cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; this.session...
AST#method_declaration#Left async sessionFlowFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ca...
async sessionFlowFn(cameraManager: camera.CameraManager, cameraInput: camera.CameraInput, previewOutput: camera.PreviewOutput | undefined): Promise<void> { try { this.session = cameraManager.createSession(camera.SceneMode.NORMAL_PHOTO) as camera.PhotoSession; this.session.beginConfig(); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraServiceUint.ets#L221-L236
ffd667db837d56f53b0c145170551e7c9ec754d8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
importData
导入数据
private async importData(): Promise<void> { try { console.log('[Settings] Starting data import...'); promptAction.showDialog({ title: '导入数据', message: '导入数据将覆盖当前所有联系人,是否继续?', buttons: [ { text: '取消', color: '#999999' }, { ...
AST#method_declaration#Left private async importData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#ty...
private async importData(): Promise<void> { try { console.log('[Settings] Starting data import...'); promptAction.showDialog({ title: '导入数据', message: '导入数据将覆盖当前所有联系人,是否继续?', buttons: [ { text: '取消', color: '#999999' }, { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1322-L1356
dc8a3e2884f25defd064072f3ceac2ded5ff984b
github
yanweiguo198-commits/Harmony-Calendar-App.git
9ebdfbe588dfc230231af619a6eeb89b3c7fc39f
entry/src/main/ets/pages/Index.ets
arkts
handleSaveEvent
--- 2. 保存/更新逻辑 ---
async handleSaveEvent(event: CalendarEvent) { // 提醒逻辑 if (event.isReminded && event.startTime > new Date().getTime()) { // 简单处理:先取消旧提醒(如果有),再加新提醒 if (event.reminderId !== -1) { await ReminderService.cancelReminder(event.reminderId); } let targetDate = new Date(event.startTime); ...
AST#method_declaration#Left async handleSaveEvent AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left CalendarEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 提醒逻辑 AST#ui_control_flow...
async handleSaveEvent(event: CalendarEvent) { if (event.isReminded && event.startTime > new Date().getTime()) { if (event.reminderId !== -1) { await ReminderService.cancelReminder(event.reminderId); } let targetDate = new Date(event.startTime); event.reminderId = await Re...
https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/pages/Index.ets#L44-L69
65ee7fee43a4537b08347a0efeab57a0acf75d2d
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/data/RegionData.ets
arkts
getRegionOptions
获取地区级联选项 @returns {IBestCascaderOption[]} 地区选项
static getRegionOptions(): IBestCascaderOption[] { return REGION_OPTIONS; }
AST#method_declaration#Left static getRegionOptions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IBestCascaderOption [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#re...
static getRegionOptions(): IBestCascaderOption[] { return REGION_OPTIONS; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/data/RegionData.ets#L1354-L1356
773b38efb7a546520694808df852497f2430c652
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PhotoBrowserRange. include ALL and SELECTED_ONLY @enum { number } PhotoBrowserRange @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare enum PhotoBrowserRange { /** * ALL. all photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ ALL = 0, /** * SELECTED_ONLY. only selected photos or vedios * * @syscap SystemCapability.Fi...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PhotoBrowserRange AST#enum_body#Left { /** * ALL. all photos or vedios * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#enum_member...
export declare enum PhotoBrowserRange { ALL = 0, SELECTED_ONLY = 1 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L739-L756
23381892f6e106d77093b9ac58f790f96c9ce494
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SyncTypes.ets
arkts
数据同步相关类型定义 包含云端同步、冲突解决、备份恢复等功能的类型定义 用户认证相关
export interface UserCredentials { email?: string; phone?: string; password: string; authCode?: string; // 验证码 }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserCredentials AST#object_type#Left { AST#type_member#Left email ? : 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 phone ? : AST#type_annotat...
export interface UserCredentials { email?: string; phone?: string; password: string; authCode?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L9-L14
ff9ef070bac05d3d474f431b17c2c582c1c68f37
github
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/05.输入框与按钮和组件间隔.ets
arkts
@State message: string = 'Hello World123';
build() { // build里面只能有一个容器组件 // 使用space控制组件间的距离 Column({ space: 20 }) { TextInput({ placeholder: '请输入用户名' }) TextInput({ placeholder: '请输入密码' }) .type(InputType.Password) Button('登录') .width(200) } .padding(10) }
AST#build_method#Left build ( ) AST#build_body#Left { // build里面只能有一个容器组件 // 使用space控制组件间的距离 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 20 AST#expression#Right AST#component_paramete...
build() { Column({ space: 20 }) { TextInput({ placeholder: '请输入用户名' }) TextInput({ placeholder: '请输入密码' }) .type(InputType.Password) Button('登录') .width(200) } .padding(10) }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/05.输入框与按钮和组件间隔.ets#L8-L23
85432dd5eeadbba8d3d77e5eb5f33a0fecc35c9e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
getSmartSuggestions
获取智能建议
getSmartSuggestions(): SmartSuggestion[] { return this.smartSuggestions.filter(s => !s.read); }
AST#method_declaration#Left getSmartSuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SmartSuggestion [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_sta...
getSmartSuggestions(): SmartSuggestion[] { return this.smartSuggestions.filter(s => !s.read); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L546-L548
d0bbfa90945654a024c435269510519f12c62ae3
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/context/ContextUtil.ets
arkts
init
在 UIAbility 的 onCreate 方法中获取 UIAbilityContext
static init(context: common.UIAbilityContext) { ContextUtil.context = context; }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bui...
static init(context: common.UIAbilityContext) { ContextUtil.context = context; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/context/ContextUtil.ets#L33-L35
5addbf7bd4052e941e6fcb08ee4eb7539473b8a6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
arkts
action
聊天页面传来的相应动作
action(): void { Logger.info(TAG, `action_sendMsg:${this.sendMsg}`); if (this.sendMsg === 'closeSocket') { this.socketController?.closeSocket(); } else if (this.sendMsg === 'clear') { } else { // 转发消息 包括事件 this.sendData(this.sendMsg); } }
AST#method_declaration#Left action AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A...
action(): void { Logger.info(TAG, `action_sendMsg:${this.sendMsg}`); if (this.sendMsg === 'closeSocket') { this.socketController?.closeSocket(); } else if (this.sendMsg === 'clear') { } else { this.sendData(this.sendMsg); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L82-L92
fab29f3098792c0fa78a698d7a44c36090448e20
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineDataSet.ets
arkts
setCircleRadius
Sets the radius of the drawn circles. Default radius = 4f, Min = 1f @param radius
public setCircleRadius(radius: number): void { if (radius >= 1) { // this.mCircleRadius = Utils.convertDpToPixel(radius); this.mCircleRadius = radius; } else { LogUtil.log("LineDataSet", "Circle radius cannot be < 1") } }
AST#method_declaration#Left public setCircleRadius AST#parameter_list#Left ( AST#parameter#Left radius : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
public setCircleRadius(radius: number): void { if (radius >= 1) { this.mCircleRadius = radius; } else { LogUtil.log("LineDataSet", "Circle radius cannot be < 1") } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L155-L163
c073959c3fbf0c6ad3388ec6071d49ddfc18d417
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/product/default/src/main/ets/feature/SunCanvasFeature.ets
arkts
initMoon
月出月落图 @param context @param img @param iconMoon
function initMoon(context: CanvasRenderingContext2D, img: ImageBitmap, iconMoon: ImageBitmap) { /* * 根据月出月落时间点绘制 * 获取两个时间点 * 分割成一个半圆 * 角度换算刻度 * 绘制 */ try { let begin = resourceManager!.getStringSync($r('app.string.moonrise_begin').id); let final = resourceManager!.getStringSync($r('...
AST#function_declaration#Left function initMoon AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left img : AST#type_annotation#Left AST#primary_type#Left Im...
function initMoon(context: CanvasRenderingContext2D, img: ImageBitmap, iconMoon: ImageBitmap) { try { let begin = resourceManager!.getStringSync($r('app.string.moonrise_begin').id); let final = resourceManager!.getStringSync($r('app.string.moonset_final').id); let now = new Date(); let time: numbe...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/product/default/src/main/ets/feature/SunCanvasFeature.ets#L111-L188
ebbeb162afae9f75ff97b28f3325d11eb8fca2e6
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/database/PreferencesHandler.ets
arkts
clear
清除用户首选项中的数据。
public clear() { if (this.preferences != null) { this.preferences.clear(); } }
AST#method_declaration#Left public clear 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Righ...
public clear() { if (this.preferences != null) { this.preferences.clear(); } }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesHandler.ets#L63-L67
ad7b2210efe73b0b4a8f010bd87b257082e2293d
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Manager/CDbPath.ets
arkts
构造函数
constructor(pureName: string) { this.baseName = pureName; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left pureName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statemen...
constructor(pureName: string) { this.baseName = pureName; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CDbPath.ets#L15-L17
89525ed99d9121cb8c12bcfa120c7c2ecca3a215
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/pages/EnvironmentMonitoringPage.ets
arkts
checkTemperatureStatus
温度状态判断
function checkTemperatureStatus(value: number): string { if (value > TEMPERATURE.WARNING_HIGH) { return EnvironmentStatusType.HIGH } else if (value < TEMPERATURE.WARNING_LOW) { return EnvironmentStatusType.LOW } return EnvironmentStatusType.NORMAL }
AST#function_declaration#Left function checkTemperatureStatus AST#parameter_list#Left ( AST#parameter#Left value : 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...
function checkTemperatureStatus(value: number): string { if (value > TEMPERATURE.WARNING_HIGH) { return EnvironmentStatusType.HIGH } else if (value < TEMPERATURE.WARNING_LOW) { return EnvironmentStatusType.LOW } return EnvironmentStatusType.NORMAL }
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/EnvironmentMonitoringPage.ets#L50-L57
87a6ca8aa08b94e05ab2538452825f09f1c19974
github