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
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/database/PrivacyNoteDB.ets
arkts
getStoreInstance
获取数据库操作的实例 @returns 数据库操作的实例
private async getStoreInstance() { // 如果数据库实例已存在,直接返回,没有才创建实例 if (this.store) { return this.store } // 获取应用上下文 const context = new UIContext().getHostContext() as Context // 获取操作数据库的实例 const store = await relationalStore.getRdbStore(context, { name: 'guardian.db', // 数据库名称 ...
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 getStoreInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
private async getStoreInstance() { // 如果数据库实例已存在,直接返回,没有才创建实例 if (this.store) { return this.store } // 获取应用上下文 const context = new UIContext().getHostContext() as Context // 获取操作数据库的实例 const store = await relationalStore.getRdbStore(context, { name: 'guardian.db', // 数据库名称 ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
58a9fa7c6ad7ec6cff664814dfeae66c5168c8b7
gitcode
PollenWang6/HiXD
entry/src/main/ets/services/SchoolnetService.ets
arkts
tryFetchZfwHome
===== ZFW 登录与数据抓取 ===== 对齐 Flutter schoolnet_session.dart 流程: 1. GET /home → 已登录直接解析,302/跳转→未登录 2. GET /login → 提取 csrf + RSA public key 3. GET /site/captcha?refresh=1 → 刷新验证码 4. GET /site/captcha → 获取验证码图片 5. POST /site/validate-user → 验证用户(pre-login) 6. POST / → 完成登录(NETSTACK POST 302 不跟随,需手动 GET /home) 7. GET /home ...
async tryFetchZfwHome(): Promise<ZfwUsageData | null> { // 检查 cookie 大小,如果异常大则清除(防止之前 bug 积累的超大 cookie) const cookieStr: string = this.http.getCookiesForDomain('zfw.xidian.edu.cn'); if (cookieStr.length > 2000) { console.error(TAG, 'ZFW cookie too large (' + cookieStr.length + '), clearing'); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left tryFetchZfwHome 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 tryFetchZfwHome(): Promise<ZfwUsageData | null> { // 检查 cookie 大小,如果异常大则清除(防止之前 bug 积累的超大 cookie) const cookieStr: string = this.http.getCookiesForDomain('zfw.xidian.edu.cn'); if (cookieStr.length > 2000) { console.error(TAG, 'ZFW cookie too large (' + cookieStr.length + '), clearing'); ...
https://github.com/PollenWang6/HiXD
d19e0f556cc83d07346b799e4932aff0e835e238
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
toStringAsBinary
Converts the BigInt to a binary string representation. @returns { string } A binary string representation of the BigInt. @syscap SystemCapability.Utils.Lang @FaAndStageModel
private toStringAsBinary(): string { if (this.isZero()) { return "0" } return this.addSignToString(this.toStringAsUnsignedBinary()) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left toStringAsBinary 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#string#Left string...
private toStringAsBinary(): string { if (this.isZero()) { return "0" } return this.addSignToString(this.toStringAsUnsignedBinary()) }
https://gitcode.com/iop123123/arkts-static-skills
071cbc4cf5e304695593b6f3c57f1a8627d78c55
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
filter
creates a new Float64Array from current Float64Array based on a condition fn @param fn the condition to apply for each element @returns a new Float64Array with elements from current Float64Array that satisfy condition fn
public filter(fn: (val: double, index: int) => boolean): Float64Array { let newF: (val: double, index: int, array: Float64Array) => boolean = (val: double, index: int, array: Float64Array): boolean => { return fn(val, index) } return this.filter(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
public filter(fn: (val: double, index: int) => boolean): Float64Array { let newF: (val: double, index: int, array: Float64Array) => boolean = (val: double, index: int, array: Float64Array): boolean => { return fn(val, index) } return this.filter(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7b688449ec7f89ac19cbc2419c9b877fcddd4ea4
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
atan
Return a new Decimal whose value is the arctangent in radians of `n`, rounded to `precision` significant digits using rounding mode `rounding`. @param { Value } n {double | string | Decimal} @returns { Decimal } the Decimal type @throws { BusinessError } 10200060 - Precision limit exceeded.
static atan(n: Value): Decimal { return new Decimal(n).atan(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left atan AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
static atan(n: Value): Decimal { return new Decimal(n).atan(); }
https://gitcode.com/iop123123/arkts-static-skills
9e69e6f91c7d962dab9ae2a3b3cba8a3c549f3f7
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
onTouchStart
手指接触屏幕
onTouchStart(columnIndex: number){ this.startOffset = this.getOffset(columnIndex) this.touchStartTime = Date.now() this.momentumOffset = this.startOffset }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onTouchStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left columnIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right A...
onTouchStart(columnIndex: number){ this.startOffset = this.getOffset(columnIndex) this.touchStartTime = Date.now() this.momentumOffset = this.startOffset }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L504-L508
18b69912e66706c45932c3d2bc20796ea87f9b23
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleHealthCheck.ets
arkts
hasActiveTimers
Test seam — true while the deferred initial-send setTimeout is armed.
public hasActiveTimers(): boolean { return this.initialSendTimer !== null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasActiveTimers 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 A...
public hasActiveTimers(): boolean { return this.initialSendTimer !== null; }
https://github.com/Countly/countly-sdk-hos
1ca179dfce9b2a847970ae49a4e81f2d72c6e616
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/Rect.ets
arkts
height
@return the rectangle's height. This does not check for a valid rectangle (i.e. top <= bottom) so the result may be negative.
public height(): number { return this.bottom - this.top; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left height 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#R...
public height(): number { return this.bottom - this.top; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
890803f836198ed1ad896fc1073cc1bb801fc867
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
getLoginInfoMap
获取登录信息Map(对应Legado的getLoginInfoMap)
getLoginInfoMap(sourceId: string): Record<string, string> { const info = this.getLoginInfo(sourceId); if (!info) return {}; try { return SafeUtils.parseObj(info) as Record<string, string>; } catch (e) { return {}; } }
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLoginInfoMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right A...
getLoginInfoMap(sourceId: string): Record<string, string> { const info = this.getLoginInfo(sourceId); if (!info) return {}; try { return SafeUtils.parseObj(info) as Record<string, string>; } catch (e) { return {}; } }
https://github.com/DaLongZhuaZi/manxia
5746c780f2d8d7b24a6ae039dc54249e4c1fb7fb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/DiskCacheManager.ets
arkts
rebuildIndex
重建缓存索引
private async rebuildIndex(): Promise<void> { try { this.cacheIndex.clear(); this.totalSize = 0; const cacheDirExists = await fs.access(this.cacheDir); if (!cacheDirExists) { return; } const files = await fs.listFile(this.cacheDir); for (const fileName of files)...
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 rebuildIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async rebuildIndex(): Promise<void> { try { this.cacheIndex.clear(); this.totalSize = 0; const cacheDirExists = await fs.access(this.cacheDir); if (!cacheDirExists) { return; } const files = await fs.listFile(this.cacheDir); for (const fileName of files)...
https://github.com/DaLongZhuaZi/manxia
16ece3f47df3c0f20226a69319628258ef48bcab
github
openharmony-sig/ostest_integration_test
function/bms/bundlemanager/sceneProject/bmsqueryresourceinfo062/entry/src/main/ets/accessibilityextability/AccessibilityExtAbility.ets
arkts
onConnect
Called when your accessibility service is successfully connected to the OS. You can implement this method to perform subsequent initialization operations.
onConnect() { console.log("[AccessibilityExtAbility] onConnect"); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onConnect 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...
onConnect() { console.log("[AccessibilityExtAbility] onConnect"); }
https://gitee.com/openharmony-sig/ostest_integration_test.git
5b6ac36f4a3406120485aa87a96fcf203c699cf8
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Message.ets
arkts
constructor
Create a basic message instance @param { MessageHandler } handler The message handler
constructor(handler: concurrency.MessageHandler) { this.handler = handler; }
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 handler AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left...
constructor(handler: concurrency.MessageHandler) { this.handler = handler; }
https://gitcode.com/iop123123/arkts-static-skills
c6db61074065acf699d23b31a1dc28537dcbaaac
gitcode
honjow/Next2V
entry/src/main/ets/model/ImagePreviewCoordinator.ets
arkts
fitScale
ImageFit.Contain letterboxes the bitmap inside the viewport-sized element: the DRAWN content size is the intrinsic size times this fit-factor (min of the per-axis ratios). All pan/clamp math must use the drawn (fitted) size, NOT the raw intrinsic size, or the bounds are off by the fit-factor.
static fitScale( viewportW: number, viewportH: number, intrinsicW: number, intrinsicH: number, ): number { if (viewportW <= 0 || viewportH <= 0 || intrinsicW <= 0 || intrinsicH <= 0) { return 1 } const f: number = Math.min(viewportW / intrinsicW, viewportH / intrinsicH) return ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fitScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left viewportW AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Righ...
static fitScale( viewportW: number, viewportH: number, intrinsicW: number, intrinsicH: number, ): number { if (viewportW <= 0 || viewportH <= 0 || intrinsicW <= 0 || intrinsicH <= 0) { return 1 } const f: number = Math.min(viewportW / intrinsicW, viewportH / intrinsicH) return ...
https://github.com/honjow/Next2V
9066f7379c8e0d46c97d70dc84b6790f0a085c5e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets
arkts
createEmptyItem
创建空的存储项
private createEmptyItem(type: StorageType, name: string): StorageItem { return { type: type, name: name, description: '暂无数据', size: 0, fileCount: 0, path: '', canClear: false, lastModified: Date.now() }; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createEmptyItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private createEmptyItem(type: StorageType, name: string): StorageItem { return { type: type, name: name, description: '暂无数据', size: 0, fileCount: 0, path: '', canClear: false, lastModified: Date.now() }; }
https://github.com/DaLongZhuaZi/manxia
f449905d89289b1c25c744a83a3ede23d8d8d995
github
webabcd/HarmonyDemo
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
UIAbility 的窗口创建完成时 在这里需要通过 windowStage.loadContent() 加载当前 UIAbility 的首页
onWindowStageCreate(windowStage: window.WindowStage): void { MyLog.d('ability onWindowStageCreate'); let record: Record<string, number> = { 'myNumber': 5000 }; let storage: LocalStorage = new LocalStorage(record); // 加载当前 UIAbility 的首页 // 必须是 @Entry 组件 // 必须在 main_pages.json 文件...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif...
onWindowStageCreate(windowStage: window.WindowStage): void { MyLog.d('ability onWindowStageCreate'); let record: Record<string, number> = { 'myNumber': 5000 }; let storage: LocalStorage = new LocalStorage(record); // 加载当前 UIAbility 的首页 // 必须是 @Entry 组件 // 必须在 main_pages.json 文件...
https://github.com/webabcd/HarmonyDemo
5d0915ef56b4eac106bd0a5b406bf6640ac91e0b
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningRecordService.ets
arkts
getRecordsByDateRange
获取指定日期范围的记录 @param records 所有记录 @param startDate 开始日期 (YYYY-MM-DD) @param endDate 结束日期 (YYYY-MM-DD) @returns 符合条件的记录列表
static getRecordsByDateRange( records: AnswerRecord[], startDate: string, endDate: string ): AnswerRecord[] { return records.filter(record => { const recordDate = record.timestamp.split('T')[0]; return recordDate >= startDate && recordDate <= endDate; }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRecordsByDateRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri...
static getRecordsByDateRange( records: AnswerRecord[], startDate: string, endDate: string ): AnswerRecord[] { return records.filter(record => { const recordDate = record.timestamp.split('T')[0]; return recordDate >= startDate && recordDate <= endDate; }); }
https://github.com/the-wwyang/kids-learning-app
ac273250029891bdb249ab73b0db4211628d453c
github
richshaw2015/nds
ohos/entry/src/test/NativeSync.test.ets
arkts
getBatchCallCount
获取批量调用次数
getBatchCallCount(): number { return this.batchCallCount; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBatchCallCount 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#stat...
getBatchCallCount(): number { return this.batchCallCount; }
https://github.com/richshaw2015/nds
0cafa38ad05a368242d972f9942dbf6e7696a8e5
github
zcg741/chengyu-game
entry/src/main/ets/service/ChengyuService.ets
arkts
getUIContext
当前过滤后的列表
function getUIContext(): common.UIAbilityContext | null { return getAppContext(); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getUIContext 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#union_type#Lef...
function getUIContext(): common.UIAbilityContext | null { return getAppContext(); }
https://github.com/zcg741/chengyu-game
705b38340d7024ba7f198c01a5652d5e4c4c4452
github
mybricks/comlib-harmony-normal
packages/rt-arkts/comlib/src/main/ets/audio/AudioCapturer.ets
arkts
removeEventListener
取消事件监听
removeEventListener(key: string, listener: (value: ESObject) => void) { this.eventListener.get(key)?.delete(listener); }
AST#program#Left AST#ERROR#Left AST#identifier#Left removeEventListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST...
removeEventListener(key: string, listener: (value: ESObject) => void) { this.eventListener.get(key)?.delete(listener); }
https://github.com/mybricks/comlib-harmony-normal
c954e861d79219c96c163077efc5bbad59c5f985
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/ImageUtil.ets
arkts
setColorDataToPreference
保存颜色从数据到首选项 @param imgUrl string @param data number[] @returns Promise<void>
private static setColorDataToPreference(imgUrl: string, data: number[]): Promise<void> { return new Promise((resolve: () => void) => { PreferenceUtil.getInstance().hasValue(IMAGE_COLOR) .then((result) => { if (result) { PreferenceUtil.getInstance() .getValue<Recor...
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 setColorDataToPreference AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imgUrl AST#identifier#Right...
private static setColorDataToPreference(imgUrl: string, data: number[]): Promise<void> { return new Promise((resolve: () => void) => { PreferenceUtil.getInstance().hasValue(IMAGE_COLOR) .then((result) => { if (result) { PreferenceUtil.getInstance() .getValue<Recor...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
5d58f8aa23989270ead975a58b66f15d07b23240
gitcode
PollenWang6/HiXD
entry/src/main/ets/services/SchoolCardService.ets
arkts
setOpenId
===== openid 管理 ===== 由外部(WebView OAuth)注入 openid,绕开 NETSTACK 跨域重定向限制
setOpenId(oid: string): void { this.openid = oid; this.openidFetchedAt = Date.now(); console.info(TAG, 'setOpenId: injected from WebView, len=' + oid.length); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOpenId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left oid AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#...
setOpenId(oid: string): void { this.openid = oid; this.openidFetchedAt = Date.now(); console.info(TAG, 'setOpenId: injected from WebView, len=' + oid.length); }
https://github.com/PollenWang6/HiXD
003639a00845ccb2e73270753dcb97b6b2514386
github
openharmony/arkui_ace_engine
examples/Accessibility/ListItemGroupAccessibility/entry/src/main/ets/pages/ListDataSource.ets
arkts
notifyDataChange
通知控制器数据变化
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataChange 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 number AST#identifier#Right AST#)#Left...
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }); }
https://gitcode.com/openharmony/arkui_ace_engine
b69a26f64af115f524fd3cc4a02b6e620f8f4292
gitcode
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
showCancelModal
显示取消原因选择弹窗 @returns {void} 无返回值
showCancelModal(): void { this.cancelModalVisible = true; this.loadCancelReasons(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showCancelModal 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...
showCancelModal(): void { this.cancelModalVisible = true; this.loadCancelReasons(); }
https://github.com/Joker-x-dev/CoolMallArkTS
bbf9654ceeeff1250cce184114444da9ba64e2c7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
set
Copies elements from an ArrayLike object to the Uint8Array. @param { ArrayLike<number> } array - An ArrayLike object containing the elements to copy. @param { int } [offset] - Optional. The offset into the target array at which to begin writing values from the source array. The default value is 0. @throws { RangeError ...
public set(array: ArrayLike<number>, offset: int = 0): void { const insertPos = offset if (insertPos < 0 || insertPos + array.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < array.length; ++i) { this.setUnsafe(i...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public set(array: ArrayLike<number>, offset: int = 0): void { const insertPos = offset if (insertPos < 0 || insertPos + array.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < array.length; ++i) { this.setUnsafe(i...
https://gitcode.com/iop123123/arkts-static-skills
c50a443c6cfc128274e09b0e4c44a66145a113eb
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/AuthenticationHandler.ets
arkts
getLoginConfig
获取登录配置
getLoginConfig(): { url: string; method: string; payload: Record<string, string>; } | null { if (!this.config.loginUrl || !this.config.loginMethod) { return null; } return { url: this.config.loginUrl, method: this.config.loginMethod, payload: this.config.loginPayload...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLoginConfig 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#statement_block#Left AST#{#Left { AST#{#Right A...
getLoginConfig(): { url: string; method: string; payload: Record<string, string>; } | null { if (!this.config.loginUrl || !this.config.loginMethod) { return null; } return { url: this.config.loginUrl, method: this.config.loginMethod, payload: this.config.loginPayload...
https://github.com/DaLongZhuaZi/manxia
728155783ac6bef4f50faca74748245536ab2ec3
github
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
typeIndicatorName
Get human-readable type indicator name
public typeIndicatorName(typeIndicator: number): string { return eulumdat_napi.typeIndicatorName(typeIndicator); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left typeIndicatorName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left typeIndicator AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
public typeIndicatorName(typeIndicator: number): string { return eulumdat_napi.typeIndicatorName(typeIndicator); }
https://github.com/holg/eulumdat-rs
6c60ba48566885afa717b7b8ae10f248077a6dfc
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets
arkts
replaceAllElements
Replaces all elements in the ArrayList using a callback function that takes the value and index, and itself. @param callbackfn - The callback function taking the value, index, and the ArrayList as arguments.
public replaceAllElements(callbackfn: ArrayListReplaceCb<T>): void { for (let i: int = 0; i < this.length; i++) { this.buffer[i] = callbackfn(this.buffer[i], i, this); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replaceAllElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackfn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instant...
public replaceAllElements(callbackfn: ArrayListReplaceCb<T>): void { for (let i: int = 0; i < this.length; i++) { this.buffer[i] = callbackfn(this.buffer[i], i, this); } }
https://gitcode.com/iop123123/arkts-static-skills
039755c3156df535ab64446f90ba53bdb47e052c
gitcode
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets
arkts
getRecordingsByScheduleId
获取日程的所有录音
async getRecordingsByScheduleId(scheduleId: string): Promise<Recording[]> { if (!this.rdbStore) { return [] } try { const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_RECORDING) predicates.equalTo('scheduleId', scheduleId) const resultSet = await this.rdbStore...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getRecordingsByScheduleId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left scheduleId AST#iden...
async getRecordingsByScheduleId(scheduleId: string): Promise<Recording[]> { if (!this.rdbStore) { return [] } try { const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_RECORDING) predicates.equalTo('scheduleId', scheduleId) const resultSet = await this.rdbStore...
https://gitcode.com/openharmony/codelabs
b8f578959b7911cd097385a461b5ca52a2bc007a
gitcode
arkui-x/samples
CodeLab/Cases/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
clearHistoryData
清除历史识别数据
clearHistoryData() { this.name = ''; this.phone = ''; this.address = ''; this.myTagList = MOCK_TAG_DATA; this.isDefault = false; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearHistoryData 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...
clearHistoryData() { this.name = ''; this.phone = ''; this.address = ''; this.myTagList = MOCK_TAG_DATA; this.isDefault = false; }
https://gitcode.com/arkui-x/samples
373c07cbfc7fcc474cfac896853f8202dc5ad658
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Distributed/DistributedDataSyncManager.ets
arkts
addOnStatusChangedCallback
添加状态变更监听
public addOnStatusChangedCallback(callback: (status: 'online' | 'offline' | 'restored' | 'error', message?: string) => void): void { this.statusChangedCallbacks.add(callback); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left addOnStatusChangedCallback 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 addOnStatusChangedCallback(callback: (status: 'online' | 'offline' | 'restored' | 'error', message?: string) => void): void { this.statusChangedCallbacks.add(callback); }
https://github.com/DaLongZhuaZi/manxia
7442db42828fca4e6d49cb95aa1646cb2d82a1cc
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/AxisRenderer.ets
arkts
getTransformer
Returns the Transformer object used for transforming the axis values. @return
public getTransformer(): Transformer | null { return this.mTrans; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTransformer 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 ...
public getTransformer(): Transformer | null { return this.mTrans; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
52bcecf2ec3de4a81c55deb10516bdcd3f92f966
gitee
wgli-collab/qs-arkts
entry/src/main/ets/pages/Index.ets
arkts
t11_strictNullHandling
T11: strictNullHandling
t11_strictNullHandling(): void { const opts: ParseOptions = { strictNullHandling: true }; const r: Record<string, Object> = parse('a&b=', opts); const rec: Record<string, Object> = r as Record<string, Object>; const aVal: Object = rec['a']; const bVal: Object = rec['b']; const passed: boolean ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t11_strictNullHandling 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#state...
t11_strictNullHandling(): void { const opts: ParseOptions = { strictNullHandling: true }; const r: Record<string, Object> = parse('a&b=', opts); const rec: Record<string, Object> = r as Record<string, Object>; const aVal: Object = rec['a']; const bVal: Object = rec['b']; const passed: boolean ...
https://github.com/wgli-collab/qs-arkts
3398e56d03c94a31adf4c5178d7936851c738a39
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
some
/ === with element lambda functions === Checks that at least one element of BigInt64Array satisfies the passed function @param fn check function @returns true if some element satisfies fn
public some(fn: (element: long, index: int, array: BigInt64Array) => boolean): boolean { for (let i = 0; i < this.length; ++i) { if (fn(this.at(i), i, this)) { return true } } return false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public some(fn: (element: long, index: int, array: BigInt64Array) => boolean): boolean { for (let i = 0; i < this.length; ++i) { if (fn(this.at(i), i, this)) { return true } } return false }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
546f3a0920011803d10a8e6cd48b332f07f73705
gitee
the-wwyang/kids-learning-app
src/main/ets/services/WrongQuestionService.ets
arkts
recordReview
记录复习 @param record 错题记录 @param isCorrect 本次复习是否答对 @returns 更新后的记录
static recordReview( record: WrongQuestionRecord, isCorrect: boolean ): WrongQuestionRecord { const currentTime = new Date().toISOString(); // 根据答题情况确定各字段值 let isMastered = record.isMastered; let errorCount = record.errorCount; let lastErrorTime = record.lastErrorTime; // 如果连续复习正确3...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left recordReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left W...
static recordReview( record: WrongQuestionRecord, isCorrect: boolean ): WrongQuestionRecord { const currentTime = new Date().toISOString(); // 根据答题情况确定各字段值 let isMastered = record.isMastered; let errorCount = record.errorCount; let lastErrorTime = record.lastErrorTime; // 如果连续复习正确3...
https://github.com/the-wwyang/kids-learning-app
26557ed9484264ab275ae77136dfc4cce4198785
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARRenderer.ets
arkts
setArrowStatus
根据状态设置箭头颜色 @param status 状态('normal'|'turn'|'arrival'|'warning')
public setArrowStatus(status: 'normal' | 'turn' | 'arrival' | 'warning'): void { switch (status) { case 'normal': this.arrowColor = this.arrowColors.normal; break; case 'turn': this.arrowColor = this.arrowColors.turn; break; case 'arrival': this.arrowColor...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setArrowStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressi...
public setArrowStatus(status: 'normal' | 'turn' | 'arrival' | 'warning'): void { switch (status) { case 'normal': this.arrowColor = this.arrowColors.normal; break; case 'turn': this.arrowColor = this.arrowColors.turn; break; case 'arrival': this.arrowColor...
https://github.com/LJ666-ui/harmony-health-care
e1ce04ed9a37213b4efea5841c82c007ef3692c9
github
751496032/ZRouter
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
modifier
该页面的动画转场所需要的modifier,也可以自己传进去 @param component @param modifier @returns
public modifier(component: object, modifier?: NavAnimationModifier): NavAnimationModifier { return NavAnimationStore.getInstance().modifier(component, modifier) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left modifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left component AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#object#Left object AST#object#Righ...
public modifier(component: object, modifier?: NavAnimationModifier): NavAnimationModifier { return NavAnimationStore.getInstance().modifier(component, modifier) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L64-L66
8f383d38c5917787a73af81e1c74cca301c1a4d5
github
eclipse-oniro4openharmony/f-oh
entry/src/main/ets/utils/GlobalContent.ets
arkts
setWindowStage
新增方法来设置和获取 windowStage
setWindowStage(windowStage: window.WindowStage): void { this._windowStage = windowStage; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWindowStage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identifier#R...
setWindowStage(windowStage: window.WindowStage): void { this._windowStage = windowStage; }
https://github.com/eclipse-oniro4openharmony/f-oh
9ee58ab0b5ee1fd1997eac64afa4a8a67bafe689
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
fromWidth
Creates a Size with infinite height
static fromWidth(width: number): Size { return new Size(width, Infinity); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
static fromWidth(width: number): Size { return new Size(width, Infinity); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L183-L185
1611a1a7dc1aee9090b46edbba6e27752d431158
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test51_original_index.ets
arkts
caesarEncrypt
=== Round 51: Generator-like state machine, Caesar cipher with key, weighted random, matrix multiplication, spiral traversal, RPN calculator with stack === --- Caesar cipher with variable key ---
function caesarEncrypt(text: string, shift: number): string { let result: string = ''; for (let i: number = 0; i < text.length; i++) { let ch: string = text.charAt(i); let code: number = ch.charCodeAt(0); if (code >= 65 && code <= 90) { code = ((code - 65 + shift) % 26 + 26) % 26 + 65; } else ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left caesarEncrypt AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function caesarEncrypt(text: string, shift: number): string { let result: string = ''; for (let i: number = 0; i < text.length; i++) { let ch: string = text.charAt(i); let code: number = ch.charCodeAt(0); if (code >= 65 && code <= 90) { code = ((code - 65 + shift) % 26 + 26) % 26 + 65; } else ...
https://github.com/miaochiahao/ark-ghidra
a8e92597944bcb09eba152d2d5b7fbba19204305
github
openharmony/applications_mms
entry/src/main/ets/pages/conversationlist/conversationListController.ets
arkts
jumpToConversationPage
The session details page is displayed.
jumpToConversationPage(item) { router.push({ uri: 'pages/conversation/conversation', params: { strContactsNumber: item?.telephone, strContactsNumberFormat: item?.telephoneFormat, strContactsName: item?.name, contactsNum:...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToConversationPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left item AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right ...
jumpToConversationPage(item) { router.push({ uri: 'pages/conversation/conversation', params: { strContactsNumber: item?.telephone, strContactsNumberFormat: item?.telephoneFormat, strContactsName: item?.name, contactsNum:...
https://gitee.com/openharmony/applications_mms.git
06df17fd7a2565b7f67d64412fefc2df61461538
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
constructor
@param name fully qualified name of class type, can include only [A-Za-z0-9_.]
public constructor(name: string) { super() this.name = name }
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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
public constructor(name: string) { super() this.name = name }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
273db07efd377c66f46d129c1077d6b272623b99
gitee
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/AudioCapturerManager.ets
arkts
requestPermissions
初始化权限
async requestPermissions() { // 申请权限 try { // 申请权限 await permissionManager.requestPermissions(this.permissions) } catch { // 未开启弹窗提示 new PromptAction().showDialog({ alignment: DialogAlignment.Center, title: '温馨提示', message: '录音功能需要获取权限,请在系统设置中打开麦克风开关', ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left requestPermissions AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
async requestPermissions() { // 申请权限 try { // 申请权限 await permissionManager.requestPermissions(this.permissions) } catch { // 未开启弹窗提示 new PromptAction().showDialog({ alignment: DialogAlignment.Center, title: '温馨提示', message: '录音功能需要获取权限,请在系统设置中打开麦克风开关', ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
5a23ecdc35a012b548d907f0965bdcb1db14374d
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/pages/IntroductionPage.ets
arkts
initializeZoneId
Initialize the zone id accord to the type of jumping to this page.
initializeZoneId() { if (this.cardID !== -1) { this.currentZoneId = this.cardID; } else if (this.isContinuation === 'false' || router.getParams() !== undefined) { this.currentZoneId = (router.getParams() as RouterParmaInterface).id; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initializeZoneId 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...
initializeZoneId() { if (this.cardID !== -1) { this.currentZoneId = this.cardID; } else if (this.isContinuation === 'false' || router.getParams() !== undefined) { this.currentZoneId = (router.getParams() as RouterParmaInterface).id; } }
https://gitee.com/harmonyos/codelabs.git
26c24e10aed9154478aff6cc50f3796bd272dbb1
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInternals.ets
arkts
asFixedArray
Casts an object to FixedArray type. @static @param { object } obj The object to be converted. @returns { FixedArray<E> } The converted FixedArray instance with element type `E`. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static asFixedArray<E>(obj: object): FixedArray<E> { return obj as FixedArray<E> }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left asFixedArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left E AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Righ...
public static asFixedArray<E>(obj: object): FixedArray<E> { return obj as FixedArray<E> }
https://gitcode.com/iop123123/arkts-static-skills
2ff16c3baa5d40484a9912ce9302deb31b5beb8a
gitcode
Coke0807/NewsAPP-HarmonyOS
NewsApp/entry/src/main/ets/utils/SettingsUtil.ets
arkts
loadSettings
加载设置到AppStorage
static async loadSettings(): Promise<void> { if (!SettingsUtil.prefs) return; try { const themeColor = await SettingsUtil.prefs.get(STORAGE_KEYS.THEME_COLOR, DEFAULT_THEME_COLOR) as string; const fontSize = await SettingsUtil.prefs.get(STORAGE_KEYS.FONT_SIZE, DEFAULT_FONT_SIZE) as number; ...
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 loadSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
static async loadSettings(): Promise<void> { if (!SettingsUtil.prefs) return; try { const themeColor = await SettingsUtil.prefs.get(STORAGE_KEYS.THEME_COLOR, DEFAULT_THEME_COLOR) as string; const fontSize = await SettingsUtil.prefs.get(STORAGE_KEYS.FONT_SIZE, DEFAULT_FONT_SIZE) as number; ...
https://github.com/Coke0807/NewsAPP-HarmonyOS
7b822e5b9b637faf1b88af704acf256027b4e773
github
HarmonyOS_Samples/guide-snippets
Ability/UIAbilityRecover/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onSaveState
[StartExclude onCreate]
onSaveState(reason: AbilityConstant.StateType, wantParam: Record<string, Object>): AbilityConstant.OnSaveResult { // 保存应用数据。 hilog.info(DOMAIN, 'EntryAbility', '[Demo] EntryAbility onSaveState'); wantParam['myData'] = 'my1234567'; return AbilityConstant.OnSaveResult.ALL_AGREE; }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left onSaveState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expressio...
onSaveState(reason: AbilityConstant.StateType, wantParam: Record<string, Object>): AbilityConstant.OnSaveResult { // 保存应用数据。 hilog.info(DOMAIN, 'EntryAbility', '[Demo] EntryAbility onSaveState'); wantParam['myData'] = 'my1234567'; return AbilityConstant.OnSaveResult.ALL_AGREE; }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
ba8f6568c4730ba6f6c65c5946840b5408519712
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheConstants.ets
arkts
clearForceRefresh
清除强制刷新标志
static clearForceRefresh(): void { AppStorage.setOrCreate(CacheConstants.FORCE_REFRESH_KEY, false); hilog.debug(DOMAIN, TAG, 'Clear force refresh'); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearForceRefresh 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 clearForceRefresh(): void { AppStorage.setOrCreate(CacheConstants.FORCE_REFRESH_KEY, false); hilog.debug(DOMAIN, TAG, 'Clear force refresh'); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L186-L189
c7c7393d97b662b890b959764aad1cdb954ef539
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HtmlParserLogger.ets
arkts
parseComplete
解析完成日志
static parseComplete(elementCount: number, duration: number): void { if (HtmlParserLogger._enabled && HtmlParserLogger._debugEnabled) { logger.debug(TAG, `解析完成,元素数: ${elementCount},耗时: ${duration}ms`); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left elementCount AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num...
static parseComplete(elementCount: number, duration: number): void { if (HtmlParserLogger._enabled && HtmlParserLogger._debugEnabled) { logger.debug(TAG, `解析完成,元素数: ${elementCount},耗时: ${duration}ms`); } }
https://github.com/DaLongZhuaZi/manxia
9e25216388ba09cb8632c011f0ccce2c39e53f6f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseTypes.ets
arkts
createDownloadTaskRecord
创建下载任务数据库记录
static createDownloadTaskRecord(): DownloadTaskDatabaseRecord { return { id: '', comicId: '', chapterId: '', taskType: 'chapter', status: '', progress: 0, totalSize: 0, downloadedSize: 0, downloadSpeed: 0, priority: 0, createTime: 0, startTim...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDownloadTaskRecord 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#Le...
static createDownloadTaskRecord(): DownloadTaskDatabaseRecord { return { id: '', comicId: '', chapterId: '', taskType: 'chapter', status: '', progress: 0, totalSize: 0, downloadedSize: 0, downloadSpeed: 0, priority: 0, createTime: 0, startTim...
https://github.com/DaLongZhuaZi/manxia
2558592222f4815275c60d9c2954c5bf1f58d352
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
findEntryByUuid
根据UUID查找条目
private findEntryByUuid(group: KdbxGroup, uuid: KdbxUuid): KdbxEntry | null { for (let i = 0; i < group.entries.length; i++) { if (group.entries[i].uuid.equals(uuid)) { return group.entries[i]; } } for (let i = 0; i < group.groups.length; i++) { const found = this.findEntryByUuid...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findEntryByUuid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private findEntryByUuid(group: KdbxGroup, uuid: KdbxUuid): KdbxEntry | null { for (let i = 0; i < group.entries.length; i++) { if (group.entries[i].uuid.equals(uuid)) { return group.entries[i]; } } for (let i = 0; i < group.groups.length; i++) { const found = this.findEntryByUuid...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L397-L410
b5e8951bfa5c5a74b8af6e3eebbaa6bf48db3aaa
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
convertToSmartCategoryRule
转换为SmartCategoryRule
static convertToSmartCategoryRule(resultSet: relationalStore.ResultSet): SmartCategoryRule { const rule = new SmartCategoryRule(); rule.ruleId = DAOHelper.getNumberValue(resultSet, 'rule_id'); rule.userId = DAOHelper.getNumberValue(resultSet, 'user_id'); rule.ruleName = DAOHelper.getStringValue(result...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToSmartCategoryRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
static convertToSmartCategoryRule(resultSet: relationalStore.ResultSet): SmartCategoryRule { const rule = new SmartCategoryRule(); rule.ruleId = DAOHelper.getNumberValue(resultSet, 'rule_id'); rule.userId = DAOHelper.getNumberValue(resultSet, 'user_id'); rule.ruleName = DAOHelper.getStringValue(result...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
d74f2b0d11b0198c1f7c07c04cce8651ebd6af2f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
slice
Returns a copy of a section of an array. @param { int } [start] The beginning index of the specified portion of the array. @param { int } [end] The end index of the specified portion of the array. The slice includes elements up to but not including the end index. @returns { Array<T> } A new Array object containing the ...
public slice(start?: int, end?: int): Array<T> { const len: int = this.actualLength; const relStart = normalizeIndex(start ?? 0, len) const relEnd = normalizeIndex(end ?? len, len) let count = relEnd - relStart; if (count < 0) { count = 0; } let r...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#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 star...
public slice(start?: int, end?: int): Array<T> { const len: int = this.actualLength; const relStart = normalizeIndex(start ?? 0, len) const relEnd = normalizeIndex(end ?? len, len) let count = relEnd - relStart; if (count < 0) { count = 0; } let r...
https://gitcode.com/iop123123/arkts-static-skills
b9683551b880e43e6de4e7764bbde45594750ab6
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/checkboxGroup/index.ets
arkts
handleMaxChange
当最大数量变化时
handleMaxChange() { this.max > 0 && ibestEmitter.emit(getEventName(COMPONENT_NAME, CHECKBOX_GROUP_EVENT_NAME.ON_MAX_CHANGE, this.group), { max: this.max, checkedList: this.activeList }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleMaxChange 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...
handleMaxChange() { this.max > 0 && ibestEmitter.emit(getEventName(COMPONENT_NAME, CHECKBOX_GROUP_EVENT_NAME.ON_MAX_CHANGE, this.group), { max: this.max, checkedList: this.activeList }) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/checkboxGroup/index.ets#L109-L115
683d7d1cc4476d9aec007ca9f277b86b6feeac6a
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/pages/RollPage/RollDataManager.ets
arkts
constructor
扇形填充色
constructor(id: string, text: string, weight: number, color: string) { this.id = id this.text = text this.weight = weight this.color = color }
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 id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST...
constructor(id: string, text: string, weight: number, color: string) { this.id = id this.text = text this.weight = weight this.color = color }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
874ded0d1979f4b0194ba6788c8f5c81d966c747
github
dingzhilin1990/zhilinclaw
src/security/OAuthGateway.ets
arkts
isAuthenticated
检查是否已认证 @param providerId 提供商 ID
public isAuthenticated(providerId: string): boolean { const session = this.sessions.get(providerId); if (!session) { return false; } return !this.isTokenExpired(session.token); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAuthenticated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left providerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
public isAuthenticated(providerId: string): boolean { const session = this.sessions.get(providerId); if (!session) { return false; } return !this.isTokenExpired(session.token); }
https://github.com/dingzhilin1990/zhilinclaw
898c592c9cc2af733866e97c265713ca059b4113
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
isGraphicsEnabled
检查图形系统是否可用 与音频不同,图形系统是必需的,如果初始化失败则模拟器无法运行 此函数用于在启动模拟前检查图形系统状态 @returns 图形系统是否可用 Requirements: 11.2
static isGraphicsEnabled(): boolean { return MelonDSNative.native.isGraphicsEnabled(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isGraphicsEnabled 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...
static isGraphicsEnabled(): boolean { return MelonDSNative.native.isGraphicsEnabled(); }
https://github.com/richshaw2015/nds
3d5f3e001ab1eff01ef6ce1cd2d2c5d592f385a4
github
openharmony-sig/earth
hpauditor/tests/issues/expected/issue551.ets.audit.ets
arkts
directflog
HPAudit: Explicitly declare return types of functions and methods : hp-specs-explicit-return-types : 1 : 11 : issue551.ets
function directflog(): void { hilog.info(0x0000, 'testTag', `[${tag}] ${message}`); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left directflog AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#...
function directflog(): void { hilog.info(0x0000, 'testTag', `[${tag}] ${message}`); }
https://gitee.com/openharmony-sig/earth.git
c8e291c98d1a10319408341126dbf4e4964fda2a
gitee
iichen-bycode/ArkTsWanandroid
entry/src/main/ets/utils/StorageUtils.ets
arkts
getPreferences
获取Prefer实例 @param preferenceName @returns
static async getPreferences(preferenceName: string = defaultPreferenceName) { return await dataPreferences.getPreferences(this.context, preferenceName) }
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 getPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left preferenceName AST#identifier#Right AST#:...
static async getPreferences(preferenceName: string = defaultPreferenceName) { return await dataPreferences.getPreferences(this.context, preferenceName) }
https://github.com/iichen-bycode/ArkTsWanandroid
2937dc3ba3efe4c669c60af8990aa9be6794df94
github
wuba/omni-ui
omni_component/src/main/ets/components/chart/utils/DrawPieViewModel.ets
arkts
setCenter
获取中心坐标
setCenter (flag = false): Array<number> { const wc = this.center[0] const hc = this.center[1] const cx = this.width * percentToNumer(wc) const cy = this.height * percentToNumer(hc) if (!flag) { this.ctx!.translate(cx, cy); } return [cx, cy] }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left setCenter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#assignment_expression#Left AST#identifier#Left flag AST#identifier#Right AST#=#Left = AST#=#Rig...
setCenter (flag = false): Array<number> { const wc = this.center[0] const hc = this.center[1] const cx = this.width * percentToNumer(wc) const cy = this.height * percentToNumer(hc) if (!flag) { this.ctx!.translate(cx, cy); } return [cx, cy] }
https://github.com/wuba/omni-ui
8f27165be7715fc30f541db8bf5d341c6de630d1
github
Joker-x-dev/CoolMallArkTS
core/state/src/main/ets/UserState.ets
arkts
logout
用户登出,清空状态 @returns {void} 无返回值 @example getUserState().logout();
logout(): void { this.auth = new Auth(); this.userInfo = new User(); new TokenStoreRepository().clearToken(); PersistenceV2.remove(USER_STATE_KEY); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logout 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#Left ...
logout(): void { this.auth = new Auth(); this.userInfo = new User(); new TokenStoreRepository().clearToken(); PersistenceV2.remove(USER_STATE_KEY); }
https://github.com/Joker-x-dev/CoolMallArkTS
f3fd1dbdb9654ee372670eb0d39cbc2a6fe57d05
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineSurfaceManagerBridge.ets
arkts
constructor
Creates the C++ ISurfaceManager during construction. @throws Error if the native layer fails to create a SurfaceManager (instanceId === 0).
constructor() { const instanceId = AGenUIEngineBridge.getInstance().createSurfaceManager(); if (instanceId === 0) { hilog.error(0x0000, 'SurfaceManager', 'AGenUIEngineSurfaceManagerBridge: Failed to create SurfaceManager, native returned instanceId=0'); throw new Error('AGenUIEngineSurfaceManagerB...
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { const instanceId = AGenUIEngineBridge.getInstance().createSurfaceManager(); if (instanceId === 0) { hilog.error(0x0000, 'SurfaceManager', 'AGenUIEngineSurfaceManagerBridge: Failed to create SurfaceManager, native returned instanceId=0'); throw new Error('AGenUIEngineSurfaceManagerB...
https://github.com/AGenUI/AGenUI
4993f6844af64932ae5115d21732d81875992c8c
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_or_equal/greater_or_equal_int.ets
arkts
main
--- desc: check greater or equal for two integers ---
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a >= b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a >= b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8b05ad5f395c3371920a32bfae5fc5ff1f2035f5
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/OCRRecognitionDAO.ets
arkts
getByStatus
根据识别状态查询
static async getByStatus( userId: number, status: 'pending' | 'processing' | 'success' | 'partial' | 'failed', limit: number = 30 ): Promise<OCRRecognitionRecord[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM ${OCRRecognitionRecord.tab...
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 getByStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST...
static async getByStatus( userId: number, status: 'pending' | 'processing' | 'success' | 'partial' | 'failed', limit: number = 30 ): Promise<OCRRecognitionRecord[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM ${OCRRecognitionRecord.tab...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6f077fd8ceb1c9bdbc74e0eae8dea545d02c71cf
github
Countly/countly-sdk-hos
library/src/main/ets/internal/Utils.ets
arkts
cloneStringRecord
ArkTS bans Object.assign. These generic clone helpers produce a fresh Record by copying each key explicitly, which is safe under arkts-limited-stdlib.
public static cloneStringRecord(src: Record<string, string>): Record<string, string> { const out: Record<string, string> = {}; const keys: string[] = Object.keys(src); for (let i = 0; i < keys.length; i++) out[keys[i]] = src[keys[i]]; return out; }
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 cloneStringRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left :...
public static cloneStringRecord(src: Record<string, string>): Record<string, string> { const out: Record<string, string> = {}; const keys: string[] = Object.keys(src); for (let i = 0; i < keys.length; i++) out[keys[i]] = src[keys[i]]; return out; }
https://github.com/Countly/countly-sdk-hos
e999a48cee21fc6f10e63dd349c3f3b8b7c32d4c
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/SyncSettingsService.ets
arkts
getOrCreateDeviceId
获取或创建持久化的设备ID 设备ID存储在独立的 preferences 中,重启后保持不变
private static async getOrCreateDeviceId(): Promise<string> { try { if (SyncSettingsService.deviceIdPreferences) { const existingId = await SyncSettingsService.deviceIdPreferences.get(DEVICE_ID_KEY, '') as string; if (existingId) { hilog.info(DOMAIN, TAG, `Using existing deviceId: ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getOrCreateDeviceId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#a...
private static async getOrCreateDeviceId(): Promise<string> { try { if (SyncSettingsService.deviceIdPreferences) { const existingId = await SyncSettingsService.deviceIdPreferences.get(DEVICE_ID_KEY, '') as string; if (existingId) { hilog.info(DOMAIN, TAG, `Using existing deviceId: ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L88-L117
8158a59bb7537278acc1f92a268529f7b45e382b
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
setScreenLocked
Set screen locked state
setScreenLocked(locked: boolean): void { this.isScreenLocked = locked; console.info(`SessionState: Screen locked: ${locked}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setScreenLocked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locked AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Lef...
setScreenLocked(locked: boolean): void { this.isScreenLocked = locked; console.info(`SessionState: Screen locked: ${locked}`); }
https://github.com/tangwengang-del/freerdp-harmonyos
809a66b759c5efedbaee1b36f6275d8b58ac0ed7
github
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
onActionEnd
Gesture method onActionEnd.
onActionEnd() { setTimeout(() => { this.playerModel.volumeShow = false; this.playerModel.brightShow = false; this.positionX = PlayConstants.POSITION_X; this.positionY = PlayConstants.POSITION_Y; }, PlayConstants.DISAPPEAR_TIME); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onActionEnd 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 A...
onActionEnd() { setTimeout(() => { this.playerModel.volumeShow = false; this.playerModel.brightShow = false; this.positionX = PlayConstants.POSITION_X; this.positionY = PlayConstants.POSITION_Y; }, PlayConstants.DISAPPEAR_TIME); }
https://gitee.com/openharmony/codelabs.git
c5000c79e076d43af2dff8abf92062d6369af4d7
gitee
CPF-ApplicationTPC/ImageKnife
library/src/main/ets/ImageKnife.ets
arkts
getCacheImageSync
从内存或文件缓存中获取图片数据同步接口 @param url 图片地址url @param cacheType 缓存策略 @returns 图片数据 @param signature key自定义信息
getCacheImageSync(loadSrc: string | ImageKnifeOption | ImageKnifeOptionV2, cacheType: CacheStrategy = CacheStrategy.Default, signature?: string): ImageKnifeData | undefined { let option = this.getOption(loadSrc,signature) if (cacheType === CacheStrategy.Memory) { return this.readMemoryCache(option) ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCacheImageSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loadSrc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_ex...
getCacheImageSync(loadSrc: string | ImageKnifeOption | ImageKnifeOptionV2, cacheType: CacheStrategy = CacheStrategy.Default, signature?: string): ImageKnifeData | undefined { let option = this.getOption(loadSrc,signature) if (cacheType === CacheStrategy.Memory) { return this.readMemoryCache(option) ...
https://gitcode.com/CPF-ApplicationTPC/ImageKnife/blob/b77b0fbdd908f68c6c5b9baf28a9ca75c07b6d0a/library/src/main/ets/ImageKnife.ets#L285-L296
8e0be13aee6350f04a2b51fc87a4776b7f5f880c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/components/PreloadManager.ets
arkts
buildWebtoonPreloadTasks
条漫模式:构建预加载任务列表 @param visibleIndices 当前可见的页面索引列表 @param pages 所有页面数据 @param range 预加载范围(可见页面前后各加载多少页) @returns 预加载任务列表
buildWebtoonPreloadTasks(visibleIndices: number[], pages: MangaPage[], range: number = 8): PreloadTaskItem[] { const tasks: PreloadTaskItem[] = []; const preloadIndices = new Set<number>(); this.updateVisiblePages(visibleIndices); // 为每个可见页面添加前后范围内的页面 for (let i = 0; i < visibleIndices.lengt...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildWebtoonPreloadTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left visibleIndices AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AS...
buildWebtoonPreloadTasks(visibleIndices: number[], pages: MangaPage[], range: number = 8): PreloadTaskItem[] { const tasks: PreloadTaskItem[] = []; const preloadIndices = new Set<number>(); this.updateVisiblePages(visibleIndices); // 为每个可见页面添加前后范围内的页面 for (let i = 0; i < visibleIndices.lengt...
https://github.com/DaLongZhuaZi/manxia
73d8fbb3fba8041bb6a617142575d31b5924f9b5
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test48_original_index.ets
arkts
testObjectValues
--- Object.values ---
function testObjectValues(): string { let scores: Record<string, number> = {}; scores['math'] = 90; scores['english'] = 85; scores['science'] = 95; let vals: number[] = Object.values(scores); let total: number = 0; for (let i: number = 0; i < vals.length; i++) { total = total + vals[i]; } return S...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectValues AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined...
function testObjectValues(): string { let scores: Record<string, number> = {}; scores['math'] = 90; scores['english'] = 85; scores['science'] = 95; let vals: number[] = Object.values(scores); let total: number = 0; for (let i: number = 0; i < vals.length; i++) { total = total + vals[i]; } return S...
https://github.com/miaochiahao/ark-ghidra
60946a78939aaa0abb4316612cc04f95b5cb790d
github
the-wwyang/kids-learning-app
src/main/ets/services/StatisticsService.ets
arkts
calculateStreakDays
计算连续学习天数 @param dailyRecords 每日记录(需要按日期排序) @returns 连续学习天数
static calculateStreakDays(dailyRecords: DailyRecord[]): number { if (dailyRecords.length === 0) return 0; // 按日期降序排序 const sorted = [...dailyRecords].sort((a, b) => b.date.localeCompare(a.date)); let streak = 0; const today = new Date(); today.setHours(0, 0, 0, 0); for (let i = 0; i < ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateStreakDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dailyRecords AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs...
static calculateStreakDays(dailyRecords: DailyRecord[]): number { if (dailyRecords.length === 0) return 0; // 按日期降序排序 const sorted = [...dailyRecords].sort((a, b) => b.date.localeCompare(a.date)); let streak = 0; const today = new Date(); today.setHours(0, 0, 0, 0); for (let i = 0; i < ...
https://github.com/the-wwyang/kids-learning-app
46036fd065d4d3b3b201e22f0539bd8a5f3cc99d
github
wuba/omni-ui
omni_component/src/main/ets/components/filterbar/bean/OmniFilterItemBean.ets
arkts
clearChildSelectedStatus
清空子节点的选中状态
clearChildSelectedStatus(): void { if (this.children.length > 0) { for (const child of this.children) { child.isSelected = false; child.clearChildSelectedStatus(); // 递归清空子节点 } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearChildSelectedStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_e...
clearChildSelectedStatus(): void { if (this.children.length > 0) { for (const child of this.children) { child.isSelected = false; child.clearChildSelectedStatus(); // 递归清空子节点 } } }
https://github.com/wuba/omni-ui
8aad854b08d7daccf89b463b3df09289d2ed1e71
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/StepDao.ets
arkts
getStepRecordById
根据ID查询单个步数记录
async getStepRecordById(id: string): Promise<StepRecord | null> { const rdbStore = await this.initDatabase(); try { const predicates = new relationalStore.RdbPredicates('step_records'); predicates.equalTo('id', id); const resultSet = await rdbStore.query( predicates, ['id',...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getStepRecordById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async getStepRecordById(id: string): Promise<StepRecord | null> { const rdbStore = await this.initDatabase(); try { const predicates = new relationalStore.RdbPredicates('step_records'); predicates.equalTo('id', id); const resultSet = await rdbStore.query( predicates, ['id',...
https://gitcode.com/openharmony/codelabs
ef24ae3d1608a9768af6a6290ce7477207b4d6af
gitcode
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
isNetworkAvailable
判断当前设备网络是否可用 @returns
static isNetworkAvailable(): boolean { let allNets = NetworkUtil.getAllNetsSync(); if (allNets && allNets.length > 0) { return true; } else { return false; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNetworkAvailable 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 boolea...
static isNetworkAvailable(): boolean { let allNets = NetworkUtil.getAllNetsSync(); if (allNets && allNets.length > 0) { return true; } else { return false; } }
https://github.com/tdcare/tdwebrtc
200d20cca37a0d7b5327620a458110f01dfbb775
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/NetworkManager.ets
arkts
initialize
Initialize network monitoring
static async initialize(): Promise<void> { console.info(`${TAG}: Initializing network manager`); try { // Create network connection object netConnection = connection.createNetConnection(); // Register network state callback netConnection.register((error: BusinessError) => { i...
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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
static async initialize(): Promise<void> { console.info(`${TAG}: Initializing network manager`); try { // Create network connection object netConnection = connection.createNetConnection(); // Register network state callback netConnection.register((error: BusinessError) => { i...
https://github.com/tangwengang-del/freerdp-harmonyos
3cb70b528815eddaa6aecbf966dbe6b69811bc85
github
ZestBox-18/kitebook-frontend
commons/base/src/main/ets/utils/DebounceManager.ets
arkts
clearAll
清除所有防抖定时器
public clearAll(): void { DebounceManager.debounceTimers.forEach((timer, methodName) => { clearTimeout(timer.timerId); console.info(`[DebounceManager] ${methodName}方法的防抖定时器已被清除`); }); DebounceManager.debounceTimers.clear(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_st...
public clearAll(): void { DebounceManager.debounceTimers.forEach((timer, methodName) => { clearTimeout(timer.timerId); console.info(`[DebounceManager] ${methodName}方法的防抖定时器已被清除`); }); DebounceManager.debounceTimers.clear(); }
https://github.com/ZestBox-18/kitebook-frontend
d4985b96454526c28c2c336dd228f0ffa1f9af8a
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/DownloadsViewModel.ets
arkts
_generateSafeFileName
纯函数:仅负责生成文件名
private _generateSafeFileName(illustInfo: PixivIllust, url: string): string { // 获取后缀名 const extension = url.split('.').pop() || 'jpg'; // 只提取页码数字部分(如 _p0 → "0",_p12 → "12") const pageMatch = url.match(/_p(\d+)/); // 提取并安全化各个字段 const safeIllustId = `${illustInfo.id}`; const safePart = pag...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _generateSafeFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left illustInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
private _generateSafeFileName(illustInfo: PixivIllust, url: string): string { // 获取后缀名 const extension = url.split('.').pop() || 'jpg'; // 只提取页码数字部分(如 _p0 → "0",_p12 → "12") const pageMatch = url.match(/_p(\d+)/); // 提取并安全化各个字段 const safeIllustId = `${illustInfo.id}`; const safePart = pag...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L600-L640
7b8da2cc0fdf3ca3fd0240ede64825895a49c8b9
github
HarmonyOS_Samples/BestPracticeSnippets
TaskPoolPractice/entry/src/main/ets/pages/test.ets
arkts
concurrentFunc
[End err] [Start abc]
@Concurrent function concurrentFunc() { hilog.info(0xFF00, 'sampleTag', 'value: ' + a); }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left concurrentFunc AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST...
@Concurrent function concurrentFunc() { hilog.info(0xFF00, 'sampleTag', 'value: ' + a); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
1632b6eac7d10630600e7a17ea8df1b224fc25d0
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/LibFreeRDP.ets
arkts
getActiveConnectionCount
Get the count of active connections
static getActiveConnectionCount(): number { return instanceState.size; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getActiveConnectionCount 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 n...
static getActiveConnectionCount(): number { return instanceState.size; }
https://github.com/tangwengang-del/freerdp-harmonyos
8cab4f2b1a7276f0608f9fd8e05ef2fa9d794c03
github
HarmonyOS_Samples/guide-snippets
ArkData/DataShare/ShareConfig/entry/src/main/ets/pages/Index.ets
arkts
getSharedConfig
[End delete_shared_config] [Start get_shared_config]
function getSharedConfig() { dataShare.createDataProxyHandle().then((dataProxyHandle) => { const urisToGet: string[] = [ 'datashareproxy://com.samples.shareconfig/config1', 'datashareproxy://com.samples.shareconfig/config2' ]; const config: dataShare.DataProxyConfig = { type: dataShare.D...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getSharedConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_...
function getSharedConfig() { dataShare.createDataProxyHandle().then((dataProxyHandle) => { const urisToGet: string[] = [ 'datashareproxy://com.samples.shareconfig/config1', 'datashareproxy://com.samples.shareconfig/config2' ]; const config: dataShare.DataProxyConfig = { type: dataShare.D...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
a3efcf54066fda1b1f52e04d4a984f30105f3f43
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getAllSettings
==================== 设置管理方法 ==================== 获取所有设置
async getAllSettings(): Promise<UserSettingsDatabaseRecord[]> { try { const sql = 'SELECT * FROM user_settings WHERE userId = ?'; const result = await this.databaseManager.querySql(sql, ['default_user']); return result as UserSettingsDatabaseRecord[]; } catch (error) { logger.error(TAG...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllSettings 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#gener...
async getAllSettings(): Promise<UserSettingsDatabaseRecord[]> { try { const sql = 'SELECT * FROM user_settings WHERE userId = ?'; const result = await this.databaseManager.querySql(sql, ['default_user']); return result as UserSettingsDatabaseRecord[]; } catch (error) { logger.error(TAG...
https://github.com/DaLongZhuaZi/manxia
17f0f3db6e3e16dfafbc1ba5b79f19c10a085c2e
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/HelpFormatter.ets
arkts
renderWrappedTextBlock
Render the specified text width a maximum width. This method differs from renderWrappedText by not removing leading spaces after a new line. @param sb The StringBuffer to place the rendered text into. @param width The number of characters to display per line @param nextLineTabStop The position on the next line for the ...
private renderWrappedTextBlock(width: number, nextLineTabStop: number, text: string): string[] { let arr = text.split("\n"); let sb: Array<string> = new Array(); let firstLine = true; for (let index = 0;index < arr.length; index++) { if (!firstLine) { this.getNewLine(); } else { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left renderWrappedTextBlock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private renderWrappedTextBlock(width: number, nextLineTabStop: number, text: string): string[] { let arr = text.split("\n"); let sb: Array<string> = new Array(); let firstLine = true; for (let index = 0;index < arr.length; index++) { if (!firstLine) { this.getNewLine(); } else { ...
https://gitee.com/openharmony-sig/commons-cli.git
8d58fb8d16385c1ebf46d5a7829c4385809a576c
gitee
fbinba3955/Flymby
common/src/main/ets/utils/VolumeUtil.ets
arkts
getMaxVolume
获取最大音量值 @returns 最大音量值 0.0-1.0
public static async getMaxVolume(): Promise<number> { try { if (!VolumeUtil.audioVolumeGroupManager) { LogUtil.error('VolumeUtil 音量组管理器未初始化'); return VolumeUtil.MAX_VOLUME; } // 使用音量组管理器获取最大音量 const maxSystemVolume = await VolumeUtil.audioVolumeGroupManager.getMaxVolume(au...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getMaxVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#R...
public static async getMaxVolume(): Promise<number> { try { if (!VolumeUtil.audioVolumeGroupManager) { LogUtil.error('VolumeUtil 音量组管理器未初始化'); return VolumeUtil.MAX_VOLUME; } // 使用音量组管理器获取最大音量 const maxSystemVolume = await VolumeUtil.audioVolumeGroupManager.getMaxVolume(au...
https://github.com/fbinba3955/Flymby
4d5f57360bd2fe4ceb900b1d05cb643eb65026ce
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Byte.ets
arkts
byteValue
Returns value of this instance @returns value as byte
public override byteValue(): byte { return this.value; }
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 byteValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public override byteValue(): byte { return this.value; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
cc4978f287a17a055da75a6c704fb7cc2ebf4b6d
gitee
honjow/Next2V
shared/src/main/ets/services/AutoDailyCheckinService.ets
arkts
refreshAccountMetaAfterRedeem
Page-independent equivalent of AccountPage.loadAccountMeta(true): after a confirmed redeem, fetch the authoritative balance + mission and publish them through the single-writer AccountMetaPublisher so every surface (我的 card + 账号 detail) and the persisted cache reflect 已签到 + the new balance without an app restart. Best-...
private static async refreshAccountMetaAfterRedeem( context: common.UIAbilityContext, cookie: string, ): Promise<void> { const clean = (cookie || '').trim() if (!clean) { return } // Derive the owner key exactly as AccountPage does (session username + active multi-account id). When the...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left refreshAccountMetaAfterRedeem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#i...
private static async refreshAccountMetaAfterRedeem( context: common.UIAbilityContext, cookie: string, ): Promise<void> { const clean = (cookie || '').trim() if (!clean) { return } // Derive the owner key exactly as AccountPage does (session username + active multi-account id). When the...
https://github.com/honjow/Next2V
c10e25d18db160a09b36ddc56bd25a6012512781
github
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock.ets
arkts
generateEnvironmentData
生成环境数据
public generateEnvironmentData(): EnvironmentData { return { temperature: Number((22 + Math.random() * 4).toFixed(1)), // 22-26℃ humidity: Math.floor(50 + Math.random() * 20), // 50-70% lightLevel: Math.floor(200 + Math.random() * 300), // 200-500 lux noiseLevel: Math.floor(30 + Math.rando...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateEnvironmentData 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#Lef...
public generateEnvironmentData(): EnvironmentData { return { temperature: Number((22 + Math.random() * 4).toFixed(1)), // 22-26℃ humidity: Math.floor(50 + Math.random() * 20), // 50-70% lightLevel: Math.floor(200 + Math.random() * 300), // 200-500 lux noiseLevel: Math.floor(30 + Math.rando...
https://github.com/LJ666-ui/harmony-health-care
7b0612b0a5ba01b759795ac704920e3b1920ce7e
github
Eklps/harmony-mall-perf
entry/src/main/ets/viewmodel/CartModel.ets
arkts
increaseQuantity
增加商品数量
static increaseQuantity(itemId: string) { let cartList = AppStorage.get<CartItemType[]>('cartList') || []; const index = cartList.findIndex(cartItem => cartItem.goods.id === itemId); if (index >= 0) { cartList[index].quantity += 1; AppStorage.setOrCreate('cartList', [...cartList]); } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left increaseQuantity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
static increaseQuantity(itemId: string) { let cartList = AppStorage.get<CartItemType[]>('cartList') || []; const index = cartList.findIndex(cartItem => cartItem.goods.id === itemId); if (index >= 0) { cartList[index].quantity += 1; AppStorage.setOrCreate('cartList', [...cartList]); } ...
https://github.com/Eklps/harmony-mall-perf
60c377a71354016f9d64080dc6c1328f248466f9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayBlockingQueue.ets
arkts
pop
Removes and returns the first element in the BlockingQueue. If the queue is empty, blocking. @returns { T } the fisrt element poped in the queue.
override pop(): T { ConcurrencyHelpers.mutexLock(this.mutex); this.waitUntilQueueIsNotEmpty(); try { const val = this.array[this.curHeadIdx]; this.increaseHeadIdx(); return val as T; } finally { Concu...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left pop 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...
override pop(): T { ConcurrencyHelpers.mutexLock(this.mutex); this.waitUntilQueueIsNotEmpty(); try { const val = this.array[this.curHeadIdx]; this.increaseHeadIdx(); return val as T; } finally { Concu...
https://gitcode.com/iop123123/arkts-static-skills
fe13995981ce17dd04dac7672830a873fb9d7aae
gitcode
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmManager.ets
arkts
recalculateAllAlarmsAlarmTime
Refresh all alarms ALARM_TIME in database.
async recalculateAllAlarmsAlarmTime(isIntentMode?: boolean): Promise<void> { const alarmList = await this.getAllAlarms(); if (!alarmList || alarmList.length <= 0) { LogUtil.info(TAG, 'There is no alarm, no need to recalculate'); return; } const rdbStore = await this.getRdbStore(); try ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left recalculateAllAlarmsAlarmTime AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left isIntentMode AST#identifier#Right AST#?#Left ? AS...
async recalculateAllAlarmsAlarmTime(isIntentMode?: boolean): Promise<void> { const alarmList = await this.getAllAlarms(); if (!alarmList || alarmList.length <= 0) { LogUtil.info(TAG, 'There is no alarm, no need to recalculate'); return; } const rdbStore = await this.getRdbStore(); try ...
https://gitee.com/openharmony-sig/applications_clock.git
847677516b54c80933f72492173ce202e744fbb4
gitee
wuba/omni-ui
omni_component/src/main/ets/components/popup/BubbleComponent.ets
arkts
getBubbleTopRightRadius
获取右上圆角 @returns
getBubbleTopRightRadius(): number { return this.mBubbleTopRightRadius == -1 ? this.mBubbleRadius : this.mBubbleTopRightRadius }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBubbleTopRightRadius 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 AS...
getBubbleTopRightRadius(): number { return this.mBubbleTopRightRadius == -1 ? this.mBubbleRadius : this.mBubbleTopRightRadius }
https://github.com/wuba/omni-ui
d8a28dae7521dd1ac2469a11f676c035a72cfe71
github
arkui-x/samples
CodeLab/Cases/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
updateTableName
修改表名 @param oldTableName 旧表名 @param newTableName 新表名
async updateTableName(oldTableName: string, newTableName: string): Promise<void> { if (store === undefined) { return; } const updateTableSql: string = util.format(Constants.UPDATE_TABLE_SQL_TEMPLATE, oldTableName, newTableName); try { await store.executeSql(updateTableSql); } catch (er...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateTableName AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left oldTableName AST#identifier#R...
async updateTableName(oldTableName: string, newTableName: string): Promise<void> { if (store === undefined) { return; } const updateTableSql: string = util.format(Constants.UPDATE_TABLE_SQL_TEMPLATE, oldTableName, newTableName); try { await store.executeSql(updateTableSql); } catch (er...
https://gitcode.com/arkui-x/samples
44a38055968c934cb41aaec815654bad0bfe2b7e
gitcode
openharmony/arkcompiler_taihe_ffi_gen
test/ani_bundle/user/main.ets
arkts
test_bundle_interface_elementName_with_deviceId_noSet
elementName.d.ts
function test_bundle_interface_elementName_with_deviceId_noSet() { let eleName: elementName.ElementName = elementName.getElementName() let info = eleName.deviceId; console.log("eleName.deviceId: " + info) arktest.assertEQ(info, undefined); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_bundle_interface_elementName_with_deviceId_noSet AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AS...
function test_bundle_interface_elementName_with_deviceId_noSet() { let eleName: elementName.ElementName = elementName.getElementName() let info = eleName.deviceId; console.log("eleName.deviceId: " + info) arktest.assertEQ(info, undefined); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
dc341c6eab14c841c0d108c8eafa2a7b2e7b963d
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
writeIntLE
Writes a signed integer to the buffer at the specified offset using little-endian format @param {long} value - Value to write @param {int} offset - Number of bytes to skip before writing @param {int} byteLength - Number of bytes to write (maximum 6) @returns {int} Offset plus the number of bytes written @throws {Error}...
public writeIntLE(value: long, offset: int, byteLength: int): int { Buffer.checkByteLengthConstraint(byteLength); this.checkWriteInt(value, offset, byteLength); const view = this.getDataView(); let remaining = value; for (let i = 0; i < byteLength; i++...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeIntLE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#...
public writeIntLE(value: long, offset: int, byteLength: int): int { Buffer.checkByteLengthConstraint(byteLength); this.checkWriteInt(value, offset, byteLength); const view = this.getDataView(); let remaining = value; for (let i = 0; i < byteLength; i++...
https://gitcode.com/iop123123/arkts-static-skills
f6dbbef9bfae665a5d5cf59e74b0a4211a2eef86
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
pushOne
Adds the specified element to the end of an array and returns the new length of the array. @param { T } val The element to add to the end of the array. @returns { int } The new length of the array. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public pushOne(val: T): int { this.ensureUnusedCapacity(1) this.buffer[this.actualLength] = val this.actualLength += 1 return this.actualLength }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pushOne AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left val AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AS...
public pushOne(val: T): int { this.ensureUnusedCapacity(1) this.buffer[this.actualLength] = val this.actualLength += 1 return this.actualLength }
https://gitcode.com/iop123123/arkts-static-skills
99c35bec9fbf6652dc30758b7c257d45b6f7121f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getRegexStringWithSplitRules
使用分割规则获取正则字符串
private getRegexStringWithSplitRules(rules: string[], splitType: string): string { const results: string[] = []; for (const rule of rules) { const result = this.getStringByRegexSingle(rule); if (result) { results.push(result); if (splitType === '||') { return result;...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getRegexStringWithSplitRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rules AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
private getRegexStringWithSplitRules(rules: string[], splitType: string): string { const results: string[] = []; for (const rule of rules) { const result = this.getStringByRegexSingle(rule); if (result) { results.push(result); if (splitType === '||') { return result;...
https://github.com/DaLongZhuaZi/manxia
a13490e4f0d3547815b914c189f4973f359311b4
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCalendarViewModel.ets
arkts
setSelectedDates
设置多选模式下的选中日期数组(不可变方式) @param dates 日期字符串数组
setSelectedDates(dates: string[]): void { this.selectedDates = [...dates]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSelectedDates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left string A...
setSelectedDates(dates: string[]): void { this.selectedDates = [...dates]; }
https://github.com/codelably/tuniao-ui
12598b2e6522171e882794461dbaa31a43f447f4
github
dingzhilin1990/zhilinclaw
src/core/ZhiLinClawCore.ets
arkts
getPluginManager
获取插件管理器
public getPluginManager(): PluginManager { return this.pluginManager; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPluginManager 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 Plugi...
public getPluginManager(): PluginManager { return this.pluginManager; }
https://github.com/dingzhilin1990/zhilinclaw
e6301b8a5433e6e38b9526c87cb2e059b886e796
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
findLastIndex
Finds an index of the last element in the Uint16Array that satisfies the condition @param { function } fn - condition @returns { int } - the index of the last element that satisfies fn, -1 otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLastIndex(fn: (val: number, index: int, array: Uint16Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; i--) { if (fn(this.getUnsafe(i).toDouble(), i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
public findLastIndex(fn: (val: number, index: int, array: Uint16Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; i--) { if (fn(this.getUnsafe(i).toDouble(), i, this)) { return i } } return -1 }
https://gitcode.com/iop123123/arkts-static-skills
fb000dce9893deef96df7d0694c094cf666fa248
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getTableCount
获取表记录数量 使用 DatabaseManager 的类型安全聚合查询方法
private async getTableCount(tableName: string): Promise<number> { try { return await this.databaseManager.getTableCount(tableName); } catch (error) { logger.error(TAG, `获取表 ${tableName} 记录数失败`, String(error)); return 0; } }
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 getTableCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Le...
private async getTableCount(tableName: string): Promise<number> { try { return await this.databaseManager.getTableCount(tableName); } catch (error) { logger.error(TAG, `获取表 ${tableName} 记录数失败`, String(error)); return 0; } }
https://github.com/DaLongZhuaZi/manxia
28a9c07ab53e643a733d62aae533f6e8dc551e1e
github
codelably/HCompass
core/navigation/src/main/ets/NavigationService.ets
arkts
navigateBack
返回上一页 @param animated 是否需要动画
navigateBack(animated?: boolean): void { if (!this.stack) { return; } try { this.stack.pop(undefined, animated); this.log('Navigated back'); } catch (err) { this.logError(`Navigate back failed: ${JSON.stringify(err)}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigateBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animated AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERR...
navigateBack(animated?: boolean): void { if (!this.stack) { return; } try { this.stack.pop(undefined, animated); this.log('Navigated back'); } catch (err) { this.logError(`Navigate back failed: ${JSON.stringify(err)}`); } }
https://github.com/codelably/HCompass
ce4569183376408214a58f34e9aa0ca6ff20eb15
github