nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ContentPanel.ets
arkts
setActiveTab
切换活动标签
setActiveTab(tabId: string): void { if (this.tabs.some(t => t.id === tabId)) { this.activeTabId = tabId; this.notifyCallback(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setActiveTab AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tabId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A...
setActiveTab(tabId: string): void { if (this.tabs.some(t => t.id === tabId)) { this.activeTabId = tabId; this.notifyCallback(); } }
https://github.com/DaLongZhuaZi/manxia
f58e96bf5b87af53ba2da7ab2d767d59cf16878f
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets
arkts
friction
摩擦插值器
static friction(friction: number = 1.0): curves.ICurve { return AnimationInterpolator.decelerate(friction); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left friction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left friction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressi...
static friction(friction: number = 1.0): curves.ICurve { return AnimationInterpolator.decelerate(friction); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
46fcab448c567103636058018f818831a0d99789
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
handleGCDeviceChange
处理 Game Controller Kit 设备状态变化 包含去重逻辑:同一物理 USB 手柄的多个 HID 接口只注册一次
private handleGCDeviceChange(deviceId: string, isConnected: boolean, info: GameControllerDeviceInfo): void { console.info(`[GAMEPAD-GC] 设备状态变化: deviceId=${deviceId}, isConnected=${isConnected}, name=${info?.name}, physAddr=${info?.physicalAddress || 'N/A'}`); if (isConnected) { // 防止重复注册:同一 deviceI...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleGCDeviceChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private handleGCDeviceChange(deviceId: string, isConnected: boolean, info: GameControllerDeviceInfo): void { console.info(`[GAMEPAD-GC] 设备状态变化: deviceId=${deviceId}, isConnected=${isConnected}, name=${info?.name}, physAddr=${info?.physicalAddress || 'N/A'}`); if (isConnected) { // 防止重复注册:同一 deviceI...
https://github.com/AlkaidLab/moonlight-harmony
1ba0194446847a05f582af64139a1fedeb22b7c7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/MetadataXmlGenerator.ets
arkts
parseEBookMetadataXml
解析电子书元数据XML
static parseEBookMetadataXml(xmlContent: string): EBookMetadata | null { try { const getTagValue = (tagName: string): string => { const regex = new RegExp(`<${tagName}>([\\s\\S]*?)</${tagName}>`, 'i'); const match = xmlContent.match(regex); return match ? MetadataXmlGenerator.unescap...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseEBookMetadataXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xmlContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
static parseEBookMetadataXml(xmlContent: string): EBookMetadata | null { try { const getTagValue = (tagName: string): string => { const regex = new RegExp(`<${tagName}>([\\s\\S]*?)</${tagName}>`, 'i'); const match = xmlContent.match(regex); return match ? MetadataXmlGenerator.unescap...
https://github.com/DaLongZhuaZi/manxia
8642bf145ccdd59967b4d53913e6b4b8940075ec
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
isDateValid
The `isDateValid()` method checks if constructed date is maximum of ±100,000,000 (one hundred million) days relative to January 1, 1970 UTC (that is, April 20, 271821 BCE ~ September 13, 275760 CE) can be represented by the standard Date object (equivalent to ±8,640,000,000,000,000 milliseconds). @returns { boolean } r...
public isDateValid(): boolean { return this.isDateValid(this.ms); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDateValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b...
public isDateValid(): boolean { return this.isDateValid(this.ms); }
https://gitcode.com/iop123123/arkts-static-skills
4d0b7c75ac0aa04a02c6104670136593a75d861f
gitcode
arkui-x/samples
CodeLab/Cases/feature/dealstridesolution/src/main/ets/components/XComponentView.ets
arkts
aboutToAppear
相机设备索引
aboutToAppear(): void { if (this.xComponentSurfaceId !== '') { CameraService.initCamera(this.cameraDeviceIndex, this.xComponentSurfaceId); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { if (this.xComponentSurfaceId !== '') { CameraService.initCamera(this.cameraDeviceIndex, this.xComponentSurfaceId); } }
https://gitcode.com/arkui-x/samples
f074d49c6fca8515f354b9c77f987884d693470d
gitcode
somnio-software/my-bot-pal
entry/src/main/ets/utils/PermissionUtils.ets
arkts
checkPermissionGrant
Checks if a specific permission has been granted by the user. If not granted, requests the permission from the user. @param permission - The permission to check @param context - The application context @returns A promise that resolves to true if the permission is granted, false otherwise
public async checkPermissionGrant(permission: Permissions, context: Context): Promise<boolean> { console.log(`[REAL] Checking permission: ${permission}`); const tokenId = await this.getAppTokenId(); if (tokenId === -1) { return false; } console.log(`[REAL] Token ID: ${tokenId}`); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left checkPermissionGrant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST...
public async checkPermissionGrant(permission: Permissions, context: Context): Promise<boolean> { console.log(`[REAL] Checking permission: ${permission}`); const tokenId = await this.getAppTokenId(); if (tokenId === -1) { return false; } console.log(`[REAL] Token ID: ${tokenId}`); ...
https://github.com/somnio-software/my-bot-pal
d303649d87ba1d59176935ddf92bf36910028237
github
openharmony/applications_dlp_manager
entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets
arkts
setNeedStartAbility
拉沙箱之前调用
public setNeedStartAbility(requestId: string): void { this.printAllDecryptingMap(); HiLog.info(TAG, `OpeningDialogManager setNeedStartAbility requestId ${requestId}`); const decryptingState: DecryptingState | undefined = this._decryptingMap.get(requestId); if (!decryptingState) { HiLog.info(TAG,...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNeedStartAbility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#...
public setNeedStartAbility(requestId: string): void { this.printAllDecryptingMap(); HiLog.info(TAG, `OpeningDialogManager setNeedStartAbility requestId ${requestId}`); const decryptingState: DecryptingState | undefined = this._decryptingMap.get(requestId); if (!decryptingState) { HiLog.info(TAG,...
https://gitee.com/openharmony/applications_dlp_manager.git
e81c4979660805803521d01037e553004fc26fd4
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test19_original_index.ets
arkts
testArrayFrom
--- Array.from and Array.fill and copyWithin ---
function testArrayFrom(): string { let arr: number[] = Array.from([10, 20, 30]); return String(arr.length) + ',' + String(arr[1]); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayFrom AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_ty...
function testArrayFrom(): string { let arr: number[] = Array.from([10, 20, 30]); return String(arr.length) + ',' + String(arr[1]); }
https://github.com/miaochiahao/ark-ghidra
30d444b22aaa375a9906892c79e5cf7a39c6fdd7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Exceptions.ets
arkts
constructor
Constructs an UnsupportedOperationError instance. @param { String } [ message ] The error message. @param { ErrorOptions } [ options ] Error options, usually containing the error stack information. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(message?: String, options?: ErrorOptions) { super("UnsupportedOperationError", message, options) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi...
constructor(message?: String, options?: ErrorOptions) { super("UnsupportedOperationError", message, options) }
https://gitcode.com/iop123123/arkts-static-skills
affb9195e877a6b6c55ca3b74203a0177c9eb6f1
gitcode
Joker-x-dev/CoolMallArkTS
feature/market/src/main/ets/view/CouponPage.ets
arkts
build
构建优惠券页面 @returns {void} 无返回值
build(): void { AppNavDestination({ title: $r("app.string.coupon_title"), viewModel: this.vm }) { BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.CouponContent() }); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { AppNavDestination({ title: $r("app.string.coupon_title"), viewModel: this.vm }) { BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.CouponContent() }); } }
https://github.com/Joker-x-dev/CoolMallArkTS
a55b14675e336de3c28a192767397cdefa66c465
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/JArrayList.ets
arkts
moveTo
将当前位置移动到指定位置 @param {*} position
moveTo(position: number) { this.pos = position; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left moveTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left position AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left...
moveTo(position: number) { this.pos = position; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6305b11a6a75041dacf8e95ff7d412c299754cc0
gitee
honjow/Next2V
shared/src/main/ets/settings/AccountStore.ets
arkts
restoreActiveId
Read the persisted active account ID from preferences and restore to transient static field. Must be called before getActiveId() to ensure active ID survives process restart.
static async restoreActiveId(context: common.UIAbilityContext): Promise<string> { try { const store = await preferences.getPreferences(context, STORE_NAME) const persisted = store.getSync(KEY_ACTIVE_ACCOUNT_ID, '') as string if (persisted) { AccountStore.activeAccountId = persisted ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left restoreActiveId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left ...
static async restoreActiveId(context: common.UIAbilityContext): Promise<string> { try { const store = await preferences.getPreferences(context, STORE_NAME) const persisted = store.getSync(KEY_ACTIVE_ACCOUNT_ID, '') as string if (persisted) { AccountStore.activeAccountId = persisted ...
https://github.com/honjow/Next2V
172d32ac30982a1af16bf239cef95e1ee4581409
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/basepage/ColumnPage.ets
arkts
onPageHide
生命周期回调:页面隐藏 // darcyRefactor: 只限入口组件
onPageHide(): void { Log.info(TAG + "onPageHide") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageHide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
onPageHide(): void { Log.info(TAG + "onPageHide") }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/basepage/ColumnPage.ets#L21-L23
7d3ff09559a294b9879f2ad0d97764655cb4da78
github
fbinba3955/Flymby
common/src/main/ets/video/AvManager.ets
arkts
setLaunchAbility
设置拉起的Ability
private setLaunchAbility() { const wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: AppUtil.getContext().abilityInfo.bundleName, // 待启动Ability所在的应用Bundle名称 abilityName: AppUtil.getContext().abilityInfo.name // 待启动Ability名称 } ], operationType: ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setLaunchAbility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#...
private setLaunchAbility() { const wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: AppUtil.getContext().abilityInfo.bundleName, // 待启动Ability所在的应用Bundle名称 abilityName: AppUtil.getContext().abilityInfo.name // 待启动Ability名称 } ], operationType: ...
https://github.com/fbinba3955/Flymby
1ec1d1aff6d493783189e6612200d993d3a593a1
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
toUpperCase
Creates new string similar to this String but with all characters in upper case. @returns new string with all characters in upper case
public toUpperCase(): String { let resChars: char[] = this.getChars(); for (let i: int = 0; i < resChars.length; i++) { resChars[i] = Char.toUpperCase(resChars[i]); } return new String(resChars); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toUpperCase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST...
public toUpperCase(): String { let resChars: char[] = this.getChars(); for (let i: int = 0; i < resChars.length; i++) { resChars[i] = Char.toUpperCase(resChars[i]); } return new String(resChars); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1550a3615db2a9bc0105cbf82b7256c0a9de07bd
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
writeInt8
Writes a signed 8-bit integer to the buffer at the specified offset @param {long} value - Value to write @param {int} [offset=0] - Number of bytes to skip before writing @returns {int} Offset plus the number of bytes written
public writeInt8(value: long, offset: int = 0): int { this.checkOffset(offset, 1); this.checkValue(value, (-Math.pow(2, 7).toLong()), (Math.pow(2, 7).toLong() - 1), (-Math.pow(2, 7)).toString(), (Math.pow(2, 7) - 1).toString()); this.getDataView().setInt8(offset, value); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeInt8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#R...
public writeInt8(value: long, offset: int = 0): int { this.checkOffset(offset, 1); this.checkValue(value, (-Math.pow(2, 7).toLong()), (Math.pow(2, 7).toLong() - 1), (-Math.pow(2, 7)).toString(), (Math.pow(2, 7) - 1).toString()); this.getDataView().setInt8(offset, value); ...
https://gitcode.com/iop123123/arkts-static-skills
c9974e5ed0a6fa5f9f1a02261813cd70d7a92787
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
containsSplitter
检查是否包含分割符(排除引号内和<js>标签内的)
private containsSplitter(str: string, splitter: string): boolean { let inQuote = false; let quoteChar = ''; let inJsTag = false; for (let i = 0; i < str.length; i++) { // 检查是否进入或离开<js>标签 if (this.isJsOpenTagAt(str, i)) { inJsTag = true; i += 3; continue; } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left containsSplitter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private containsSplitter(str: string, splitter: string): boolean { let inQuote = false; let quoteChar = ''; let inJsTag = false; for (let i = 0; i < str.length; i++) { // 检查是否进入或离开<js>标签 if (this.isJsOpenTagAt(str, i)) { inJsTag = true; i += 3; continue; } ...
https://github.com/DaLongZhuaZi/manxia
7c23d0b5eb96e01cf9b2acf6d3e27ba3d24f2a20
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
zoomIn
Zooms in by 1.4f, into the charts center.
public zoomIn(): void { let center: MPPointF = this.mViewPortHandler.getContentCenter(); this.mViewPortHandler.zoomIn(center.x, -center.y, this.mZoomMatrixBuffer); this.mViewPortHandler.refresh(this.mZoomMatrixBuffer, this, false); MPPointF.recycleInstance(center); // Range might have changed,...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left zoomIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat...
public zoomIn(): void { let center: MPPointF = this.mViewPortHandler.getContentCenter(); this.mViewPortHandler.zoomIn(center.x, -center.y, this.mZoomMatrixBuffer); this.mViewPortHandler.refresh(this.mZoomMatrixBuffer, this, false); MPPointF.recycleInstance(center); // Range might have changed,...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
1245abec9f227927da094041f3ffedd54e61d7c1
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
getCategoryItemsByType
获取分类中指定类型的内容ID
getCategoryItemsByType(categoryId: string, contentType: ContentType): string[] { const itemIds: string[] = []; this.itemCategoryMap.forEach((item) => { if (item.categoryId === categoryId && item.contentType === contentType) { itemIds.push(item.itemId); } }); return itemIds; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getCategoryItemsByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERRO...
getCategoryItemsByType(categoryId: string, contentType: ContentType): string[] { const itemIds: string[] = []; this.itemCategoryMap.forEach((item) => { if (item.categoryId === categoryId && item.contentType === contentType) { itemIds.push(item.itemId); } }); return itemIds; }
https://github.com/DaLongZhuaZi/manxia
c0f4fefd8a72f151535a93f8a937d44dd4b130de
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/SmartWardInitializer.ets
arkts
registerControllers
注册设备控制器
private registerControllers(): void { console.log('SmartWardInitializer: Registering device controllers...'); const deviceManager = DeviceManager.getInstance(); // 注意:这里需要从smartward/core/controllers导入控制器 // 由于控制器文件较多,暂时注释掉,待后续集成 // deviceManager.registerController(DeviceType.SMART_LIGHT, SmartLi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerControllers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
private registerControllers(): void { console.log('SmartWardInitializer: Registering device controllers...'); const deviceManager = DeviceManager.getInstance(); // 注意:这里需要从smartward/core/controllers导入控制器 // 由于控制器文件较多,暂时注释掉,待后续集成 // deviceManager.registerController(DeviceType.SMART_LIGHT, SmartLi...
https://github.com/LJ666-ui/harmony-health-care
ea84740a50de930fa41cd0a22717b457dbbb0cb4
github
Vincent-Leon/zotero-harmony
entry/src/main/ets/components/ItemDetailView.ets
arkts
isPdf
PDF check by content-type first (canonical), filename extension as a fallback for attachments where Zotero didn't record contentType.
function isPdf(contentType: string, filename: string): boolean { if (contentType.length > 0) { const lower = contentType.toLowerCase(); if (lower === 'application/pdf' || lower === 'application/x-pdf') { return true; } } const lowerName = filename.toLowerCase(); return lowerName.endsWith('.pdf...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isPdf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left contentType AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function isPdf(contentType: string, filename: string): boolean { if (contentType.length > 0) { const lower = contentType.toLowerCase(); if (lower === 'application/pdf' || lower === 'application/x-pdf') { return true; } } const lowerName = filename.toLowerCase(); return lowerName.endsWith('.pdf...
https://github.com/Vincent-Leon/zotero-harmony
8e6d18db444181a121dfbae68f6a0a73b4807990
github
HarmonyOS_Samples/BestPracticeSnippets
LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
[StartExclude power_entry_ability]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } catch (error) { hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail'); } hilog.info(DOMAIN, 'test...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } catch (error) { hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail'); } hilog.info(DOMAIN, 'test...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
878e14f9e7fb4fdd54aa102e8fe44d41e96e2a07
gitcode
RicardoWesleyli/HarmonyNEXT_Examples
Chapter2/entry/src/main/ets/pages/Index.ets
arkts
recommendFood
推荐食物的方法
recommendFood() { const foods = ['猪脚饭','螺蛳粉','麻辣烫','拉面', '寿司','披萨','汉堡'] const index = Math.floor(Math.random() * foods.length) this.recommendedFood = foods[index] }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left recommendFood AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
recommendFood() { const foods = ['猪脚饭','螺蛳粉','麻辣烫','拉面', '寿司','披萨','汉堡'] const index = Math.floor(Math.random() * foods.length) this.recommendedFood = foods[index] }
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples
9391121fbd2b10d89ab2e9c8d0fe6ac3e5f59290
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HTMLElement.ets
arkts
id
获取 id 属性
get id(): string { return this._attrs.get('id') || ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST...
get id(): string { return this._attrs.get('id') || ''; }
https://github.com/DaLongZhuaZi/manxia
e800ae22358c10d96bccb11971f2f7a27dbcf231
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
toString
Returns a string representation of the BigInt object. @param { int } radix An integer in the range 2 through 36 specifying the base to use for representing numeric values. @returns { string } A string representing the specified BigInt object. @throws { RangeError } Throw RangeError when radix is not between 2 and 36 @s...
public toString(radix: int): string { if (radix < 2 || radix > 36) { throw new RangeError(BigInt.INVALID_RADIX_MESSAGE) } if (this.isZero()) { return "0" } let fastToStringHandler = BigInt.FAST_TO_STRING_HANDLER_MAP[radix] if (fastToStringHandl...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left radix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig...
public toString(radix: int): string { if (radix < 2 || radix > 36) { throw new RangeError(BigInt.INVALID_RADIX_MESSAGE) } if (this.isZero()) { return "0" } let fastToStringHandler = BigInt.FAST_TO_STRING_HANDLER_MAP[radix] if (fastToStringHandl...
https://gitcode.com/iop123123/arkts-static-skills
1dbee6d2d5b1e2d50b0845a29de4dad9dc5c584f
gitcode
webabcd/HarmonyDemo
entry/src/main/ets/pages/ui/StyleDemo.ets
arkts
myStyles1
@Styles 用于定义通用属性和通用事件(可以在组件内部定义,也可以在全局定义) @Styles 装饰的函数不能有参数,只能在当前文件中使用(也就是说不支持 export,如果想实现 export 功能,请参见 AttributeModifier 的说明)
@Styles function myStyles1() { .width("100%") .height(50) .foregroundColor(Color.White) .backgroundColor(Color.Orange) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Styles AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left myStyles1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left )...
@Styles function myStyles1() { .width("100%") .height(50) .foregroundColor(Color.White) .backgroundColor(Color.Orange) }
https://github.com/webabcd/HarmonyDemo
5f4adfba741a820124ad966adbd58eeea175fcae
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/JMap.ets
arkts
keys
获取MAP中所有KEY的数组(ARRAY)
keys():Array<T1> { let arr: Array<T1> = new Array(); for (let i = 0; i < this.elements.length; i++) { arr.push(this.elements[i].key); } return arr; };
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left keys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:...
keys():Array<T1> { let arr: Array<T1> = new Array(); for (let i = 0; i < this.elements.length; i++) { arr.push(this.elements[i].key); } return arr; };
https://gitee.com/openharmony-sig/commons-cli.git
53f0d77a33ea8883628acfc15bc62400fa4045d2
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
exists
检查记录是否存在 @param tableName 表名 @param idColumn 主键列名 @param id 主键值 @returns 是否存在
static async exists(tableName: string, idColumn: string, id: number): Promise<boolean> { const sql = `SELECT 1 FROM ${tableName} WHERE ${idColumn} = ? AND is_deleted = 0`; const store = DatabaseManager.getDatabase(); let rs: relationalStore.ResultSet | null = null; try { rs = await store.querySq...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left exists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
static async exists(tableName: string, idColumn: string, id: number): Promise<boolean> { const sql = `SELECT 1 FROM ${tableName} WHERE ${idColumn} = ? AND is_deleted = 0`; const store = DatabaseManager.getDatabase(); let rs: relationalStore.ResultSet | null = null; try { rs = await store.querySq...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
a6cb952bda31c7086029f0dfd9c982e0099de4f7
github
harmonyos/codelabs
AlarmClock/entry/src/main/ets/common/utils/DataTypeUtils.ets
arkts
isNull
return obj is null. @return boolean.
static isNull(obj: Object): boolean { return (typeof obj === 'undefined' || obj == null || obj === ''); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST...
static isNull(obj: Object): boolean { return (typeof obj === 'undefined' || obj == null || obj === ''); }
https://gitee.com/harmonyos/codelabs.git
d6659b4eb849a2231b330d33a11f748cd614e239
gitee
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/AccountManager.ets
arkts
ensureDefaultAccounts
当账户表为空时回填默认账户,避免首页和记账页没有可用账户。
static async ensureDefaultAccounts(): Promise<void> { const accounts: AccountBean[] = await AccountManager.getAccounts(); if (accounts.length > 0) { return; } const defaults: AccountBean[] = AccountManager.buildDefaultAccounts(); for (const account of defaults) { await AccountManager.a...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left ensureDefaultAccounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
static async ensureDefaultAccounts(): Promise<void> { const accounts: AccountBean[] = await AccountManager.getAccounts(); if (accounts.length > 0) { return; } const defaults: AccountBean[] = AccountManager.buildDefaultAccounts(); for (const account of defaults) { await AccountManager.a...
https://github.com/ZestBox-18/kitebook-frontend
cc90fce274ac633804f30b048d5c7a3c519e6e1a
github
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getCellularDataFlowType
获取蜂窝数据业务的上下行状态,使用Promise方式作为异步方法。 @returns
static async getCellularDataFlowType(): Promise<data.DataFlowType> { return data.getCellularDataFlowType(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getCellularDataFlowType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
static async getCellularDataFlowType(): Promise<data.DataFlowType> { return data.getCellularDataFlowType(); }
https://github.com/tdcare/tdwebrtc
c78d32dc8b0b0612f2aa5d87a26fc6c2f84465cc
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
sort
Sorts in-place according to the numeric ordering @returns sorted Float64Array
public sort(): Float64Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as double const b1 = b as double as int as double return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public sort(): Float64Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as double const b1 = b as double as int as double return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
dd778ab1464e4b165026b5e01549a7a3d1ce43d4
gitee
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/system/ThemePalette.ets
arkts
isAndroidDynamicColor
Check if a synced theme palette is valid and from Android Dynamic Color. Only when this returns true should the UI show "Use Android synced theme color" toggle.
static isAndroidDynamicColor(palette: ThemePaletteData | null): boolean { return palette !== null && palette.source === 'android_dynamic_color' }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isAndroidDynamicColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left palette AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_...
static isAndroidDynamicColor(palette: ThemePaletteData | null): boolean { return palette !== null && palette.source === 'android_dynamic_color' }
https://github.com/Xiwei753/xiezuoruanjian
6b2f558afb2ae91037a47bf45608bef473dbfe39
github
openharmony-tpc/ImageKnife
library/src/main/ets/transform/BlurTransformation.ets
arkts
constructor
模糊半径,单位是像素。模糊效果与所设置的值成正比,值越大效果越明显。
constructor(radius: number) { super() this.radius = radius }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left radius AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right...
constructor(radius: number) { super() this.radius = radius }
https://gitee.com/openharmony-tpc/ImageKnife.git
5a23bba96452132fa09741fb3e6f48f1a38094b4
gitee
erosTeam/NextE
feature/reader/src/main/ets/viewmodel/ReaderViewModel.ets
arkts
totalPages
Total pages for the slider: the known file count, else however many are loaded so far.
totalPages(): number { if (this.fileCount > 0) { return this.fileCount } return this.previewMapUpperBound() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left totalPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_b...
totalPages(): number { if (this.fileCount > 0) { return this.fileCount } return this.previewMapUpperBound() }
https://github.com/erosTeam/NextE
cbb4d1ab51401f095434e07638ceb09c36a43d47
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
setInteger
Sets a current JsonElement to an integer value. @param {int} value - The integer value to set
setInteger(value: int): void { this.setUndefined() this.maybeLongValue = value.toLong() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInteger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#...
setInteger(value: int): void { this.setUndefined() this.maybeLongValue = value.toLong() }
https://gitcode.com/iop123123/arkts-static-skills
b2a93f487799fe9623400e6e767c2239870586cd
gitcode
openharmony/applications_contacts
entry/src/main/ets/model/ContactAbilityModel.ets
arkts
websiteContact
Save the contact website information to the database. @param {Object} addParams Contact Information @param {string} DAHelper Database path @param {number} result Contact ID @param {string} uri Database address
websiteContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) { if (!ArrayUtil.isEmpty(addParams.websites)) { addParams.websites.forEach(element => { if (StringUtil.isEmpty(element)) { return; } let websiteContact: Record<string, s...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left websiteContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactInfo AST#ident...
websiteContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) { if (!ArrayUtil.isEmpty(addParams.websites)) { addParams.websites.forEach(element => { if (StringUtil.isEmpty(element)) { return; } let websiteContact: Record<string, s...
https://gitee.com/openharmony/applications_contacts.git
4cba9f72f53814efe8484b93694c7070c4a97125
gitee
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/WindowUtil.ets
arkts
setWindowSystemBarProperties
Sets status / navigation / home-indicator bar color and other system bar properties. @param props System bar property payload per window API.
setWindowSystemBarProperties(props: window.SystemBarProperties): void { if (this.mainWindow === undefined) { Logger.error('setWindowSystemBarProperties: mainWindow is undefined'); return; } try { this.mainWindow.setWindowSystemBarProperties(props).catch((err: BusinessError) => { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWindowSystemBarProperties AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left props AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left...
setWindowSystemBarProperties(props: window.SystemBarProperties): void { if (this.mainWindow === undefined) { Logger.error('setWindowSystemBarProperties: mainWindow is undefined'); return; } try { this.mainWindow.setWindowSystemBarProperties(props).catch((err: BusinessError) => { ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
b710c9a53c9cc6f0b3d83496ff0fd1a4cfc6d07c
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/components/RemoteModifierHandle.ets
arkts
build
============================================================ 构建 ============================================================
build() { Stack() { // 胶囊本体 — 半透明深色工具柄 Row() { if (this.handleSide === 'left') { Text(this.getLabel()) .fontSize(10) .fontColor(this.labelColor()) .fontWeight(this.hasActiveModifier() ? FontWeight.Bold : FontWeight.Normal) .width(HIDDEN...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Stack() { // 胶囊本体 — 半透明深色工具柄 Row() { if (this.handleSide === 'left') { Text(this.getLabel()) .fontSize(10) .fontColor(this.labelColor()) .fontWeight(this.hasActiveModifier() ? FontWeight.Bold : FontWeight.Normal) .width(HIDDEN...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
c8be9fdca3fa4ef0eefb04fd888a9878d8638e7b
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets
arkts
loginByQqApp
QQ APP 授权登录 @param {QQLoginRequest} params - QQ 授权参数 @returns {Promise<NetworkResponse<Auth>>} 登录结果
async loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>> { const response: AxiosResponse<NetworkResponse<Auth>> = await NetworkClient.http.post("user/login/qq", params); return response.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginByQqApp AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>> { const response: AxiosResponse<NetworkResponse<Auth>> = await NetworkClient.http.post("user/login/qq", params); return response.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
fb9b7896020aec239591456115ae0b4f7396fb9c
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_uint.ets
arkts
main
--- desc: check prefix increment for unsigned integer operand ---
function main(): void { let value: uint = {{v.value}} let result: uint = ++value assert value == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let value: uint = {{v.value}} let result: uint = ++value assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e93e97b7cd6258c0cdb3212503bf3c2b8e6250ac
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamLifecycleManager.ets
arkts
handleServerResolutionChanged
处理服务端分辨率变化(屏幕旋转/分辨率改变) 更新窗口管理器的串流分辨率并重新计算 XComponent 尺寸
async handleServerResolutionChanged(width: number, height: number): Promise<void> { console.info(`[StreamPage] 服务端分辨率变化: ${width}x${height}`); if (!this.windowManager) return; // 更新窗口管理器的串流分辨率 this.windowManager.setStreamResolution(width, height); // 重新配置窗口方向(可能会触发屏幕旋转) await this.windowMana...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left handleServerResolutionChanged AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left width AST#identifier#Right AST#type_anno...
async handleServerResolutionChanged(width: number, height: number): Promise<void> { console.info(`[StreamPage] 服务端分辨率变化: ${width}x${height}`); if (!this.windowManager) return; // 更新窗口管理器的串流分辨率 this.windowManager.setStreamResolution(width, height); // 重新配置窗口方向(可能会触发屏幕旋转) await this.windowMana...
https://github.com/AlkaidLab/moonlight-harmony
59ccdd522a32c205ee28899dd5f1a7ead200d843
github
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/storage/PreferencesUtil.ets
arkts
has
判断键是否存在 @param {string} key 键 @returns {Promise<boolean>} 是否存在
async has(key: string): Promise<boolean> { try { const prefs: preferences.Preferences = await this.getPrefs(); return prefs.has(key); } catch (error) { throw this.wrapError(error, `判断键 ${key} 是否存在失败`); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
async has(key: string): Promise<boolean> { try { const prefs: preferences.Preferences = await this.getPrefs(); return prefs.has(key); } catch (error) { throw this.wrapError(error, `判断键 ${key} 是否存在失败`); } }
https://github.com/Joker-x-dev/CoolMallArkTS
0c26ca8b1485c0575abf4f8de0ed84c7c0d8b8e7
github
LiHuaJZOAQ/GuardSysAPP
entry/src/main/ets/pages/WifiManager.ets
arkts
getDeviceMac
获取设备唯一标识(序列号,用于设备 ID)
static async getDeviceMac(): Promise<string> { try { const serial: string = deviceInfo.serial; if (serial && serial !== '') { return serial; } } catch (e) { console.error('deviceInfo.serial failed: ' + JSON.stringify(e)); } // fallback: 使用WiFi MAC地址 try { cons...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getDeviceMac AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
static async getDeviceMac(): Promise<string> { try { const serial: string = deviceInfo.serial; if (serial && serial !== '') { return serial; } } catch (e) { console.error('deviceInfo.serial failed: ' + JSON.stringify(e)); } // fallback: 使用WiFi MAC地址 try { cons...
https://github.com/LiHuaJZOAQ/GuardSysAPP
798323e057439c44b758bc0623b39939a450313c
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/DownloadVM.ets
arkts
canDownload
─── 进行中任务 ──────────────────────────────────── 判断一本书是否可下载:有 hash(eAPI file 端点)或 dl(旧路径兜底)。
static canDownload(book: Book): boolean { const hasHash: boolean = book.hash !== undefined && book.hash.length > 0; const hasDl: boolean = book.dl !== undefined && book.dl.length > 0; return hasHash || hasDl; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left canDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left book AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Book...
static canDownload(book: Book): boolean { const hasHash: boolean = book.hash !== undefined && book.hash.length > 0; const hasDl: boolean = book.dl !== undefined && book.dl.length > 0; return hasHash || hasDl; }
https://github.com/LZZLHY/hlib
dc513cc7954525cd6c83c279aed299dd467c7469
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Makes a copy of internal elements to insertPos from begin to end of Uint8ClampedArray. See rules of parameters normalization: {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin} public
/* public */ internal copyWithin(insertPos: int): void { this.copyWithin(insertPos, 0, this.length) }
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST...
/* public */ internal copyWithin(insertPos: int): void { this.copyWithin(insertPos, 0, this.length) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
c139d801f6d8d4b1bf4ea57985ca76d87e07c762
gitee
openharmony/arkui_ace_engine
advanced_ui_component/subheader/source/subheader.ets
arkts
getNumberByResource
get resource size @param resourceName resource id @returns resource size
public static getNumberByResource(resourceId: number, defaultNumber: number): number { try { let currentDeviceType: resourceManager.DeviceType | undefined = resourceManager.getSysResourceManager()?.getConfigurationSync()?.deviceType; let systemConfiguration: resourceManager.Configuration = ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getNumberByResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resourceId AST#identifier#Right AST#ERROR#Left AST...
public static getNumberByResource(resourceId: number, defaultNumber: number): number { try { let currentDeviceType: resourceManager.DeviceType | undefined = resourceManager.getSysResourceManager()?.getConfigurationSync()?.deviceType; let systemConfiguration: resourceManager.Configuration = ...
https://gitcode.com/openharmony/arkui_ace_engine
79d38aa727ac0d61a39e49de975e2ebb003a72a6
gitcode
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/model/ReminderModel.ets
arkts
getReminderConfig
获取提醒配置
getReminderConfig(type: ReminderType): ReminderConfig | undefined { return this.settings.get(type); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getReminderConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
getReminderConfig(type: ReminderType): ReminderConfig | undefined { return this.settings.get(type); }
https://gitcode.com/openharmony/codelabs
ca161b006125e14e060253c49d36e5ec253b0709
gitcode
XJTUWYD/ArkDiff
entry/src/main/ets/services/AnalyticsService.ets
arkts
getErrors
获取最近的错误列表(只读视图)
static getErrors(): AnalyticsError[] { AnalyticsService.init(); return AnalyticsService.errors; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getErrors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left AnalyticsErr...
static getErrors(): AnalyticsError[] { AnalyticsService.init(); return AnalyticsService.errors; }
https://github.com/XJTUWYD/ArkDiff
b69640da1b8f16972ee57d4d8ae693e3934429b1
github
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/ImagePreprocessor.ets
arkts
validateImageSize
验证图像大小 @param imageSizeBytes 图像大小(字节) @returns 是否符合要求(≤10MB)
validateImageSize(imageSizeBytes: number): boolean { const maxSizeBytes = 10 * 1024 * 1024; // 10MB return imageSizeBytes <= maxSizeBytes; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left validateImageSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left imageSizeBytes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Le...
validateImageSize(imageSizeBytes: number): boolean { const maxSizeBytes = 10 * 1024 * 1024; // 10MB return imageSizeBytes <= maxSizeBytes; }
https://github.com/LJ666-ui/harmony-health-care
448e3d2c22383591f0a5f42196397dc92736fd21
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
some
Checks that at least one element of BigInt64Array satisfies the passed function @param fn check function @returns true if some element satisfies fn
public some(fn: (element: long, index: int) => boolean): boolean { let newF: (element: long, index: int, array: BigInt64Array) => boolean = (element: long, index: int, array: BigInt64Array): boolean => { return fn(element, index) } return this.some(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public some(fn: (element: long, index: int) => boolean): boolean { let newF: (element: long, index: int, array: BigInt64Array) => boolean = (element: long, index: int, array: BigInt64Array): boolean => { return fn(element, index) } return this.some(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8fcff601cff7162f143b2a435b20421a17e23f5b
gitee
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/view/ImageViewComponent.ets
arkts
detectBoundary
Detect boundary to keep the image in window.
detectBoundary(): void { let maxOffsetX = this.imgScale * this.deviceWidth / 2 - this.deviceWidth / 2; if(vp2px(this.imgOffsetX) > (maxOffsetX)) { this.imgOffsetX = px2vp(maxOffsetX); } if (vp2px(this.imgOffsetX) < -(maxOffsetX)) { this.imgOffsetX = -px2vp(maxOffsetX); } let maxOff...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left detectBoundary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo...
detectBoundary(): void { let maxOffsetX = this.imgScale * this.deviceWidth / 2 - this.deviceWidth / 2; if(vp2px(this.imgOffsetX) > (maxOffsetX)) { this.imgOffsetX = px2vp(maxOffsetX); } if (vp2px(this.imgOffsetX) < -(maxOffsetX)) { this.imgOffsetX = -px2vp(maxOffsetX); } let maxOff...
https://gitee.com/harmonyos/codelabs.git
13beff5abf6c76aa08eb44b94bfb451578c9a351
gitee
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/calculator/UnitSunshineCalculator.ets
arkts
findClosestBlockingBuilding
找到最近的遮挡建筑
findClosestBlockingBuilding( buildings: BuildingModel[], targetBuilding: BuildingModel ): BuildingModel | null { let closest: BuildingModel | null = null; let minDistance = Number.MAX_VALUE; for (const building of buildings) { if (building.id === targetBuilding.id) { continue;...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left findClosestBlockingBuilding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buildings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right A...
findClosestBlockingBuilding( buildings: BuildingModel[], targetBuilding: BuildingModel ): BuildingModel | null { let closest: BuildingModel | null = null; let minDistance = Number.MAX_VALUE; for (const building of buildings) { if (building.id === targetBuilding.id) { continue;...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
400b1b17188a50fe0a2a55b34fb491de60a1315c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets
arkts
finally
finally 方法
finally(onfinally?: (() => void) | null): CancellablePromise<T> { return new CancellablePromise<T>((resolve, reject, signal) => { if (this._isCancelled) { signal.abort(this._cancelReason); reject(new CancellationError(this._cancelReason)); return; } this.signal.add...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left finally AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left onfinally AST#identifier#Right AST#ERROR#Left AST#?#Le...
finally(onfinally?: (() => void) | null): CancellablePromise<T> { return new CancellablePromise<T>((resolve, reject, signal) => { if (this._isCancelled) { signal.abort(this._cancelReason); reject(new CancellationError(this._cancelReason)); return; } this.signal.add...
https://github.com/DaLongZhuaZi/manxia
2cc9a7a9240be3e2aecd53798761fd4dc449cd0e
github
XHXYT/Pixark
entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleFetchDataEvent
--- 数据同步与事件 --- 全局数据刷新事件处理 (核心调度中心)
private async handleFetchDataEvent() { logger.info('FetchDataEvent', 'Received FetchData event, reloading all data...'); if (!pixiv.isLogin()) { PixState.isLoggedIn = false; return; } // 更新全局基础状态 PixState.isLoggedIn = true; const currentUser = pixiv.getCurrentUser(); if (curr...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left handleFetchDataEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
private async handleFetchDataEvent() { logger.info('FetchDataEvent', 'Received FetchData event, reloading all data...'); if (!pixiv.isLogin()) { PixState.isLoggedIn = false; return; } // 更新全局基础状态 PixState.isLoggedIn = true; const currentUser = pixiv.getCurrentUser(); if (curr...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/entryability/EntryAbility.ets#L236-L258
58f6ee0c0ec941a88b8ecc8f131bc7bcefb07073
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/PersistedUriManager.ets
arkts
revokePermission
移除持久化权限
public async revokePermission(uri: string): Promise<boolean> { if (!PersistedUriManager.isSupported()) { return false; } try { const policyInfo: fileShare.PolicyInfo = { uri: uri, operationMode: fileShare.OperationMode.READ_MODE, }; await fileShare.revokePermissio...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left revokePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : A...
public async revokePermission(uri: string): Promise<boolean> { if (!PersistedUriManager.isSupported()) { return false; } try { const policyInfo: fileShare.PolicyInfo = { uri: uri, operationMode: fileShare.OperationMode.READ_MODE, }; await fileShare.revokePermissio...
https://github.com/richshaw2015/nds
2de18963bfdd1d5dceeea2dec40193c2de2a6fec
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/Login.ets
arkts
onPageHide
倒计时定时器(用于清理) 3. 页面生命周期:隐藏时清除定时器(防止内存泄漏)
onPageHide(): void { if (this.timer) { clearInterval(this.timer); this.timer = null; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageHide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left...
onPageHide(): void { if (this.timer) { clearInterval(this.timer); this.timer = null; } }
https://github.com/cpdd5201314/harmonyOS-music-app
9a6ec81037c9e4925ccd882fe4c4c6c7a66037c2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets
arkts
notifyLoadSuccess
通知加载成功
private notifyLoadSuccess(request: ImageRequestInfo, response: WebViewLoadingResult): void { this.loadListeners.forEach(listener => { try { listener.onLoadSuccess(request, response); } catch (error) { logger.error(TAG, `通知加载成功失败: ${error instanceof Error ? error.message : String(error)...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyLoadSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private notifyLoadSuccess(request: ImageRequestInfo, response: WebViewLoadingResult): void { this.loadListeners.forEach(listener => { try { listener.onLoadSuccess(request, response); } catch (error) { logger.error(TAG, `通知加载成功失败: ${error instanceof Error ? error.message : String(error)...
https://github.com/DaLongZhuaZi/manxia
545a738771d405428f5365b479d8d3689e33d6c0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets
arkts
escapeXml
XML转义
private escapeXml(text: string): string { return text .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&#39;'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str...
private escapeXml(text: string): string { return text .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&#39;'); }
https://github.com/DaLongZhuaZi/manxia
12c65c83101b8ffcbd4345cbfa5d8dcf91d27048
github
aimilin6688/KeePassHO
entry/src/main/ets/services/RecentFilesService.ets
arkts
doAdd
添加最近打开的文件 @param fileParam 文件参数
private async doAdd(recentFile: RecentFile): Promise<void> { try { hilog.info(DOMAIN, TAG, 'Add recent file filePath:%{public}s', recentFile.filePath); if (!this.preferences) { return; } // 获取当前的最近文件列表 const recentFiles = await this.getRecentFiles(); // 检查文件是否已经在列表中 ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left doAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left recentFile AST#identifier#Right AST#:#Left : AS...
private async doAdd(recentFile: RecentFile): Promise<void> { try { hilog.info(DOMAIN, TAG, 'Add recent file filePath:%{public}s', recentFile.filePath); if (!this.preferences) { return; } // 获取当前的最近文件列表 const recentFiles = await this.getRecentFiles(); // 检查文件是否已经在列表中 ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L103-L152
0fd519bd360042a9815726aade2455f78ab774b0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/SandboxManager.ets
arkts
startCleanupTimer
启动定期清理定时器
private startCleanupTimer(): void { if (this.cleanupTimer) { clearInterval(this.cleanupTimer); } this.cleanupTimer = setInterval(() => { this.cleanupExpiredFiles(); this.checkAndCleanupCache(); }, this.config.cleanupInterval); logger.debug(TAG, '定期清理定时器已启动'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startCleanupTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#e...
private startCleanupTimer(): void { if (this.cleanupTimer) { clearInterval(this.cleanupTimer); } this.cleanupTimer = setInterval(() => { this.cleanupExpiredFiles(); this.checkAndCleanupCache(); }, this.config.cleanupInterval); logger.debug(TAG, '定期清理定时器已启动'); }
https://github.com/DaLongZhuaZi/manxia
ed939aaa52caba409d2255786274430164620df7
github
openharmony-sig/applications_clock
feature/worldclock/src/main/ets/pages/TimeZoneUtil.ets
arkts
getAvailableZoneCityIDs
获取系统支持的时区城市ID集合
static getAvailableZoneCityIDs(): Array<string> { return i18n.TimeZone.getAvailableZoneCityIDs(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAvailableZoneCityIDs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
static getAvailableZoneCityIDs(): Array<string> { return i18n.TimeZone.getAvailableZoneCityIDs(); }
https://gitee.com/openharmony-sig/applications_clock.git
ffcc6ae51f214ff2ea3165954ede6987e1591d06
gitee
richshaw2015/nds
ohos/entry/src/main/ets/pages/settings/RewindSettings.ets
arkts
aboutToAppear
页面即将显示时处理参数并加载设置 Requirements: 14.5, 14.7
aboutToAppear(): void { const params = router.getParams() as RouterParams | undefined; if (params?.parentScrollPosition !== undefined) { hilog.info(DOMAIN, TAG, 'Received parent scroll position: %{public}d', params.parentScrollPosition); } hilog.info(DOMAIN, TAG, 'RewindSettings page appeared');...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { const params = router.getParams() as RouterParams | undefined; if (params?.parentScrollPosition !== undefined) { hilog.info(DOMAIN, TAG, 'Received parent scroll position: %{public}d', params.parentScrollPosition); } hilog.info(DOMAIN, TAG, 'RewindSettings page appeared');...
https://github.com/richshaw2015/nds
133c11e4df6d15afa5f382bf53a2386f378f91ac
github
openharmony/arkui_ace_engine
advanced_ui_component/treeview/source/treeview.ets
arkts
checkMainTitleIsValid
check main title is valid @param title main title @returns check result
public checkMainTitleIsValid(title: string): boolean { if (new RegExp('/[\\\/:*?"<>|]/').test(title)) { return false; } if ((new RegExp('/^[\u4e00-\u9fa5]+$/').test(title) && title.length > this.MAX_CN_LENGTH) || (!new RegExp('/^[\u4e00-\u9fa5]+$/').test(title) && title.length > this.MAX_EN_LE...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left checkMainTitleIsValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public checkMainTitleIsValid(title: string): boolean { if (new RegExp('/[\\\/:*?"<>|]/').test(title)) { return false; } if ((new RegExp('/^[\u4e00-\u9fa5]+$/').test(title) && title.length > this.MAX_CN_LENGTH) || (!new RegExp('/^[\u4e00-\u9fa5]+$/').test(title) && title.length > this.MAX_EN_LE...
https://gitee.com/openharmony/arkui_ace_engine.git
f5371b11d7bb5682ee1b740b29061dd008b90042
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Atomics.ets
arkts
add
Int8Array
public static add(typedArray: Int8Array, index: int, value: byte): byte { let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, Int8Array.BYTES_PER_ELEMENT, typedArray.length, index) let buffer = typedArray.buffer if (buffer instanceof ArrayBuffer) { let oldVa...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left typedArray AST#identifier#R...
public static add(typedArray: Int8Array, index: int, value: byte): byte { let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, Int8Array.BYTES_PER_ELEMENT, typedArray.length, index) let buffer = typedArray.buffer if (buffer instanceof ArrayBuffer) { let oldVa...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
83e1135a4fe476787b9fe677a161caa5555d30e8
gitee
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/pages/CommentScrollPage.ets
arkts
toggleLike
移除了复杂的手势处理,使用List组件内置的滚动和刷新功能
toggleLike(commentId: string) { for (let i = 0; i < this.commentDataSource.totalCount(); i++) { const comment = this.commentDataSource.getData(i) if (comment.id === commentId) { comment.isLiked = !comment.isLiked comment.likes += comment.isLiked ? 1 : -1 this.commentDataSource....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleLike AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)...
toggleLike(commentId: string) { for (let i = 0; i < this.commentDataSource.totalCount(); i++) { const comment = this.commentDataSource.getData(i) if (comment.id === commentId) { comment.isLiked = !comment.isLiked comment.likes += comment.isLiked ? 1 : -1 this.commentDataSource....
https://github.com/SMAT-Lab/PhantomRendering
f20f467def641f7dba24ceef73a77e3f19720f73
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/JSONPathParser.ets
arkts
parseString
解析字符串值
static parseString(data: Record<string, Object>, path: string): string { const result: JSONPathResult = JSONPathParser.parse(data, path); if (result === null || result === undefined) { return ''; } return String(result); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres...
static parseString(data: Record<string, Object>, path: string): string { const result: JSONPathResult = JSONPathParser.parse(data, path); if (result === null || result === undefined) { return ''; } return String(result); }
https://github.com/DaLongZhuaZi/manxia
f1d0ed461670af21fe065bcbeed105f88839c4c7
github
JQHxx/codelabs
NewsRelease/entry/src/main/ets/viewmodel/NewsTypeViewModel.ets
arkts
getNewsTypeList
Get news type list from server. @return NewsTypeModel[] newsTypeList
getNewsTypeList(): Promise<NewsTypeModel[]> { return new Promise((resolve: Function) => { let url = `${Constants.SERVER}/${Constants.GET_NEWS_TYPE}`; httpRequestGet(url).then((data: ResponseResult) => { if (data.code === Constants.SERVER_CODE_SUCCESS) { resolve(data.data); } ...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getNewsTypeList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS...
getNewsTypeList(): Promise<NewsTypeModel[]> { return new Promise((resolve: Function) => { let url = `${Constants.SERVER}/${Constants.GET_NEWS_TYPE}`; httpRequestGet(url).then((data: ResponseResult) => { if (data.code === Constants.SERVER_CODE_SUCCESS) { resolve(data.data); } ...
https://github.com/JQHxx/codelabs
b2beb66c62c50e13d916e4e4b5709ca860086ff9
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
createDefaultMetadata
创建默认元数据
static createDefaultMetadata(correlationId: string, userId: number): EventMetadata { const result: EventMetadata = { correlationId: correlationId, causationId: '', userId: userId, userAgent: '', ipAddress: '', deviceId: '', sessionId: '', source: EVENT_SOURCE_APP ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDefaultMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left correlationId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin...
static createDefaultMetadata(correlationId: string, userId: number): EventMetadata { const result: EventMetadata = { correlationId: correlationId, causationId: '', userId: userId, userAgent: '', ipAddress: '', deviceId: '', sessionId: '', source: EVENT_SOURCE_APP ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
c999c275f0dd037995174223f1e86a94d97f67e4
github
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/repository/ChatRepository.ets
arkts
buildRequestParams
Build request parameters object
private buildRequestParams(requestParams: ChatRequestParams): Record<string, string | number> { const params: Record<string, string | number> = {}; // Only add parameters that are defined if (requestParams.lat !== undefined) { params.lat = requestParams.lat; } if (requestParams.lon !== unde...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildRequestParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
private buildRequestParams(requestParams: ChatRequestParams): Record<string, string | number> { const params: Record<string, string | number> = {}; // Only add parameters that are defined if (requestParams.lat !== undefined) { params.lat = requestParams.lat; } if (requestParams.lon !== unde...
https://github.com/somnio-software/my-bot-pal
d463d24d8884bec9b99330619915e2f0b3213535
github
queueit/harmony-sdk
queueit_sdk/src/main/ets/view/QueueItViewManager.ets
arkts
handleSslErrorReceive
Called by <Web onSslErrorReceive={...}>
public handleSslErrorReceive(event: OnSslErrorEventReceiveEvent): void { this.isLoading = false; const error = event?.error; const sslErrorCode = error.toString() ?? 'Unknown SSL Error'; Logger.error(QueueItViewManager.TAG, `onSslErrorReceive: ${sslErrorCode}`); this.queueLis...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleSslErrorReceive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public handleSslErrorReceive(event: OnSslErrorEventReceiveEvent): void { this.isLoading = false; const error = event?.error; const sslErrorCode = error.toString() ?? 'Unknown SSL Error'; Logger.error(QueueItViewManager.TAG, `onSslErrorReceive: ${sslErrorCode}`); this.queueLis...
https://github.com/queueit/harmony-sdk
48d574e185faa4993034d2b6e8d9718519f3b228
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceAntiCrawler.ets
arkts
isWebViewReady
检查WebView是否已准备好
private isWebViewReady(): boolean { try { // 尝试获取URL来检查WebView是否已关联 this.webviewController.getUrl(); return true; } catch (error) { return false; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isWebViewReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean...
private isWebViewReady(): boolean { try { // 尝试获取URL来检查WebView是否已关联 this.webviewController.getUrl(); return true; } catch (error) { return false; } }
https://github.com/DaLongZhuaZi/manxia
451e21c08b24faeca6f13762ed827530398f73b5
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
includes
Checks whether an Array includes a certain value among its entries, returning true or false as appropriate. @param val value to search @returns true if val is in Array
public includes(val: T): boolean { return this.indexOf(val) != -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left val AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right A...
public includes(val: T): boolean { return this.indexOf(val) != -1 }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2692278959826805af2f44d60aa1674b634d7d83
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_xor/bitwise_xor_char.ets
arkts
main
--- desc: check bitwise XOR of two chars ---
function main(): void { const a: char = {{v.left}} const b: char = {{v.right}} assert (a ^ b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: char = {{v.left}} const b: char = {{v.right}} assert (a ^ b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e18ae832da8db8a4d1de99bbaf54fdcb637136cf
gitee
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
updateRegionWithValue
更新省市区(包含选择值) @param {string} province - 省 @param {string} city - 市 @param {string} district - 区 @param {Array<string>} valuePath - 级联值路径 @returns {void} 无返回值
updateRegionWithValue(province: string, city: string, district: string, valuePath: Array<string>): void { this.province = province; this.city = city; this.district = district; this.regionValue = valuePath; this.refreshRegionDisplay(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateRegionWithValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left province AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left...
updateRegionWithValue(province: string, city: string, district: string, valuePath: Array<string>): void { this.province = province; this.city = city; this.district = district; this.regionValue = valuePath; this.refreshRegionDisplay(); }
https://github.com/Joker-x-dev/CoolMallArkTS
24649eac5991e8f2ff47bef7eabcb2bbdcd004d7
github
Joker-x-dev/CoolMallArkTS
core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets
arkts
ensureMigrated
确保购物车表完成迁移 @returns {void} 无返回
private ensureMigrated(): void { if (!CartLocalDataSourceImpl.migrated) { this.orm.migrate(CartEntity); CartLocalDataSourceImpl.migrated = true; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureMigrated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr...
private ensureMigrated(): void { if (!CartLocalDataSourceImpl.migrated) { this.orm.migrate(CartEntity); CartLocalDataSourceImpl.migrated = true; } }
https://github.com/Joker-x-dev/CoolMallArkTS
7fb3b9a44228554a4d87743f623a58bd68ff5f79
github
the-wwyang/kids-learning-app
src/main/ets/services/DataBackupService.ets
arkts
validateBackupData
验证备份数据格式
private validateBackupData(data: BackupData): boolean { return !!( data && data.version && data.timestamp && data.userProfile && Array.isArray(data.learningProgress) && Array.isArray(data.achievements) ); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateBackupData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private validateBackupData(data: BackupData): boolean { return !!( data && data.version && data.timestamp && data.userProfile && Array.isArray(data.learningProgress) && Array.isArray(data.achievements) ); }
https://github.com/the-wwyang/kids-learning-app
d45b8d8b5c6c99407a5dd22cff23f7411612073a
github
huangyuanlove/HelloArkUI
entry/src/main/ets/pages/playground/take_photo/TakePhotoPage.ets
arkts
getSupportFlashModeStrs
展示在弹窗列表中的闪光灯模式说明
getSupportFlashModeStrs(): string[] { let result: string [] = [] this.supportFlashMode.forEach((value) => { if (value === camera.FlashMode.FLASH_MODE_CLOSE) { result.push('闪光灯关闭') } else if (value === camera.FlashMode.FLASH_MODE_OPEN) { result.push('闪光灯打开') } else if (value =...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSupportFlashModeStrs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST...
getSupportFlashModeStrs(): string[] { let result: string [] = [] this.supportFlashMode.forEach((value) => { if (value === camera.FlashMode.FLASH_MODE_CLOSE) { result.push('闪光灯关闭') } else if (value === camera.FlashMode.FLASH_MODE_OPEN) { result.push('闪光灯打开') } else if (value =...
https://github.com/huangyuanlove/HelloArkUI
caf2b0d4d7decdb3d1175fc661226c6fefbc2a88
github
richshaw2015/nds
ohos/entry/src/test/SyncToNativeProperty.test.ets
arkts
syncToNativeTestable
Replicates the syncToNative logic from SettingsManager: 1. Validates key exists in SETTINGS_DEFINITIONS 2. If invalid key -> returns ERR_UNKNOWN_SETTING_KEY (no NAPI call) 3. If valid key -> calls NAPI and returns result
function syncToNativeTestable(key: string, value: SettingValue): SettingsResult<void> { const definition = getSettingDefinition(key); if (!definition) { return createErrorResult(SettingsErrorCode.ERR_UNKNOWN_SETTING_KEY, key, value); } try { const success = mockSetSettingsConfig(key, value as SettingsCo...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left syncToNativeTestable AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
function syncToNativeTestable(key: string, value: SettingValue): SettingsResult<void> { const definition = getSettingDefinition(key); if (!definition) { return createErrorResult(SettingsErrorCode.ERR_UNKNOWN_SETTING_KEY, key, value); } try { const success = mockSetSettingsConfig(key, value as SettingsCo...
https://github.com/richshaw2015/nds
e5f7c7429d3d58a7454c87313a1cb2719919ef7b
github
ZestBox-18/kitebook-frontend
features/profile/src/main/ets/components/UserEditSheet.ets
arkts
aboutToAppear
退出按钮缩放
aboutToAppear() { if (this.profile.isLoggedIn) { this.currentAvatar = this.profile.avatar; this.currentNickname = this.profile.nickname; this.loginSuccess = true; // 已登录状态,直接显示最终状态 this.oldTextOpacity = 0; this.newTextOpacity = 1; this.newTextTranslateX = 0; this.lo...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { if (this.profile.isLoggedIn) { this.currentAvatar = this.profile.avatar; this.currentNickname = this.profile.nickname; this.loginSuccess = true; // 已登录状态,直接显示最终状态 this.oldTextOpacity = 0; this.newTextOpacity = 1; this.newTextTranslateX = 0; this.lo...
https://github.com/ZestBox-18/kitebook-frontend
820f9a14f2d6764e9f2155aed978a33634cfc381
github
wly5556/S1-Orange
entry/src/main/ets/config/UserConfig.ets
arkts
modify
修改配置项:在modifier回调中对于ApplicationConfig的修改将被flush 可被await来保证后续逻辑中对配置的修改已经生效
async modify(modifier: (conf: ApplicationConfig) => void) { if (!this.initialized) { await this.initPromise } modifier(this.proxy!) this.dirty.forEach(key => { this.preferences?.put(key, Reflect.get(this.config, key)) }) await this.preferences?.flush() this.dirty.clear() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left modify AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left modifier AST#identifier#Right AST#type...
async modify(modifier: (conf: ApplicationConfig) => void) { if (!this.initialized) { await this.initPromise } modifier(this.proxy!) this.dirty.forEach(key => { this.preferences?.put(key, Reflect.get(this.config, key)) }) await this.preferences?.flush() this.dirty.clear() }
https://github.com/wly5556/S1-Orange
0db1c47704f43597c1dc6d6351230981daa84333
github
openharmony-sig/applications_clock
common/src/main/ets/manager/SnoozeManager.ets
arkts
clearSnoozeTimes
Clear the number of naps @param alarmId alarm id
async clearSnoozeTimes(alarmId: string): Promise<void> { const preferences = await this.getPreferences(); await preferences.delete(alarmId); await preferences.flush(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearSnoozeTimes AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmId AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async clearSnoozeTimes(alarmId: string): Promise<void> { const preferences = await this.getPreferences(); await preferences.delete(alarmId); await preferences.flush(); }
https://gitee.com/openharmony-sig/applications_clock.git
455ad5db165a19532b3072919b92fc731954e2ff
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
calculate
Calculates the minimum / maximum and range values of the axis with the given minimum and maximum values from the chart data. @param dataMin the min value according to chart data @param dataMax the max value according to chart data
public calculate(dataMin: number, dataMax: number): void { // if custom, use value as is, else use data value let min: number = this.mCustomAxisMin ? this.mAxisMinimum : (dataMin - this.mSpaceMin); let max: number = this.mCustomAxisMax ? this.mAxisMaximum : (dataMax + this.mSpaceMax); // temporary r...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calculate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dataMin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right...
public calculate(dataMin: number, dataMax: number): void { // if custom, use value as is, else use data value let min: number = this.mCustomAxisMin ? this.mAxisMinimum : (dataMin - this.mSpaceMin); let max: number = this.mCustomAxisMax ? this.mAxisMaximum : (dataMax + this.mSpaceMax); // temporary r...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
72bc5b6b759f0cba52c1967decaafbcd4572ada3
gitee
offlinecat-dev/OCNetORM
src/main/ets/mapping/ViewModelMapper.ets
arkts
toEntityDataArray
批量转换 ViewModel 数组为 EntityData 数组 @param viewModelArray ViewModel 数组 @param entityName 实体名称 @param propertyNames 属性名列表 @param valueGetter 值获取回调 @returns EntityData 数组
static toEntityDataArray<T>( viewModelArray: Array<T>, entityName: string, propertyNames: Array<string>, valueGetter: ReversePropertyMapper<T> ): Array<EntityData> { const result: Array<EntityData> = [] for (let i = 0; i < viewModelArray.length; i++) { result.push(ViewModelMapper.toEnt...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left toEntityDataArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( A...
static toEntityDataArray<T>( viewModelArray: Array<T>, entityName: string, propertyNames: Array<string>, valueGetter: ReversePropertyMapper<T> ): Array<EntityData> { const result: Array<EntityData> = [] for (let i = 0; i < viewModelArray.length; i++) { result.push(ViewModelMapper.toEnt...
https://github.com/offlinecat-dev/OCNetORM
74582c5ff8dd752ecf0f5844a88438ffc5647414
github
HarmonyOS_Samples/MusicHome
products/pc/src/main/ets/pcbackupability/PcBackupAbility.ets
arkts
onRestore
Invoked when restoring backup data on PC. @param bundleVersion Version info from the backup framework.
async onRestore(bundleVersion: BundleVersion) { Logger.info(`PcBackupAbility: onRestore ok ${JSON.stringify(bundleVersion)}`); await Promise.resolve(); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onRestore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bundleVersion AST#identifier#Right AST#type_annotation#Left ...
async onRestore(bundleVersion: BundleVersion) { Logger.info(`PcBackupAbility: onRestore ok ${JSON.stringify(bundleVersion)}`); await Promise.resolve(); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
ccfa94ae947940f4a66e3f4d636fe9c5514593d7
gitcode
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/model/GlobalUserDBModel.ets
arkts
updateLoginState
更新用户登录状态 @param id 用户id @param login_state 登录状态
async updateLoginState(id: number, login_state: number) { let predicates = new relationalStore.RdbPredicates(this.TABLE_USER) predicates.equalTo("id", id) try { //更新login_state let rowNum = await this.store.update({ "login_state": login_state }, predicates) } catch (err) { } }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateLoginState AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#...
async updateLoginState(id: number, login_state: number) { let predicates = new relationalStore.RdbPredicates(this.TABLE_USER) predicates.equalTo("id", id) try { //更新login_state let rowNum = await this.store.update({ "login_state": login_state }, predicates) } catch (err) { } }
https://github.com/RedRackham-R/WanAndroidHarmoney
639cebf00bee85dfee91960165172fc157146a25
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
includes
Determines whether Float32Array includes a certain element, returning true or false as appropriate @param { float } searchElement - The element to search for. The search starts at index 0. @returns { boolean } - true if searchElement is in Float32Array, false otherwise @syscap SystemCapability.Utils.Lang @FaAndStageMod...
public includes(searchElement: float): boolean { return this.includes(searchElement, 0) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left float AST#iden...
public includes(searchElement: float): boolean { return this.includes(searchElement, 0) }
https://gitcode.com/iop123123/arkts-static-skills
5b16a29db2bce42167416191f27b8fe6d7f27bde
gitcode
openharmony/codelabs
Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
arkts
addToDeviceList
Add a device to the device list. @param device Device information.
addToDeviceList(device: deviceManager.DeviceInfo): void { let isExist: boolean = false; for (let i: number = 0; i < this.deviceList.length; i++) { if (device.deviceId === this.deviceList[i].deviceId) { this.deviceList[i] = device; isExist = true; break; } } if (!isE...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addToDeviceList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left deviceManag...
addToDeviceList(device: deviceManager.DeviceInfo): void { let isExist: boolean = false; for (let i: number = 0; i < this.deviceList.length; i++) { if (device.deviceId === this.deviceList[i].deviceId) { this.deviceList[i] = device; isExist = true; break; } } if (!isE...
https://gitee.com/openharmony/codelabs.git
b78fb99090e7d9ddc1c20ada158373e9b1e00c6c
gitee
openharmony-sig/ohos_checksum
library/src/main/ets/md5.ets
arkts
binl_md5
Calculate the MD5 of an array of little-endian words, and a bit length.
binl_md5(x: number[], len: number): number[]{ /* append padding */ x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; let a = 1732584193; let b = -271733879; let c = -1732584194; let d = 271733878; for (let i = 0; i < x.len...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left binl_md5 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left numbe...
binl_md5(x: number[], len: number): number[]{ /* append padding */ x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; let a = 1732584193; let b = -271733879; let c = -1732584194; let d = 271733878; for (let i = 0; i < x.len...
https://gitee.com/openharmony-sig/ohos_checksum.git
964b85fbbea7051ebc339636ef9518b0a0ae712c
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
stopAllSensors
停止所有传感器(串流断开时调用)
stopAllSensors(): void { this.deviceSensorService.disableAll(); this.usingDeviceSensorFallback = false; this.sensorDataCallback = null; console.info('[GAMEPAD] 所有传感器已停止'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopAllSensors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo...
stopAllSensors(): void { this.deviceSensorService.disableAll(); this.usingDeviceSensorFallback = false; this.sensorDataCallback = null; console.info('[GAMEPAD] 所有传感器已停止'); }
https://github.com/AlkaidLab/moonlight-harmony
e7559f47ab106f3c66c838a40ecbcb3b05a70624
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/Retrofit.ets
arkts
setHttpClient
Set the HTTP client to use for requests.
setHttpClient(client: HttpClient): RetrofitBuilder { this.client = client; return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHttpClient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left client AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left HttpClient AST#identifier#Right AST#)#Le...
setHttpClient(client: HttpClient): RetrofitBuilder { this.client = client; return this; }
https://github.com/killetom/ktretrofit
1578c34fae252050c04ca2a4a96524f0e81b6106
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
getInt16
Gets an signed short. @param byteOffset The byte offset. @param littleEndian If the value is little endian. @returns The value.
getInt16(byteOffset: number, littleEndian?: boolean): number { return this.dataView?.getInt16(byteOffset, littleEndian) || 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getInt16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Ri...
getInt16(byteOffset: number, littleEndian?: boolean): number { return this.dataView?.getInt16(byteOffset, littleEndian) || 0 }
https://gitee.com/openharmony-sig/flutter_engine.git
0577d5fb8f802373c97c95a9e34a4e6214aff6b3
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Process.ets
arkts
listUnhandledPromises
This method applies default or user-provided handler to all unhandled rejected promise results @param { Object[][] } objs array of pairs of rejection results and rejected promises
function listUnhandledPromises(objs: Object[][], defaultHandlerMode: int): void { for (let objAndReason of objs) { callPromiseHandler(objAndReason, defaultHandlerMode); } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left listUnhandledPromises AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left objs AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
function listUnhandledPromises(objs: Object[][], defaultHandlerMode: int): void { for (let objAndReason of objs) { callPromiseHandler(objAndReason, defaultHandlerMode); } }
https://gitcode.com/iop123123/arkts-static-skills
d6293022baedadd7570515640115d3efaa2c867d
gitcode
Gramony/Gramony
features/home/src/main/ets/entities/Message.ets
arkts
getEntitiesByType
获取指定类型的所有实体
public getEntitiesByType(type: MessageEntityType): MessageEntity[] { if (!this.fmtEntities) return []; return this.fmtEntities.filter(e => e.entityType === type); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEntitiesByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public getEntitiesByType(type: MessageEntityType): MessageEntity[] { if (!this.fmtEntities) return []; return this.fmtEntities.filter(e => e.entityType === type); }
https://github.com/Gramony/Gramony
c1ca3a1075d340ae826ac2c7c81bba2f4a694ec3
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets
arkts
HasWriteLock
Checks if the lock is held by a writer. @param { long } state Current lock state @returns { boolean } True if the lock is held by a writer, false otherwise @syscap SystemCapability.Utils.Lang
public static HasWriteLock(state: long): boolean { return (state & State.STATE_MASK) == State.WRITE_LOCKED; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left HasWriteLock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
public static HasWriteLock(state: long): boolean { return (state & State.STATE_MASK) == State.WRITE_LOCKED; }
https://gitcode.com/iop123123/arkts-static-skills
6f2e1120b5549c07e6075f49f7a9ddc3197a3251
gitcode
yang-kun-long/HarmonyAccounting
entry/src/main/ets/common/database/Rdb.ets
arkts
updateData
更新数据 @param predicates 更新条件 @param data 要更新的数据 @param callback 回调函数,当数据更新完成时被调用,参数为更新结果
updateData(predicates: relationalStore.RdbPredicates, data: relationalStore.ValuesBucket, callback: Function = () => { }) { // 检查回调函数是否有效 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'updateDate() has no callback!'); return; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Le...
updateData(predicates: relationalStore.RdbPredicates, data: relationalStore.ValuesBucket, callback: Function = () => { }) { // 检查回调函数是否有效 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'updateDate() has no callback!'); return; ...
https://github.com/yang-kun-long/HarmonyAccounting
a8fa15731984654e2250b3350441d1619f708db0
github
PollenWang6/HiXD
entry/src/main/ets/utils/HttpUtil.ets
arkts
saveResponseCookies
公开方法,供 CasLoginService 等外部调用者保存 cookie
saveResponseCookies(domain: string, setCookieHeader: string): void { if (!this.cookieStore[domain]) { this.cookieStore[domain] = {}; } const cookies = setCookieHeader.split(/,(?=\s*[^,;=]+=)/); for (const cookie of cookies) { const first = cookie.split(';')[0].trim(); const eq = firs...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left saveResponseCookies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#...
saveResponseCookies(domain: string, setCookieHeader: string): void { if (!this.cookieStore[domain]) { this.cookieStore[domain] = {}; } const cookies = setCookieHeader.split(/,(?=\s*[^,;=]+=)/); for (const cookie of cookies) { const first = cookie.split(';')[0].trim(); const eq = firs...
https://github.com/PollenWang6/HiXD
880b7f140634a74bd4e2e652303ee60cc9986760
github
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets
arkts
send_meta
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 内部函数 // ////////// 元数据获取发送 //
private async send_meta(path: string) { // 获取基础元数据 // tmp[0] = [文件名, 文件类型, 声道, 采样率, 位深, 比特率, 时长(分:秒), 时长(毫秒)] // tmp[1] = [标题, 歌手, 专辑, 专辑作家, 流派] const tmp = await get_meta(path) // 获取封面 const tmp_img = await get_image(path) // 广播元数据 if (tmp && tmp[0].length > 0) {emitter.emit({ eventId...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left send_meta AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#...
private async send_meta(path: string) { // 获取基础元数据 // tmp[0] = [文件名, 文件类型, 声道, 采样率, 位深, 比特率, 时长(分:秒), 时长(毫秒)] // tmp[1] = [标题, 歌手, 专辑, 专辑作家, 流派] const tmp = await get_meta(path) // 获取封面 const tmp_img = await get_image(path) // 广播元数据 if (tmp && tmp[0].length > 0) {emitter.emit({ eventId...
https://github.com/Nekofox-POT/LinMusic
2c5ba12bb72f48be2d365f0a9bd32f5c423a1075
github
offlinecat-dev/OCNetORM
src/main/ets/core/MetadataStorage.ets
arkts
hasRelation
检查实体是否有指定的关联关系 @param entityName 实体名称 @param propertyName 属性名 @returns 是否存在该关联关系
hasRelation(entityName: string, propertyName: string): boolean { return this.getRelation(entityName, propertyName) !== null }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasRelation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,...
hasRelation(entityName: string, propertyName: string): boolean { return this.getRelation(entityName, propertyName) !== null }
https://github.com/offlinecat-dev/OCNetORM
e3f36cb59abb75e00deef8dd832d996db46af959
github