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
wuba/omni-ui
omni_component/src/main/ets/components/toast/OmniToast.ets
arkts
initToast
初始化 @param uiContext
public static initToast(uiContext: UIContext) { OmniToast.uiContext = uiContext }
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 initToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : A...
public static initToast(uiContext: UIContext) { OmniToast.uiContext = uiContext }
https://github.com/wuba/omni-ui
574240becf56c827a774a3f83d61e421182e83f0
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/DeviceSensorService.ets
arkts
disableAll
禁用所有传感器
disableAll(): void { this.setGyroState(0); this.setAccelState(0); this.dataCallback = null; console.info('[DeviceSensor] 所有传感器已禁用'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left disableAll 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...
disableAll(): void { this.setGyroState(0); this.setAccelState(0); this.dataCallback = null; console.info('[DeviceSensor] 所有传感器已禁用'); }
https://github.com/AlkaidLab/moonlight-harmony
10e725599f0ebbef52b7bbb785acb0d3777dcd95
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
slice
Creates a slice of current Uint8ClampedArray using range [begin, end] {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice} @param { int } [begin] start - index to be taken into slice @param { int } [end] - last index to be taken into slice @returns { Uint8ClampedArra...
public slice(begin?: int, end?: int): Uint8ClampedArray { return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#...
public slice(begin?: int, end?: int): Uint8ClampedArray { return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt) }
https://gitcode.com/iop123123/arkts-static-skills
a8f9e6bf24cf78d46df3951cee5fd729d6ad16dc
gitcode
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
setSplitWriteNum
Set split Writ eNum @param num @return BleManager
public setSplitWriteNum(num: number): BleManager { if (num > 0) { this.splitWriteNum = num; } return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSplitWriteNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public setSplitWriteNum(num: number): BleManager { if (num > 0) { this.splitWriteNum = num; } return this; }
https://gitee.com/openharmony-sig/FastBle.git
e91dc59a947b89fd2201821301ad3a118726dd4c
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
sendCommand
发送命令到 Worker 或直接调用 NAPI
private sendCommand(message: QemuWorkerMessage): Promise<QemuWorkerResponse> { return new Promise((resolve, reject) => { // Worker 不可用时,返回失败响应(不崩溃) if (!this.workerAvailable || !this.worker) { console.warn('[QemuVMManager] Worker 不可用,命令被忽略:', message.command) // 返回失败响应而不是 reject,避免崩溃 ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private sendCommand(message: QemuWorkerMessage): Promise<QemuWorkerResponse> { return new Promise((resolve, reject) => { // Worker 不可用时,返回失败响应(不崩溃) if (!this.workerAvailable || !this.worker) { console.warn('[QemuVMManager] Worker 不可用,命令被忽略:', message.command) // 返回失败响应而不是 reject,避免崩溃 ...
https://github.com/AetheriumSimulator/qemu-hmos
6b5b88c07a2623b2029ef6ddc46546b3f50f845d
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
getOnChartGestureListener
Returns the custom gesture listener. @return
public getOnChartGestureListener(): OnChartGestureListener | null { return this.mGestureListener; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOnChartGestureListener 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#binary_expre...
public getOnChartGestureListener(): OnChartGestureListener | null { return this.mGestureListener; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
2ea92b347d6fd43c29795edb203c5faecf7ac1fb
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/IndoorLocator.ets
arkts
setPositionUpdateCallback
设置位置更新回调 @param callback 回调函数
public setPositionUpdateCallback(callback: (pos: Position3D) => void): void { this.positionUpdateCallback = callback; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left setPositionUpdateCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#...
public setPositionUpdateCallback(callback: (pos: Position3D) => void): void { this.positionUpdateCallback = callback; }
https://github.com/LJ666-ui/harmony-health-care
40e9123ad1526c616fede1b093be84de47c7508b
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
moveToTop
@deprecated @see {ZRouter.getInstance().moveToTop} @param name
public static moveToTop(name: string) { ZRouter.getRouterMgr().moveToTop(name) }
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 moveToTop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#...
public static moveToTop(name: string) { ZRouter.getRouterMgr().moveToTop(name) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L560-L562
51f69a822c1246c16d07474bb64193f1131960bf
github
zcg741/chengyu-game
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
getTotalCorrect
获取总答对题数
async getTotalCorrect(): Promise<number> { return await getNumber('total_correct', 0); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTotalCorrect AST#identifier#Right AST#ERROR#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#gene...
async getTotalCorrect(): Promise<number> { return await getNumber('total_correct', 0); }
https://github.com/zcg741/chengyu-game
1af6aea4dd191a44762c6d9c7ca0716c152c0d3d
github
openharmony-sig/earth
hpauditor/tests/issues/expected/issue25.ets.audit.ets
arkts
foo2
2. Dynamically creating a function
function foo2(f: boolean, a: number, b: number): number { if (f) { /* HPAudit: Do not dynamically declare functions and classes : hp-performance-no-dynamic-cls-func : 1 : 50 : issue25.ets */ const add = (c: number, d: number): number => { return c + d; } return add(a, b); } else { /* H...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo2 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left f AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#pred...
function foo2(f: boolean, a: number, b: number): number { if (f) { /* HPAudit: Do not dynamically declare functions and classes : hp-performance-no-dynamic-cls-func : 1 : 50 : issue25.ets */ const add = (c: number, d: number): number => { return c + d; } return add(a, b); } else { /* H...
https://gitee.com/openharmony-sig/earth.git
dacd513b86c46b60a29c3266ec7301f1dc1af940
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Reader.ets
arkts
sfixed32
Read sfixed32 little-endian
sfixed32(): number { const v = new DataView(this.b.buffer, this.b.byteOffset + this.pos, 4).getInt32(0, true); this.pos += 4; return v | 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sfixed32 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_blo...
sfixed32(): number { const v = new DataView(this.b.buffer, this.b.byteOffset + this.pos, 4).getInt32(0, true); this.pos += 4; return v | 0 }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
5e54cfbc235809d691fe7c97739e19efcad036b5
gitcode
FinalScave/SweetLine
platform/OHOS/demo/src/main/ets/pages/ResourceUtils.ets
arkts
isRawFileExists
Check if a file exists in rawfile
static async isRawFileExists(context: Context | undefined, fileName: string, directory: string = ''): Promise<boolean> { try { if (context == undefined) { return false; } const rawFileList = ResourceUtils.listRawFileNames(context, directory); return rawFileList.includes(fileName); ...
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 isRawFileExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left ...
static async isRawFileExists(context: Context | undefined, fileName: string, directory: string = ''): Promise<boolean> { try { if (context == undefined) { return false; } const rawFileList = ResourceUtils.listRawFileNames(context, directory); return rawFileList.includes(fileName); ...
https://github.com/FinalScave/SweetLine
49538de66169d2f57b9054847436c1505a321c9b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreMediaFiles
恢复媒体文件 [修复] 每个恢复操作独立try-catch,确保一个失败不会影响其他操作(特别是字体恢复)
private async restoreMediaFiles(tempDir: string): Promise<void> { logger.info(TAG, 'Restoring media files...'); const failures: string[] = []; // [修复] 首先列出临时目录内容,用于调试 let tempContents: string[] = []; try { tempContents = SafeFileUtils.listFileSync(tempDir); logger.info(TAG, `临时目录内...
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 restoreMediaFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tempDir AST#identifier#Right AST#ERROR#Left AST#:#...
private async restoreMediaFiles(tempDir: string): Promise<void> { logger.info(TAG, 'Restoring media files...'); const failures: string[] = []; // [修复] 首先列出临时目录内容,用于调试 let tempContents: string[] = []; try { tempContents = SafeFileUtils.listFileSync(tempDir); logger.info(TAG, `临时目录内...
https://github.com/DaLongZhuaZi/manxia
6dda97551af56e54d2fc9b267e3150e66b47ccf0
github
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
touchInLeftThumb
判断左边滑块滑动
touchInLeftThumb(event?: GestureEvent): boolean { logger.info(TAG, ' touchInLeftThumb'); let pointX: number = this.clearUndefined(event?.fingerList[0].localX); let pointY: number = this.clearUndefined(event?.fingerList[0].localY); return this.pointInArea(pointX, pointY, this.leftThumbRect); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left touchInLeftThumb 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#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GestureEvent ...
touchInLeftThumb(event?: GestureEvent): boolean { logger.info(TAG, ' touchInLeftThumb'); let pointX: number = this.clearUndefined(event?.fingerList[0].localX); let pointY: number = this.clearUndefined(event?.fingerList[0].localY); return this.pointInArea(pointX, pointY, this.leftThumbRect); }
https://github.com/openharmony/applications_app_samples
673af9c456a02ee1de199e103d4351ca822b8fa7
github
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets
arkts
processReminderData
processReminderData
function processReminderData(params: PublishReminderInfo, preferences: preferences.Preferences, notifyId: string) { let timer = fetchData(params); reminderAgent.publishReminder(timer).then((reminderId: number) => { putPreferencesValue(preferences, notifyId, reminderId); }).catch((err: Error) => { Logger.e...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left processReminderData AST#identifier#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 : ...
function processReminderData(params: PublishReminderInfo, preferences: preferences.Preferences, notifyId: string) { let timer = fetchData(params); reminderAgent.publishReminder(timer).then((reminderId: number) => { putPreferencesValue(preferences, notifyId, reminderId); }).catch((err: Error) => { Logger.e...
https://gitee.com/harmonyos/codelabs.git
4e668e213ca107d82a7f827c146e3c14111d67b9
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Authentication/LoginManager.ets
arkts
loginWithWebView
WebView登录
private async loginWithWebView( sourceId: number, config: WebViewLoginConfig ): Promise<LoginResult> { logger.info(TAG, `WebView登录: ${config.loginUrl}`); // 这个方法需要在UI组件中调用,因为需要显示WebView // 这里返回配置,让调用者打开WebView return { success: false, message: 'WebView登录需要在UI中完成,请使用openLoginWebV...
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 loginWithWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#...
private async loginWithWebView( sourceId: number, config: WebViewLoginConfig ): Promise<LoginResult> { logger.info(TAG, `WebView登录: ${config.loginUrl}`); // 这个方法需要在UI组件中调用,因为需要显示WebView // 这里返回配置,让调用者打开WebView return { success: false, message: 'WebView登录需要在UI中完成,请使用openLoginWebV...
https://github.com/DaLongZhuaZi/manxia
2f6d18e65a2467073fda5f09561b6869fe40e4db
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnInputViewModel.ets
arkts
setSizeSmValue
设置小尺寸输入框的内容 @param value 新的输入值
setSizeSmValue(value: string): void { this.sizeSmValue = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSizeSmValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
setSizeSmValue(value: string): void { this.sizeSmValue = value; }
https://github.com/codelably/tuniao-ui
c4f5efd9c91513879610ee6dfb19cac3f8f43924
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
floor
Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the direction of negative Infinity. @returns { Decimal } the Decimal type
public floor(): Decimal { return Utils.finalise(new Decimal(this), this.exponent + 1, Decimal.ROUND_FLOOR); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left floor 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#:#Rig...
public floor(): Decimal { return Utils.finalise(new Decimal(this), this.exponent + 1, Decimal.ROUND_FLOOR); }
https://gitcode.com/iop123123/arkts-static-skills
eaa9aa33980700361674d5b37335e22157a41e1c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets
arkts
ensureCacheSpace
确保缓存有足够空间
private async ensureCacheSpace(requiredSize: number): Promise<void> { // 如果缓存项数超过最大值,清理最旧的 while (this.cache.size >= this.MAX_CACHE_COUNT) { this.evictOldest(); } // 如果内存超过最大值,清理最旧的 while (this.currentCacheSize + requiredSize > this.MAX_CACHE_SIZE && this.cache.size > 0) { this.evictO...
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 ensureCacheSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requiredSize AST#identifier#Right AST#ERROR#Left AS...
private async ensureCacheSpace(requiredSize: number): Promise<void> { // 如果缓存项数超过最大值,清理最旧的 while (this.cache.size >= this.MAX_CACHE_COUNT) { this.evictOldest(); } // 如果内存超过最大值,清理最旧的 while (this.currentCacheSize + requiredSize > this.MAX_CACHE_SIZE && this.cache.size > 0) { this.evictO...
https://github.com/DaLongZhuaZi/manxia
4e9cc5bef7826dde4cd766baf674cf5169e1a666
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/StoragePaths.ets
arkts
ensureDirectories
确保所有必要的目录存在
static async ensureDirectories(): Promise<void> { // 内部目录 const internalDirs = [ StoragePaths.VMS_DIR, StoragePaths.ISOS_DIR, StoragePaths.FIRMWARE_DIR, StoragePaths.LOGS_DIR ] // 共享目录(文件管理可见) const sharedDirs = [ StoragePaths.SHARED_BASE, StoragePaths.SHAR...
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 ensureDirectories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
static async ensureDirectories(): Promise<void> { // 内部目录 const internalDirs = [ StoragePaths.VMS_DIR, StoragePaths.ISOS_DIR, StoragePaths.FIRMWARE_DIR, StoragePaths.LOGS_DIR ] // 共享目录(文件管理可见) const sharedDirs = [ StoragePaths.SHARED_BASE, StoragePaths.SHAR...
https://github.com/AetheriumSimulator/qemu-hmos
e713f581fd78e7e78f9d928f5bdba6e411a223e9
github
openharmony/applications_call
entry/src/main/ets/model/CallDataManager.ets
arkts
isActiveCall
Judge whether the call is active or holding.
public isActiveCall(callId): boolean { const callData = this.callList.find((call) => call.callId === callId && (call.callState === CallStateConst.CALL_STATUS_ACTIVE || call.callState === CallStateConst.CALL_STATUS_HOLDING)); return callData !== undefined; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isActiveCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callId AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public isActiveCall(callId): boolean { const callData = this.callList.find((call) => call.callId === callId && (call.callState === CallStateConst.CALL_STATUS_ACTIVE || call.callState === CallStateConst.CALL_STATUS_HOLDING)); return callData !== undefined; }
https://gitee.com/openharmony/applications_call.git
472d37aef7dd112b271944f28905a5a8782559c6
gitee
erosTeam/NextE
feature/user/src/main/ets/viewmodel/FavoritesViewModel.ets
arkts
refresh
Pull-to-refresh: guarded so a concurrent loadMore can't interleave.
async refresh(afterPrepend?: (prependedCount: number) => void): Promise<void> { if (this.isLoading || this.isLoadingMore) { return } if (this.canLoadPreviousAfterJump()) { await this.loadPrevious(afterPrepend) return } await this.load() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left refresh AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left afterPrepend AST#identifier#Right AST...
async refresh(afterPrepend?: (prependedCount: number) => void): Promise<void> { if (this.isLoading || this.isLoadingMore) { return } if (this.canLoadPreviousAfterJump()) { await this.loadPrevious(afterPrepend) return } await this.load() }
https://github.com/erosTeam/NextE
8a7750460a2c8632edad6c50d6d615cfb6366eac
github
openharmony/codelabs
Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets
arkts
destroyAllEnemy
销毁所有敌机
destroyAllEnemy() { for (var k = 0; k < this.enemyPlanes.length; k++) { var destroyEnemy = this.enemyPlanes[k]; if (destroyEnemy.flag == 1) { this.score += 50 sendMessageToRemoteService(this.score) } if (destroyEnemy.flag == 2) { this.score += 100 sendMessag...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left destroyAllEnemy 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#Le...
destroyAllEnemy() { for (var k = 0; k < this.enemyPlanes.length; k++) { var destroyEnemy = this.enemyPlanes[k]; if (destroyEnemy.flag == 1) { this.score += 50 sendMessageToRemoteService(this.score) } if (destroyEnemy.flag == 2) { this.score += 100 sendMessag...
https://gitee.com/openharmony/codelabs.git
932a88ee789ef9d50ede783da7a3ef5f19dec23b
gitee
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
getFileSuffixes
Get the file suffixes supported by the syntax rule
public getFileSuffixes(): string[] { return lib.SyntaxRule_GetFileSuffixes(this.nativeHandle); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFileSuffixes 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...
public getFileSuffixes(): string[] { return lib.SyntaxRule_GetFileSuffixes(this.nativeHandle); }
https://github.com/FinalScave/SweetLine
c9fca4cde389a3de293041832a1e8fd686532d9a
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
removeNode
Delete a node. Register an ON_ITEM_DELETE callback through the EventBus mechanism to obtain the IDs of all deleted nodes. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Delete a node. Register an ON_ITEM_DELETE callback through the EventBus mechanism to obtain the IDs of all deleted nodes. @syscap SystemCapability...
public removeNode(): void { let clickNodeId: number = this.listNodeDataSource.getClickNodeId(); if (clickNodeId < 0) { return; } let parentNodeId: number = this.listNodeDataSource.findParentNodeId(clickNodeId); let removeNodeIdList: number[] = this.listNodeDataSource.removeNode(clickNodeId, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeNode 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#Rig...
public removeNode(): void { let clickNodeId: number = this.listNodeDataSource.getClickNodeId(); if (clickNodeId < 0) { return; } let parentNodeId: number = this.listNodeDataSource.findParentNodeId(clickNodeId); let removeNodeIdList: number[] = this.listNodeDataSource.removeNode(clickNodeId, ...
https://gitcode.com/openharmony/arkui_ace_engine
0999db775a1642897d3b665cebc4ea371e111eff
gitcode
who7708/harmonyos-codelabs
HarmonyOS_NEXT/WaterFlow/entry/src/main/ets/viewmodel/WaterFlowDataSource.ets
arkts
setDataArray
Set water flow data array. @param {ProductBean[]} productDataArray Displaying water flow Data.
public setDataArray(productDataArray: ProductBean[]): void { this.dataArray = productDataArray; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDataArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Product...
public setDataArray(productDataArray: ProductBean[]): void { this.dataArray = productDataArray; }
https://github.com/who7708/harmonyos-codelabs
a328d0a398bd760fd2be1c458a5c25a332c5ac80
github
cheinlu/HarmonyOS-groundhog-charging-system
TbsChargeHarmonyOs/feature/charge/src/main/ets/view/ChargeItemDialogView.ets
arkts
pileStateText
区分不同状态的文本
pileStateText(state: number) { switch (state) { case 0: return $r('app.string.idle') case 1: return $r('app.string.charging_in_progress') case 2: return $r('app.string.faults') default: return $r('app.string.idle') } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pileStateText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ...
pileStateText(state: number) { switch (state) { case 0: return $r('app.string.idle') case 1: return $r('app.string.charging_in_progress') case 2: return $r('app.string.faults') default: return $r('app.string.idle') } }
https://github.com/cheinlu/HarmonyOS-groundhog-charging-system
4a12987fa6fb97629ff081d40bbe7fd8eff91600
github
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/view/component/TimeAnalysisCard.ets
arkts
analyze
核心分析逻辑 (改良版)
analyze() { console.info(`[TimeCard] 开始分析,收到了 ${this.timeStamps.length} 条数据`); // 1. 更新总数 this.totalCount = this.timeStamps.length; if (this.totalCount === 0) { this.userTag = '暂无数据'; this.morningCount = 0; this.afternoonCount = 0; this.nightCount = 0; return; } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left analyze 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#{#Left { AST#{#Right AST#expression_statement#Left AST...
analyze() { console.info(`[TimeCard] 开始分析,收到了 ${this.timeStamps.length} 条数据`); // 1. 更新总数 this.totalCount = this.timeStamps.length; if (this.totalCount === 0) { this.userTag = '暂无数据'; this.morningCount = 0; this.afternoonCount = 0; this.nightCount = 0; return; } ...
https://gitcode.com/openharmony/codelabs
4119fc0eccf17e5ebe211f662a4b5e3b9c2d5a3f
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/pickerGroup/index.ets
arkts
init
初始化tabList
init(){ this.tabsList = this.tabs.map((item, index) => { let obj: IBestTabItemType = { label: item, name: index + '' } return obj }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init 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#{#Left { AST#{#Right AST#expression_statement#Left AST#as...
init(){ this.tabsList = this.tabs.map((item, index) => { let obj: IBestTabItemType = { label: item, name: index + '' } return obj }) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/pickerGroup/index.ets#L71-L79
5f44bf24ba4656592e3bb479ba37d3e814af6ec3
github
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
products/watch/src/main/ets/model/WindowService.ets
arkts
initWindowSize
Window height, in vp.
public static initWindowSize(window: window.Window): void { if (window) { try { const windowRect: window.Rect = window.getWindowProperties().windowRect; Logger.info(TAG, `Succeeded in getting windowRect by windowObj. width: ${windowRect.width}, height: ${windowRect.height}`); ...
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 initWindowSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left window AST#identifier#Right AST#:#Left :...
public static initWindowSize(window: window.Window): void { if (window) { try { const windowRect: window.Rect = window.getWindowProperties().windowRect; Logger.info(TAG, `Succeeded in getting windowRect by windowObj. width: ${windowRect.width}, height: ${windowRect.height}`); ...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
019033e643811e84854a18bb4bcba0ef10ab1b9a
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCheckboxViewModel.ets
arkts
setCheckboxValues6
设置复选框组6的选中值集合 @param values 新的选中值数组
setCheckboxValues6(values: Array<string | number>): void { this.checkboxValues6 = values; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCheckboxValues6 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left A...
setCheckboxValues6(values: Array<string | number>): void { this.checkboxValues6 = values; }
https://github.com/codelably/tuniao-ui
51a22d05a9444641abd59cbe95029bb39c417167
github
honjow/Next2V
feature/detail/src/main/ets/viewmodel/DetailViewModel.ets
arkts
flushHeldRepliesPublish
Safety net: if a held page-1 publish never got superseded by a preload publish (preload failed, mode flipped, preconditions changed), push the internal state out so the UI never stays permanently stale relative to this.replies.
private flushHeldRepliesPublish(): void { if (!this.heldRepliesPublish) { return } this.publishVisibleReplies() }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left flushHeldRepliesPublish 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...
private flushHeldRepliesPublish(): void { if (!this.heldRepliesPublish) { return } this.publishVisibleReplies() }
https://github.com/honjow/Next2V
8cf1ca4f996f3e9c13b8a2e26fbeac38ded5842d
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/ExportManager.ets
arkts
exportData
导出数据 @param context 应用上下文 @param dataType 导出数据类型 @param format 导出格式
async exportData( context: Context, dataType: ExportDataType, format: ExportFormat ): Promise<ExportResult> { try { // 生成文件名 const fileName = this.generateFileName(dataType, format); // 获取文件路径 const filePath = `${context.cacheDir}/${fileName}`; // 根据数据类型和格式生成内容 ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left exportData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async exportData( context: Context, dataType: ExportDataType, format: ExportFormat ): Promise<ExportResult> { try { // 生成文件名 const fileName = this.generateFileName(dataType, format); // 获取文件路径 const filePath = `${context.cacheDir}/${fileName}`; // 根据数据类型和格式生成内容 ...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
8db1e5107bd5cfc70af297825b0418be4fc6b3ea
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SharedLedger.ets
arkts
checkPermission
检查用户是否有权限
static checkPermission(member: LedgerMember, permission: string): boolean { return member.hasPermission(permission); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left member AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static checkPermission(member: LedgerMember, permission: string): boolean { return member.hasPermission(permission); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
abab6e1ce9b4f5d904945f03ea5ca2f16adcc558
github
openharmony/security_privacy_center
entry/src/main/ets/common/utils/AutoMenuManager.ets
arkts
getMenuConfigFromBms
To get all config in system @param context The context @param userId The user id @returns The all menu config
async getMenuConfigFromBms(context: Context, userId: number): Promise<MenuConfig[]> { // Obtain all configuration information and internally check permissions let allPkgConfigList: MenuConfig[] = await this._readConfigFromBms(context); // Adapt to businessId for (let index = 0; index < allPkgConfi...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getMenuConfigFromBms AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#...
async getMenuConfigFromBms(context: Context, userId: number): Promise<MenuConfig[]> { // Obtain all configuration information and internally check permissions let allPkgConfigList: MenuConfig[] = await this._readConfigFromBms(context); // Adapt to businessId for (let index = 0; index < allPkgConfi...
https://gitee.com/openharmony/security_privacy_center.git
69caa7125822a4fbe406cd2944b8c72ddb29e1b7
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CoverCacheManager.ets
arkts
getSourceCoverDir
获取图源封面目录(使用pkg作为文件夹名,确保图源重装后缓存不丢失)
private getSourceCoverDir(sourceId: number): string { const pkg = this.sourcePkgCache.get(sourceId); if (pkg) { // 使用 pkg 作为目录名(清理特殊字符) const safePkg = pkg.replace(/[^a-zA-Z0-9._-]/g, '_'); return `${this.coverBasePath}/${safePkg}`; } // 降级:使用 sourceId(仅在 pkg 未缓存时) return `${this...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSourceCoverDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#...
private getSourceCoverDir(sourceId: number): string { const pkg = this.sourcePkgCache.get(sourceId); if (pkg) { // 使用 pkg 作为目录名(清理特殊字符) const safePkg = pkg.replace(/[^a-zA-Z0-9._-]/g, '_'); return `${this.coverBasePath}/${safePkg}`; } // 降级:使用 sourceId(仅在 pkg 未缓存时) return `${this...
https://github.com/DaLongZhuaZi/manxia
024ee20fa5497242db868fd81cec096ec1b0811b
github
richshaw2015/nds
ohos/entry/src/main/ets/types/SettingsErrors.ets
arkts
createErrorKeysMap
============================================================================ 错误消息映射 - 使用 Map 替代对象字面量 ============================================================================
function createErrorKeysMap(): Map<SettingsErrorCode, string> { const map = new Map<SettingsErrorCode, string>() map.set(SettingsErrorCode.SUCCESS, 'err_success') map.set(SettingsErrorCode.ERR_PREFERENCES_INIT_FAILED, 'err_prefs_init') map.set(SettingsErrorCode.ERR_PREFERENCES_READ_FAILED, 'err_prefs_read') m...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createErrorKeysMap 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#generic_...
function createErrorKeysMap(): Map<SettingsErrorCode, string> { const map = new Map<SettingsErrorCode, string>() map.set(SettingsErrorCode.SUCCESS, 'err_success') map.set(SettingsErrorCode.ERR_PREFERENCES_INIT_FAILED, 'err_prefs_init') map.set(SettingsErrorCode.ERR_PREFERENCES_READ_FAILED, 'err_prefs_read') m...
https://github.com/richshaw2015/nds
ed1d8953d1c3a5b3a259979396b438f0e34b0774
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVBackupManager.ets
arkts
autoBackup
自动备份(上传最新的本地备份)
async autoBackup(): Promise<void> { if (!this.client && !this.nativeClient) { const errorMsg = 'WebDAV未配置'; throw new Error(errorMsg); } try { // 获取最新的本地备份 const backupsDir = `${this.sandboxManager.getDirectory('files')}/backups`; if (!await this.sandboxManager.exists(backup...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left autoBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#...
async autoBackup(): Promise<void> { if (!this.client && !this.nativeClient) { const errorMsg = 'WebDAV未配置'; throw new Error(errorMsg); } try { // 获取最新的本地备份 const backupsDir = `${this.sandboxManager.getDirectory('files')}/backups`; if (!await this.sandboxManager.exists(backup...
https://github.com/DaLongZhuaZi/manxia
d96b5fb4c57747dcbfec5bd422cc27097f6a7e3c
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/RecurringBillService.ets
arkts
calculateDatesShouldGenerate
计算应该生成的日期列表(从最后生成日期或开始日期到今天)
private calculateDatesShouldGenerate(config: RecurringBillConfig, today: string, alreadyGeneratedCount: number): string[] { const dates: string[] = []; // 确定起始日期:最后生成日期的下一个周期,或者开始日期 let currentDate: Date; if (config.lastGeneratedDate) { currentDate = this.getNextDate(new Date(config.lastGen...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateDatesShouldGenerate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
private calculateDatesShouldGenerate(config: RecurringBillConfig, today: string, alreadyGeneratedCount: number): string[] { const dates: string[] = []; // 确定起始日期:最后生成日期的下一个周期,或者开始日期 let currentDate: Date; if (config.lastGeneratedDate) { currentDate = this.getNextDate(new Date(config.lastGen...
https://github.com/qiuhaotc/HarmonyOSPlayground
62a5f7ec3b8d7238e55b813075421bafd3044c46
github
openharmony-sig/flutter_packages
packages/local_auth/local_auth_ohos/ohos/src/main/ets/io/flutter/plugins/localauth/LocalAuthPlugin.ets
arkts
stopAuthentication
Cancels any in-progress authentication. <p>Returns true only if authentication was in progress, and was successfully cancelled.
stopAuthentication(result: MethodResult): void { try { if (this.authHelper != null && authInProgress) { this.authHelper.stopAuthentication(); this.authHelper = null; } authInProgress = false; result.success(true); } catch (e) { result.success(false); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopAuthentication AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MethodResult AST#identifier#Right A...
stopAuthentication(result: MethodResult): void { try { if (this.authHelper != null && authInProgress) { this.authHelper.stopAuthentication(); this.authHelper = null; } authInProgress = false; result.success(true); } catch (e) { result.success(false); } }
https://gitee.com/openharmony-sig/flutter_packages.git
48c37cee0ea72a79424f8350b784eebae7f8a4b5
gitee
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/by_ffmpeg_player.ets
arkts
switch_eq
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 外部函数 - eq类 // ///////////////// 设置 EQ 模式(0=OFF, 1=GEQ, 2=PEQ)
switch_eq(mode: number): void { nativeModule.switch_eq(mode) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left switch_eq AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)...
switch_eq(mode: number): void { nativeModule.switch_eq(mode) }
https://github.com/Nekofox-POT/LinMusic
8c80f25bcc3907045c9f54570dc2f0b733f5a231
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreMangaReadProgress
恢复漫画阅读进度 [修复] 使用正确的数据库字段名:pageNumber而非pageIndex,添加userId和createTime
private async restoreMangaReadProgress(items: MangaReadProgressBackup[]): Promise<void> { logger.info(TAG, `Restoring manga read progress: ${items.length} items`); const now = Date.now(); const failures: string[] = []; for (const item of items) { try { // 先检查comicId和chapterId是否存在 ...
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 restoreMangaReadProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right A...
private async restoreMangaReadProgress(items: MangaReadProgressBackup[]): Promise<void> { logger.info(TAG, `Restoring manga read progress: ${items.length} items`); const now = Date.now(); const failures: string[] = []; for (const item of items) { try { // 先检查comicId和chapterId是否存在 ...
https://github.com/DaLongZhuaZi/manxia
2b286df86f768a1d80ea6240e10073997677da23
github
Explore-In-HMOS-Wearable/unit-calculator
entry/src/main/ets/utils/UnitConversion.ets
arkts
convertPower
POWER
static convertPower(value: number, from: PowerUnit, to: PowerUnit): number { const toWatts: Record<PowerUnit, number> = { [PowerUnit.WATT]: 1, [PowerUnit.KILOWATT]: 1000, [PowerUnit.HORSEPOWER]: 745.7, [PowerUnit.BTU_PER_HOUR]: 0.293071 }; const decimalCount: Record<PowerUnit, num...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertPower AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
static convertPower(value: number, from: PowerUnit, to: PowerUnit): number { const toWatts: Record<PowerUnit, number> = { [PowerUnit.WATT]: 1, [PowerUnit.KILOWATT]: 1000, [PowerUnit.HORSEPOWER]: 745.7, [PowerUnit.BTU_PER_HOUR]: 0.293071 }; const decimalCount: Record<PowerUnit, num...
https://github.com/Explore-In-HMOS-Wearable/unit-calculator
f6381a1f7b90d88334c4d2f9ffff7f19e1297cb2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getLiteral
Returns literal of type @returns {string} type literal @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override getLiteral(): string { if (this.isValue) { return "short" } return "Short" }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left getLiteral AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public override getLiteral(): string { if (this.isValue) { return "short" } return "Short" }
https://gitcode.com/iop123123/arkts-static-skills
da6026b64e8bfab08983e0f220ba45b347a964b1
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/CombinedChartRenderer.ets
arkts
getSubRenderer
Returns the sub-renderer object at the specified index. @param index @return
public getSubRenderer(index: number): DataRenderer | null { if (index >= this.mRenderers.size() || index < 0) return null; else return this.mRenderers.get(index); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSubRenderer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public getSubRenderer(index: number): DataRenderer | null { if (index >= this.mRenderers.size() || index < 0) return null; else return this.mRenderers.get(index); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
86c630453ae2f3c1c4124bfbe832d3525d93aa36
gitee
XHXYT/Pixark
entry/src/main/ets/common/utils/ColorUtils.ets
arkts
getNormalColor
获取一个标准的、未经修改的颜色值 @returns number
private getNormalColor(color: ResourceColor): number { if (!this.context) { console.error(`颜色工具没有初始化`); throw new Error('颜色工具没有初始化'); } if (typeof color === 'number') return color; if (typeof color === 'string') { const parsed = this.parseColorString(color); if (parsed !== null...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNormalColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private getNormalColor(color: ResourceColor): number { if (!this.context) { console.error(`颜色工具没有初始化`); throw new Error('颜色工具没有初始化'); } if (typeof color === 'number') return color; if (typeof color === 'string') { const parsed = this.parseColorString(color); if (parsed !== null...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/ColorUtils.ets#L77-L95
996bf67b6264e73a0ac2d5b59540215362815ba2
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/response/Response.ets
arkts
error
Create a synthetic error response.
static error<T>(code: number, message: string = 'Error'): Response<T> { return new Response<T>(code, message, null, {}); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Rig...
static error<T>(code: number, message: string = 'Error'): Response<T> { return new Response<T>(code, message, null, {}); }
https://github.com/killetom/ktretrofit
c254c03bb77bf5b780a474c55ad288be7556027d
github
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
vibrateHeavyClick
重击反馈 — 单次沉重振动,模拟强力点击
static vibrateHeavyClick(): void { VibratorManager.logExecution('vibrateHeavyClick'); VibratorManager.vibratePreset(HapticEffect.HARD, 1, 100, VibrationUsage.PHYSICAL_FEEDBACK); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateHeavyClick 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...
static vibrateHeavyClick(): void { VibratorManager.logExecution('vibrateHeavyClick'); VibratorManager.vibratePreset(HapticEffect.HARD, 1, 100, VibrationUsage.PHYSICAL_FEEDBACK); }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
34df8578e6e50179b52426dc9b04f272c18e9cd9
github
openharmony/codelabs
Media/AudioPlayer/entry/src/main/ets/controller/AudioPlayerControllerl.ets
arkts
initAudioPlayer
Initializes the AVPlayer instance.
initAudioPlayer() { media.createAVPlayer((error, video) => { if (video === undefined) { this.avPlayer = video; Logger.error(TAG, `createAVPlayer fail, error: ${error}`); } else { this.avPlayer = video; Logger.info(TAG, 'createAVPlayer success'); } }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initAudioPlayer 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#Le...
initAudioPlayer() { media.createAVPlayer((error, video) => { if (video === undefined) { this.avPlayer = video; Logger.error(TAG, `createAVPlayer fail, error: ${error}`); } else { this.avPlayer = video; Logger.info(TAG, 'createAVPlayer success'); } }); }
https://gitee.com/openharmony/codelabs.git
2744222e5b783876df23d004e358a5676ce9cb34
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
getFirstLeft
Returns the first DataSet from the datasets-array that has it's dependency on the left axis. Returns null if no DataSet with left dependency could be found. @return
protected getFirstLeft(sets: JArrayList<T>): T | null { for (let dataSet of sets.dataSource) { if (dataSet.getAxisDependency() == AxisDependency.LEFT) return dataSet; } return null; }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getFirstLeft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sets AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiat...
protected getFirstLeft(sets: JArrayList<T>): T | null { for (let dataSet of sets.dataSource) { if (dataSet.getAxisDependency() == AxisDependency.LEFT) return dataSet; } return null; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c77d44b0b135e7f903663fb298324f876b26a4ff
gitee
the-wwyang/kids-learning-app
src/main/ets/services/ParentalControlService.ets
arkts
getUsageRecords
获取使用记录
private async getUsageRecords(): Promise<UsageRecord[]> { if (!this.dataPreferences) return []; try { const recordsJson = await this.dataPreferences.get( ParentalControlService.USAGE_RECORDS_KEY, '[]' ) as string; return JSON.parse(recordsJson) as UsageRecord[]; } catch...
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 getUsageRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async getUsageRecords(): Promise<UsageRecord[]> { if (!this.dataPreferences) return []; try { const recordsJson = await this.dataPreferences.get( ParentalControlService.USAGE_RECORDS_KEY, '[]' ) as string; return JSON.parse(recordsJson) as UsageRecord[]; } catch...
https://github.com/the-wwyang/kids-learning-app
dfb1f64e18bcce2b75b1a6feac01a360f0c5dfcf
github
openharmony/distributedhardware_distributed_hardware_fwk
application/entry/src/main/ets/utils/TipsJumpUtils.ets
arkts
jumpTips
Jump to the specified page of Tips by FUN_NUM @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext @param funNum: page FUN_NUM @param type: entry type ID, used for dotting @param moduleName: phone_widget: jump phone, pc_widget: jump pc
public static jumpTips(context: startAbleContext, funNum: string, type: string, moduleName: string = MODULE_NAME_PHONE) { let uri = util.format(URI_FORMATTER, funNum, type); TipsJumpUtils.jumpTipsByUri(context, uri, moduleName ?? MODULE_NAME_PHONE); }
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 jumpTips AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#...
public static jumpTips(context: startAbleContext, funNum: string, type: string, moduleName: string = MODULE_NAME_PHONE) { let uri = util.format(URI_FORMATTER, funNum, type); TipsJumpUtils.jumpTipsByUri(context, uri, moduleName ?? MODULE_NAME_PHONE); }
https://gitee.com/openharmony/distributedhardware_distributed_hardware_fwk.git
d4317c4bef31eea7c5fb14e80b52cb1ac44f594e
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
createComicArchive
创建漫画归档
public async createComicArchive(chapterId: string): Promise<string> { try { // 获取章节信息 const chapters = await this.databaseManager.query( 'chapter', undefined, 'id = ?', [chapterId] ); if (chapters.length === 0) { throw new Error('章节不存在'); } ...
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 createComicArchive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#...
public async createComicArchive(chapterId: string): Promise<string> { try { // 获取章节信息 const chapters = await this.databaseManager.query( 'chapter', undefined, 'id = ?', [chapterId] ); if (chapters.length === 0) { throw new Error('章节不存在'); } ...
https://github.com/DaLongZhuaZi/manxia
dfd0f5e0f4a953a4fdd27bae092158de05c3d648
github
harmonyos/codelabs
HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/common/database/ContactsDataBase.ets
arkts
delete
Deletes data with a specified key value from the database. @param key Key of the data to be deleted. @param callback Callback function.
delete(key: string, callback: AsyncCallback<void>): void { try { this.kvStore?.delete(key, callback); } catch (err) { Logger.error(TAG, `An unexpected error occurred, error message is ${JSON.stringify(err)}`); } }
AST#program#Left AST#ERROR#Left AST#delete#Left delete AST#delete#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 AST#predefined_type#Left AST#string#Left string AST#string#Right AST#pred...
delete(key: string, callback: AsyncCallback<void>): void { try { this.kvStore?.delete(key, callback); } catch (err) { Logger.error(TAG, `An unexpected error occurred, error message is ${JSON.stringify(err)}`); } }
https://gitee.com/harmonyos/codelabs.git
5b21dbc4eae232077b7eb950c08a5f3b4579db46
gitee
terryma2024/happyword
harmonyos/entry/src/main/ets/services/LearningRecorder.ets
arkts
clear
Drop all stats. Useful for tests and for a future "reset" button.
async clear(): Promise<void> { this.snapshot = new LearningSnapshot(); this.sessionStartLearnedIds.clear(); this.sessionNewlyLearnedIds.clear(); await this.flushNow(); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right A...
async clear(): Promise<void> { this.snapshot = new LearningSnapshot(); this.sessionStartLearnedIds.clear(); this.sessionNewlyLearnedIds.clear(); await this.flushNow(); }
https://github.com/terryma2024/happyword
4eb8d0f6e9849567f9abd9fd6427d1ee8521fece
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Legend.ets
arkts
setMaxSizePercent
The maximum relative size out of the whole chart view. / If the legend is to the right/left of the chart, then this affects the width of the legend. / If the legend is to the top/bottom of the chart, then this affects the height of the legend. / default: 0.95f (95%) @param maxSize
public setMaxSizePercent(maxSize: number): void { this.mMaxSizePercent = maxSize; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaxSizePercent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb...
public setMaxSizePercent(maxSize: number): void { this.mMaxSizePercent = maxSize; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
b181dc43886a0f0d5743c612f3f7c323f240cb4e
gitee
offlinecat-dev/OCNetORM
src/main/ets/core/MetadataStorage.ets
arkts
registerRelation
注册关联关系 @param sourceEntity 源实体名称 @param relation 关联关系元数据
registerRelation(sourceEntity: string, relation: RelationMetadata): void { this.getEntityOrThrow(sourceEntity) if (relation.targetEntity) { this.getEntityOrThrow(relation.targetEntity) } let entityRelations = this.relations.get(sourceEntity) if (!entityRelations) { entityRelations = []...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerRelation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceEntity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left ...
registerRelation(sourceEntity: string, relation: RelationMetadata): void { this.getEntityOrThrow(sourceEntity) if (relation.targetEntity) { this.getEntityOrThrow(relation.targetEntity) } let entityRelations = this.relations.get(sourceEntity) if (!entityRelations) { entityRelations = []...
https://github.com/offlinecat-dev/OCNetORM
c3d49dae94693d3b1f7ac471f6347cfa3aa28689
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
startVideoEncoder
启动 Rust 层内部视频编码器
public startVideoEncoder(): boolean { if (!this.client) return false; return this.client.startVideoEncoder(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startVideoEncoder 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...
public startVideoEncoder(): boolean { if (!this.client) return false; return this.client.startVideoEncoder(); }
https://github.com/tdcare/tdwebrtc
9ff85307847be919556b9486644f731cdd9a7df2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
of
Returns Type of value @param {FixedArray<boolean>} v value @returns {Type} Type instance of this value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(v: FixedArray<boolean>): Type { return ArrayType.getInstance(Class.of(v), TypeAPI.getTypeDescriptor(new Boolean())) }
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#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#...
public static of(v: FixedArray<boolean>): Type { return ArrayType.getInstance(Class.of(v), TypeAPI.getTypeDescriptor(new Boolean())) }
https://gitcode.com/iop123123/arkts-static-skills
c50c3f637ae7209fca3b07308f7ccfa07ec5ed2b
gitcode
zhubowen-bot/Bowen_ArkWeb_framework
entry/src/main/ets/delegate/WebDownloadFileImpl.ets
arkts
generateDefaultPath
静态路径生成
private static generateDefaultPath(): string { const defaultDir = `${getContext().cacheDir}/web_download` const fileName = WebDownloadFileHelper._webDownloadItem?.getSuggestedFileName() || `download_${Date.now()}.bin` return `${defaultDir}${fileName}` }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left generateDefaultPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
private static generateDefaultPath(): string { const defaultDir = `${getContext().cacheDir}/web_download` const fileName = WebDownloadFileHelper._webDownloadItem?.getSuggestedFileName() || `download_${Date.now()}.bin` return `${defaultDir}${fileName}` }
https://github.com/zhubowen-bot/Bowen_ArkWeb_framework
579ebd11628d0b10d3c5d3d29a39fc954a2f9726
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
getCategoryCoverImages
获取分类的封面图片列表(默认分类从实际内容获取)
private getCategoryCoverImages(category: BookshelfCategory): string[] { if (category.isDefault) { // 默认分类:从实际内容列表获取封面(使用已标准化的路径) const covers: string[] = []; // 从漫画获取封面 for (const manga of this.mangaList) { if (covers.length >= 3) break; const normalizedPath = this.normaliz...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCategoryCoverImages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
private getCategoryCoverImages(category: BookshelfCategory): string[] { if (category.isDefault) { // 默认分类:从实际内容列表获取封面(使用已标准化的路径) const covers: string[] = []; // 从漫画获取封面 for (const manga of this.mangaList) { if (covers.length >= 3) break; const normalizedPath = this.normaliz...
https://github.com/DaLongZhuaZi/manxia
7a23132ecb38eddad80b8bd51a0433834a5abc46
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressListViewModel.ets
arkts
deleteAddress
执行删除操作,成功后刷新列表并关闭弹窗 @returns {void} 无返回值
deleteAddress(): void { const id: number | null = this.deleteId; if (id === null) { return; } RequestHelper.repository(this.repository.deleteAddress(new Ids([id]))) .execute() .then((): void => { this.onRefresh(); this.hideDeleteDialog(); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteAddress 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...
deleteAddress(): void { const id: number | null = this.deleteId; if (id === null) { return; } RequestHelper.repository(this.repository.deleteAddress(new Ids([id]))) .execute() .then((): void => { this.onRefresh(); this.hideDeleteDialog(); }); }
https://github.com/Joker-x-dev/CoolMallArkTS
ffaa71d6dc74ce90fb35de66de25153450b2ffe5
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Float64Array with respect to data, byteOffset and length. @param buf data initializer @param byteOffset byte offset from begin of the buf @param length size of elements of type double in newly created Float64Array
public constructor(buf: Buffer, byteOffset: int, length: int) { if (buf.getByteLength() % Float64Array.BYTES_PER_ELEMENT != 0) { throw new RangeError("ArrayBuffer.byteLength should be multiple of 8 as Float64Array.BYTES_PER_ELEMENT") } if (byteOffset % Float64Array.BYTES_PER_ELEM...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe...
public constructor(buf: Buffer, byteOffset: int, length: int) { if (buf.getByteLength() % Float64Array.BYTES_PER_ELEMENT != 0) { throw new RangeError("ArrayBuffer.byteLength should be multiple of 8 as Float64Array.BYTES_PER_ELEMENT") } if (byteOffset % Float64Array.BYTES_PER_ELEM...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
d572a48219a62408c98d898fbdc3faae71b59c8e
gitee
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getOperatorName
获取运营商名称 @param slotId 卡槽ID,如果不指定slotId,默认主卡。 @returns
static async getOperatorName(slotId?: number): Promise<string> { slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号 return radio.getOperatorName(slotId); }
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 getOperatorName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ?...
static async getOperatorName(slotId?: number): Promise<string> { slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号 return radio.getOperatorName(slotId); }
https://github.com/tdcare/tdwebrtc
fa86061449c2fc9d58b8b2cfb68b35c718a884c4
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/GamepadManager.ets
arkts
handleConnectionEvent
处理手柄连接/断开事件
private handleConnectionEvent(connected: boolean): void { this.connected = connected hilog.info(DOMAIN, TAG, `Gamepad ${connected ? 'connected' : 'disconnected'}`) if (!connected) { this.inputProcessor.resetAxisStates() this.hatAxisStates.clear() } this.onConnectionChanged(connected)...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleConnectionEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left connected AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boole...
private handleConnectionEvent(connected: boolean): void { this.connected = connected hilog.info(DOMAIN, TAG, `Gamepad ${connected ? 'connected' : 'disconnected'}`) if (!connected) { this.inputProcessor.resetAxisStates() this.hatAxisStates.clear() } this.onConnectionChanged(connected)...
https://github.com/richshaw2015/nds
9ee9f3284b799b0dec6354215e711709531ae59e
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
getMarker
returns the marker that is set as a marker view for the chart @return
public getMarker(): IMarker | null { return this.mMarker; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMarker 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#binary_expression#Left AST#i...
public getMarker(): IMarker | null { return this.mMarker; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
aa8c4d00537904df1b55623287d4b2de9035eb77
gitee
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets
arkts
updateEventInstanceReminders
更新事件实例提醒
async updateEventInstanceReminders(event: CalendarEvent): Promise<boolean> { try { if (!event.id || event.reminder < 0) { return false; } // 1. 先删除所有旧实例提醒 await this.deleteEventInstanceReminders(event.id); // 2. 重新生成实例并设置提醒 if (event.repeatRule && event.repeatRule.tri...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateEventInstanceReminders AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left event AST#identifier#Right AST#type_annotation#Lef...
async updateEventInstanceReminders(event: CalendarEvent): Promise<boolean> { try { if (!event.id || event.reminder < 0) { return false; } // 1. 先删除所有旧实例提醒 await this.deleteEventInstanceReminders(event.id); // 2. 重新生成实例并设置提醒 if (event.repeatRule && event.repeatRule.tri...
https://gitcode.com/openharmony/codelabs
53e31a7c6129f25df71e67b9b456ec3f5499eb23
gitcode
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets
arkts
getRate
Get rate. @returns
getRate(): number { return (this.w / this.h); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRate 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_bloc...
getRate(): number { return (this.w / this.h); }
https://gitee.com/openharmony/codelabs.git
f55115b6160f5ee111b74de51e5717499c301781
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/NotificationManager.ets
arkts
cancelTaskNotification
按任务 ID 取消通知
public async cancelTaskNotification(taskId: string): Promise<void> { await this.cancelNotification(this.getNotificationId(taskId)); }
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 cancelTaskNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:...
public async cancelTaskNotification(taskId: string): Promise<void> { await this.cancelNotification(this.getNotificationId(taskId)); }
https://github.com/DaLongZhuaZi/manxia
2187e2fba99f125c73ead5f584846d37b3ab843b
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/toast/TnToast.ets
arkts
tnToastBuilder
轻提示内容 Builder 函数 @param params 轻提示参数
@Builder function tnToastBuilder(params: TnToastParams): void { TnToastContent({ params: params }); }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left tnToastBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#re...
@Builder function tnToastBuilder(params: TnToastParams): void { TnToastContent({ params: params }); }
https://github.com/codelably/tuniao-ui
a5d16a5ec64d394ff6ae6895dc00f3c1d6a4f82c
github
huangyuanlove/HelloArkUI
entry/src/main/ets/pages/playground/input/CanvasInputVerificationCode.ets
arkts
aboutToDisappear
页面关闭时解绑输入法
aboutToDisappear() { hilog.error(0x01, "CanvasInputVerificationCode", "aboutToDisappear") this.inputDetach(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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#L...
aboutToDisappear() { hilog.error(0x01, "CanvasInputVerificationCode", "aboutToDisappear") this.inputDetach(); }
https://github.com/huangyuanlove/HelloArkUI
8678e38a49976090252db9e5829d0fddabd98886
github
CPF-ApplicationTPC/imageknifepro
entry/src/main/ets/pages/TestDesiredSizeDecode.ets
arkts
previewLayoutOnLoadFailed
加载失败时固定 400×400 预览区,便于 errorSrc 错误图展示。
public static previewLayoutOnLoadFailed(): DesiredSizeLayoutPx { const size = DesiredSizeDemoSupport.ERROR_PREVIEW_LAYOUT_PX return { width: size, height: size } }
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 previewLayoutOnLoadFailed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
public static previewLayoutOnLoadFailed(): DesiredSizeLayoutPx { const size = DesiredSizeDemoSupport.ERROR_PREVIEW_LAYOUT_PX return { width: size, height: size } }
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/entry/src/main/ets/pages/TestDesiredSizeDecode.ets#L373-L376
a14c0fda1a4c3a792516ff967cb2b508451e457c
gitcode
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets
arkts
secondToTime
Seconds converted to HH:mm:ss. @param seconds Maximum video duration (seconds). @return Time after conversion.
secondToTime(seconds: number): string { let hourUnit = CommonConstants.TIME_UNIT * CommonConstants.TIME_UNIT; let hour = Math.floor(seconds / hourUnit); let minute = Math.floor((seconds - hour * hourUnit) / CommonConstants.TIME_UNIT); let second = seconds - hour * hourUnit - minute * CommonConstants.T...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left secondToTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
secondToTime(seconds: number): string { let hourUnit = CommonConstants.TIME_UNIT * CommonConstants.TIME_UNIT; let hour = Math.floor(seconds / hourUnit); let minute = Math.floor((seconds - hour * hourUnit) / CommonConstants.TIME_UNIT); let second = seconds - hour * hourUnit - minute * CommonConstants.T...
https://gitee.com/openharmony/codelabs.git
0ae02273e5571898e539247ac777388b3b9391ad
gitee
the-wwyang/kids-learning-app
src/main/ets/storage/AppStorageManager.ets
arkts
loadUserData
加载用户数据
private async loadUserData(username: string): Promise<UserData | null> { if (this.dataPreferences === null) { return null; } try { const dataJson = await this.dataPreferences.get( `${AppStorageManager.USER_DATA_KEY}_${username}`, '' ) as string; if (dataJson === '...
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 loadUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left...
private async loadUserData(username: string): Promise<UserData | null> { if (this.dataPreferences === null) { return null; } try { const dataJson = await this.dataPreferences.get( `${AppStorageManager.USER_DATA_KEY}_${username}`, '' ) as string; if (dataJson === '...
https://github.com/the-wwyang/kids-learning-app
0b10c4a335e42bd2534d976c1586aad1af7fb70c
github
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
vibrateReveal
神秘揭晓 — 悬念积聚后揭示,适合答案之书、八卦占卜等
static vibrateReveal(): void { VibratorManager.logExecution('vibrateReveal'); VibratorManager.vibratePattern([30, 120, 50, 120, 80, 250, 150], 1, VibrationUsage.PHYSICAL_FEEDBACK); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateReveal 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#expressi...
static vibrateReveal(): void { VibratorManager.logExecution('vibrateReveal'); VibratorManager.vibratePattern([30, 120, 50, 120, 80, 250, 150], 1, VibrationUsage.PHYSICAL_FEEDBACK); }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
60665be1f9d74b0d36cfe0144864aefb78b39220
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/sub_pages/metronome/MetronomePage.ets
arkts
adjustBPM
快速调整BPM
adjustBPM(delta: number): void { this.changeBPM(this.bpm + delta) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left adjustBPM AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left delta AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#...
adjustBPM(delta: number): void { this.changeBPM(this.bpm + delta) }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
7e5ba641d7ff085d77f85b0fb06b75eac085bce7
github
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets
arkts
handleCollected
7.Handling interface like interaction logic: when the userData state sub-property collectedIds received using the @StorageLink decorator is modified, the new value is synchronized to AppStorage
handleCollected(): void { // [StartExclude Case4] const resourceId = this.articleItem.id; // [EndExclude Case4] const index = this.userData?.collectedIds.findIndex((id: string) => id === this.articleItem.id) as number; if (index === -1) { this.userData?.collectedIds.push(resourceId); } e...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleCollected 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_bl...
handleCollected(): void { // [StartExclude Case4] const resourceId = this.articleItem.id; // [EndExclude Case4] const index = this.userData?.collectedIds.findIndex((id: string) => id === this.articleItem.id) as number; if (index === -1) { this.userData?.collectedIds.push(resourceId); } e...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
abfc5ac79f1503b1c5eb0ac97ff43db3d21e857e
gitcode
openharmony/codelabs
ETSUI/AccountApp/entry/src/main/ets/model/AppAccount.ets
arkts
constructor
归属人ID (关联 User 表的 id)
constructor(platformName: string, accountName: string, password: string, ownerId: number) { this.id = 0; this.platformName = platformName; this.accountName = accountName; this.password = password; this.ownerId = ownerId; }
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 platformName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A...
constructor(platformName: string, accountName: string, password: string, ownerId: number) { this.id = 0; this.platformName = platformName; this.accountName = accountName; this.password = password; this.ownerId = ownerId; }
https://gitcode.com/openharmony/codelabs
caa37fce9f32f16e425f642178a0aa692941514c
gitcode
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/common/utils/ImageCache.ets
arkts
getKey
生成缓存 key,目前直接使用字符串形式
private getKey(src: ImageSourceType): string { return typeof src === 'string' ? src : JSON.stringify(src); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left getKey AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
private getKey(src: ImageSourceType): string { return typeof src === 'string' ? src : JSON.stringify(src); }
https://gitcode.com/openharmony/codelabs
7dbe50f3b62e28b10a0f7402dfbd3be14037c92e
gitcode
751496032/DSBridge-HarmonyOS
library/src/main/ets/core/WebViewControllerProxy.ets
arkts
createProxy
创建代理 @param controller webview控制器 @param obj 要注入的对象 @returns
static createProxy(controller: webview.WebviewController, obj?: object): WebViewControllerProxy { return new WebViewControllerProxy(controller, obj) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createProxy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left controller AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ide...
static createProxy(controller: webview.WebviewController, obj?: object): WebViewControllerProxy { return new WebViewControllerProxy(controller, obj) }
https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L218-L220
a43be1d6dec33d28d96d8bae1104b2bcc612a6c0
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
readUInt16LE
Reads an unsigned 16-bit integer from the buffer at the specified offset using little-endian format @param {int} [offset=0] - Number of bytes to skip before reading @returns {long} The read value
public readUInt16LE(offset: int = 0): long { let lengthOffset: int = this.length - 2; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${len...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readUInt16LE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expres...
public readUInt16LE(offset: int = 0): long { let lengthOffset: int = this.length - 2; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${len...
https://gitcode.com/iop123123/arkts-static-skills
f55a011b79b3f10aeadf5803ff8c04ca913c00c8
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/AdviceFeedbackDAO.ets
arkts
getAverageAccuracyScore
获取平均准确性评分
static async getAverageAccuracyScore(userId: number): Promise<number> { try { const store = DatabaseManager.getDatabase(); const query = ` SELECT AVG(accuracy_score) as avg_score FROM advice_feedbacks WHERE user_id = ? AND accuracy_score > 0 `; const resultSet = aw...
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 getAverageAccuracyScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#...
static async getAverageAccuracyScore(userId: number): Promise<number> { try { const store = DatabaseManager.getDatabase(); const query = ` SELECT AVG(accuracy_score) as avg_score FROM advice_feedbacks WHERE user_id = ? AND accuracy_score > 0 `; const resultSet = aw...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b641f25aad809b956973c50a0cc5cb7c4c94c81a
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/ContactManager.ets
arkts
getContactById
根据ID获取联系人
public async getContactById(id: number): Promise<ContactsItem | null> { if (!id || id <= 0) { return null; } try { return await this.contactDao.getContactById(id); } catch (error) { console.error('[ContactManager] 获取联系人失败:', error); return null; } }
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 getContactById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#...
public async getContactById(id: number): Promise<ContactsItem | null> { if (!id || id <= 0) { return null; } try { return await this.contactDao.getContactById(id); } catch (error) { console.error('[ContactManager] 获取联系人失败:', error); return null; } }
https://gitcode.com/openharmony/codelabs
87ef3e3dd21ab50aa6c500db3d949da77fb00f5e
gitcode
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
init
vm初始化 @param timeMs 跳跃到歌曲的毫秒时间点 @returns {Promise<void>}
async init(context: Context, musicInfoArr: Array<MusicInfo>): Promise<void> { // 初始化歌曲列表数据 musicInfoArr.forEach((musicInfo: MusicInfo) => { const musicModel: MusicModel = new MusicModel(musicInfo); this.musicModelArr.push(musicModel); }) this.curMusicModelRaw = this.musicModelArr[this.curM...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async init(context: Context, musicInfoArr: Array<MusicInfo>): Promise<void> { // 初始化歌曲列表数据 musicInfoArr.forEach((musicInfo: MusicInfo) => { const musicModel: MusicModel = new MusicModel(musicInfo); this.musicModelArr.push(musicModel); }) this.curMusicModelRaw = this.musicModelArr[this.curM...
https://gitcode.com/arkui-x/samples
7bc454dada3b6111c41bc381f75df70c120b7a8a
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/cellGroup/index.ets
arkts
getMargin
获取margin
getMargin() { return this.inset ? getSizeByUnit(this.outerMargin) : 0 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getMargin 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 AST...
getMargin() { return this.inset ? getSizeByUnit(this.outerMargin) : 0 }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/cellGroup/index.ets#L50-L52
8637b6caeaebadb379d5aeb8d4015ad6abc125e2
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test10_original_index.ets
arkts
testArraySpliceSlice
--- Array splice/slice/reverse/includes ---
function testArraySpliceSlice(): string { let arr: number[] = [1, 2, 3, 4, 5]; let sliced: number[] = arr.slice(1, 4); let has3: boolean = sliced.includes(3); let rev: number[] = sliced.reverse(); return String(sliced.length) + ',' + String(has3) + ',' + String(rev[0]); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArraySpliceSlice 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#predef...
function testArraySpliceSlice(): string { let arr: number[] = [1, 2, 3, 4, 5]; let sliced: number[] = arr.slice(1, 4); let has3: boolean = sliced.includes(3); let rev: number[] = sliced.reverse(); return String(sliced.length) + ',' + String(has3) + ',' + String(rev[0]); }
https://github.com/miaochiahao/ark-ghidra
7414e2879d1eab5b2242da0c1979ba3a5b6085a3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getUnclosedElementFallback
从指定位置提取完整的HTML元素
private getUnclosedElementFallback(html: string, startIndex: number): string { const fallbackEnd = Math.min( html.length, startIndex + PerformanceConfig.MAX_UNCLOSED_ELEMENT_FALLBACK_SIZE ); return html.substring(startIndex, fallbackEnd); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getUnclosedElementFallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
private getUnclosedElementFallback(html: string, startIndex: number): string { const fallbackEnd = Math.min( html.length, startIndex + PerformanceConfig.MAX_UNCLOSED_ELEMENT_FALLBACK_SIZE ); return html.substring(startIndex, fallbackEnd); }
https://github.com/DaLongZhuaZi/manxia
2e1e5d0468bd8afe433d1dd9844e9eef3efd40e3
github
PollenWang6/HiXD
entry/src/main/ets/pages/schoolnet/SchoolNetPage.ets
arkts
openPwdDialog
===== 密码弹窗 =====
openPwdDialog(): void { this.pwdInput = PreferenceUtil.getString('schoolnet_password'); this.showPwdDialog = true; animateTo({ duration: 300, curve: Curve.EaseOut }, () => { this.pwdOpacity = 1; this.pwdTranslate = 0; }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openPwdDialog 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...
openPwdDialog(): void { this.pwdInput = PreferenceUtil.getString('schoolnet_password'); this.showPwdDialog = true; animateTo({ duration: 300, curve: Curve.EaseOut }, () => { this.pwdOpacity = 1; this.pwdTranslate = 0; }); }
https://github.com/PollenWang6/HiXD
6a9658529df3406621d51f647f00f9572e3e8fbc
github
SuperBird007/HarmonyApp_beichengyu
entry/src/main/ets/util/PreferencesUtil.ets
arkts
getPreferenceValue
从preferences实例中获取键对应的值 @key 健 @defaultValue 获取失败时,返回的值
async getPreferenceValue(key: string, defaultValue: preferences.ValueType): Promise<preferences.ValueType> { let value: preferences.ValueType = defaultValue // 获取对应的值之前,先判断preferences是否初始化完成 if (!this.pref) { console.error(`preferences[${this.sp_name}]尚未初始化!`) return value } try { ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPreferenceValue 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 A...
async getPreferenceValue(key: string, defaultValue: preferences.ValueType): Promise<preferences.ValueType> { let value: preferences.ValueType = defaultValue // 获取对应的值之前,先判断preferences是否初始化完成 if (!this.pref) { console.error(`preferences[${this.sp_name}]尚未初始化!`) return value } try { ...
https://github.com/SuperBird007/HarmonyApp_beichengyu
8efc3aaa207fc8b9ae81d4bcafbf4c6b424dcd08
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setTransparentCircleAlpha
Sets the amount of transparency the transparent circle should have 0 = fully transparent, 255 = fully opaque. Default value is 100. @param alpha 0-255
public setTransparentCircleAlpha(alpha: number): void { if (!this.mRenderer) { return; } ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintTransparentCircle().setGlobalAlpha(alpha / 255); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTransparentCircleAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alpha AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
public setTransparentCircleAlpha(alpha: number): void { if (!this.mRenderer) { return; } ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintTransparentCircle().setGlobalAlpha(alpha / 255); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
13f28d11558c881293b9f2e99b930b4187809219
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
subarray
Creates a Uint32Array with the same ArrayBuffer @returns new Uint32Array with the same ArrayBuffer
public subarray(): Uint32Array { return this.subarray(0, this.length) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray 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 Uint32Array A...
public subarray(): Uint32Array { return this.subarray(0, this.length) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
04e8a10beb3e0c7caaac892b3804647b20f1729a
gitee
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/bridge/NativeWriterCoreBridge.ets
arkts
listVolumes
── Volume ──
async listVolumes(projectId: string): Promise<ResultEnvelope<Volume[]>> { try { const jsonStr: string = this.getNativeModule().nativeListVolumes(projectId) return this.parseEnvelope<Volume[]>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left listVolumes AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left projectId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async listVolumes(projectId: string): Promise<ResultEnvelope<Volume[]>> { try { const jsonStr: string = this.getNativeModule().nativeListVolumes(projectId) return this.parseEnvelope<Volume[]>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native...
https://github.com/Xiwei753/xiezuoruanjian
ba091da9878080f62edf09ef1190e7a3d3d65d62
github
Joker-x-dev/HarmonyKit
core/data/src/main/ets/repository/DemoRepository.ets
arkts
constructor
构造函数,支持注入自定义数据源(便于测试) @param {DemoLocalDataSource} [localDataSource] - 可选的本地数据源
constructor(localDataSource?: DemoLocalDataSource) { this.demoLocalDataSource = localDataSource ?? new DemoLocalDataSourceImpl(); }
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 localDataSource AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
constructor(localDataSource?: DemoLocalDataSource) { this.demoLocalDataSource = localDataSource ?? new DemoLocalDataSourceImpl(); }
https://github.com/Joker-x-dev/HarmonyKit
8794f0f317746b9c32bf57cc638be09c3fa70893
github
openharmony/applications_call
entry/src/main/ets/model/CallDataManager.ets
arkts
hasAliveCall
Judge whether the call exists.
public hasAliveCall() { const callData = this.callList.find((call) => call.callState !== CallStateConst.CALL_STATUS_DISCONNECTED && call.callState !== CallStateConst.CALL_STATUS_DISCONNECTING); LogUtils.i(TAG, 'hasAliveCall:' + JSON.stringify(callData !== undefined)); return callData !== undefined; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasAliveCall 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#{#Left { ...
public hasAliveCall() { const callData = this.callList.find((call) => call.callState !== CallStateConst.CALL_STATUS_DISCONNECTED && call.callState !== CallStateConst.CALL_STATUS_DISCONNECTING); LogUtils.i(TAG, 'hasAliveCall:' + JSON.stringify(callData !== undefined)); return callData !== undefined; ...
https://gitee.com/openharmony/applications_call.git
7a370aa09bb7da2c264ec5bb0c014911486757b0
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/entryability/EntryAbility.ets
arkts
registerAppStateCallback
注册应用前后台状态变化监听
private registerAppStateCallback(): void { const applicationContext = this.context.getApplicationContext(); this.appStateCallback = { onApplicationForeground: () => { hilog.info(DOMAIN, TAG, '%{public}s', 'Application onForeground'); AppStateService.getInstance().onForeground(); },...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerAppStateCallback 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 ...
private registerAppStateCallback(): void { const applicationContext = this.context.getApplicationContext(); this.appStateCallback = { onApplicationForeground: () => { hilog.info(DOMAIN, TAG, '%{public}s', 'Application onForeground'); AppStateService.getInstance().onForeground(); },...
https://github.com/AlkaidLab/moonlight-harmony
ce17c2cb031762abbca8d3a641c6fc67c2c562b6
github
Countly/countly-sdk-hos
library/src/main/ets/internal/ModuleBase.ets
arkts
onHalt
Called on halt/destroy of the owning instance.
public onHalt(): Promise<void> { return Promise.resolve(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onHalt 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#instantiation_expression#Left A...
public onHalt(): Promise<void> { return Promise.resolve(); }
https://github.com/Countly/countly-sdk-hos
926794ce77a8d3085c056e44bbeb26a0e17f7071
github
Goway-Hui/harmonyos-next-dev
harmonyos-next-dev/assets/modal-sheet-template.ets
arkts
showAlertDialog
==================== 确认对话框 ====================
showAlertDialog(): void { AlertDialog.show({ title: '确认删除', message: '确定要删除这条记录吗?此操作不可撤销。', autoCancel: true, alignment: DialogAlignment.Center, gridColumnCount: 2, primaryButton: { value: '取消', action: () => { promptAction.showToast({ message: '已取消' }...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showAlertDialog 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_bl...
showAlertDialog(): void { AlertDialog.show({ title: '确认删除', message: '确定要删除这条记录吗?此操作不可撤销。', autoCancel: true, alignment: DialogAlignment.Center, gridColumnCount: 2, primaryButton: { value: '取消', action: () => { promptAction.showToast({ message: '已取消' }...
https://github.com/Goway-Hui/harmonyos-next-dev
05a36fd711ab767de4fdeec341d9ff8e4ddf3579
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loading/LoadingStateManager.ets
arkts
resetToPhase
重置到指定阶段
private resetToPhase(targetPhase: LoadingPhase): RecoveryResult { this.currentPhase = targetPhase; // 重置所有后续阶段 const phaseEntries = Array.from(this.phases.entries()); for (let i = 0; i < phaseEntries.length; i++) { const phase = phaseEntries[i][0]; const detail = phaseEntries[i][1]; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetToPhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left targetPhase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private resetToPhase(targetPhase: LoadingPhase): RecoveryResult { this.currentPhase = targetPhase; // 重置所有后续阶段 const phaseEntries = Array.from(this.phases.entries()); for (let i = 0; i < phaseEntries.length; i++) { const phase = phaseEntries[i][0]; const detail = phaseEntries[i][1]; ...
https://github.com/DaLongZhuaZi/manxia
3cd9365ee17b21729ed6708472138545f51dacf0
github
offlinecat-dev/OCNetORM
src/main/ets/core/HooksProcessor.ets
arkts
constructor
私有构造函数,防止外部实例化
private constructor() { this.initializeGlobalHooks() }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor 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#{#Left ...
private constructor() { this.initializeGlobalHooks() }
https://github.com/offlinecat-dev/OCNetORM
427705184ed4574b0338faa1a7aa64132413b426
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
add
Performs floating point addition of this instance with provided one, returns the result as new instance @param { Double } other Right hand side of the addition @returns { Double } Result of the addition @syscap SystemCapability.Utils.Lang @FaAndStageModel
public add(other: Double): Double { return new Double((this.value + other.toDouble()) as double) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public add(other: Double): Double { return new Double((this.value + other.toDouble()) as double) }
https://gitcode.com/iop123123/arkts-static-skills
ab85d67740f21cb05d08605f5015f3db6e3be845
gitcode