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
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/view/common/TopBar.ets
arkts
TopBar
TopBar component.
@Component export struct TopBar { // Double binding of index values to achieve linkage effect. @Link index: number; private tabArray: Array<TopBarItem> = initializeOnStartup(); build() { Row({ space: CommonConstants.SPACE_TOP_BAR }) { ForEach(this.tabArray, (item: TopBarItem) => { T...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TopBar AST#component_body#Left { // Double binding of index values to achieve linkage effect. AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right index : AST#type_annotation#Left AST#primary_ty...
@Component export struct TopBar { @Link index: number; private tabArray: Array<TopBarItem> = initializeOnStartup(); build() { Row({ space: CommonConstants.SPACE_TOP_BAR }) { ForEach(this.tabArray, (item: TopBarItem) => { Text(item.name) .fontSize(this.index === item.id ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/common/TopBar.ets#L23-L47
2719e7fcb93ea5880e1ef76f938eb454d1c99299
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
generateContactAvatar
生成联系人头像
async generateContactAvatar(contact: Contact, options?: ImageProcessOptions): Promise<string> { try { // 如果联系人已有头像,则处理现有头像 if (contact.avatar) { return await this.processImage(contact.avatar, { width: 120, height: 120, quality: 85, format: 'jpeg', ...
AST#method_declaration#Left async generateContactAvatar AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left Image...
async generateContactAvatar(contact: Contact, options?: ImageProcessOptions): Promise<string> { try { if (contact.avatar) { return await this.processImage(contact.avatar, { width: 120, height: 120, quality: 85, format: 'jpeg', ...options ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L312-L331
623dd3424621d8ff6425c060c9fde2285f1a41ae
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/form.ets
arkts
validateAgreement
验证协议
private validateAgreement() { if (!this.formData.agree) { this.validation.agree = { valid: false, message: '请阅读并同意用户协议' } } else { this.validation.agree = { valid: true, message: '' } } }
AST#method_declaration#Left private validateAgreement AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_e...
private validateAgreement() { if (!this.formData.agree) { this.validation.agree = { valid: false, message: '请阅读并同意用户协议' } } else { this.validation.agree = { valid: true, message: '' } } }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/form.ets#L170-L176
dc526a1c67ee8ea39f8f6a5878ba48eeeae29bc1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
pauseGame
暂停游戏
pauseGame(sessionId: string): boolean { try { const session = this.activeSessions.get(sessionId); if (!session || session.state !== GameState.PLAYING) { return false; } session.state = GameState.PAUSED; return true; } catch (error) { hilog.error(LogConstants.DOMAIN_A...
AST#method_declaration#Left pauseGame AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R...
pauseGame(sessionId: string): boolean { try { const session = this.activeSessions.get(sessionId); if (!session || session.state !== GameState.PLAYING) { return false; } session.state = GameState.PAUSED; return true; } catch (error) { hilog.error(LogConstants.DOMAIN_A...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L316-L330
a9c37f464a63e227e18b352636766d28d328dbd8
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets
arkts
sendMessageToRemoteService
连接成功后发送消息
async function sendMessageToRemoteService(imageIndexForPosition) { if (mRemote == null) { prompt.showToast({ message: "mRemote is null" }); return; } let option = new rpc.MessageOption(); let data = new rpc.MessageParcel(); let reply = new rpc.MessageParcel(); data.writeIntArray(JSON.parse...
AST#function_declaration#Left async function sendMessageToRemoteService AST#parameter_list#Left ( AST#parameter#Left imageIndexForPosition AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression...
async function sendMessageToRemoteService(imageIndexForPosition) { if (mRemote == null) { prompt.showToast({ message: "mRemote is null" }); return; } let option = new rpc.MessageOption(); let data = new rpc.MessageParcel(); let reply = new rpc.MessageParcel(); data.writeIntArray(JSON.parse...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L138-L152
b0c531a41f2d91cf768160bfd6338caeaec2b77f
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement4.ets
arkts
ConcurrentTaskManagement4
[End execcolorinfo]
@Component export struct ConcurrentTaskManagement4 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.priority_scheduling_title')) .buttonStyles() .margin({ bottom: 16 }) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ConcurrentTaskManagement4 AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right buttonStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_bod...
@Component export struct ConcurrentTaskManagement4 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.priority_scheduling_title')) .buttonStyles() .margin({ bottom: 16 }) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement4.ets#L51-L82
da45bf89968a8c2b1131394984739cf7e91c36c8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TcpClient.ets
arkts
closeConnection
关闭连接
closeConnection() { let tcpMessage: TcpMessage = { type: 'disConnect', }; workerPort.postMessage( tcpMessage ); workerPort.onmessage = (e: MessageEvents) => { const response: TcpMessage = e.data; if (response.type === 'Connection closed') { this.msgHistory += 'Connec...
AST#method_declaration#Left closeConnection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tcpMessage : AST#type_annotation#Left AST#primary_type#Left TcpMessage AST#primary_type#Right AST#type_annotation#...
closeConnection() { let tcpMessage: TcpMessage = { type: 'disConnect', }; workerPort.postMessage( tcpMessage ); workerPort.onmessage = (e: MessageEvents) => { const response: TcpMessage = e.data; if (response.type === 'Connection closed') { this.msgHistory += 'Connec...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TcpClient.ets#L219-L235
a218172a98324cd1b266f731ea7c39230a58e08f
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/pages/SettingsPage.ets
arkts
loadSettings
加载设置
private async loadSettings(): Promise<void> { try { // 获取脱敏的API密钥 this.apiKeyMasked = await this.configService.getMaskedApiKey(); // 获取TTS状态 this.isTTSEnabled = this.ttsService.isEnabled(); // 获取语音提醒状态 this.isVoiceReminderEnabled = this.notificationService.isVoiceReminderEnable...
AST#method_declaration#Left private async loadSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#...
private async loadSettings(): Promise<void> { try { this.apiKeyMasked = await this.configService.getMaskedApiKey(); this.isTTSEnabled = this.ttsService.isEnabled(); this.isVoiceReminderEnabled = this.notificationService.isVoiceReminderEnabled(); this.isNotifica...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/pages/SettingsPage.ets#L43-L59
19050ff5c6244c20c617d26724c84a0bed474c6e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
性别枚举
export enum Gender { MALE = 'male', FEMALE = 'female', OTHER = 'other' }
AST#export_declaration#Left export AST#enum_declaration#Left enum Gender AST#enum_body#Left { AST#enum_member#Left MALE = AST#expression#Left 'male' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left FEMALE = AST#expression#Left 'female' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left O...
export enum Gender { MALE = 'male', FEMALE = 'female', OTHER = 'other' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L68-L72
40a9815655cea7dcf96ea27c38d4e5184eedb8f8
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Statuses Gets current tabs style is whether horizontal or not. @returns a boolean. True for is horizontal.
export function current_tabs_style_is_horizontal(storage: LocalStorage) { let tablet_mode = storage.get('tablet_mode') as boolean; let tabs_style = AppStorage.get('tabs_style') as string; let tabs_style_non_tablet_mode = AppStorage.get('tabs_style_non_tablet_mode') as string; if (tablet_mode) { return tabs_...
AST#export_declaration#Left export AST#function_declaration#Left function current_tabs_style_is_horizontal AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AS...
export function current_tabs_style_is_horizontal(storage: LocalStorage) { let tablet_mode = storage.get('tablet_mode') as boolean; let tabs_style = AppStorage.get('tabs_style') as string; let tabs_style_non_tablet_mode = AppStorage.get('tabs_style_non_tablet_mode') as string; if (tablet_mode) { return tabs_...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L16-L25
b7e1f391f82c85a405729b0e6326ec032069e2ba
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/BluetoothAdvertising.ets
arkts
stopAdvertising
6 完全关闭广播,释放广播资源
public async stopAdvertising() { try { this.toastReport.showResult('bluetooth advertising stop success'); await ble.stopAdvertising(this.advHandle); ble.off('advertisingStateChange', (data: ble.AdvertisingStateChangeInfo) => { console.info(TAG, 'bluetooth advertising state = ' + JSON.strin...
AST#method_declaration#Left public async stopAdvertising AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#L...
public async stopAdvertising() { try { this.toastReport.showResult('bluetooth advertising stop success'); await ble.stopAdvertising(this.advHandle); ble.off('advertisingStateChange', (data: ble.AdvertisingStateChangeInfo) => { console.info(TAG, 'bluetooth advertising state = ' + JSON.strin...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/BluetoothAdvertising.ets#L166-L178
234dd4535765fb6311588f4b7fdadc72276b9016
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets
arkts
touchInMiddleThumb
是否触摸在选取框的中间 @param event @returns
touchInMiddleThumb(event?: GestureEvent): boolean { let pointX: number = this.clearUndefined(event?.fingerList[0].localX); if (pointX >= (this.leftThumbRect[2] + 10) && pointX <= (this.rightThumbRect[0] - 10)) { return true; } else { return false; } }
AST#method_declaration#Left touchInMiddleThumb AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#p...
touchInMiddleThumb(event?: GestureEvent): boolean { let pointX: number = this.clearUndefined(event?.fingerList[0].localX); if (pointX >= (this.leftThumbRect[2] + 10) && pointX <= (this.rightThumbRect[0] - 10)) { return true; } else { return false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets#L400-L411
a8d9819a740d253ddf4d1ae9e6cda15f425f1261
gitee
lentozi/DailyPlan.git
96ce0bec8f545511c51b577c4aa8327c2c5bb0c8
entry/src/main/ets/databaseability/tables/TodoTable.ets
arkts
insertData
插入数据
insertData(todoItem: TodoItem, callback: Function) { const valueBucket: relationalStore.ValuesBucket = generateBucket(todoItem); this.todoTable.insertData(valueBucket, callback); }
AST#method_declaration#Left insertData AST#parameter_list#Left ( AST#parameter#Left todoItem : AST#type_annotation#Left AST#primary_type#Left TodoItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_...
insertData(todoItem: TodoItem, callback: Function) { const valueBucket: relationalStore.ValuesBucket = generateBucket(todoItem); this.todoTable.insertData(valueBucket, callback); }
https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/tables/TodoTable.ets#L33-L36
db549333d716b651e7b8bc2bc3d416976e9ab0f0
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
requestRegister
用户注册
static async requestRegister( user: RegisterInfo, avatarFile: string, ): Promise<RegisterResult> { let registerResult: ResponseDao<string>; try { const response: AxiosResponse<ResponseDao<string>> = await axios.post( `${BASE_URL}/ddchat/index/register`, user, { ...
AST#method_declaration#Left static async requestRegister AST#parameter_list#Left ( AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left RegisterInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left avatarFile : AST#type_annotation#Left AST#primary_type#Left s...
static async requestRegister( user: RegisterInfo, avatarFile: string, ): Promise<RegisterResult> { let registerResult: ResponseDao<string>; try { const response: AxiosResponse<ResponseDao<string>> = await axios.post( `${BASE_URL}/ddchat/index/register`, user, { ...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L288-L336
72f731f214ed65dfaab708a0ff6d772984dbadd5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/SwipeableListItem.ets
arkts
itemEnd
[Start build_the_tail_slide_out_component]
@Builder itemEnd(index: number) { // 构建尾端滑出组件 Button({ type: ButtonType.Circle }) { Image($r('sys.media.ohos_ic_bottomsheet_close')) .width(40) .height(40) } // [StartExclude build_the_tail_slide_out_component] .backgroundColor('#FFE1E2E3') // [EndExclude build_the_tail_s...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemEnd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left {...
@Builder itemEnd(index: number) { Button({ type: ButtonType.Circle }) { Image($r('sys.media.ohos_ic_bottomsheet_close')) .width(40) .height(40) } .backgroundColor('#FFE1E2E3') .onClick(() => { this.arr.splice(index, 1); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/SwipeableListItem.ets#L25-L40
a2be27a401585d7e9344dcd42faea6594c8fb918
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/viewmodel/AlarmClockViewModel.ets
arkts
disableExpiredReminders
禁用已过期的提醒。
disableExpiredReminders() { this.reminderService.getValidReminders( (remindRequests: Array<reminderAgentManager.ReminderRequest>) => { let remindRequestIds = remindRequests.map(remindRequest => remindRequest.notificationId); this.alarms .filter(alarm =>!remindRequestIds.includes(alar...
AST#method_declaration#Left disableExpiredReminders 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...
disableExpiredReminders() { this.reminderService.getValidReminders( (remindRequests: Array<reminderAgentManager.ReminderRequest>) => { let remindRequestIds = remindRequests.map(remindRequest => remindRequest.notificationId); this.alarms .filter(alarm =>!remindRequestIds.includes(alar...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/AlarmClockViewModel.ets#L81-L90
17139803a9b1e513f021c2c00f2807780112ba90
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BarEntry.ets
arkts
getPositiveSum
Reuturns the sum of all positive values this entry (if stacked) contains. @return
public getPositiveSum(): number { return this.mPositiveSum; }
AST#method_declaration#Left public getPositiveSum AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_ex...
public getPositiveSum(): number { return this.mPositiveSum; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarEntry.ets#L106-L108
ed8edfaedf864976272a700cd0116263ffb5f322
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/model/ChildTool.ets
arkts
ChildTool
工具项组件
@Component export struct ChildTool { // 工具项UI builder?: WrappedBuilder<[ToolInterface]>; // 工具项静态参数 params?: CustomParams; // 工具项动效参数 @ObjectLink animationAttribute: CustomAnimation; build() { Column() { this.builder!.builder({params: this.params, animation: this.animationAttribute}); } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChildTool AST#component_body#Left { // 工具项UI AST#property_declaration#Left builder ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#...
@Component export struct ChildTool { builder?: WrappedBuilder<[ToolInterface]>; params?: CustomParams; @ObjectLink animationAttribute: CustomAnimation; build() { Column() { this.builder!.builder({params: this.params, animation: this.animationAttribute}); } } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/ChildTool.ets#L23-L38
b62d75db0dccc6339841e4b9542ad9d7e3b164ad
gitee
zeroone001/harmonyAPP.git
49c8fa1b56de89cb7513b25f3b1b753ba857968a
features/quickstart/src/main/ets/view/Banner.ets
arkts
aboutToAppear(): void { this.getBannerDataFromJSON(); } getBannerDataFromJSON() { getContext(this).resourceManager.getRawFileContent('BannerData.json').then(value => { this.bannerList = JSON.parse(bufferToString(value)) as BannerClass[]; }) }
build() { Swiper() { ForEach(this.bannerList, (item: BannerClass) => { Image($r(item.imageSrc)) .objectFit(ImageFit.Contain) .width('100%') .borderRadius(16) .padding({ top: 11, left: 16, right: 16 }) .onClick(() => { // 把 item 塞到 bannerDet...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Swiper ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST...
build() { Swiper() { ForEach(this.bannerList, (item: BannerClass) => { Image($r(item.imageSrc)) .objectFit(ImageFit.Contain) .width('100%') .borderRadius(16) .padding({ top: 11, left: 16, right: 16 }) .onClick(() => { this.arti...
https://github.com/zeroone001/harmonyAPP.git/blob/49c8fa1b56de89cb7513b25f3b1b753ba857968a/features/quickstart/src/main/ets/view/Banner.ets#L52-L72
456ae6efa4e1a34b328b0ea1c5b93e794ab7bb70
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/viewmodels/ReviewViewModel.ets
arkts
getFilteredTasks
根据筛选模式获取过滤后的任务
static getFilteredTasks(completedTasks: TaskItem[], filterMode: 'all' | 'week' | 'month'): TaskItem[] { const now = Date.now(); const dayMs = 24 * 60 * 60 * 1000; switch (filterMode) { case 'week': return completedTasks.filter(t => now - (t.completedTime || 0) <= 7 * dayMs); case 'month...
AST#method_declaration#Left static getFilteredTasks AST#parameter_list#Left ( AST#parameter#Left completedTasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filterMode AST#...
static getFilteredTasks(completedTasks: TaskItem[], filterMode: 'all' | 'week' | 'month'): TaskItem[] { const now = Date.now(); const dayMs = 24 * 60 * 60 * 1000; switch (filterMode) { case 'week': return completedTasks.filter(t => now - (t.completedTime || 0) <= 7 * dayMs); case 'month...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L164-L175
e03c2d1577e2987e87a06bf0110f0f93dec06518
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SM3Sync.ets
arkts
hmac
消息认证码计算 @param str 计算字符串 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns
static hmac(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return DynamicSyncUtil.hmac(str, 'SM3', resultCoding); }
AST#method_declaration#Left static hmac 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left...
static hmac(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return DynamicSyncUtil.hmac(str, 'SM3', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM3Sync.ets#L44-L46
1d9e733e4e27ee6e8a51cb0b32887ef892e8febf
gitee
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/pages/Index.ets
arkts
onSelectedIndexChange
当前页面监听:当进入第三页时关闭菜单栏侧滑
@Monitor('selectedIndex') onSelectedIndexChange(monitor: IMonitor) { const newIndex = monitor.value()?.now as number; this.disableSwipeOpen = (newIndex === 3 || newIndex === 4); }
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'selectedIndex' AST#expression#Right ) AST#decorator#Right onSelectedIndexChange AST#parameter_list#Left ( AST#parameter#Left monitor : AST#type_annotation#Left AST#primary_type#Left IMonitor AST#primary_type#Right AST#type_annotation#Right ...
@Monitor('selectedIndex') onSelectedIndexChange(monitor: IMonitor) { const newIndex = monitor.value()?.now as number; this.disableSwipeOpen = (newIndex === 3 || newIndex === 4); }
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/Index.ets#L50-L54
36f1e78d05940247ccfdb2c0aa3d40d32dfa6262
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MePage.ets
arkts
getCurrentUser
获取当前用户信息 @returns {User} 用户信息
private getCurrentUser(): User { return this.userState.getUserInfo(); }
AST#method_declaration#Left private getCurrentUser AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expre...
private getCurrentUser(): User { return this.userState.getUserInfo(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L206-L208
a0bc2a5a10bfb88139c6827f071315ba31220103
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Box.ets
arkts
compareTo
MARK: - Comparable 比较 比较两个Box的大小 @param other - 另一个Box对象
compareTo(other: Box): number { if (this.num === other.num) { return this.distance - other.distance; } else { return this.num - other.num; } }
AST#method_declaration#Left compareTo AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left Box AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST...
compareTo(other: Box): number { if (this.num === other.num) { return this.distance - other.distance; } else { return this.num - other.num; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L70-L76
87998f28b38c43308370c5ea4812d974c39537b1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/AttributeModifier.ets
arkts
枚举文本类型
export enum TextType { TYPE_ONE, TYPE_TWO, TYPE_Three, TYPE_FOUR }
AST#export_declaration#Left export AST#enum_declaration#Left enum TextType AST#enum_body#Left { AST#enum_member#Left TYPE_ONE AST#enum_member#Right , AST#enum_member#Left TYPE_TWO AST#enum_member#Right , AST#enum_member#Left TYPE_Three AST#enum_member#Right , AST#enum_member#Left TYPE_FOUR AST#enum_member#Right } AST#e...
export enum TextType { TYPE_ONE, TYPE_TWO, TYPE_Three, TYPE_FOUR }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/AttributeModifier.ets#L121-L126
db8eecd537a509343be6b76383a3d4fd3796557a
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
isDownloadPaused
检查下载是否暂停
isDownloadPaused(episodeId: string): boolean { const task = this.downloadTasks.get(episodeId); return task ? task.isPaused : false; }
AST#method_declaration#Left isDownloadPaused 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 boolean AST#primary...
isDownloadPaused(episodeId: string): boolean { const task = this.downloadTasks.get(episodeId); return task ? task.isPaused : false; }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L221-L224
7cad2f2f5da1ab6ab087055857a8c4719717565f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets
arkts
tagListItemBuilder
左侧类别视图
@Builder tagListItemBuilder(item: string, index: number) { ListItem() { Text(item) .width('100%') .height(COMPONENT_STYLE.TAG_TEXT_HEIGHT) .fontWeight(FontWeight.Regular) .fontColor($r('sys.color.ohos_fa_text_secondary')) .textAlign(TextAlign.Center) .backgrou...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tagListItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#...
@Builder tagListItemBuilder(item: string, index: number) { ListItem() { Text(item) .width('100%') .height(COMPONENT_STYLE.TAG_TEXT_HEIGHT) .fontWeight(FontWeight.Regular) .fontColor($r('sys.color.ohos_fa_text_secondary')) .textAlign(TextAlign.Center) .backgrou...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets#L190-L213
13552488fed8c4325c452470c766f88e5d05b818
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/calendar/BirthdayListPage.ets
arkts
aboutToAppear
页面生命周期 - 即将出现
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'BirthdayListPage aboutToAppear'); this.loadBirthdays(); }
AST#method_declaration#Left aboutToAppear 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 hilog AST#expression#Right . info AST#member_expre...
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'BirthdayListPage aboutToAppear'); this.loadBirthdays(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/calendar/BirthdayListPage.ets#L36-L39
9ab1b296a042b978e4857aa4462adeb0664407a0
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaHelper.ets
arkts
unit8ArrayToStr
Uint8Array转字符串 @param src Uint8Array @returns 字符串
private static unit8ArrayToStr(src: Uint8Array, encoding: buffer.BufferEncoding = 'utf-8'): string { let textDecoder = util.TextDecoder.create(encoding, { ignoreBOM: true }) let result = textDecoder.decodeWithStream(src, { stream: true }); return result; }
AST#method_declaration#Left private static unit8ArrayToStr AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left encoding : AST#type_annotation#Left AST#primary_type#Left AST#...
private static unit8ArrayToStr(src: Uint8Array, encoding: buffer.BufferEncoding = 'utf-8'): string { let textDecoder = util.TextDecoder.create(encoding, { ignoreBOM: true }) let result = textDecoder.decodeWithStream(src, { stream: true }); return result; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L155-L159
4aef9c27bbc6d1ad8053dfd32b29562834daddfc
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets
arkts
practiceGraphType
统计图样式 ***************************************统计图************************************************88 UI
@Builder practiceGraphType(type:string,workoutdata:WorkoutData,isTime:boolean,totalTime:number,totalCarolie:number){ Column(){ // 标题行 Row(){ //左边标题 Text((isTime)?'锻炼时长':'卡路里') .fontSize(24) .fontColor('#333333') .fontWeight(500) .margin({left:15}...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right practiceGraphType AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left workoutdata : AST#type_annota...
@Builder practiceGraphType(type:string,workoutdata:WorkoutData,isTime:boolean,totalTime:number,totalCarolie:number){ Column(){ Row(){ Text((isTime)?'锻炼时长':'卡路里') .fontSize(24) .fontColor('#333333') .fontWeight(500) .margin({left:15}) ...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets#L109-L208
c2b1d9a7bc5740b04230cae95b3518f8ec8e3596
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
applyThemeSettings
应用主题设置
private applyThemeSettings(): void { // 更新全局颜色系统 this.updateGlobalColors(); // 关闭对话框 this.showThemeSettings = false; // 显示成功提示 promptAction.showToast({ message: `主题已应用 - ${this.getThemeColorName()}`, duration: 2000 }); }
AST#method_declaration#Left private applyThemeSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 更新全局颜色系统 AST#expression_statement#Left AST#expression#Left AST#call_expre...
private applyThemeSettings(): void { this.updateGlobalColors(); this.showThemeSettings = false; promptAction.showToast({ message: `主题已应用 - ${this.getThemeColorName()}`, duration: 2000 }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L5840-L5852
9cf5785315f083a539e3ca23efce9615db60a09a
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history.ets
arkts
shift_time
Increases this history's accessed_time by one (1).
shift_time() { this.accessed_time++; }
AST#method_declaration#Left shift_time AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accessed_time AST#membe...
shift_time() { this.accessed_time++; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L38-L40
c8a48adc30f631884470a64c90f42016f11dcdc6
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets
arkts
getChartValues
Get chart values. @param {number} stepsValue Value of steps. @param {DataRdb.RdbStore} rdbStore RDB database. @return {ChartValues} chartValues.
async getChartValues(stepsValue: number, rdbStore: DataRdb.RdbStore) { let chartValues: ChartValues = new ChartValues(); // Set fill color. chartValues.fillColor = CommonConstants.CHART_VALUES_FILL_COLOR; // Set the color of the line. chartValues.strokeColor = CommonConstants.CHART_VALUES_STROKE_COL...
AST#method_declaration#Left async getChartValues AST#parameter_list#Left ( AST#parameter#Left stepsValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualifi...
async getChartValues(stepsValue: number, rdbStore: DataRdb.RdbStore) { let chartValues: ChartValues = new ChartValues(); chartValues.fillColor = CommonConstants.CHART_VALUES_FILL_COLOR; chartValues.strokeColor = CommonConstants.CHART_VALUES_STROKE_COLOR; chartValues.gradient = true; l...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets#L49-L68
07aecd4a64356730b03c7ed231f28a94d38c5427
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pulltorefreshnews/src/main/ets/viewModel/BasicDataSource.ets
arkts
notifyDataChange
通知LazyForEach组件需要在index对应索引处添加子组件
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }) }
AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pulltorefreshnews/src/main/ets/viewModel/BasicDataSource.ets#L57-L61
f9148992eaebb696d81460a25dd94b86eec3b2ea
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
dailyUpdate
每日更新快捷方式
async dailyUpdate(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Starting daily shortcut update'); // 移除过期的快捷方式 await this.removeExpiredShortcuts(); // 重新创建动态快捷方式 await this.createDynamicShortcuts(); hilog.info(LogConstant...
AST#method_declaration#Left async dailyUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
async dailyUpdate(): Promise<void> { try { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Starting daily shortcut update'); await this.removeExpiredShortcuts(); await this.createDynamicShortcuts(); hilog.info(LogConstants.DOMAIN_APP, LogConstant...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L320-L334
79b8bdd8a0c2df8378a40a2248adcc55e513db73
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/UserFile/ManagingExternalStorageDevices/entry/src/main/ets/pages/Index.ets
arkts
receiveBroadcastNotifications
[End subscribe_events_2] [Start subscribe_events_3]
receiveBroadcastNotifications() { // [StartExclude subscribe_events_3] Logger.info('receiveBroadcastNotifications() begin'); if (subscriber === undefined) { Logger.error('Subscriber is not defined. Please subscribe to events first.'); return; } // [EndExclude subscribe_events_3] comm...
AST#method_declaration#Left receiveBroadcastNotifications AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // [StartExclude subscribe_events_3] AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Le...
receiveBroadcastNotifications() { Logger.info('receiveBroadcastNotifications() begin'); if (subscriber === undefined) { Logger.error('Subscriber is not defined. Please subscribe to events first.'); return; } commonEventManager.subscribe(subscriber, (err: BusinessError, data: common...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/ManagingExternalStorageDevices/entry/src/main/ets/pages/Index.ets#L111-L140
33a8c14d7057aaadd9aa1d7efb054cf1459368b2
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/DemoCounterState.ets
arkts
@file 全局计数器状态(ArkTS V2),提供跨页面共享的响应式状态 @author Joker.X AppStorageV2 键名
export const DEMO_COUNTER_KEY: string = "demo_counter_state";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DEMO_COUNTER_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "demo_counter_state" AST#expression#Right AST#variable_declarator#Right ; AS...
export const DEMO_COUNTER_KEY: string = "demo_counter_state";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/DemoCounterState.ets#L11-L11
768bee46c3c34997888b9a471c97c2ad2f7b65b4
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ibestui/Index.ets
arkts
@file ibestui 模块统一导出 @author Joker.X
export * from "@ibestservices/ibest-ui-v2";
AST#export_declaration#Left export * from "@ibestservices/ibest-ui-v2" ; AST#export_declaration#Right
export * from "@ibestservices/ibest-ui-v2";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ibestui/Index.ets#L6-L6
88cb427d1a697c1fc7b47db6ba47ca39e7c3d6d6
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/rest/RequestHandlers/RequestHandler.ets
arkts
构造函数参数类型标注(约束1)
constructor(restManager: RESTManager) { this.restManager = restManager; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left restManager : AST#type_annotation#Left AST#primary_type#Left RESTManager AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_...
constructor(restManager: RESTManager) { this.restManager = restManager; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/rest/RequestHandlers/RequestHandler.ets#L15-L17
815c7c898b24ab9217acc1c163984d7997adfd56
github
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '0.3.3';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '0.3.3' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '0.3.3';
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/BuildProfile.ets#L4-L4
d7a6190f55c01bb3e44bac4836899211b05c0eed
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/community/PostDetailPage.ets
arkts
handleCommentLike
处理评论点赞
handleCommentLike(comment: Comment): void { if (comment && comment.likeCount !== undefined) { if (comment.isLiked) { comment.likeCount = Math.max(0, comment.likeCount - 1); } else { comment.likeCount += 1; } comment.isLiked = !comment.isLiked; } }
AST#method_declaration#Left handleCommentLike AST#parameter_list#Left ( AST#parameter#Left comment : AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
handleCommentLike(comment: Comment): void { if (comment && comment.likeCount !== undefined) { if (comment.isLiked) { comment.likeCount = Math.max(0, comment.likeCount - 1); } else { comment.likeCount += 1; } comment.isLiked = !comment.isLiked; } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostDetailPage.ets#L315-L324
f360857fd1b7b410df726d84e277335e387b80df
github
azhuge233/Wake-HarmonyOS.git
68c4e961f9cf5fab8699af99313dd5854ea313a1
entry/src/main/ets/model/DeviceList.ets
arkts
updateAllFormBelongsToDevice
以下为桌面卡片(Form)相关 仅更改持久化存储,不刷新卡片 UI 卡片 UI 在 ViewModel 刷新
private async updateAllFormBelongsToDevice(device: Device): Promise<string[]> { const updatedFormIDs = await this.pm.updateByDevice(device); Logger.debug(this.LOG_TAG, `已更新 ${updatedFormIDs.length} 个相关卡片`); return updatedFormIDs; }
AST#method_declaration#Left private async updateAllFormBelongsToDevice AST#parameter_list#Left ( AST#parameter#Left device : AST#type_annotation#Left AST#primary_type#Left Device AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L...
private async updateAllFormBelongsToDevice(device: Device): Promise<string[]> { const updatedFormIDs = await this.pm.updateByDevice(device); Logger.debug(this.LOG_TAG, `已更新 ${updatedFormIDs.length} 个相关卡片`); return updatedFormIDs; }
https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/model/DeviceList.ets#L119-L123
c686a4590800b20c2bdafb4d4733bf07047205ea
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/CallbackTransformer.ets
arkts
throw
Improve: need invert dependency: createUiDetachedRoot should be imported from @koalaui/arkoala same as in TS
export type UIDetachedRootCreator = ( peerFactory: () => PeerNode, @memo builder: () => void ) => PeerNode function createUiDetachedRootStub( factory: () => PeerNode, @memo builder: () => void ): PeerNode { throw
AST#export_declaration#Left export AST#ERROR#Left type UIDetachedRootCreator = ( AST#parameter#Left peerFactory : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left PeerNode AST#primary_type#Right AST#type_annotation#Rig...
export type UIDetachedRootCreator = ( peerFactory: () => PeerNode, @memo builder: () => void ) => PeerNode function createUiDetachedRootStub( factory: () => PeerNode, @memo builder: () => void ): PeerNode { throw
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/CallbackTransformer.ets#L23-L34
0028bf367fbc95182cf3fb86a281d38441a55aa8
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/RelationshipRemove.ets
arkts
应用约束60:使用export default代替module.exports
export default RelationshipRemoveHandler;
AST#export_declaration#Left export default AST#expression#Left RelationshipRemoveHandler AST#expression#Right ; AST#export_declaration#Right
export default RelationshipRemoveHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/RelationshipRemove.ets#L42-L42
3f37f79e719b9ecc2ebd4ee5a97807e9c6529515
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets
arkts
子分类数据模型
export interface CategoryChild { id: number; name: string; pic: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CategoryChild AST#object_type#Left { AST#type_member#Left id : 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 name : AST#type_annotation#Left A...
export interface CategoryChild { id: number; name: string; pic: string; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets#L48-L52
634229be5fb21c877d274ed10fa9f92178bbe520
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/negative/src/main/ets/common/CustomRoutes.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 CustomRoutes { static readonly ROUTES: Route[] = [ { title: '未使用组件复用', child: [ { text: '场景1', title: '列表项结构类型相同', to: 'NoReuseScene1' }, { text: '场景2', title: '列表项结构类型相同-结构一', to: 'NoReuseScene2_StructureOne' }, { text: '场景2', title: '列表项结构类型相同-结构二', to: 'NoReuseS...
AST#export_declaration#Left export AST#class_declaration#Left class CustomRoutes AST#class_body#Left { AST#property_declaration#Left static readonly ROUTES : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Route [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expressio...
export class CustomRoutes { static readonly ROUTES: Route[] = [ { title: '未使用组件复用', child: [ { text: '场景1', title: '列表项结构类型相同', to: 'NoReuseScene1' }, { text: '场景2', title: '列表项结构类型相同-结构一', to: 'NoReuseScene2_StructureOne' }, { text: '场景2', title: '列表项结构类型相同-结构二', to: 'NoReuseS...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/negative/src/main/ets/common/CustomRoutes.ets#L16-L36
73826a27c9747cdf08b6d2af35d88bbda00d5ba0
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FormatUtil.ets
arkts
getPhoneLocationName
获取电话号码归属地 @param phone @param locale string 区域ID country string 表示电话号码所属国家或地区代码。 options PhoneNumberFormatOptions 电话号码格式化对象的相关选项。默认值:NATIONAL。 @returns
static getPhoneLocationName(phone: string, locale: string = "zh-CN", country: string = "CN", option?: i18n.PhoneNumberFormatOptions): string { const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option); return phoneNumberFormat.getLocationName(phone, locale); }
AST#method_declaration#Left static getPhoneLocationName AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left locale : AST#type_annotation#Left AST#primary_type#Left string AST#...
static getPhoneLocationName(phone: string, locale: string = "zh-CN", country: string = "CN", option?: i18n.PhoneNumberFormatOptions): string { const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option); return phoneNumberFormat.getLocationName(phone, locale); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L63-L67
376d2b580c7e172a27bba110e4bcbd5e640ee0a5
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildEmojiCreate.ets
arkts
Emitted whenever a custom emoji is created in a guild. @event Client#emojiCreate @param {Emoji} emoji The emoji that was created 应用约束60: 使用ES模块导出
export default GuildEmojiCreateAction;
AST#export_declaration#Left export default AST#expression#Left GuildEmojiCreateAction AST#expression#Right ; AST#export_declaration#Right
export default GuildEmojiCreateAction;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildEmojiCreate.ets#L32-L32
4ee611b9d0dbc747f93d0910021002610147ac80
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/model/DataModel.ets
arkts
getData
Retrieve data at the specified index.
public getData(index: number): string { return this.tabContent[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 string AST#primary_type#R...
public getData(index: number): string { return this.tabContent[index]; }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/DataModel.ets#L60-L62
18d2e4bb4db6a8fbfd9e131eb3808ec85a57ca17
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/RegexUtil.ets
arkts
isEmail
判断传入的邮箱格式是否正确 @param content @returns
static isEmail(content: string): boolean { return RegexUtil.isMatch(content, RegexUtil.REG_EMAIL); }
AST#method_declaration#Left static isEmail 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 boolean AST#primary_typ...
static isEmail(content: string): boolean { return RegexUtil.isMatch(content, RegexUtil.REG_EMAIL); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RegexUtil.ets#L237-L239
54f8b4195239abb53735d8e4cedf1b12f725da9c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
playNext
播放后一首(根据当前循环模式)
async playNext() { switch (this.curLoopMode) { case AVSessionManager.LoopMode.LOOP_MODE_SINGLE: { this.seek(0); break; } case AVSessionManager.LoopMode.LOOP_MODE_LIST: { this.curMusicModelIndex = (this.curMusicModelIndex + 1) % this.musicModelArr.length; this.curMu...
AST#method_declaration#Left async playNext 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 switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curL...
async playNext() { switch (this.curLoopMode) { case AVSessionManager.LoopMode.LOOP_MODE_SINGLE: { this.seek(0); break; } case AVSessionManager.LoopMode.LOOP_MODE_LIST: { this.curMusicModelIndex = (this.curMusicModelIndex + 1) % this.musicModelArr.length; this.curMu...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L356-L372
f773f86ef36c0cc3fd069c3ad7205ed424fa67e8
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
deleteWordIds
/ 删除wordIds
async deleteWordIds(wordIds: number[]): Promise<void> { await PlanManager.deleteWordIds(wordIds, this); }
AST#method_declaration#Left async deleteWordIds AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#...
async deleteWordIds(wordIds: number[]): Promise<void> { await PlanManager.deleteWordIds(wordIds, this); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L496-L498
e09c43551225040fde4cb56dc4641ef0a182914a
github
FantasyWind/fwrouter
eea785a7bf728862de1f88de487ef3857dee3364
router/src/main/ets/RouterManagerForNavigation.ets
arkts
init
RouterHandler相关方法
init(uiAbility: UIAbility): void { this.observerPageLifecycle(uiAbility) }
AST#method_declaration#Left init AST#parameter_list#Left ( AST#parameter#Left uiAbility : AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ...
init(uiAbility: UIAbility): void { this.observerPageLifecycle(uiAbility) }
https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/router/src/main/ets/RouterManagerForNavigation.ets#L104-L106
af055ee7b64b6e0e301a5e2aba2a916504eae643
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pendingitems/src/main/ets/pages/ToDoList.ets
arkts
itemEnd
item左滑显示工具栏
@Builder itemEnd(item: ToDo) { Row({ space: STYLE_CONFIG.ICON_GUTTER }) { Image($r('app.media.pendingitems_ic_public_settings_filled')).imageStyle() .onClick(() => { promptAction.showToast({ message: $r('app.string.pendingitems_incomplete') }); }) Image($r('app.media.pendingi...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemEnd AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ToDo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AS...
@Builder itemEnd(item: ToDo) { Row({ space: STYLE_CONFIG.ICON_GUTTER }) { Image($r('app.media.pendingitems_ic_public_settings_filled')).imageStyle() .onClick(() => { promptAction.showToast({ message: $r('app.string.pendingitems_incomplete') }); }) Image($r('app.media.pendingi...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pendingitems/src/main/ets/pages/ToDoList.ets#L132-L151
4dce52b91b306f48f5be301c6731979f31ac0d1e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
aboutToDisappear
页面生命周期 - 页面即将消失
aboutToDisappear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Index page aboutToDisappear'); }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_ex...
aboutToDisappear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Index page aboutToDisappear'); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L169-L171
97a7e7b0584f94faeb0b07073236a4af334bfbbc
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/StringCipherArkTS/entry/src/main/ets/model/UserTableApi.ets
arkts
getListFromResultSet
Encapsulates the query result into the user information corresponding to the user. @param resultSet Query result set. @returns Result set of the user object type.
getListFromResultSet(resultSet: dataRdb.ResultSet): User[] { if (!resultSet) { Logger.error(`resultSet is null or undefined`); } let userList: User[] = []; for (let i = 0; i < resultSet.rowCount; i++) { resultSet.goToNextRow(); let user = new User(resultSet.getDouble(resultSet.getColu...
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 dataRdb . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ...
getListFromResultSet(resultSet: dataRdb.ResultSet): User[] { if (!resultSet) { Logger.error(`resultSet is null or undefined`); } let userList: User[] = []; for (let i = 0; i < resultSet.rowCount; i++) { resultSet.goToNextRow(); let user = new User(resultSet.getDouble(resultSet.getColu...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/model/UserTableApi.ets#L59-L73
0b00f7456ff0236eddd72a403ee04e637d8cb007
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets
arkts
@Author csx @DateTime 2024/3/18 10:33:03 @TODO SM2Sync SM2同步操作类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class SM2Sync { /** * 生成SM2的非对称密钥 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns SM2密钥{publicKey:公钥,privateKey:私钥} */ static generateSM2Key(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey { return CryptoSyncUtil.generateCryptoKey('SM2_256', resultCoding); } ...
AST#export_declaration#Left export AST#class_declaration#Left class SM2Sync AST#class_body#Left { /** * 生成SM2的非对称密钥 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns SM2密钥{publicKey:公钥,privateKey:私钥} */ AST#method_declaration#Left static generateSM2Key AST#parameter_list#Left ( AST#parame...
export class SM2Sync { static generateSM2Key(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey { return CryptoSyncUtil.generateCryptoKey('SM2_256', resultCoding); } static encode(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'):...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L28-L146
05e895299229f6da7c55dba94f921333ef7cc0ee
gitee
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/view/launcher/BannerCards.ets
arkts
aboutToAppear
onPageShow(): void { console.log("homeAddCardsData onPageShow ") this.initData() }
aboutToAppear(): void { console.log("homeAddCardsData aboutToAppear ") this.initData() }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { console.log("homeAddCardsData aboutToAppear ") this.initData() }
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/view/launcher/BannerCards.ets#L35-L38
0a21bf0a09953812b979f24234ee9111ef22f6a1
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/watch/VHLinkTextView.ets
arkts
openLink
打开链接
private openLink(url: string) { const params=new WebViewParams("e.vhall.com",url); this.contentNode = new ComponentContent(this.getUIContext(), wrapBuilder(WebViewPageBuilder),params); PromptActionClass.setContext(this.getUIContext()); PromptActionClass.setContentNode(this.contentNode); PromptAction...
AST#method_declaration#Left private openLink AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef...
private openLink(url: string) { const params=new WebViewParams("e.vhall.com",url); this.contentNode = new ComponentContent(this.getUIContext(), wrapBuilder(WebViewPageBuilder),params); PromptActionClass.setContext(this.getUIContext()); PromptActionClass.setContentNode(this.contentNode); PromptAction...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/watch/VHLinkTextView.ets#L58-L65
f80a064a9cdded533bc0c3a61fd5eaafdcdf221d
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
common/component/src/main/ets/default/textComponent.ets
arkts
TextComponentWithEndText
Text title with end text layout with harmony round style used in list item. Note that this does not contains the white padding when is touched. If you want to use it in single touch layout, wrap it with extra container component.
@Component export struct TextComponentWithEndText { @State endText: string = ""; @State isTouched: boolean = false; private title: string | Resource = ''; build() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { Text(this.title) .fontSize($r...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextComponentWithEndText AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right endText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AS...
@Component export struct TextComponentWithEndText { @State endText: string = ""; @State isTouched: boolean = false; private title: string | Resource = ''; build() { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Row() { Text(this.title) .fontSize($r...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/textComponent.ets#L107-L165
e14e0b73ebdf9c042c8a8007e156a8eb9e346cdd
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/ai/AIAssistantService.ets
arkts
建议动作接口
export interface SuggestedAction { id: string; type: ActionType; title: string; description: string; priority: number; parameters?: Record<string, any>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SuggestedAction AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left...
export interface SuggestedAction { id: string; type: ActionType; title: string; description: string; priority: number; parameters?: Record<string, any>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/ai/AIAssistantService.ets#L192-L199
d6e2149298faf30f61bcac237f6ca4d96c13bff4
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets
arkts
buildThemeModeSection
构建主题模式选择
@Builder buildThemeModeSection() { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('主题模式') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) Row({ space: UIConstants.SMALL_PADDING }) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildThemeModeSection 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 Card ( ) AST#container_content_body#Left { AST#arkts...
@Builder buildThemeModeSection() { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('主题模式') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) Row({ space: UIConstants.SMALL_PADDING }) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L339-L380
f9b9bdbef71b9ef68a1093bbf9e5d7831aa103bf
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/CharUtil.ets
arkts
isLetter
判断字符串char是否是字母 @param char @returns
static isLetter(char: string): boolean { return i18n.Unicode.isLetter(char); }
AST#method_declaration#Left static isLetter AST#parameter_list#Left ( AST#parameter#Left char : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#...
static isLetter(char: string): boolean { return i18n.Unicode.isLetter(char); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CharUtil.ets#L40-L42
d2219089c3bfbf7c34a65353b39c6838716b06ce
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/controller/EditController.ets
arkts
操作数据
export type OperateData = TextInputData | CropData | MosaicData | PaletteData;
AST#export_declaration#Left export AST#type_declaration#Left type OperateData = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left TextInputData AST#primary_type#Right | AST#primary_type#Left CropData AST#primary_type#Right | AST#primary_type#Left MosaicData AST#primary_type#Right | AST#primary_type#Lef...
export type OperateData = TextInputData | CropData | MosaicData | PaletteData;
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/controller/EditController.ets#L25-L25
31db8f782fb93c11ec30cef92b5aa2edbcc11404
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets
arkts
startDrawTask
启动绘画任务
private startDrawTask() { let that = this; that.renderContext.translate( this.canvasSize / CommonConstants.DEFAULT_DOUBLE, this.canvasSize / CommonConstants.DEFAULT_DOUBLE); that.drawClockArea(); this.drawInterval = setInterval(() => { that.drawClockArea(); }, MainConstant.DEFAULT_...
AST#method_declaration#Left private startDrawTask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left that = AST#expression#Left this AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaratio...
private startDrawTask() { let that = this; that.renderContext.translate( this.canvasSize / CommonConstants.DEFAULT_DOUBLE, this.canvasSize / CommonConstants.DEFAULT_DOUBLE); that.drawClockArea(); this.drawInterval = setInterval(() => { that.drawClockArea(); }, MainConstant.DEFAULT_...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets#L56-L65
1f828bf398054a2bb40e9d64d05a49cf515f558e
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/chained_call/chained_call_002_F.ets
arkts
Introduction 链式调用
export function chained_call_002_F(taint_src : string) { new A().setData("_").clearData().setData("clean").f(); }
AST#export_declaration#Left export AST#function_declaration#Left function chained_call_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function chained_call_002_F(taint_src : string) { new A().setData("_").clearData().setData("clean").f(); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/chained_call/chained_call_002_F.ets#L6-L9
82e3377a0cfd0069d0f89279bf1124f9c3903d13
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/runtime/NormalPermissionRequest.ets
arkts
checkOtherConfig
检查权限的其它配置 @param permissions
checkOtherConfig(permissions: Array<Permissions>) { const locationPermissionIndex = permissions.indexOf(this.LOCATION_PERMISSION) const locationBackgroundIndex = permissions.indexOf(this.LOCATION_IN_BACKGROUND) if (locationPermissionIndex >= 0 && locationBackgroundIndex < 0) { /* * 对于位置权限,有两种情况...
AST#method_declaration#Left checkOtherConfig AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right > AST#t...
checkOtherConfig(permissions: Array<Permissions>) { const locationPermissionIndex = permissions.indexOf(this.LOCATION_PERMISSION) const locationBackgroundIndex = permissions.indexOf(this.LOCATION_IN_BACKGROUND) if (locationPermissionIndex >= 0 && locationBackgroundIndex < 0) { permissions = [] ...
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/runtime/NormalPermissionRequest.ets#L16-L37
63e9865fe953de298d8d23bc4f48405f3adfdea9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/VirtualEconomyService.ets
arkts
交易记录接口
export interface Transaction { id: string; userId: string; type: TransactionType; itemId?: string; currencyType: CurrencyType; amount: number; balanceBefore: number; balanceAfter: number; reason: string; metadata: Record<string, any>; timestamp: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Transaction AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left userId : AST#type_annotation#Left A...
export interface Transaction { id: string; userId: string; type: TransactionType; itemId?: string; currencyType: CurrencyType; amount: number; balanceBefore: number; balanceAfter: number; reason: string; metadata: Record<string, any>; timestamp: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L131-L143
c3b8084c76684059b282b4b5b5ff99cf5afa36bb
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/AppUtility.ets
arkts
============================================================ 主工具类 ============================================================
export class AppUtility { // ================== 资源相关方法 ================== /** * Used for iab gold icon * @returns 图标资源ID数组 */ static getIabGoldIconResIds(): number[] { const ids: number[] = [ // $r('app.media.gold_iap1'), // $r('app.media.gold_iap2'), // $r('app.media.gold_iap3') ...
AST#export_declaration#Left export AST#class_declaration#Left class AppUtility AST#class_body#Left { // ================== 资源相关方法 ================== /** * Used for iab gold icon * @returns 图标资源ID数组 */ AST#method_declaration#Left static getIabGoldIconResIds AST#parameter_list#Left ( ) AST#parameter_list#Right :...
export class AppUtility { static getIabGoldIconResIds(): number[] { const ids: number[] = [ ]; return ids; } static getQuizTopIconResIds(): number[] { const ids: number[] = [ ]; return ids; } static getQuizTopTextS...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L49-L449
9265171b82f87c8ba98a0af146ed3ba504c49a8c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets
arkts
releaseTranscoderingProcess
释放转码流程。
async releaseTranscoderingProcess() { if (canIUse('SystemCapability.Multimedia.Media.AVTranscoder')) { if (this.avTranscoder != undefined) { // 1.释放转码实例。 await this.avTranscoder.release(); this.avTranscoder = undefined; // 2.关闭转码目标文件fd。 fs.closeSync(this.avTranscoder!.f...
AST#method_declaration#Left async releaseTranscoderingProcess AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ...
async releaseTranscoderingProcess() { if (canIUse('SystemCapability.Multimedia.Media.AVTranscoder')) { if (this.avTranscoder != undefined) { await this.avTranscoder.release(); this.avTranscoder = undefined; fs.closeSync(this.avTranscoder!.fdDst); } } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets#L109-L119
53678529022a862833c482d07541fa69afdecade
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/components/Component.ets
arkts
PanelListItem
panel中list布局样式
@Component export struct PanelListItem { private desc: string = ''; private including: string = ''; build() { Row() { Column() { Text(this.desc) .fontSize(14) .margin({ bottom: $r("app.integer.bottompanelslide_number_10") }) Text(this.including) .fontSize(1...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PanelListItem AST#component_body#Left { AST#property_declaration#Left private desc : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#...
@Component export struct PanelListItem { private desc: string = ''; private including: string = ''; build() { Row() { Column() { Text(this.desc) .fontSize(14) .margin({ bottom: $r("app.integer.bottompanelslide_number_10") }) Text(this.including) .fontSize(1...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/components/Component.ets#L93-L118
6194daa7b84f33e343549382c80346f34ee1e035
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/ime/text/Key/KeyHintConfiguration.ets
arkts
Helper class for summarizing all hint preferences in one single object.
export class KeyHintConfiguration { symbolHintMode: KeyHintMode; numberHintMode: KeyHintMode; mergeHintPopups: boolean; constructor(symbolHintMode: KeyHintMode, numberHintMode: KeyHintMode, mergeHintPopups: boolean) { this.symbolHintMode = symbolHintMode; this.numberHintMode = numberHintMode; this....
AST#export_declaration#Left export AST#class_declaration#Left class KeyHintConfiguration AST#class_body#Left { AST#property_declaration#Left symbolHintMode : AST#type_annotation#Left AST#primary_type#Left KeyHintMode AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declarat...
export class KeyHintConfiguration { symbolHintMode: KeyHintMode; numberHintMode: KeyHintMode; mergeHintPopups: boolean; constructor(symbolHintMode: KeyHintMode, numberHintMode: KeyHintMode, mergeHintPopups: boolean) { this.symbolHintMode = symbolHintMode; this.numberHintMode = numberHintMode; this....
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/ime/text/Key/KeyHintConfiguration.ets#L13-L25
175a50cec6e37d45c4e47c460691849ca54a2e23
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
onRangeStopScrollChanged
视频范围选择结束
onRangeStopScrollChanged() { let start: number = this.scroller.currentOffset().xOffset; // 计算开始位置 let startPosition: number = start * 1000.0 / this.msPxAvg startPosition = Math.max(0, Math.floor(startPosition)); // 计算结束位置 let endPosition: number = startPosition + this.mRangSeekBarOption.mMaxCou...
AST#method_declaration#Left onRangeStopScrollChanged AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left start : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#...
onRangeStopScrollChanged() { let start: number = this.scroller.currentOffset().xOffset; let startPosition: number = start * 1000.0 / this.msPxAvg startPosition = Math.max(0, Math.floor(startPosition)); let endPosition: number = startPosition + this.mRangSeekBarOption.mMaxCountRange + 5; l...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L377-L391
75543f20bd683544db208b47b8e51c45d79535d2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogBuilder.ets
arkts
DatePickerDialogBuilder
DatePickerDialog @param options
@Builder export function DatePickerDialogBuilder(options: DateTimePickerOptions) { DatePickerDialogView({ options: options }); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function DatePickerDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DateTimePickerOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ...
@Builder export function DatePickerDialogBuilder(options: DateTimePickerOptions) { DatePickerDialogView({ options: options }); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L187-L190
fbe1428bf9906fb131be1b4841465c57b2f42d37
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/MD5.ets
arkts
digestSegmentSync
MD5摘要,分段,同步 @param data 待摘要的数据 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度 @returns
static digestSegmentSync(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { return CryptoUtil.digestSegmentSync(data, 'MD5', resultCoding, len); }
AST#method_declaration#Left static digestSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#quali...
static digestSegmentSync(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { return CryptoUtil.digestSegmentSync(data, 'MD5', resultCoding, len); }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/MD5.ets#L70-L72
c0d728e7038d36f50efe426abb3858cb4220ecb4
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/router/Router.ets
arkts
getParams
获取路由参数
getParams(): RouteParams { try { const params = router.getParams() as Record<string, string>; const result: RouteParams = {}; const userId = params['userId']; const pageId = params['pageId']; const value = params['value']; const productId = params['productId']; const conver...
AST#method_declaration#Left getParams AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RouteParams AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left ...
getParams(): RouteParams { try { const params = router.getParams() as Record<string, string>; const result: RouteParams = {}; const userId = params['userId']; const pageId = params['pageId']; const value = params['value']; const productId = params['productId']; const conver...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Router.ets#L259-L302
e2bd013332e91c270bf85d74f30364e645e988e8
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/ChannelDelete.ets
arkts
应用约束60: 使用export代替module.exports
export default ChannelDeleteAction;
AST#export_declaration#Left export default AST#expression#Left ChannelDeleteAction AST#expression#Right ; AST#export_declaration#Right
export default ChannelDeleteAction;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/ChannelDelete.ets#L41-L41
e8e720ee484019a6a6fb27b8f72cde5b8af98731
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/subheaderv2/source/subheaderv2.ets
arkts
getNumberByResource
get resource size @param resourceName resource id @returns resource size
public static getNumberByResource(resourceId: number, defaultNumber: number): number { try { let resourceNumber: number = resourceManager.getSystemResourceManager().getNumber(resourceId); if (resourceNumber === 0) { return defaultNumber; } else { return resourceNumber; } ...
AST#method_declaration#Left public static getNumberByResource AST#parameter_list#Left ( AST#parameter#Left resourceId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultNumber : AST#type_annotation#Left AST#primary_typ...
public static getNumberByResource(resourceId: number, defaultNumber: number): number { try { let resourceNumber: number = resourceManager.getSystemResourceManager().getNumber(resourceId); if (resourceNumber === 0) { return defaultNumber; } else { return resourceNumber; } ...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/subheaderv2/source/subheaderv2.ets#L1268-L1282
7f2a34274a3052f7d8082cde03447cc17227a3c1
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/book/CategoryManager.ets
arkts
reload
/ 重新获取类别
async reload() { this.categories = []; await this.loadCategories(); }
AST#method_declaration#Left async reload 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 . categories AST#member_expression#Righ...
async reload() { this.categories = []; await this.loadCategories(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/CategoryManager.ets#L39-L42
56adc6412e29cb27a303ef8d1cf5d55d904117de
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
ability/ability_runtime/getresourcedirndk/getresourcedirndknothaveres/shared/Index.ets
arkts
add
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 { add } from './src/main/ets/utils/Calc';
AST#export_declaration#Left export { add } from './src/main/ets/utils/Calc' ; AST#export_declaration#Right
export { add } from './src/main/ets/utils/Calc';
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/ability/ability_runtime/getresourcedirndk/getresourcedirndknothaveres/shared/Index.ets#L16-L16
5c9fd4cb139ab08c134ff8ee2692266d2a6457df
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/constants/AppConstants.ets
arkts
lightenColor
颜色处理工具方法
private static lightenColor(color: string, percent: number): string { const rgb = AppConstants.hexToRgb(color); if (!rgb) return color; const r = Math.min(255, rgb.r + Math.round((255 - rgb.r) * percent / 100)); const g = Math.min(255, rgb.g + Math.round((255 - rgb.g) * percent / 100)); const b = M...
AST#method_declaration#Left private static lightenColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left percent : AST#type_annotation#Left AST#primary_type#Left number AST...
private static lightenColor(color: string, percent: number): string { const rgb = AppConstants.hexToRgb(color); if (!rgb) return color; const r = Math.min(255, rgb.r + Math.round((255 - rgb.r) * percent / 100)); const g = Math.min(255, rgb.g + Math.round((255 - rgb.g) * percent / 100)); const b = M...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/constants/AppConstants.ets#L74-L83
67272c4a7d6238d17f8ada59613e9c0f8a93cdd1
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets
arkts
generate2048RSAKey
生成2048位RSA的非对称密钥 @returns 2048位RSA密钥{publicKey:2048位公钥,privateKey:2048位私钥}
static async generate2048RSAKey(): Promise<OutDTO<CryptoKey>> { return CryptoUtil.generateCryptoKey('RSA2048'); }
AST#method_declaration#Left static async generate2048RSAKey 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 < ...
static async generate2048RSAKey(): Promise<OutDTO<CryptoKey>> { return CryptoUtil.generateCryptoKey('RSA2048'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L42-L44
6ef688aff3436f03913c5031b7079cdc7ba575a1
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
readC3
读取C3部分 @param sm2_sequence sm2序列工具 @param data 待读取的数据 @returns C3部分
private readC3(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith("0420")) { sm2_sequence.C3 = data.slice(4, 68); data = data.slice(68, data.length); } else { Logger.debug('读取SM2字符串中的C3出错~'); } return data; }
AST#method_declaration#Left private readC3 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
private readC3(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith("0420")) { sm2_sequence.C3 = data.slice(4, 68); data = data.slice(68, data.length); } else { Logger.debug('读取SM2字符串中的C3出错~'); } return data; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L253-L261
977547253c0de7c2e38434d39d108cd77369c5f6
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/textInput/TextEditNodeController.ets
arkts
onFuncTypeChanged
功能菜单切换通知 用于处理画板、马赛克、文本叠加处理后切到文本时露出文本供用户操作,从文本切走后恢复用户操作时的叠加状态 @param isText 是否为文本功能
onFuncTypeChanged(isText: boolean): void { if (this.rootNode) { let textNodes = Array.from(this.textRecords).filter((record: OperateRecord) => { return record.type === ImageEditFunctionType.TEXT; }); if (!textNodes || textNodes.length === 0) { return; } if (!isText) { ...
AST#method_declaration#Left onFuncTypeChanged AST#parameter_list#Left ( AST#parameter#Left isText : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
onFuncTypeChanged(isText: boolean): void { if (this.rootNode) { let textNodes = Array.from(this.textRecords).filter((record: OperateRecord) => { return record.type === ImageEditFunctionType.TEXT; }); if (!textNodes || textNodes.length === 0) { return; } if (!isText) { ...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextEditNodeController.ets#L124-L148
c9300eb5bcec7e2acc71020b7f0ceb016d1f4f14
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment2.ets
arkts
VideoCard
[Start Case1]
@Component export struct VideoCard { @State isVideoInit: boolean = false; // [StartExclude Case1] @Prop item: VideoItem = { id: '' }; private createComplexVideoPlayer(): void { } // [EndExclude Case1] build() { Column() { // Video Playback Component } .onAreaChange((old, newValue) => {...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoCard AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isVideoInit : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_ann...
@Component export struct VideoCard { @State isVideoInit: boolean = false; @Prop item: VideoItem = { id: '' }; private createComplexVideoPlayer(): void { } build() { Column() { } .onAreaChange((old, newValue) => { if (!this.isVideoInit) { let positionY: number = newValu...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment2.ets#L27-L52
f82f072c73c8123d1c76ada0acc1cfdb6b4ff2ce
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets
arkts
CigenWordTables.ts
export namespace CigenTable { // ============================================================ // Cgcz 表 // ============================================================ export namespace Cgcz { export const table = 'Cgcz';
AST#export_declaration#Left export AST#ERROR#Left namespace CigenTable { // ============================================================ // Cgcz 表 // ============================================================ export namespace Cgcz { export AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Le...
export namespace CigenTable { export namespace Cgcz { export const table = 'Cgcz';
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets#L13-L19
7d447a2806d6968e2272379eae64cacef98b9adf
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/networks/Http.ets
arkts
_request
私有方法:执行实际HTTP请求
private static _request( url: string, method: HttpUtils.Method, params: HttpUtils.HttpParams, callback: (responseData: string | null) => void ): void { const httpRequest = http.createHttp(); let finalUrl = url; let requestParams: string | null = null; // GET请求处理查询参数 if (method ==...
AST#method_declaration#Left private static _request AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left AST#qualified_typ...
private static _request( url: string, method: HttpUtils.Method, params: HttpUtils.HttpParams, callback: (responseData: string | null) => void ): void { const httpRequest = http.createHttp(); let finalUrl = url; let requestParams: string | null = null; if (method === HttpUtils.Me...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Http.ets#L103-L159
0dac4cc6fc6ca3f026a450cd77127723fedbf7c2
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/DemoRepository.ets
arkts
createDemo
创建 Demo 记录 @param {string} title - 标题 @param {string} description - 描述 @returns {Promise<number>} 新建记录主键
async createDemo(title: string, description: string = ""): Promise<number> { return this.demoLocalDataSource.createItem(title, description); }
AST#method_declaration#Left async createDemo AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
async createDemo(title: string, description: string = ""): Promise<number> { return this.demoLocalDataSource.createItem(title, description); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/DemoRepository.ets#L27-L29
0f608178c6258dcfc8720e6b63fc7518c6215d87
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AudioRecorder.ets
arkts
音频录制
export class AudioRecorder { private avRecorder: media.AVRecorder | undefined = undefined; public maxAmplitude: number = 0; public time: number = 0; private avProfile: media.AVRecorderProfile = { audioBitrate: Const.AUDIO_BITRATE, // 音频比特率 audioChannels: Const.AUDIO_CHANNELS, // 音频声道数 audioCodec: me...
AST#export_declaration#Left export AST#class_declaration#Left class AudioRecorder AST#class_body#Left { AST#property_declaration#Left private avRecorder : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left media . AVRecorder AST#qualified_type#Right AST#primary_type#Right | AST#p...
export class AudioRecorder { private avRecorder: media.AVRecorder | undefined = undefined; public maxAmplitude: number = 0; public time: number = 0; private avProfile: media.AVRecorderProfile = { audioBitrate: Const.AUDIO_BITRATE, audioChannels: Const.AUDIO_CHANNELS, audioCodec: media.CodecMimeTyp...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AudioRecorder.ets#L22-L113
6513214d2717511a3255e03b75303bed8d0608fa
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
FramedRendering/entry/src/main/ets/view/DateItemView.ets
arkts
aboutToAppear
[EndExclude Case2]
aboutToAppear(): void { hiTraceMeter.startTrace('appear_', 1); this.displaySync = displaySync.create(); const range: ExpectedFrameRateRange = { expected: 120, min: 60, max: 120 }; this.displaySync.setExpectedFrameRateRange(range); this.displaySync.on('frame', () => { // [...
AST#method_declaration#Left aboutToAppear 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#expression_statement#Left AST#expression#Left AST#call_expression#Left A...
aboutToAppear(): void { hiTraceMeter.startTrace('appear_', 1); this.displaySync = displaySync.create(); const range: ExpectedFrameRateRange = { expected: 120, min: 60, max: 120 }; this.displaySync.setExpectedFrameRateRange(range); this.displaySync.on('frame', () => { ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FramedRendering/entry/src/main/ets/view/DateItemView.ets#L67-L113
6339e7123f0a539b5a72fa67b78c0babc5454704
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/StatsManager.ets
arkts
exportStats
导出统计数据
async exportStats(): Promise<string> { const exportData = { exportTime: new Date().toISOString(), version: '1.0', stats: this.stats }; return JSON.stringify(exportData, null, 2); }
AST#method_declaration#Left async exportStats 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async exportStats(): Promise<string> { const exportData = { exportTime: new Date().toISOString(), version: '1.0', stats: this.stats }; return JSON.stringify(exportData, null, 2); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L366-L373
284deae64b3fba35a1df6654a7144635a5a26f83
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/userdata/CosDownloaderUserData.ets
arkts
MARK: - 构造函数
private constructor() { // 初始化腾讯云服务 CosService.shared; }
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 初始化腾讯云服务 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CosService AST#expression#Right . shared AST#member_express...
private constructor() { CosService.shared; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/userdata/CosDownloaderUserData.ets#L20-L23
6442f62dcb2fc245fe09df2b30bbc2f07bf410fd
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
getDataPixelMap
读取系统剪贴板PixelMap内容,使用Promise异步回调。 @returns
static async getDataPixelMap(): Promise<image.PixelMap> { const pasteData: pasteboard.PasteData = await PasteboardUtil.getData(); return pasteData.getPrimaryPixelMap(); }
AST#method_declaration#Left static async getDataPixelMap 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_typ...
static async getDataPixelMap(): Promise<image.PixelMap> { const pasteData: pasteboard.PasteData = await PasteboardUtil.getData(); return pasteData.getPrimaryPixelMap(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L276-L279
a550046158609e3d70b7d55fa20e4a63c15264d9
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/DatePickerBuilderProxy.ets
arkts
dateType
时间类型 @param dateType 枚举:YmdHms-年月日时分秒; YmdHm-年月日时分; YmdH-年月日时; Ymd-年月日; Ym-年月; Y-年; Hms-时分秒; Hm-时分; Ms-分秒 @returns
dateType(dateType: DateType) { this.builderOptions.dateType = dateType return this }
AST#method_declaration#Left dateType AST#parameter_list#Left ( AST#parameter#Left dateType : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left...
dateType(dateType: DateType) { this.builderOptions.dateType = dateType return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/DatePickerBuilderProxy.ets#L16-L19
cc93d9be582934a6ca31128ff423e81bdeef4097
github
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/MQTTUtil.ets
arkts
publishMessage
发布消息到指定主题 @param topic 主题 @param message 消息内容 @returns 发布是否成功
async publishMessage(topic: string, message: string): Promise<boolean> { // 检查连接状态,如果未连接则尝试重连 if (!this.isClientConnected()) { console.warn('MQTT客户端未连接,尝试重新连接...'); try { // 使用保存的回调进行重连 if (this.messageCallback) { await this.connect(this.messageCallback); } else { ...
AST#method_declaration#Left async publishMessage AST#parameter_list#Left ( AST#parameter#Left topic : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
async publishMessage(topic: string, message: string): Promise<boolean> { if (!this.isClientConnected()) { console.warn('MQTT客户端未连接,尝试重新连接...'); try { if (this.messageCallback) { await this.connect(this.messageCallback); } else { await this.con...
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/MQTTUtil.ets#L191-L255
86a22e15c0eb765aa5dbbaa0eac8b2f0d0c61a08
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets
arkts
构造函数,初始化 ORM 并确保足迹表已迁移 @returns {FootprintLocalDataSourceImpl} 实例
constructor() { this.ensureMigrated(); }
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 . ensure...
constructor() { this.ensureMigrated(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L24-L26
a3370fc52ac990a5301e55909eb2f5a280244d32
github
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/pages/component/MinuteLineComponent.ets
arkts
_drawMinuteLine
绘制分钟线
_drawMinuteLine() { this.drawBackgroundLine() this.drawMinuteLine() this.drawAveragePriceLine() this.context.font = '40px' this.context.textAlign = 'center' this.context.textBaseline = 'middle' //绘制左侧最高价格 if (this.stockData.lineHighest != null) { this.context.fillStyle = '#e2233e' ...
AST#method_declaration#Left _drawMinuteLine 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 this AST#expression#Right . drawBackgroundLine A...
_drawMinuteLine() { this.drawBackgroundLine() this.drawMinuteLine() this.drawAveragePriceLine() this.context.font = '40px' this.context.textAlign = 'center' this.context.textBaseline = 'middle' if (this.stockData.lineHighest != null) { this.context.fillStyle = '#e2233e' let ...
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/MinuteLineComponent.ets#L255-L280
ad40e48600a16593fb53eac531fa3f986318efd1
github
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/component/Dialog.ets
arkts
openDialog
打开自定义对话框
openDialog() { if (this.contentNode !== null && this.contentNode !== undefined) { this.ctx?.getPromptAction() .openCustomDialog(this.contentNode, this.options) .then(() => { hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'OpenCustomDialog complete'); // 记录日志,对话框打开完成 ...
AST#method_declaration#Left openDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left...
openDialog() { if (this.contentNode !== null && this.contentNode !== undefined) { this.ctx?.getPromptAction() .openCustomDialog(this.contentNode, this.options) .then(() => { hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'OpenCustomDialog complete'); }) .cat...
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Dialog.ets#L31-L45
edfb3c15079a4fa59c317003d4a96eec8acb52aa
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets
arkts
sendData
TCP 和 TLS发送消息 @param data
public sendData(data: string): void { this.mSocket?.sendData(data); }
AST#method_declaration#Left public sendData AST#parameter_list#Left ( AST#parameter#Left data : 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 void AST#primary_type#Rig...
public sendData(data: string): void { this.mSocket?.sendData(data); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets#L96-L98
b488d19801a2502c906a46bda56814b080975936
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/@pornhub_alerts/94.0.1/package/app.ets
arkts
应用约束60: 使用ES模块的export语法代替CommonJS的exports
export function printMsg(): void {}
AST#export_declaration#Left export AST#function_declaration#Left function printMsg AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { } AST#block_statement#Right AST#function_declaration#R...
export function printMsg(): void {}
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/@pornhub_alerts/94.0.1/package/app.ets#L2-L2
d0205959e4186b4ad2f3d842b9da8504793a3826
github