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
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
loadCurrentTheme
加载当前主题配置
private async loadCurrentTheme(): Promise<void> { try { const themeConfigStr = await this.preferencesService.getString(StorageConstants.THEME_MODE); if (themeConfigStr) { this.currentTheme = JSON.parse(themeConfigStr); } else { this.currentTheme = this.createDefaultTheme(); }...
AST#method_declaration#Left private async loadCurrentTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > ...
private async loadCurrentTheme(): Promise<void> { try { const themeConfigStr = await this.preferencesService.getString(StorageConstants.THEME_MODE); if (themeConfigStr) { this.currentTheme = JSON.parse(themeConfigStr); } else { this.currentTheme = this.createDefaultTheme(); }...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L752-L764
a230424cef5a8fd6e392507307b22954fa0f4fff
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
drawCircularText
Draw Arc Text. @param textString textString. @param startAngle startAngle. @param endAngle endAngle.
drawCircularText(textString: string, startAngle: number, endAngle: number) { if (CheckEmptyUtils.isEmptyStr(textString)) { Logger.error('[DrawModel][drawCircularText] textString is empty.') return; } class CircleText { x: number = 0; y: number = 0; radius: number = 0; }
AST#method_declaration#Left drawCircularText AST#parameter_list#Left ( AST#parameter#Left textString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left startAngle : AST#type_annotation#Left AST#primary_type#Left number AST#pr...
drawCircularText(textString: string, startAngle: number, endAngle: number) { if (CheckEmptyUtils.isEmptyStr(textString)) { Logger.error('[DrawModel][drawCircularText] textString is empty.') return; } class CircleText { x: number = 0; y: number = 0; radius: number = 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets#L212-L221
cdcb8af12720cb7fec1740d3ebf881afd4388e61
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/model.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/model.ets#L14-L16
19a7b9e35b9c67e013aea7db8764ff4d25afb33f
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/DES.ets
arkts
encodeCBC
加密-CBC模式 @param str 待加密的字符串 @param aesKey 3DES密钥 @param iv iv偏移量字符串 @returns
static async encodeCBC(str: string, desKey: string, iv: string): Promise<OutDTO<string>> { return CryptoUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192); }
AST#method_declaration#Left static async encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
static async encodeCBC(str: string, desKey: string, iv: string): Promise<OutDTO<string>> { return CryptoUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/DES.ets#L53-L55
ee7eb0bf31cd43e391b3e16f915f9662dc8b7c8d
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/DESSync.ets
arkts
generate3DESKey
生成3DES的对称密钥 @param resultCoding 生成3DES秘钥的字符串格式(hex/base64)-默认不传为base64格式 @returns 3DES密钥
static generate3DESKey(resultCoding: buffer.BufferEncoding = 'base64'): string { // 获取对称密钥的二进制数据 return CryptoSyncUtil.generateSymKey('3DES192', resultCoding); }
AST#method_declaration#Left static generate3DESKey AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expre...
static generate3DESKey(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('3DES192', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DESSync.ets#L33-L36
426fc6b3811ad36b20ae83ec2846d0528a6eacca
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/BackGroundTaskManager.ets
arkts
stopContinuousTask
cancel continuous task
public static stopContinuousTask(context?: common.UIAbilityContext): void { if (!context) { return; } backgroundTaskManager.stopBackgroundRunning(context).then(() => { hilog.info(MAIN,TAG, 'stopBackgroundRunning succeeded'); }).catch((err: BusinessError) => { hilog.error(MAIN,TAG, `sto...
AST#method_declaration#Left public static stopContinuousTask 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#param...
public static stopContinuousTask(context?: common.UIAbilityContext): void { if (!context) { return; } backgroundTaskManager.stopBackgroundRunning(context).then(() => { hilog.info(MAIN,TAG, 'stopBackgroundRunning succeeded'); }).catch((err: BusinessError) => { hilog.error(MAIN,TAG, `sto...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/BackGroundTaskManager.ets#L58-L67
f074c17eb12a98680c6c9d053dce8668b6bd2e90
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/view/MainPage.ets
arkts
MainPage
@file 主页面视图 @author Joker.X
@ComponentV2 export struct MainPage { /** * 主页面 ViewModel */ @Local private vm: MainViewModel = new MainViewModel(); /** * 窗口安全区状态 */ @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); /** * 屏幕断点状态 */ @Local private breakpointState: BreakpointState = ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MainPage AST#component_body#Left { /** * 主页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left MainViewModel ...
@ComponentV2 export struct MainPage { @Local private vm: MainViewModel = new MainViewModel(); @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); @Local private breakpointState: BreakpointState = getBreakpointState(); build() { AppNavDestination({ hid...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/MainPage.ets#L16-L120
5c8b45fa4c6fe27c87ac1949f0b15b33867671ae
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUIWantOpenURI/entry/src/main/ets/pages/Index.ets
arkts
implicitStartAbility
隐示启动Ability
async implicitStartAbility() { try { let want = { "action": "ohos.want.action.viewData", // 等同于ACTION_VIEW_DATA "entities": [ "entity.system.browsable" ], // 等同于ENTITY_BROWSABLE "uri": "https://www.test.com:8080/query/student", "type": "text/plain" } let context = g...
AST#method_declaration#Left async implicitStartAbility 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#variable_declaration#Left let AST#variable_declarator#Left want = AST#expression#Left AST...
async implicitStartAbility() { try { let want = { "action": "ohos.want.action.viewData", "entities": [ "entity.system.browsable" ], "uri": "https://www.test.com:8080/query/student", "type": "text/plain" } let context = getContext(this) as context.AbilityContext; ...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIWantOpenURI/entry/src/main/ets/pages/Index.ets#L24-L38
ca909c84a014384137d7ca7718eb34e3334ea9ab
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/DictSelectModal.ets
arkts
CustomLoading
自定义加载状态 @returns {void} 无返回值
@Builder private CustomLoading(): void { Column() { PageLoading(); } .height(300) .width(P100); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CustomLoading AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui...
@Builder private CustomLoading(): void { Column() { PageLoading(); } .height(300) .width(P100); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L208-L215
06dedceb30555fb86cb540c3c57516216a6a9c1e
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/ZFunction.ets
arkts
findFirstMatch
在文本中查找模式串的第一个出现位置 @param text 文本字符串 @param pattern 模式串 @returns 第一个匹配位置,如果未找到则返回 -1
static findFirstMatch(text: string, pattern: string): number { if (!text || !pattern || pattern.length === 0) { return -1; } const matches = ZFunction.findAllMatches(text, pattern); return matches.length > 0 ? matches[0] : -1; }
AST#method_declaration#Left static findFirstMatch AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
static findFirstMatch(text: string, pattern: string): number { if (!text || !pattern || pattern.length === 0) { return -1; } const matches = ZFunction.findAllMatches(text, pattern); return matches.length > 0 ? matches[0] : -1; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/ZFunction.ets#L55-L62
78452f05d279d35353f2bc6acf4f61f68b1af81d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets
arkts
generateSM4Key
生成SM4的对称密钥 @returns SM4密钥
static async generateSM4Key(): Promise<OutDTO<string>> { return CryptoUtil.generateSymKey('SM4_128'); }
AST#method_declaration#Left static async generateSM4Key AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#...
static async generateSM4Key(): Promise<OutDTO<string>> { return CryptoUtil.generateSymKey('SM4_128'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets#L30-L32
58364d9fd9429f44184c14607f5ae0a0a2bdca13
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard2x4.ets
arkts
buildBirthdayList
构建生日列表
@Builder buildBirthdayList() { Column({ space: 8 }) { ForEach(this.widgetData.birthdayList || [], (item: any, index: number) => { if (index < 3) { // 最多显示3个 this.buildBirthdayItem(item) } }) // 如果有更多项目,显示提示 if (this.widgetData.birthdayList && this.widgetData.birt...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayList 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 buildBirthdayList() { Column({ space: 8 }) { ForEach(this.widgetData.birthdayList || [], (item: any, index: number) => { if (index < 3) { this.buildBirthdayItem(item) } }) if (this.widgetData.birthdayList && this.widgetData.birthdayList.length > 3) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L72-L94
d5b598aded2924a8b49ef7416277879f8fd1ad9f
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
computeMaxRectWithinLimit
Calculate the largest marquee. @param rect @param limit @param rate
static computeMaxRectWithinLimit(rect: RectF, limit: RectF, rate: number): void { let limitWidth = limit.getWidth(); let limitHeight = limit.getHeight(); let width = limitWidth; let height = limitHeight; if (rate > (limitWidth / limitHeight)) { height = width / rate; rect.left = limit.le...
AST#method_declaration#Left static computeMaxRectWithinLimit AST#parameter_list#Left ( AST#parameter#Left rect : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left RectF AST...
static computeMaxRectWithinLimit(rect: RectF, limit: RectF, rate: number): void { let limitWidth = limit.getWidth(); let limitHeight = limit.getHeight(); let width = limitWidth; let height = limitHeight; if (rate > (limitWidth / limitHeight)) { height = width / rate; rect.left = limit.le...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L113-L129
b6949d3cc1ff1d53874e817cec1ec6382610cdb7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets
arkts
getListFromResultSet
处理数据格式
getListFromResultSet(resultSet: rdb.ResultSet): Array<Contact> { // 声明结果变量 let contacts: Array<Contact> = []; // 进入结果集的第一行 resultSet.goToFirstRow(); // 如果没有结束就继续遍历 while (!resultSet.isEnded) { // 读取各个属性,初始化临时变量contact let contact: Contact = new Contact( resultSet.getDouble(re...
AST#method_declaration#Left getListFromResultSet AST#parameter_list#Left ( AST#parameter#Left resultSet : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rdb . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#...
getListFromResultSet(resultSet: rdb.ResultSet): Array<Contact> { let contacts: Array<Contact> = []; resultSet.goToFirstRow(); while (!resultSet.isEnded) { let contact: Contact = new Contact( resultSet.getDouble(resultSet.getColumnIndex('id')), resultSet.getString(...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L308-L341
6654cd2c081232fa02fdffc6abbec282eb8de865
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/EfAxiosConst.ets
arkts
@Author csx @DateTime 2024/8/12 23:46 @TODO EfAxiosConst efAxios所需的常量 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_axios
export class EfAxiosConst { /** * 默认的loading文字 */ static loadingTxt: string = '努力获取数据中,请稍后...'; }
AST#export_declaration#Left export AST#class_declaration#Left class EfAxiosConst AST#class_body#Left { /** * 默认的loading文字 */ AST#property_declaration#Left static loadingTxt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '努力获取数据中,请稍后.....
export class EfAxiosConst { static loadingTxt: string = '努力获取数据中,请稍后...'; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/EfAxiosConst.ets#L23-L28
882dde85f7834473e95dc46b714adbd1c98c7690
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/BufferModel.ets
arkts
receiveData
收到音频流后直接送到 renderer 进行播放
private async receiveData(buffer: ArrayBuffer): Promise<void> { Logger.log(TAG, `TCP onReceive: `); if (this.mRendererWorker) { this.mRendererWorker.postMessage({ 'code': Constants.WORK_MESSAGE_RENDERER_RECV, 'buffer': buffer }, [buffer]); } }
AST#method_declaration#Left private async receiveData 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
private async receiveData(buffer: ArrayBuffer): Promise<void> { Logger.log(TAG, `TCP onReceive: `); if (this.mRendererWorker) { this.mRendererWorker.postMessage({ 'code': Constants.WORK_MESSAGE_RENDERER_RECV, 'buffer': buffer }, [buffer]); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/BufferModel.ets#L249-L257
5672fa0dd6d0d39c4fdd322253711f18d41c4520
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/OrderCount.ets
arkts
fromResponse
从接口响应构建订单统计(兼容中文字段) @param {object} data - 接口原始数据 @returns {OrderCount} 订单统计
static fromResponse(data: object): OrderCount { if (data instanceof OrderCount) { return new OrderCount(data); } const result: OrderCount = new OrderCount(); const source: Object = data as Object; result.pendingPayment = OrderCount.pickNumber(source, "pendingPayment", "待付款", result.pendingPaym...
AST#method_declaration#Left static fromResponse AST#parameter_list#Left ( AST#parameter#Left data : 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#type_annotation#Left AST#primary_type#Left OrderCount AST#primar...
static fromResponse(data: object): OrderCount { if (data instanceof OrderCount) { return new OrderCount(data); } const result: OrderCount = new OrderCount(); const source: Object = data as Object; result.pendingPayment = OrderCount.pickNumber(source, "pendingPayment", "待付款", result.pendingPaym...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/OrderCount.ets#L48-L61
195b35be13f30bfcdf736812b5b821eded39785e
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/FlawService.ets
arkts
updateFlaw
更新故障 @param flaw 故障数据 @returns 更新结果
static async updateFlaw(flaw: Partial<AgvFlaw>): Promise<ApiResponse<object>> { try { console.info(`[FlawService] 📝 更新故障,ID: ${flaw.id}`); const response = await HttpUtil.put('/agv/flaw', flaw); console.info('[FlawService] ✅ 故障更新成功'); const result: ApiResponse<object> = { code: resp...
AST#method_declaration#Left static async updateFlaw AST#parameter_list#Left ( AST#parameter#Left flaw : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AgvFlaw AST#primary_type#Right AST#type_annotation#Right > AST#typ...
static async updateFlaw(flaw: Partial<AgvFlaw>): Promise<ApiResponse<object>> { try { console.info(`[FlawService] 📝 更新故障,ID: ${flaw.id}`); const response = await HttpUtil.put('/agv/flaw', flaw); console.info('[FlawService] ✅ 故障更新成功'); const result: ApiResponse<object> = { code: resp...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L137-L152
6cb41b1705355d29484ab5ab99a26b789472608f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
isFocusable
窗口是否可聚焦,默认为true。true表示可聚焦;false表示不可聚焦。 @param windowClass 不传该值,默认主窗口。 @returns
static isFocusable(windowClass: window.Window = AppUtil.getMainWindow()): boolean { return WindowUtil.getWindowProperties(windowClass).focusable; }
AST#method_declaration#Left static isFocusable AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#ex...
static isFocusable(windowClass: window.Window = AppUtil.getMainWindow()): boolean { return WindowUtil.getWindowProperties(windowClass).focusable; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L263-L265
43b4e5460156111d20b9142f45bfb446a273435b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
getUserOrderCount
获取用户订单数量汇总 @returns {Promise<NetworkResponse<OrderCount>>} 订单数量信息
async getUserOrderCount(): Promise<NetworkResponse<OrderCount>> { const resp: AxiosResponse<NetworkResponse<OrderCount>> = await NetworkClient.http.get("order/info/userCount"); return resp.data; }
AST#method_declaration#Left async getUserOrderCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left <...
async getUserOrderCount(): Promise<NetworkResponse<OrderCount>> { const resp: AxiosResponse<NetworkResponse<OrderCount>> = await NetworkClient.http.get("order/info/userCount"); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L92-L96
9be08d58c230e246189c83bf37fa59d4c447ce52
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
setWindowPrivacyMode
设置窗口是否为隐私模式。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。该方法已过时,推荐使用:WindowUtil.setWindowPrivacyMode()
static async setWindowPrivacyMode(isPrivacyMode: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return WindowUtil.setWindowPrivacyMode(isPrivacyMode, windowClass); }
AST#method_declaration#Left static async setWindowPrivacyMode AST#parameter_list#Left ( AST#parameter#Left isPrivacyMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_t...
static async setWindowPrivacyMode(isPrivacyMode: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return WindowUtil.setWindowPrivacyMode(isPrivacyMode, windowClass); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L599-L601
55eeb7d72dd3c2fb723ad0cd45ae5da403ae6849
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/StepperView.ets
arkts
itemStyle
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...
@Styles function itemStyle() { .width(336) .height(621) .margin({ top: 48, left: 12 }) .borderRadius(24) .backgroundColor('#FFFFFF') }
AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function itemStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 336 AST#expression#Right ) AST#modifier_chain_expression#Left ....
@Styles function itemStyle() { .width(336) .height(621) .margin({ top: 48, left: 12 }) .borderRadius(24) .backgroundColor('#FFFFFF') }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/StepperView.ets#L16-L23
d8ef294db940f20d0288b746fd7ff2b448a81a46
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/editaddress/src/main/ets/utils/TextPickerView.ets
arkts
TextPickerView
标题字体间距值 功能描述: 通过使用TextPicker滑动选择文本内容组件实现联动选择联动的内容,并回填到输入框。 实现原理: 1. 通过传入的cascade读取联动数据传入TextPicker中。 2. 当滑动选中TextPicker文本内容后,通过.onChange((value: string | string[])触发回调,点击确定,返回给调用者处理。 @param {Array<Cascade>} cascade - 联动资源属性 @param {void} selectHandle - 点击确定逻辑 @param {void} cancelHandle - 点击取消逻辑 @param {number | numb...
@Component export struct TextPickerView { // --------------必传属性--------------- // 联动资源属性 cascade: Array<Cascade> = []; // 确定逻辑 selectHandle: (selectArr: number | number []) => void = (selectArr: number | number []) => { }; // 取消逻辑 cancelHandle: () => void = () => { }; // 默认选中项在数组中的索引值 ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextPickerView AST#component_body#Left { // --------------必传属性--------------- // 联动资源属性 AST#property_declaration#Left cascade : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_argum...
@Component export struct TextPickerView { cascade: Array<Cascade> = []; selectHandle: (selectArr: number | number []) => void = (selectArr: number | number []) => { }; cancelHandle: () => void = () => { }; indexArr: number | number [] = [0, 0, 0]; title: string | Resource = '...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/utils/TextPickerView.ets#L34-L118
3ea86f28a20d3e2feb41b88fa00980e3a989b6d2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
setArticle
设置指定文章的信息,并立即播放。 @param readInfo 文章信息,包括图片和内容;如果文章的ID不在列表中,则不会生效。
static setArticle(readInfo: TextReader.ReadInfo): boolean { try { TextReader.setArticle(readInfo); return true; } catch (e) { console.error(`TextReader failed to setArticle. Code: ${e.code}, message: ${e.message}`); return false; } }
AST#method_declaration#Left static setArticle AST#parameter_list#Left ( AST#parameter#Left readInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AS...
static setArticle(readInfo: TextReader.ReadInfo): boolean { try { TextReader.setArticle(readInfo); return true; } catch (e) { console.error(`TextReader failed to setArticle. Code: ${e.code}, message: ${e.message}`); return false; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L210-L218
b1c473cce7182746ee4ed8ddfc02f67605849391
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarSolarMappingService.ets
arkts
cleanCache
清理缓存(保留当前年份前后一年)
cleanCache(): void { const currentYear = new Date().getFullYear(); const keepYears = [currentYear - 1, currentYear, currentYear + 1]; for (const year of this.mappingCache.keys()) { if (!keepYears.includes(year)) { this.mappingCache.delete(year); } } hilog.info(LogConstants.DOMA...
AST#method_declaration#Left cleanCache AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentYear = ...
cleanCache(): void { const currentYear = new Date().getFullYear(); const keepYears = [currentYear - 1, currentYear, currentYear + 1]; for (const year of this.mappingCache.keys()) { if (!keepYears.includes(year)) { this.mappingCache.delete(year); } } hilog.info(LogConstants.DOMA...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L330-L342
07f72e8a6068f4e2bb82b78798086c686db4dbd6
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/common/utils/HttpUtils.ets
arkts
HTTP 请求工具类 HTTP Request Utility Source: 前后端联调封装
export class HttpUtils { /** * POST 请求 * @param url 接口路径 * @param data 请求体 * @returns Promise<ApiResponse<T>> */ static async post<T>(url: string, data: object): Promise<ApiResponse<T>> { let httpRequest = http.createHttp(); try { let response = await httpRequest.request( ...
AST#export_declaration#Left export AST#class_declaration#Left class HttpUtils AST#class_body#Left { /** * POST 请求 * @param url 接口路径 * @param data 请求体 * @returns Promise<ApiResponse<T>> */ AST#method_declaration#Left static async post AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter...
export class HttpUtils { static async post<T>(url: string, data: object): Promise<ApiResponse<T>> { let httpRequest = http.createHttp(); try { let response = await httpRequest.request( ApiConstants.BASE_URL + url, { method: http.RequestMethod.POST, header: ...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/HttpUtils.ets#L53-L212
0ceb5b05def11e685a6f2b7c6d878bfb9d791d01
github
Million-mo/tree-sitter-arkts.git
2fd0ad75e2d848709edcf4be038f27b178114ef6
examples/event_handling.ets
arkts
handleLongPress
长按事件处理
private handleLongPress() { this.eventData.updateEvent('longpress') promptAction.showToast({ message: '长按事件触发', duration: 2000 }) }
AST#method_declaration#Left private handleLongPress 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#expressio...
private handleLongPress() { this.eventData.updateEvent('longpress') promptAction.showToast({ message: '长按事件触发', duration: 2000 }) }
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/event_handling.ets#L41-L47
97aba647ead311298294da1c3143b39211cdbac5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets
arkts
compare
根据电量排序 @param pro='power' @param order='desc'
compare() { return (obj1: BatteryStatsModel, obj2: BatteryStatsModel) => { let val1: number = obj1.percent; let val2: number = obj2.percent; if (val2 < val1) { return 1; } else if (val2 > val1) { return -1; } else { return 0; } } }
AST#method_declaration#Left compare AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left obj1 : AST#type_annotation#Left AST#primary_type#Left BatterySt...
compare() { return (obj1: BatteryStatsModel, obj2: BatteryStatsModel) => { let val1: number = obj1.percent; let val2: number = obj2.percent; if (val2 < val1) { return 1; } else if (val2 > val1) { return -1; } else { return 0; } } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets#L94-L106
336949cbffa478dd8f601cacbd1911faf12f69a3
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets
arkts
uploadImages
模拟上传图片到服务器,实际环境中应使用真实服务器API
async uploadImages(): Promise<string[]> { if (this.imageUris.length === 0) { return []; } this.isUploading = true; this.uploadProgress = 0; try { // 在实际项目中,这里应该调用服务器的图片上传API // 以下代码仅做模拟演示 const uploadedUrls: string[] = []; for (let i = 0; i < this.imageUris...
AST#method_declaration#Left async uploadImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type...
async uploadImages(): Promise<string[]> { if (this.imageUris.length === 0) { return []; } this.isUploading = true; this.uploadProgress = 0; try { const uploadedUrls: string[] = []; for (let i = 0; i < this.imageUris.length; i++) { try { ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets#L142-L182
a7cfe7f85dce1ea9fae3fe6d4902a2470f98fb3d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SHA1.ets
arkts
rol
Bitwise rotate a 32-bit number to the left. 32位二进制数循环左移
rol(num: number, cnt: number) { return (num << cnt) | (num >>> (32 - cnt)); }
AST#method_declaration#Left rol AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cnt : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_a...
rol(num: number, cnt: number) { return (num << cnt) | (num >>> (32 - cnt)); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHA1.ets#L178-L182
01aa7913dc9009fb4b7be367367d319bc76aadcb
gitee
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
entry/src/main/ets/viewmodel/AccountData.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, softw...
export default class AccountData { id: number = -1; // 一般个人信息 name: string = '用户'; email: string = ''; phoneNumber: string = ''; address: string = ''; // 余额存储 wechatPayBalance: number = 0; alipayBalance: number = 0; applePayBalance: number = 0; googlePayBalance: number = 0; cardBalance: number ...
AST#export_declaration#Left export default AST#class_declaration#Left class AccountData AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 ...
export default class AccountData { id: number = -1; name: string = '用户'; email: string = ''; phoneNumber: string = ''; address: string = ''; wechatPayBalance: number = 0; alipayBalance: number = 0; applePayBalance: number = 0; googlePayBalance: number = 0; cardBalance: number = 0; passw...
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/entry/src/main/ets/viewmodel/AccountData.ets#L16-L33
024b535e916a9ba70083b5e702e9025284efa067
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/components/UIVoice.ets
arkts
UIVoice
被呼叫页 无提示语,计时,头像相同 按钮group: mic操作按钮,挂断,扬声器操作按钮
@Component export default struct UIVoice { private controller: IndexController | null = null; @Link mRemote: Caller; @State use: boolean = true; @State useMic: boolean = true; @State useSpeaker: boolean = false; async changeMic(open: boolean): Promise<void> { if (this.controller == null) { return...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct UIVoice AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left IndexController AST#primary_type#Right | AST#primary_type...
@Component export default struct UIVoice { private controller: IndexController | null = null; @Link mRemote: Caller; @State use: boolean = true; @State useMic: boolean = true; @State useSpeaker: boolean = false; async changeMic(open: boolean): Promise<void> { if (this.controller == null) { return...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/components/UIVoice.ets#L26-L113
55e6de840e0bef2b73b3dc78321f64746366a6d9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
getBrand
获取设备品牌名称。示例:HUAWEI。
static getBrand(): string { return deviceInfo.brand; }
AST#method_declaration#Left static getBrand AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expressi...
static getBrand(): string { return deviceInfo.brand; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L150-L152
cac1fed039d94e89073b63f4c55e3772c1e3ae11
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets
arkts
setOnMessageReceivedListener
订阅消息 @param callback
setOnMessageReceivedListener(callback: (buffer: ArrayBuffer) => void): void { if (!this.tlsSocket) { return; } this.tlsSocket.on('message', (data) => { Logger.info(`${TAG} TLS data: ` + JSON.stringify(data)); let buffer = data.message; callback(buffer); }); }
AST#method_declaration#Left setOnMessageReceivedListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Rig...
setOnMessageReceivedListener(callback: (buffer: ArrayBuffer) => void): void { if (!this.tlsSocket) { return; } this.tlsSocket.on('message', (data) => { Logger.info(`${TAG} TLS data: ` + JSON.stringify(data)); let buffer = data.message; callback(buffer); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets#L218-L228
5ce36e142c94352bc6070625c32737ee30a85784
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_json/src/main/ets/json/JSONUtil.ets
arkts
toJSONString
将传入的json对象格式化成json字符串 @param object 待转换的对象 @param formatStr 字符串格式化模版 @returns @deprecated 使用JSONObject或者JSONArray/JSONArrayList 方法代替
static toJSONString(object: Object, formatStr?: string): string { const stringifyValue = (value: Object): string => { if (value instanceof Map) { let jsonObject: Record<string, Object> = {}; value.forEach((val: string, key: Object) => { if (key !== undefined && val !== undefined) { ...
AST#method_declaration#Left static toJSONString AST#parameter_list#Left ( AST#parameter#Left object : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left formatStr ? : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
static toJSONString(object: Object, formatStr?: string): string { const stringifyValue = (value: Object): string => { if (value instanceof Map) { let jsonObject: Record<string, Object> = {}; value.forEach((val: string, key: Object) => { if (key !== undefined && val !== undefined) { ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONUtil.ets#L33-L72
9a61d6fd7a360e8c9f552893fea67a2baac23edc
gitee
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/common/helper/kvManagerHelper.ets
arkts
putValue
保存value值 @param key @param value
static putValue(key: string, value: kvValueType) { if (kvManagerHelper.kvStore !== undefined) { try { kvManagerHelper.kvStore.put(key, value, (err) => { if (err !== undefined) { console.error(`Failed to put data. Code:${err.code},message:${err.message}`); return; ...
AST#method_declaration#Left static putValue AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left kvValueType AST#primary_ty...
static putValue(key: string, value: kvValueType) { if (kvManagerHelper.kvStore !== undefined) { try { kvManagerHelper.kvStore.put(key, value, (err) => { if (err !== undefined) { console.error(`Failed to put data. Code:${err.code},message:${err.message}`); return; ...
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/helper/kvManagerHelper.ets#L83-L98
d44632a7cf7b5ef7626d4d7d7df9e1a5b00cdbf8
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
buildCategoryTree
递归构建分类树 @param {CategoryTree} categoryTree - 当前分类节点 @param {Map<number, CategoryTree[]>} childrenMap - 子分类映射 @returns {CategoryTree} 构建完成的分类节点
private buildCategoryTree(categoryTree: CategoryTree, childrenMap: Map<number, CategoryTree[]>): CategoryTree { const children: CategoryTree[] = childrenMap.get(categoryTree.id) ?? []; if (children.length === 0) { return categoryTree; } categoryTree.children = children.map((child: CategoryTr...
AST#method_declaration#Left private buildCategoryTree AST#parameter_list#Left ( AST#parameter#Left categoryTree : AST#type_annotation#Left AST#primary_type#Left CategoryTree AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left childrenMap : AST#type_annotation#Left AST#primary_type#...
private buildCategoryTree(categoryTree: CategoryTree, childrenMap: Map<number, CategoryTree[]>): CategoryTree { const children: CategoryTree[] = childrenMap.get(categoryTree.id) ?? []; if (children.length === 0) { return categoryTree; } categoryTree.children = children.map((child: CategoryTr...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L236-L244
e2ad7585486314b003916fc21ed8487872ff5fe2
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Conversions Converts a uri to path. @param uri The uri. @returns Its path.
export function uri_2_path(uri: string) { return new fileUri.FileUri(uri).path; }
AST#export_declaration#Left export AST#function_declaration#Left function uri_2_path AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#sta...
export function uri_2_path(uri: string) { return new fileUri.FileUri(uri).path; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L727-L729
212dbc0db398399c03be6ba7a89dcb20eb142772
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
帖子类型枚举
export enum PostType { TEXT = 'text', IMAGE = 'image', VIDEO = 'video', BIRTHDAY_WISH = 'birthday_wish', CELEBRATION = 'celebration', MEMORY = 'memory', TIP = 'tip', QUESTION = 'question', POLL = 'poll' }
AST#export_declaration#Left export AST#enum_declaration#Left enum PostType AST#enum_body#Left { AST#enum_member#Left TEXT = AST#expression#Left 'text' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left IMAGE = AST#expression#Left 'image' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left V...
export enum PostType { TEXT = 'text', IMAGE = 'image', VIDEO = 'video', BIRTHDAY_WISH = 'birthday_wish', CELEBRATION = 'celebration', MEMORY = 'memory', TIP = 'tip', QUESTION = 'question', POLL = 'poll' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L61-L71
eea1844e76a1ea9baac17fa4bce23ba4194f9b1b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/eventpropagation/Index.ets
arkts
EventPropagation
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 {EventPropagation} from './src/main/ets/view/EventPropagation';
AST#export_declaration#Left export { EventPropagation } from './src/main/ets/view/EventPropagation' ; AST#export_declaration#Right
export {EventPropagation} from './src/main/ets/view/EventPropagation';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eventpropagation/Index.ets#L16-L16
da0d96a697aedb3811757041fa7ee6767a55fe00
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets
arkts
putCache
Add cache to lruCache
public putCache(key: string, value: Object): void { this.lruCache.put(key, value); }
AST#method_declaration#Left public putCache AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Ri...
public putCache(key: string, value: Object): void { this.lruCache.put(key, value); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets#L36-L38
b6ddb0fca559908867b3f3b841212deb9387a56e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
encrypt
加密,异步 @param data 加密或者解密的数据。data不能为null。 @param key 指定加密或解密的密钥。 @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。 @returns
static async encrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> { let cipher = cryptoFramework.createCipher(transformation); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, pa...
AST#method_declaration#Left static async encrypt 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 key : ...
static async encrypt(data: cryptoFramework.DataBlob, key: cryptoFramework.Key, params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> { let cipher = cryptoFramework.createCipher(transformation); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, pa...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L37-L43
8a7341713a9772a2f4b79b303abc155e375ba928
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnCenterStart
纵向居中 + 水平起始
@ComponentV2 export struct ColumnCenterStart { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnCenterStart AST#component_body#Left { /** * Column 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_...
@ComponentV2 export struct ColumnCenterStart { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Paddi...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L625-L700
1525a53699695ad690749886f2ca3916b26b380c
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Render/SameLayer/DMPNodeController.ets
arkts
makeNode
必须要重写的方法,用于构建节点数、返回节点数挂载在对应NodeContainer中。 在对应NodeContainer创建的时候调用、或者通过rebuild方法调用刷新。
makeNode(uiContext: UIContext): FrameNode | null { DMPLogger.d(Tags.WEB_COMPONENT, 'NativeEmbed makeNode') this.rootNode = new BuilderNode(uiContext, { surfaceId: this.surfaceId_, type: this.renderType_ }); if (this.type === 'native/video') { this.rootNode.build(wrapBuilder(VideoBuilder), this.params)...
AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Fram...
makeNode(uiContext: UIContext): FrameNode | null { DMPLogger.d(Tags.WEB_COMPONENT, 'NativeEmbed makeNode') this.rootNode = new BuilderNode(uiContext, { surfaceId: this.surfaceId_, type: this.renderType_ }); if (this.type === 'native/video') { this.rootNode.build(wrapBuilder(VideoBuilder), this.params)...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Render/SameLayer/DMPNodeController.ets#L66-L80
7b4796110da400a94232a65ddffbf4c8bd192920
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets
arkts
BaseNetWorkListViewModel
@file 网络列表请求 ViewModel 基类 @description 提供通用的网络列表请求 ViewModel 基类,包含 UI 状态管理和请求执行逻辑。 @param T 列表数据项类型 @author Joker.X
@ObservedV2 export abstract class BaseNetWorkListViewModel<T> extends BaseViewModel { /** * 列表页 UI 状态 */ @Trace uiState: BaseNetWorkListUiState = BaseNetWorkListUiState.LOADING; /** * 列表数据 */ @Trace listData: Array<T> = []; /** * 是否正在加载 */ @Trace isLoading: boolean = false; /** ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export abstract class BaseNetWorkListViewModel AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#prim...
@ObservedV2 export abstract class BaseNetWorkListViewModel<T> extends BaseViewModel { @Trace uiState: BaseNetWorkListUiState = BaseNetWorkListUiState.LOADING; @Trace listData: Array<T> = []; @Trace isLoading: boolean = false; @Trace isEnableSlideUp: boolean = true; protected currentPage...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L13-L189
f3cc3406aa39ae96b0a20cbfeff2127a84b5bded
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/StrUtils.ets
arkts
capitalize
将字符串首字母转换为大写,剩下为小写 @param str 待转换的字符串 @returns 转换后的
static capitalize(str: string = ''): string { if (StrUtils.isNotEmpty(str)) { const firstChar = str.charAt(0).toUpperCase(); const restChars = str.slice(1).toLowerCase(); return firstChar + restChars; } return ''; }
AST#method_declaration#Left static capitalize AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ...
static capitalize(str: string = ''): string { if (StrUtils.isNotEmpty(str)) { const firstChar = str.charAt(0).toUpperCase(); const restChars = str.slice(1).toLowerCase(); return firstChar + restChars; } return ''; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/StrUtils.ets#L141-L148
4313c104761b681a600e62a7bf5894cb4bbaa4ce
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/CalendarApiService.ets
arkts
getLunarInfoFromApi
从API获取农历信息
private async getLunarInfoFromApi(date: Date): Promise<LunarDate> { try { const dateStr = this.formatDate(date); const url = `${this.APIs.sojson}?date=${dateStr}`; const request = http.createHttp(); const response = await request.request(url, { method: http.RequestMethod.GET, ...
AST#method_declaration#Left private async getLunarInfoFromApi AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date 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...
private async getLunarInfoFromApi(date: Date): Promise<LunarDate> { try { const dateStr = this.formatDate(date); const url = `${this.APIs.sojson}?date=${dateStr}`; const request = http.createHttp(); const response = await request.request(url, { method: http.RequestMethod.GET, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/CalendarApiService.ets#L105-L137
f498156f2cd545b5e36cc3de1c6334caf8e0a102
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageRegistry.ets
arkts
getRegisteredTypes
获取所有已注册的类型名称 @returns 类型名称数组 使用示例: ```typescript const types = MessageRegistry.getRegisteredTypes() console.log('Registered types:', types) ```
static getRegisteredTypes(): string[] { return Array.from(MessageRegistry.types.keys()) }
AST#method_declaration#Left static getRegisteredTypes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statem...
static getRegisteredTypes(): string[] { return Array.from(MessageRegistry.types.keys()) }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageRegistry.ets#L228-L230
431fca20d1fa6ab8754229f519bd232b0c194acb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets
arkts
liftUpComponents
上抬组件
@Builder liftUpComponents() { Scroll(this.scrollerForLiftUp) { Column() { LazyForEach(this.dataSource, (item: string) => { this.liftUpContentComponent(item) }, (item: string) => item) } .id('KeyboardAvoidLiftUpComponents') .width($r('app.string.key_board_component...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right liftUpComponents AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( AST#expression#Left AST#member_expression#Left A...
@Builder liftUpComponents() { Scroll(this.scrollerForLiftUp) { Column() { LazyForEach(this.dataSource, (item: string) => { this.liftUpContentComponent(item) }, (item: string) => item) } .id('KeyboardAvoidLiftUpComponents') .width($r('app.string.key_board_component...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets#L58-L76
176c01959e7235bd8d67404eb29d120cea2b214c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets
arkts
closeCustomDialog
关闭已弹出的dialogContent对应的自定义弹窗 @param dialogId
closeCustomDialog(dialogId: string) { try { const promptActionArg = this.getArgById(dialogId); if (promptActionArg && promptActionArg.uiContext) { const promptAction = promptActionArg.uiContext.getPromptAction(); const componentContent = promptActionArg.componentContent; if (comp...
AST#method_declaration#Left closeCustomDialog AST#parameter_list#Left ( AST#parameter#Left dialogId : 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#try_statement#Left...
closeCustomDialog(dialogId: string) { try { const promptActionArg = this.getArgById(dialogId); if (promptActionArg && promptActionArg.uiContext) { const promptAction = promptActionArg.uiContext.getPromptAction(); const componentContent = promptActionArg.componentContent; if (comp...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L219-L235
444c08149df0f49b673603c3da58b6f97b393601
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets
arkts
VideoInfoComponent
视频内容介绍透明度 视频介绍页面,渲染效果不参与画中画功能开发
@Component export struct VideoInfoComponent { @State TabsInfo: Array<string> = ['视频', '评论']; // tab标题 private scrollerForList: Scroller = new Scroller(); // 列表滚动控制器 private arr: number[] = []; // 视频列表图片数组 aboutToAppear() { for (let i = 0; i < 4; i++) { this.arr.push(i) } } build() { Colu...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoInfoComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right TabsInfo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_...
@Component export struct VideoInfoComponent { @State TabsInfo: Array<string> = ['视频', '评论']; private scrollerForList: Scroller = new Scroller(); private arr: number[] = []; aboutToAppear() { for (let i = 0; i < 4; i++) { this.arr.push(i) } } build() { Column() { this.Page...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets#L25-L235
771c0e2a4d8d719e6cd82d2345d18b1974c0c8da
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/NotificationService.ets
arkts
提醒类型
export enum ReminderType { TASK_DUE = 'task_due', // 任务到期 TASK_UPCOMING = 'task_upcoming', // 任务即将到期 DAILY_SUMMARY = 'daily_summary' // 每日总结 }
AST#export_declaration#Left export AST#enum_declaration#Left enum ReminderType AST#enum_body#Left { AST#enum_member#Left TASK_DUE = AST#expression#Left 'task_due' AST#expression#Right AST#enum_member#Right , // 任务到期 AST#enum_member#Left TASK_UPCOMING = AST#expression#Left 'task_upcoming' AST#expression#Right AST#enum_m...
export enum ReminderType { TASK_DUE = 'task_due', TASK_UPCOMING = 'task_upcoming', DAILY_SUMMARY = 'daily_summary' }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/NotificationService.ets#L21-L25
67f26e0cd61daaf0f2e1ccac22c223ae692d3a94
github
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/pages/PersonPage.ets
arkts
selectPhoto
相册取图
private async selectPhoto() { try { // 配置选择选项 const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 1; // 最多选择 1 张 // 创建图库选择器实例 const photoPicker ...
AST#method_declaration#Left private async selectPhoto 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#variable_declaration#Left const AST#variable_declarator#Left photoSelectOptions ...
private async selectPhoto() { try { const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 1; const photoPicker = new photoAccessHelper.PhotoVie...
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/pages/PersonPage.ets#L97-L118
de420bf63277e74ca64f267e149a3b719b23a560
github
Hyricane/meikou-mall.git
ae4c2482ba82b78e684de213a4f33aad9af076c5
features/home/src/main/ets/viewmodel/index.ets
arkts
reloadData
数据直接重新赋值
public reloadData(data: object[]) { this.dataArray = data this.notifyDataReload() }
AST#method_declaration#Left public reloadData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left object [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L...
public reloadData(data: object[]) { this.dataArray = data this.notifyDataReload() }
https://github.com/Hyricane/meikou-mall.git/blob/ae4c2482ba82b78e684de213a4f33aad9af076c5/features/home/src/main/ets/viewmodel/index.ets#L144-L147
38b45fea8d4923e59023101e6c73dd03e337eced
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/ImageEditParam.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class ImageEditParam { //照片uri uri: string; //底部安全区高度 bottomHeight: number; constructor(uri: string, bottomHeight: number) { this.uri = uri; this.bottomHeight = bottomHeight; } }
AST#export_declaration#Left export AST#class_declaration#Left class ImageEditParam AST#class_body#Left { //照片uri AST#property_declaration#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //底部安全区高度 AST#property_declaration#...
export class ImageEditParam { uri: string; bottomHeight: number; constructor(uri: string, bottomHeight: number) { this.uri = uri; this.bottomHeight = bottomHeight; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/ImageEditParam.ets#L16-L29
d232590f3a990504f442d25946bbdc8492af2d5d
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
getCenterTextOffset
Returns the offset on the x- and y-axis the center text has in vp. @return
public getCenterTextOffset(): MPPointF { return MPPointF.getInstance(this.mCenterTextOffset.x, this.mCenterTextOffset.y); }
AST#method_declaration#Left public getCenterTextOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MPPointF AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#ca...
public getCenterTextOffset(): MPPointF { return MPPointF.getInstance(this.mCenterTextOffset.x, this.mCenterTextOffset.y); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L603-L605
88ad1517fd58f8ff0832b48e9f91223c02f6fea4
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
面试结果枚举
export enum InterviewResult { PASS = 'pass', // 通过 FAIL = 'fail', // 未通过 PENDING = 'pending', // 待定 UNKNOWN = 'unknown' // 未知 }
AST#export_declaration#Left export AST#enum_declaration#Left enum InterviewResult AST#enum_body#Left { AST#enum_member#Left PASS = AST#expression#Left 'pass' AST#expression#Right AST#enum_member#Right , // 通过 AST#enum_member#Left FAIL = AST#expression#Left 'fail' AST#expression#Right AST#enum_member#Right , // 未通过 AST#...
export enum InterviewResult { PASS = 'pass', FAIL = 'fail', PENDING = 'pending', UNKNOWN = 'unknown' }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L25-L30
e9f4a9cd86927345732e30639bd6db0fc9eaca82
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
渲染布局 @returns {void} 无返回值 @example ColumnSpaceBetweenEnd() { Text("A"); Text("B"); }
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceBetween, alignItems: HorizontalAlign.End, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.margi...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expressio...
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceBetween, alignItems: HorizontalAlign.End, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.margi...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L1084-L1099
c9736f19f0ee154162228ec41753bddbd6319288
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the security patch level represented by a string. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get securityPatchTag(): string;
AST#method_declaration#Left static get AST#ERROR#Left securityPatchTag AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static get securityPatchTag(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L186-L186
2936465c49caa005bc172b193c2cf02cdf9fd7da
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
startDownload
开始下载
private async startDownload(episode: Episode): Promise<void> { if (!this.context) { console.error('Context not set, cannot start download'); return; } try { // 生成保存路径 const fileName = `${episode.id}.m4a`; const savePath = `${this.context.filesDir}/${fileName}`; const do...
AST#method_declaration#Left private async startDownload AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode 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...
private async startDownload(episode: Episode): Promise<void> { if (!this.context) { console.error('Context not set, cannot start download'); return; } try { const fileName = `${episode.id}.m4a`; const savePath = `${this.context.filesDir}/${fileName}`; const downloadCon...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L85-L186
13dc472d14fc089ef286a3674d1164d3170539eb
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/sorting/SelectionSort.ets
arkts
选择排序实现
export class SelectionSort { /** * 选择排序算法 * @param arr 需要排序的数组 * @returns 排序后的数组 */ public static sort(arr: number[]): number[] { const result = [...arr]; const n = result.length; for (let i = 0; i < n - 1; i++) { // 找到未排序部分中的最小元素 let minIdx = i; for (let j = i + 1; j < n;...
AST#export_declaration#Left export AST#class_declaration#Left class SelectionSort AST#class_body#Left { /** * 选择排序算法 * @param arr 需要排序的数组 * @returns 排序后的数组 */ AST#method_declaration#Left public static sort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#...
export class SelectionSort { public static sort(arr: number[]): number[] { const result = [...arr]; const n = result.length; for (let i = 0; i < n - 1; i++) { let minIdx = i; for (let j = i + 1; j < n; j++) { if (result[j] < result[minIdx]) { minIdx = j; } ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/SelectionSort.ets#L4-L79
8f032f8181d349c5cfd3b0779f72bca3f8634be6
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets
arkts
removeDataChangeListener
Remove the data change listener.
removeDataChangeListener(): void { if (this.kvStore === undefined) { return; } try { this.kvStore.off('dataChange'); } catch (error) { Logger.error('KvStoreModel', `removeDataChangeListener off('dataChange') failed, err=${JSON.stringify(error)}`); } }
AST#method_declaration#Left removeDataChangeListener AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_express...
removeDataChangeListener(): void { if (this.kvStore === undefined) { return; } try { this.kvStore.off('dataChange'); } catch (error) { Logger.error('KvStoreModel', `removeDataChangeListener off('dataChange') failed, err=${JSON.stringify(error)}`); } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets#L126-L137
e9055aa5e9d20e78348d2c6a9b9cf3db981af188
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
buildContactsContent
构建联系人内容占位符
@Builder buildContactsContent() { Text('联系人页面') .fontSize(18) .fontColor('#333333') .textAlign(TextAlign.Center) .width('100%') .height('100%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactsContent 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 Text ( AST#expression#Left '联系人页面' AST#expression#Rig...
@Builder buildContactsContent() { Text('联系人页面') .fontSize(18) .fontColor('#333333') .textAlign(TextAlign.Center) .width('100%') .height('100%') }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L724-L732
8fee2870d262decec7fc845cc0490f70202f53e2
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/constants/LayoutPercent.ets
arkts
85% 百分比
export const P85: string = "85%";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P85 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "85%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right...
export const P85: string = "85%";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L94-L94
da714d849b9d1203bef2604bf48bf1a80cfa2316
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets
arkts
migrate
递归方式批次查询旧表数据 @param lastId 上一次查询的最后一个id @param targetVersion 目标版本
private async migrate(lastId: number, oldVersion: number, targetVersion: number, flag: boolean): Promise<void> { if (flag) { return; } let newDataArray: ValuesBucket[] = new Array(); await dbUtils.queryData(Constants.STUDENT_TABLE + oldVersion, Constants.MAX_BATCH_NUM, lastId, async (resultSet) =>...
AST#method_declaration#Left private async migrate AST#parameter_list#Left ( AST#parameter#Left lastId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left oldVersion : AST#type_annotation#Left AST#primary_type#Left number AST#p...
private async migrate(lastId: number, oldVersion: number, targetVersion: number, flag: boolean): Promise<void> { if (flag) { return; } let newDataArray: ValuesBucket[] = new Array(); await dbUtils.queryData(Constants.STUDENT_TABLE + oldVersion, Constants.MAX_BATCH_NUM, lastId, async (resultSet) =>...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets#L49-L75
365f41962ad85f5e308c28c657551bcc281d98e5
gitee
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/utils/grant.ets
arkts
requestPermissionsFromUser
@throws
public static async requestPermissionsFromUser(permissions: Permissions[]) { if (permissions.length === 0) { return false } const atManager = abilityAccessCtrl.createAtManager() const GRANTED = abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED return atManager.requestPermissionsFromUser(grant...
AST#method_declaration#Left public static async requestPermissionsFromUser AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramet...
public static async requestPermissionsFromUser(permissions: Permissions[]) { if (permissions.length === 0) { return false } const atManager = abilityAccessCtrl.createAtManager() const GRANTED = abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED return atManager.requestPermissionsFromUser(grant...
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/utils/grant.ets#L27-L38
ea4e7b15f4924174f67e2fe1cab724cf67e290b2
github
luhenchang/ArkTS_Unit.git
40743ac7d273f5a8e40feab2b6ccd95823fc4ddf
entry/src/main/ets/component/pullrefresh/CustomRefreshLoadLayout.ets
arkts
CustomRefreshLoadLayout
上拉和下拉加载UI 组件.
@Component export struct CustomRefreshLoadLayout { @ObjectLink config: CustomRefreshLoadLayoutConfig; build() { Row() { Image(this.config.imageSrc) .width(Const.RefreshLayout_IMAGE_WIDTH) .height(Const.RefreshLayout_IMAGE_HEIGHT) Text(this.config.textValue) .margin({ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomRefreshLoadLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right config : AST#type_annotation#Left AST#primary_type#Left CustomRefreshLoadLayoutConfig...
@Component export struct CustomRefreshLoadLayout { @ObjectLink config: CustomRefreshLoadLayoutConfig; build() { Row() { Image(this.config.imageSrc) .width(Const.RefreshLayout_IMAGE_WIDTH) .height(Const.RefreshLayout_IMAGE_HEIGHT) Text(this.config.textValue) .margin({ ...
https://github.com/luhenchang/ArkTS_Unit.git/blob/40743ac7d273f5a8e40feab2b6ccd95823fc4ddf/entry/src/main/ets/component/pullrefresh/CustomRefreshLoadLayout.ets#L7-L30
970165d8b4055c3ea6cb655e65f0f434a31230fa
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets
arkts
decodeSample_1
开发示例方式一,通过ArrayBuffer解码rawfile下的图片资源 @returns 位图操作对象。
public decodeSample_1(): Promise<image.PixelMap> { return new Promise((resolve, reject) => { // [Start pixelmap_create_image_source_by_text_jpg_arraybuffer] resourceMgr.getRawFileContent('test.jpg').then((fileData: Uint8Array) => { Logger.info('decodeSample_1: ', 'Succeeded in getting RawFileCon...
AST#method_declaration#Left public decodeSample_1 AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right...
public decodeSample_1(): Promise<image.PixelMap> { return new Promise((resolve, reject) => { resourceMgr.getRawFileContent('test.jpg').then((fileData: Uint8Array) => { Logger.info('decodeSample_1: ', 'Succeeded in getting RawFileContent'); const buffer = fileData.buffer.slice(0...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L253-L277
c8e9fcb9d84b2527bd27fa1ff31747daf9866762
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Transformer.ets
arkts
rectValueToPixelHorizontal
Transform a rectangle with all matrices with potential animation phases. @param r
public rectValueToPixelHorizontal(r: MyRect, phaseY?: number) { if (phaseY != null && phaseY != undefined) { r.left *= phaseY; r.right *= phaseY; } this.mMatrixValueToPx.mapRect(r); this.mViewPortHandler.getMatrixTouch().mapRect(r); this.mMatrixOffset.mapRect(r); }
AST#method_declaration#Left public rectValueToPixelHorizontal AST#parameter_list#Left ( AST#parameter#Left r : AST#type_annotation#Left AST#primary_type#Left MyRect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY ? : AST#type_annotation#Left AST#primary_type#Left number ...
public rectValueToPixelHorizontal(r: MyRect, phaseY?: number) { if (phaseY != null && phaseY != undefined) { r.left *= phaseY; r.right *= phaseY; } this.mMatrixValueToPx.mapRect(r); this.mViewPortHandler.getMatrixTouch().mapRect(r); this.mMatrixOffset.mapRect(r); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L329-L337
b3a8c1155aff385b08139709636d893e4f766483
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/CategorySample/entry/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
getIndexListData
Get index list data on the left. @return {Array<IndexListItem>} indexListItems
getIndexListData() { let indexListItems: Array<IndexListItem> = []; for (let index = 1; index <= CommonConstants.LIST_SIZE; index++) { let indexListItem = new IndexListItem(); indexListItem.title = $r('app.string.list_item_text', index); indexListItems.push(indexListItem); } return ind...
AST#method_declaration#Left getIndexListData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left indexListItems : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Le...
getIndexListData() { let indexListItems: Array<IndexListItem> = []; for (let index = 1; index <= CommonConstants.LIST_SIZE; index++) { let indexListItem = new IndexListItem(); indexListItem.title = $r('app.string.list_item_text', index); indexListItems.push(indexListItem); } return ind...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategorySample/entry/src/main/ets/viewmodel/CategoryViewModel.ets#L16-L24
e487d9dfbee68a492bb6999a82dc830ee878a550
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/ResponsiveScrollPositionList.ets
arkts
ResponsiveScrollPositionList
[EndExclude respond_to_scroll_position]
@Entry @Component export struct ResponsiveScrollPositionList { @State selectedIndex: number = 0; private listScroller: Scroller = new Scroller(); private currentGroupTitle: string = ''; // 用于跟踪当前显示的分组标题 // [StartExclude respond_to_scroll_position] @Builder itemHead(text: string) { // 列表分组的头部组件,对应联系人分组A...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ResponsiveScrollPositionList AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right selectedIndex : AST#type_annotation#Le...
@Entry @Component export struct ResponsiveScrollPositionList { @State selectedIndex: number = 0; private listScroller: Scroller = new Scroller(); private currentGroupTitle: string = ''; @Builder itemHead(text: string) { Text(text) .fontSize(20) .backgroundColor('#fff1f3f5') .wi...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/ResponsiveScrollPositionList.ets#L105-L176
fa9b437c27f81c3ae3d0f07c3f074156513d51fb
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DeviceUtils.ets
arkts
isXiaomiDevice
判断是否为小米设备
static isXiaomiDevice(): boolean { return DeviceUtil.getPhoneBrand() === 'xiaomi'; }
AST#method_declaration#Left static isXiaomiDevice AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_e...
static isXiaomiDevice(): boolean { return DeviceUtil.getPhoneBrand() === 'xiaomi'; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DeviceUtils.ets#L81-L83
45ec9f947dbec537e69d757ad3e41a31cd646416
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/types/game.ets
arkts
游戏系统相关声明 游戏存档状态声明
export interface TGameState { per: number mapIndex: number deep: number }
AST#export_declaration#Left export AST#interface_declaration#Left interface TGameState AST#object_type#Left { AST#type_member#Left per : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left mapIndex : AST#type_annotation#Left A...
export interface TGameState { per: number mapIndex: number deep: number }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/types/game.ets#L6-L10
fed525652c0840f695be1695aed72c9fea5ef719
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets
arkts
publicInitFunc
调用initSession获取handle
async function publicInitFunc(keyAlias: string, huksOptions: huks.HuksOptions) { console.info(`enter promise doInit`); let throwObject: ThrowObject = { isThrow: false }; try { await initSession(keyAlias, huksOptions, throwObject) .then((data) => { console.info(`promise: doInit success, data = ${...
AST#function_declaration#Left async function publicInitFunc AST#parameter_list#Left ( AST#parameter#Left keyAlias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left...
async function publicInitFunc(keyAlias: string, huksOptions: huks.HuksOptions) { console.info(`enter promise doInit`); let throwObject: ThrowObject = { isThrow: false }; try { await initSession(keyAlias, huksOptions, throwObject) .then((data) => { console.info(`promise: doInit success, data = ${...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets#L178-L199
5b9f4a9e5e8553182f8ece6657eea3afc04aa39f
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
getLastNavDestinationId
获取当前路由栈的栈顶页面DestinationId @returns
public static getLastNavDestinationId(): string | undefined { return ZRouter.getRouterMgr().getLastNavDestinationId() }
AST#method_declaration#Left public static getLastNavDestinationId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Righ...
public static getLastNavDestinationId(): string | undefined { return ZRouter.getRouterMgr().getLastNavDestinationId() }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L269-L271
3e760537afc05bb5b3991f8c114116a34d67b72d
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
cancelDownload
取消下载
async cancelDownload(episodeId: string): Promise<void> { try { const task = this.downloadTasks.get(episodeId); if (task) { await task.downloadTask.delete(); this.downloadTasks.delete(episodeId); // 更新数据库状态 await this.dbService.updateEpisodeDownloadStatus( ...
AST#method_declaration#Left async cancelDownload AST#parameter_list#Left ( AST#parameter#Left episodeId : 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_typ...
async cancelDownload(episodeId: string): Promise<void> { try { const task = this.downloadTasks.get(episodeId); if (task) { await task.downloadTask.delete(); this.downloadTasks.delete(episodeId); await this.dbService.updateEpisodeDownloadStatus( episode...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L229-L246
43d83532fea90159109f9c1ebab7af64cc83d527
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets
arkts
generateKeyItem
生成密钥
function generateKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: ThrowObject) { return new Promise<void>((resolve, reject) => { try { huks.generateKeyItem(keyAlias, huksOptions, (error, data) => { if (error) { reject(error); } else { resolve(data); ...
AST#function_declaration#Left function generateKeyItem AST#parameter_list#Left ( AST#parameter#Left keyAlias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left AST#...
function generateKeyItem(keyAlias: string, huksOptions: huks.HuksOptions, throwObject: ThrowObject) { return new Promise<void>((resolve, reject) => { try { huks.generateKeyItem(keyAlias, huksOptions, (error, data) => { if (error) { reject(error); } else { resolve(data); ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets#L119-L134
26014f773e0aa31b95aa3db8d7abea3d39607626
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderListViewModel.ets
arkts
hideCommentModal
隐藏商品评论弹窗 @returns {void} 无返回值
hideCommentModal(): void { this.commentModalVisible = false; }
AST#method_declaration#Left hideCommentModal 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#m...
hideCommentModal(): void { this.commentModalVisible = false; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderListViewModel.ets#L96-L98
51a78493e1b8adda23a697616dae6db3f5ebe27b
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/NavigationWithArgsPage.ets
arkts
构建带参跳转示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_navigation_with_args_title"), viewModel: this.vm }) { this.NavigationWithArgsContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_nav...
build() { AppNavDestination({ title: $r("app.string.demo_navigation_with_args_title"), viewModel: this.vm }) { this.NavigationWithArgsContent(); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NavigationWithArgsPage.ets#L21-L28
ca975ca118797f07ea47860df822be2ac32e58b3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/common/CommonConstant.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export enum ComponentId { START_VPN_BUTTON = 'START_VPN_BUTTON', STOP_VPN_BUTTON = 'STOP_VPN_BUTTON', CREATE_TUNNEL_BUTTON = 'CREATE_TUNNEL_BUTTON', PROTECT_BUTTON = 'PROTECT_BUTTON', SETUP_VPN_BUTTON = 'SETUP_VPN_BUTTON', START_VPN_EXT_BUTTON = 'START_VPN_EXT_BUTTON', INNER_STOP_VPN_BUTTON = 'INNER_STOP_...
AST#export_declaration#Left export AST#enum_declaration#Left enum ComponentId AST#enum_body#Left { AST#enum_member#Left START_VPN_BUTTON = AST#expression#Left 'START_VPN_BUTTON' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left STOP_VPN_BUTTON = AST#expression#Left 'STOP_VPN_BUTTON' AST#expression#Right...
export enum ComponentId { START_VPN_BUTTON = 'START_VPN_BUTTON', STOP_VPN_BUTTON = 'STOP_VPN_BUTTON', CREATE_TUNNEL_BUTTON = 'CREATE_TUNNEL_BUTTON', PROTECT_BUTTON = 'PROTECT_BUTTON', SETUP_VPN_BUTTON = 'SETUP_VPN_BUTTON', START_VPN_EXT_BUTTON = 'START_VPN_EXT_BUTTON', INNER_STOP_VPN_BUTTON = 'INNER_STOP_...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/common/CommonConstant.ets#L16-L25
387e7c6ce5dfc3e20b77c2b362ba3908a6936a47
gitee
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/views/Chat/ChatDetailBottomMediaSheet.ets
arkts
getTextInfo
placeholder 获取组件大小、位置、平移缩放旋转及仿射矩阵属性信息。
private getTextInfo(index: number): Record<string, number> { let modePosition: componentUtils.ComponentInfo = componentUtils.getRectangleById(index.toString()); return { 'left': px2vp(modePosition.windowOffset.x), 'width': px2vp(modePosition.size.width) }; }
AST#method_declaration#Left private getTextInfo 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 AST#generic_type#Lef...
private getTextInfo(index: number): Record<string, number> { let modePosition: componentUtils.ComponentInfo = componentUtils.getRectangleById(index.toString()); return { 'left': px2vp(modePosition.windowOffset.x), 'width': px2vp(modePosition.size.width) }; }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/views/Chat/ChatDetailBottomMediaSheet.ets#L201-L204
d81232ba9ede78e5ff62ad5a296f692969c51b61
github
fengcreate/harmony-document
798534b0f76399dc84e7940f5b14b3ae4e53c6a9
BackupRestore/entry/src/main/ets/restore/db/DbTransferManager.ets
arkts
DB file migration and conversion management
export default class DbTransferManager { private sourceRdbStore?: relationalStore.RdbStore; private targetRdbStore?: relationalStore.RdbStore; /** * Database migration from HarmonyOS 4.0 to HarmonyOS NEXT. * eg: * The db file name for HarmonyOS 4.0 is: * source_deb.db, which contains the table 'u...
AST#export_declaration#Left export default AST#class_declaration#Left class DbTransferManager AST#class_body#Left { AST#property_declaration#Left private sourceRdbStore ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore AST#qualified_type#Right AST#primary_type#Right A...
export default class DbTransferManager { private sourceRdbStore?: relationalStore.RdbStore; private targetRdbStore?: relationalStore.RdbStore; async transfer(context: common.Context): Promise<void> { let result = this.moveDbFile(context); if (!result) { hilog.error(0x0000, 'BackupRestore Db...
https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/db/DbTransferManager.ets#L24-L242
be97257924b09f71d32c4ec48f01aa26679547d3
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets
arkts
update
更新数据 @param predicates @param obj @param columns @returns
update(predicates: relationalStore.RdbPredicates, obj: object, columns: ColumnInfo[]): Promise<number> { return new Promise((resolve, reject) => { // 1.构建更新数据 let value = this.buildValueBucket(obj, columns); // 2.更新 this.rdbStore?.update(value, predicates, (err, result) => { if (err)...
AST#method_declaration#Left update AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left obj : AST...
update(predicates: relationalStore.RdbPredicates, obj: object, columns: ColumnInfo[]): Promise<number> { return new Promise((resolve, reject) => { let value = this.buildValueBucket(obj, columns); this.rdbStore?.update(value, predicates, (err, result) => { if (err) { Logge...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L228-L243
e1b463eec73ba4253cc95a1bb124bbf32c36fbff
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SHA.ets
arkts
digestSHA512
SHA512摘要 @param str 带摘要的字符串 @returns 摘要后的字符串
static async digestSHA512(str: string): Promise<string> { return CryptoUtil.digest(str, 'SHA512'); }
AST#method_declaration#Left static async digestSHA512 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
static async digestSHA512(str: string): Promise<string> { return CryptoUtil.digest(str, 'SHA512'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA.ets#L68-L70
5a1ee04ba5b6c17a2aff25a5e9e0ea6db9f3dd67
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets
arkts
onPullRefresh
下拉刷新逻辑
onPullRefresh() { this.isRefreshing = true; this.pageIndex = 1; setTimeout(() => { // 模拟刷新数据 const newData: OrderItem[] = [ { shopName: 'OMINI新天地店', status: this.selectedTab, waitTime: '00:05:22', address: '上海市黄浦区马当路245号新天地北里1层12号', time...
AST#method_declaration#Left onPullRefresh AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRefreshing AST#member_expression#R...
onPullRefresh() { this.isRefreshing = true; this.pageIndex = 1; setTimeout(() => { const newData: OrderItem[] = [ { shopName: 'OMINI新天地店', status: this.selectedTab, waitTime: '00:05:22', address: '上海市黄浦区马当路245号新天地北里1层12号', time: '2025-0...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets#L347-L373
dc0845422e4999d185630d5a41aa89df335ce14e
github
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/component/Logger.ets
arkts
error
打印 error 级别日志 @param args - 可变参数,用于填充日志内容
error(...args: string[]): void { hilog.error(this.domain, this.prefix, this.format, ...args); }
AST#method_declaration#Left error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim...
error(...args: string[]): void { hilog.error(this.domain, this.prefix, this.format, ...args); }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Logger.ets#L49-L51
d26b13f7f2dc7bf92b40a4eacc176f3fdc3cc3a3
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets
arkts
判断系统图标是否存在(因ArkTS限制,不再进行动态尝试) @param symbolName 系统图标名称 @returns 是否存在
export function hasSystemSymbol(symbolName: string): boolean { const systemIcons = ['add', 'search', 'arrow_left', 'close', 'checkmark', 'menu', 'settings', 'edit', 'delete', 'share', 'heart', 'star', 'download']; return systemIcons.includes(symbolName); }
AST#export_declaration#Left export AST#function_declaration#Left function hasSystemSymbol AST#parameter_list#Left ( AST#parameter#Left symbolName : 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#...
export function hasSystemSymbol(symbolName: string): boolean { const systemIcons = ['add', 'search', 'arrow_left', 'close', 'checkmark', 'menu', 'settings', 'edit', 'delete', 'share', 'heart', 'star', 'download']; return systemIcons.includes(symbolName); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L217-L222
a82faeecc0f5dd21977b78dbc3d5aed45ace7a89
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/pages/PasswordEnvelopePage.ets
arkts
LongPressTextCustomMenu
复制口令到剪切板
LongPressTextCustomMenu() { let pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.RedEnvelope?.red_code); // 获取系统剪贴板对象 let systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(pasteboardData); // 将数据放入剪贴板 systemPasteboard.getData().then((data) => { ...
AST#method_declaration#Left LongPressTextCustomMenu AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pasteboardData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Le...
LongPressTextCustomMenu() { let pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.RedEnvelope?.red_code); let systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(pasteboardData); systemPasteboard.getData().then((data) => { if (data) { ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/pages/PasswordEnvelopePage.ets#L44-L56
bbe00d8d1f54132cd6f147c1c056cadf54dc89e6
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala/loader/src/ets/perf.ets
arkts
Perf2
Test Create and Delete 421 components. (1 Grid + 20 GridItems(each have 10 items in it)) @Entry
@Component export struct Perf2 { @State currentIndex: number = 0 scroller: Scroller = new Scroller() private controller: TabsController = new TabsController() @State goodData: Array<any> = [{ boo: true, img:"http://123.60.114.106:8090/file/downloadLocal?name=img1.jpg", hei: 200, introduce: '全实木餐...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Perf2 AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A...
@Component export struct Perf2 { @State currentIndex: number = 0 scroller: Scroller = new Scroller() private controller: TabsController = new TabsController() @State goodData: Array<any> = [{ boo: true, img:"http://123.60.114.106:8090/file/downloadLocal?name=img1.jpg", hei: 200, introduce: '全实木餐...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala/loader/src/ets/perf.ets#L91-L283
f5c3b9c4fc3ee2a6869a5af42c3e986b5d572ee1
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/LoginSample/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common Constants for all features.
export class CommonConstants { /** * Login scroll layout weight. */ static readonly LOGIN_SCROLL_LAYOUT_WEIGHT: number = 1; /** * Registration success page scroll layout weight. */ static readonly SCROLL_LAYOUT_WEIGHT: number = 1; /** * Mine page column layout weight. */ static readonly ...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Login scroll layout weight. */ AST#property_declaration#Left static readonly LOGIN_SCROLL_LAYOUT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation...
export class CommonConstants { static readonly LOGIN_SCROLL_LAYOUT_WEIGHT: number = 1; static readonly SCROLL_LAYOUT_WEIGHT: number = 1; static readonly COLUMN_LAYOUT_WEIGHT: number = 1; static readonly LIST_SIZE: number = 2; static readonly TITLE_FONT_WEIGHT: number = 500; static rea...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/LoginSample/entry/src/main/ets/common/constants/CommonConstants.ets#L4-L149
69972568e2b2ec348084d4270fbd61f5c28a2579
gitee
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/pages/SearchStockPage.ets
arkts
_addItem2SelfStock
添加股票到自选股数据库 @param bean
_addItem2SelfStock(bean: SearchStockBean) { this.needRefreshSelfList = true let dbData: StockDBData = { id: 0, code: bean.code, name: bean.name, market: '', date: new Date().toUTCString(), last: bean.last.toString(), sortIndex: new Date().valueOf() } this.selfSt...
AST#method_declaration#Left _addItem2SelfStock AST#parameter_list#Left ( AST#parameter#Left bean : AST#type_annotation#Left AST#primary_type#Left SearchStockBean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_s...
_addItem2SelfStock(bean: SearchStockBean) { this.needRefreshSelfList = true let dbData: StockDBData = { id: 0, code: bean.code, name: bean.name, market: '', date: new Date().toUTCString(), last: bean.last.toString(), sortIndex: new Date().valueOf() } this.selfSt...
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/SearchStockPage.ets#L144-L169
d7a7f590ea522bb7c97ab91b0a91eae88604b67d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/WorkListDataSource.ets
arkts
getData
获取索引对应的数据 @param index 数组索引 @returns
public getData(index: number): WorkItem { return this.dataList[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WorkItem AST#primary_type...
public getData(index: number): WorkItem { return this.dataList[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/WorkListDataSource.ets#L34-L36
0a3e625cd27a0cfa1983048f8dffda36593c692e
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets
arkts
uploadFile
上传文件
async uploadFile() { //上传文件使用的分隔符 let boundary: string = '----ShandongCaoxianNB666MyBabyBoundary' + (await systemDateTime.getCurrentTime(true)).toString() let sandFile = await this.copy2Sandbox(this.uploadFilePath, this.uploadFileName) //选择要上传的文件的内容 let fileContent: Uint8Array = new Uint8Array(thi...
AST#method_declaration#Left async uploadFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //上传文件使用的分隔符 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left boundary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_ann...
async uploadFile() { let boundary: string = '----ShandongCaoxianNB666MyBabyBoundary' + (await systemDateTime.getCurrentTime(true)).toString() let sandFile = await this.copy2Sandbox(this.uploadFilePath, this.uploadFileName) let fileContent: Uint8Array = new Uint8Array(this.readContentFromFile(san...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets#L170-L201
b74c252aac6e0833e4a473aaee3b10f84d117a3d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationCenterService.ets
arkts
getAllNotifications
获取所有通知
public getAllNotifications(): NotificationItem[] { return [...this.notifications]; }
AST#method_declaration#Left public getAllNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NotificationItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#re...
public getAllNotifications(): NotificationItem[] { return [...this.notifications]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L155-L157
a8388bfcafa25a353da9d925351bdf431ef4106c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/RegUtil.ets
arkts
isMobileMatch
给定手机号是否匹配正则 @param content 手机号码
static isMobileMatch(content: string): OutDTO<string> { if (content == null || content == '') { // 提供null的字符串为不匹配 return OutDTO.Error("验证手机号不能为空"); } if (new RegExp(Const.MOBILE).test(content)) { return OutDTO.OK("手机号码格式正确") } else { return OutDTO.Error("手机号码格式不正确,请检查") } }
AST#method_declaration#Left static isMobileMatch AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
static isMobileMatch(content: string): OutDTO<string> { if (content == null || content == '') { return OutDTO.Error("验证手机号不能为空"); } if (new RegExp(Const.MOBILE).test(content)) { return OutDTO.OK("手机号码格式正确") } else { return OutDTO.Error("手机号码格式不正确,请检查") } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/RegUtil.ets#L67-L77
3da95f7f32063d369b37efee6de045149df2c520
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/ScreenAdaptDemoViewModel.ets
arkts
@file 屏幕适配示例页 ViewModel @author Joker.X
@ObservedV2 export default class ScreenAdaptDemoViewModel extends BaseViewModel { }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class ScreenAdaptDemoViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { } AST#class_body#...
@ObservedV2 export default class ScreenAdaptDemoViewModel extends BaseViewModel { }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/ScreenAdaptDemoViewModel.ets#L7-L9
7a6e068a34fd1c9552618421014713a7ec920d1f
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets
arkts
decodeCBC192
解密-CBC模式-192位 @param str 加密的字符串 @param aesKey AES密钥 @param iv iv偏移量字符串 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns
static decodeCBC192(str: string, aesKey: string, iv: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.decodeCBC(str, aesKey, iv, 'AES192', 'AES192|CBC|PKCS7', 192, keyCoding, dataCoding); }
AST#method_declaration#Left static decodeCBC192 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
static decodeCBC192(str: string, aesKey: string, iv: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.decodeCBC(str, aesKey, iv, 'AES192', 'AES192|CBC|PKCS7', 192, keyCoding, dataCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L260-L263
f5aafd8ffb0150da8aae23f37987429e8da5e554
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_commonAttrsEvents/ace_ets_module_commonAttrsEvents_api13/entry/src/main/ets/MainAbility/common/Log.ets
arkts
showError
print error level log @param {string} tag - Page or class tag @param {string} log - Log needs to be printed
static showError(tag: string, log: string) { console.error(`${TAG} tag: ${tag} --> ${log}`); }
AST#method_declaration#Left static showError AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static showError(tag: string, log: string) { console.error(`${TAG} tag: ${tag} --> ${log}`); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_commonAttrsEvents/ace_ets_module_commonAttrsEvents_api13/entry/src/main/ets/MainAbility/common/Log.ets#L48-L50
ece9c83e980d934011d730c728f6a0a1cfb9b3cb
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets
arkts
setLabelPosition
Sets the position of the LimitLine value label (either on the right or on the left edge of the chart). Not supported for RadarChart. @param pos
public setLabelPosition(pos: LimitLabelPosition) { this.mLabelPosition = pos; }
AST#method_declaration#Left public setLabelPosition AST#parameter_list#Left ( AST#parameter#Left pos : AST#type_annotation#Left AST#primary_type#Left LimitLabelPosition AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stateme...
public setLabelPosition(pos: LimitLabelPosition) { this.mLabelPosition = pos; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L169-L171
078b0e9cf18676eea462a352c2a465f56048b22c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/chat/AIAssistantPage.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader 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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L65-L137
aa957d33b0d65df86eae09627d589e888b9f3fc4
github