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
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/custom/A2UIComponent.ets
arkts
reportContentHeight
Reports the actual rendered content height to C++. Useful for custom components such as Markdown and Web whose height depends on rendered content. @param height Content height in vp @param width Content width in vp
public reportContentHeight(height: number, width: number): void { if (!this.getViewStatePtr()) { return; } nativeModule.reportComponentRenderSize( this.getContextId(), this.getNodeId(), this.customComponentType, height, width, this.getViewStatePtr() ); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reportContentHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left height AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public reportContentHeight(height: number, width: number): void { if (!this.getViewStatePtr()) { return; } nativeModule.reportComponentRenderSize( this.getContextId(), this.getNodeId(), this.customComponentType, height, width, this.getViewStatePtr() ); }
https://github.com/AGenUI/AGenUI
46fb0611cf8e0649d837d5f0d2d1188e7f00688f
github
OHPG/FinSdk
jellyfin/src/main/ets/api/SessionApi.ets
arkts
postCapabilities
postCapabilities @summary Updates capabilities for a device. @param {SessionApiPostCapabilitiesRequest} requestParameters Request parameters. @throws {RequiredError} @memberof SessionApi
public async postCapabilities(requestParameters: SessionApiPostCapabilitiesRequest = {}): Promise<void> { return this.apiClient.post({path: "/Sessions/Capabilities", parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left postCapabilities AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right ...
public async postCapabilities(requestParameters: SessionApiPostCapabilitiesRequest = {}): Promise<void> { return this.apiClient.post({path: "/Sessions/Capabilities", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
d70fca3b77048b1f1bee88e4996707cc8360b8e1
github
openharmony/applications_contacts
entry/src/main/ets/presenter/favorite/EditFavoriteListPresenter.ets
arkts
addSingleFavoriteSelectInfo
Add Selection Single Data @param isEditSelectList @param favoriteId
addSingleFavoriteSelectInfo(isEditSelectList: string[], favoriteBean: FavoriteBean): string[] { HiLog.i(TAG, 'addSingleFavoriteSelectInfo start.'); isEditSelectList.push(favoriteBean.contactId); if (1 === favoriteBean.isCommonUseType && !(this.usuallySelectList.indexOf(favoriteBean.displayName) >= 0)) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left addSingleFavoriteSelectInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isEditSelectList AST#identifier#Right AST#ERROR#Left AST#:#Left...
addSingleFavoriteSelectInfo(isEditSelectList: string[], favoriteBean: FavoriteBean): string[] { HiLog.i(TAG, 'addSingleFavoriteSelectInfo start.'); isEditSelectList.push(favoriteBean.contactId); if (1 === favoriteBean.isCommonUseType && !(this.usuallySelectList.indexOf(favoriteBean.displayName) >= 0)) { ...
https://gitee.com/openharmony/applications_contacts.git
236b557d1b7cd9e3f81eb268bf7f234c9562c7e8
gitee
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
getGoodsPage
分页查询商品 @param params 商品搜索请求参数 @returns 商品分页数据
async getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>> { return this.networkDataSource.getGoodsPage(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGoodsPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>> { return this.networkDataSource.getGoodsPage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
44d27668b226e11611994503e56ce3d400199987
github
wuba/omni-ui
omni_component/src/main/ets/components/toast/OmniToast.ets
arkts
showText
显示文本 @param options
public static showText(options: ToastOptions) { OmniToast.handleShowToast(options) }
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 showText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#...
public static showText(options: ToastOptions) { OmniToast.handleShowToast(options) }
https://github.com/wuba/omni-ui
c8aee0ce5f4280a32fe134e4a380b7e62f04cb92
github
openharmony/arkui_ace_engine
advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets
arkts
deduplicate
Array deduplication
deduplicate(arr: GridObjectSortComponentItem[]) { const result: GridObjectSortComponentItem[] = []; arr.forEach(item => { if (!result.some(x => x.id === item.id)) { result.push(item); } }); return result; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deduplicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left ...
deduplicate(arr: GridObjectSortComponentItem[]) { const result: GridObjectSortComponentItem[] = []; arr.forEach(item => { if (!result.some(x => x.id === item.id)) { result.push(item); } }); return result; }
https://gitee.com/openharmony/arkui_ace_engine.git
86235e52283fb4b0acfac47a0f0d6937865878a6
gitee
HarmonyOS_Samples/BestPracticeSnippets
LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets
arkts
aboutToDisappear
Call back when the NodeContainer corresponding to the controller is Disappear.
aboutToDisappear(): void { hilog.info(DOMAIN, TAG, 'aboutToDisappear'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
aboutToDisappear(): void { hilog.info(DOMAIN, TAG, 'aboutToDisappear'); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
0babe5af094273e74d837a4358314fd791f44f85
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/UsbDriverService.ets
arkts
handleUsbDevice
处理 USB 设备
private async handleUsbDevice(device: usbManager.USBDevice): Promise<void> { // 使用 busNum:devAddress 作为物理位置唯一标识 const deviceKey = `${device.vendorId}:${device.productId}:${device.busNum}:${device.devAddress}`; // 检查是否已处理此物理位置的设备 if (this.processedDevices.has(deviceKey)) { return; } ...
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 handleUsbDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Lef...
private async handleUsbDevice(device: usbManager.USBDevice): Promise<void> { // 使用 busNum:devAddress 作为物理位置唯一标识 const deviceKey = `${device.vendorId}:${device.productId}:${device.busNum}:${device.devAddress}`; // 检查是否已处理此物理位置的设备 if (this.processedDevices.has(deviceKey)) { return; } ...
https://github.com/AlkaidLab/moonlight-harmony
13f9efc139a55b4449e9668544944001497b5d94
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDataManager.ets
arkts
getRecentBooks
获取最近阅读的书籍
async getRecentBooks(limit: number = 20): Promise<NovelBook[]> { const store = this.getStore(); const rs = await store.querySql( `SELECT * FROM novel_book WHERE lastReadTime > 0 ORDER BY lastReadTime DESC LIMIT ?`, [limit] ); return this.parseBookResults(rs); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRecentBooks AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left limit AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async getRecentBooks(limit: number = 20): Promise<NovelBook[]> { const store = this.getStore(); const rs = await store.querySql( `SELECT * FROM novel_book WHERE lastReadTime > 0 ORDER BY lastReadTime DESC LIMIT ?`, [limit] ); return this.parseBookResults(rs); }
https://github.com/DaLongZhuaZi/manxia
2e9d4be8f15eda68734052daf9aac7a735cc5e19
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
getRecordTypeFromTableName
根据表名获取记录类型
private getRecordTypeFromTableName(tableName: string): DatabaseRecordType | null { switch (tableName) { case 'comic_source': return DatabaseRecordType.COMIC_SOURCE; case 'comic_info': return DatabaseRecordType.COMIC_INFO; case 'chapter': return DatabaseRecordType.CHAPTER_...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getRecordTypeFromTableName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left s...
private getRecordTypeFromTableName(tableName: string): DatabaseRecordType | null { switch (tableName) { case 'comic_source': return DatabaseRecordType.COMIC_SOURCE; case 'comic_info': return DatabaseRecordType.COMIC_INFO; case 'chapter': return DatabaseRecordType.CHAPTER_...
https://github.com/DaLongZhuaZi/manxia
711dc4738b395fe34592a6da4311ad7ff046b75e
github
Delsin-Yu/JustPDF
entry/src/main/ets/pages/pdfview/PDFTunerController.ets
arkts
detectPitchHz
MPM(McLeod Pitch Method)基频检测: 1. 计算 NSDF(Normalized Square Difference Function) 2. 在当前预设音域内寻找局部峰值 3. 对最佳峰值做抛物线插值,并结合前一帧音高抑制跳变
private detectPitchHz(samples: Float32Array): number { const n: number = samples.length; const preset = this.getCurrentFilterPresetDefinition(); const minLag: number = Math.floor(TunerMicSampleRateHz / preset.pitchMaxHz); const maxLag: number = Math.min( Math.floor(TunerMicSampleRateHz / preset....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left detectPitchHz AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left samples AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private detectPitchHz(samples: Float32Array): number { const n: number = samples.length; const preset = this.getCurrentFilterPresetDefinition(); const minLag: number = Math.floor(TunerMicSampleRateHz / preset.pitchMaxHz); const maxLag: number = Math.min( Math.floor(TunerMicSampleRateHz / preset....
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFTunerController.ets#L999-L1075
e774b579f3a20166e1b61270fc6ff0e07c151041
github
openharmony-sig/ohos_easyui
easyui/src/main/ets/common/components/beans/ImageItem.ets
arkts
constructor
图片文件名
constructor(name: string){ this.name = name; console.log("+++"+this.name) }
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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A...
constructor(name: string){ this.name = name; console.log("+++"+this.name) }
https://gitee.com/openharmony-sig/ohos_easyui.git
41f793172b7e1d9018d61b2e4b01a3d6f64a7981
gitee
arkui-x/samples
CodeLab/Cases/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
backup
备份数据库 @param callback 版本升级方法 @param version 版本
async backup(version: number): Promise<void> { if (store === undefined) { return; } await store.backup(version + Constants.DB_FILE_NAME_SUFFIX); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left backup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left version AST#identifier#Right AST#type_...
async backup(version: number): Promise<void> { if (store === undefined) { return; } await store.backup(version + Constants.DB_FILE_NAME_SUFFIX); }
https://gitcode.com/arkui-x/samples
22af8ecd3bd6730e8b2047a9d2a2bce341aef1bd
gitcode
gongshijier/harmonyLab
entry/src/main/ets/feed/load/db/DBHelper.ets
arkts
initDb
create && init db
initDb() { db.getRdbStore(globalThis.appContext, { name: "rdbstore.db", securityLevel: 1 }, (err, rdbStore) => { this.dbInstance = rdbStore rdbStore.executeSql(DBConstants.CREATE_TABLE_TEST) this.insert() this.query() hilog.info(0x0000, 'DBHelper', '%{public}s', 'db init !'); }) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initDb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#...
initDb() { db.getRdbStore(globalThis.appContext, { name: "rdbstore.db", securityLevel: 1 }, (err, rdbStore) => { this.dbInstance = rdbStore rdbStore.executeSql(DBConstants.CREATE_TABLE_TEST) this.insert() this.query() hilog.info(0x0000, 'DBHelper', '%{public}s', 'db init !'); }) ...
https://github.com/gongshijier/harmonyLab
9220ec4688ccfc3ff51f9a15443a9ee2b9b898eb
github
apap6628114/nga_oh
entry/src/main/ets/store/AppStore.ets
arkts
autoCheckinIfNeeded
若自动签到实际成功,则显示全局成功提示。
autoCheckinIfNeeded(): void { this.settingsStore.autoCheckinIfNeeded().then((checked: boolean): void => { if (checked) { this.showToast('自动签到成功') } }).catch((): void => {}) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left autoCheckinIfNeeded 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#statemen...
autoCheckinIfNeeded(): void { this.settingsStore.autoCheckinIfNeeded().then((checked: boolean): void => { if (checked) { this.showToast('自动签到成功') } }).catch((): void => {}) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AppStore.ets#L157-L163
e163e4134f3f15bcc0e8d704a9fe77f2e5434447
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
findIndex
Finds an index of the first element in the BigInt64Array that satisfies the condition @param fn condition @returns the index of the first element that satisfies fn
public findIndex(fn: (val: long, index: int, array: BigInt64Array) => boolean): int { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, 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 findIndex 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#...
public findIndex(fn: (val: long, index: int, array: BigInt64Array) => boolean): int { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
68a851a2b6409dc4fe598648394aff6a8797b584
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCountToViewModel.ets
arkts
resumeControl
继续手动控制的动画
resumeControl(): void { this.controlController.resume(); this.controlStatusText = "动画中"; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resumeControl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
resumeControl(): void { this.controlController.resume(); this.controlStatusText = "动画中"; }
https://github.com/codelably/tuniao-ui
e982d01c8b4e1d5bf1a78847d7cf2d3364806ef6
github
luojiang001/Pulse
Pulse/oh_modules/collect_personal_info/src/main/ets/common/WindowModel.ets
arkts
unRegisterWindowBottomPadding
取消监听底部避让区域变化
public unRegisterWindowBottomPadding() { window.getLastWindow(getContext()).then(currentWindow => { currentWindow.off('avoidAreaChange', this.getWindowBottomPadding); }) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unRegisterWindowBottomPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#L...
public unRegisterWindowBottomPadding() { window.getLastWindow(getContext()).then(currentWindow => { currentWindow.off('avoidAreaChange', this.getWindowBottomPadding); }) }
https://github.com/luojiang001/Pulse
c9bb9f0854b935aaa4aae62faa7ed299713f6fbc
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/IsoFileUtil.ets
arkts
formatIsoSize
格式化ISO文件大小显示 @param bytes 字节数 @returns 格式化字符串
static formatIsoSize(bytes: number): string { return ToolsUtil.formatFileSize(bytes) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatIsoSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
static formatIsoSize(bytes: number): string { return ToolsUtil.formatFileSize(bytes) }
https://github.com/Yebingiscn/SweetVideo
3b834b8d8bc99d62617e181818dbdf5a8fd1bcc3
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
constructor
A constructor used to create a Scope instance with the lower and upper bounds specified. @param { ScopeType } lowerObj - A ScopeType value @param { ScopeType } upperObj - A ScopeType value
constructor(lowerObj: T, upperObj: T) { if (lowerObj.compareTo(upperObj)) { throw new Error('lower limit must be less than upper limit'); } this._lowerLimit = lowerObj this._upperLimit = upperObj }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lowerObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AS...
constructor(lowerObj: T, upperObj: T) { if (lowerObj.compareTo(upperObj)) { throw new Error('lower limit must be less than upper limit'); } this._lowerLimit = lowerObj this._upperLimit = upperObj }
https://gitcode.com/iop123123/arkts-static-skills
0018d359c2a28e498b588c5d7f399d56e81e3178
gitcode
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets
arkts
setMessageHandler
Sets the given {@link io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler} as the singular handler for all incoming messages received from the Dart side of this Dart execution context. @param channel the name of the channel. @param handler a {@link BinaryMessageHandler} to be invoked on incoming messages, or ...
setMessageHandler(channel: String, handler: BinaryMessageHandler | SendableBinaryMessageHandler | null, taskQueue?: TaskQueue, ...args: Object[]): void { this.messenger.setMessageHandler(channel, handler, taskQueue, ...args); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMessageHandler AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left channel AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left String AST#identifier#Right AST#ERROR#Right AST#,#L...
setMessageHandler(channel: String, handler: BinaryMessageHandler | SendableBinaryMessageHandler | null, taskQueue?: TaskQueue, ...args: Object[]): void { this.messenger.setMessageHandler(channel, handler, taskQueue, ...args); }
https://gitee.com/openharmony-sig/flutter_engine.git
695025d4ae547f2875169787a2d7233418c4bc62
gitee
Goway-Hui/harmonyos-next-dev
harmonyos-next-dev/assets/network-request-template.ets
arkts
request
==================== 核心请求方法 ====================
private async request<T>( url: string, method: http.RequestMethod, body?: object ): Promise<ApiResponse<T>> { let req = http.createHttp(); try { let result = await req.request(url, { method: method, header: this.buildHeaders(), extraData: body ? JSON.stringify(body)...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left request AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AS...
private async request<T>( url: string, method: http.RequestMethod, body?: object ): Promise<ApiResponse<T>> { let req = http.createHttp(); try { let result = await req.request(url, { method: method, header: this.buildHeaders(), extraData: body ? JSON.stringify(body)...
https://github.com/Goway-Hui/harmonyos-next-dev
cff880bfac18da7712691aef0dfe76f00b2fc0f0
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryExecutor.ets
arkts
getAsync
异步执行查询(使用 TaskPool 优化大数据量场景) 当数据量超过阈值时,使用 TaskPool 在后台线程执行数据转换 当数据量小于等于阈值时,在主线程直接执行以避免线程切换开销 @returns Promise<Array<EntityData>> Requirements: 1.1, 1.4, 1.5
async getAsync(): Promise<Array<EntityData>> { return await this.withStoreLease(async () => { this.ensureEntityQueryMode('SELECT') const startTime = Date.now() const subQueryContext = this.createSubQueryExecutionContext() await DatabaseManager.getInstance().acquireQuerySlot() try { ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAsync 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#generic_typ...
async getAsync(): Promise<Array<EntityData>> { return await this.withStoreLease(async () => { this.ensureEntityQueryMode('SELECT') const startTime = Date.now() const subQueryContext = this.createSubQueryExecutionContext() await DatabaseManager.getInstance().acquireQuerySlot() try { ...
https://github.com/offlinecat-dev/OCNetORM
bc63755ad597d124b9bb032f2158f4bc7af19249
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/common/utils/PreferencesUtil.ets
arkts
addWeekFormId
添加周数据卡片的 formId
addWeekFormId(preferences: preferences.Preferences, formId: string): void { try { let formIds = this.getWeekFormIds(preferences); if (formIds.indexOf(formId) === -1) { formIds.push(formId); this.preferencesPut(preferences, 'weekFormIdList', formIds); hilog.info(0x0000, TAG, `ad...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addWeekFormId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left preferences AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left preferen...
addWeekFormId(preferences: preferences.Preferences, formId: string): void { try { let formIds = this.getWeekFormIds(preferences); if (formIds.indexOf(formId) === -1) { formIds.push(formId); this.preferencesPut(preferences, 'weekFormIdList', formIds); hilog.info(0x0000, TAG, `ad...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
9bc3a7581734e450fbe202dee5e3fc5f6b3c9185
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/WorkerLocal.ets
arkts
delete
Delete the worker-local value for current worker.
delete(): void { this.mutex.lockGuard(() => { const workerId = CoroutineExtras.getWorkerId(); this.storage.delete(workerId); }); }
AST#program#Left AST#expression_statement#Left AST#unary_expression#Left AST#delete#Left delete AST#delete#Right AST#ERROR#Left 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 AST#void#Lef...
delete(): void { this.mutex.lockGuard(() => { const workerId = CoroutineExtras.getWorkerId(); this.storage.delete(workerId); }); }
https://gitcode.com/iop123123/arkts-static-skills
24c185e3c1ba45a40db217054bfcc977c3f25d62
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SharedLedger.ets
arkts
getAttachments
获取附件列表
getAttachments(): string[] { try { const parsed = JSON.parse(this.attachmentsJson) as string[]; return parsed; } catch (e) { return []; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAttachments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
getAttachments(): string[] { try { const parsed = JSON.parse(this.attachmentsJson) as string[]; return parsed; } catch (e) { return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
3d97626f6f7c75a07199c4f47372361815a38f8f
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/utils/RouterManager.ets
arkts
init
初始化路由(在 Index 页面设置)
static init(pathStack: NavPathStack): void { RouterManager.pathStack = pathStack; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pathStack AST#identifier#Right AST#:#Left : AST#:#Right AST...
static init(pathStack: NavPathStack): void { RouterManager.pathStack = pathStack; }
https://github.com/Amaz1ny/HarmonyDO-public
410fcaf39023019f5b046bd5ea62240a6bb2ad76
github
HarmonyOS_Samples/BestPracticeSnippets
NdkDrawing/entry/src/main/ets/pages/Index.ets
arkts
resetType
Set the drawing type
resetType(type: DrawType): void { this.drawType = type; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetType 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#Left DrawType AST#identifier#Right AST#)#Left ) AST...
resetType(type: DrawType): void { this.drawType = type; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
15abf17b773e6245d7279189d1ffb16c74732867
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets
arkts
linearOutSlowIn
线性快出插值器
static linearOutSlowIn(): curves.ICurve { return AnimationInterpolator.cubicBezier(0, 0, 0.2, 1); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left linearOutSlowIn 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#member_expression#Left...
static linearOutSlowIn(): curves.ICurve { return AnimationInterpolator.cubicBezier(0, 0, 0.2, 1); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
e16ee5d656d7e2c007c9ff319db8c3e098d42026
gitcode
openharmony/codelabs
Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets
arkts
checkCollision
检查是否发生碰撞
checkCollision() { var that = this; let myPlane = new GameElement(); myPlane.positionX = this.planePosX myPlane.positionY = this.bulletPosY myPlane.imgWidth = this.planeSize myPlane.imgHeight = this.planeSize let props = new GameElement(); props.positionX = this.propsPosX props.p...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkCollision 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#Lef...
checkCollision() { var that = this; let myPlane = new GameElement(); myPlane.positionX = this.planePosX myPlane.positionY = this.bulletPosY myPlane.imgWidth = this.planeSize myPlane.imgHeight = this.planeSize let props = new GameElement(); props.positionX = this.propsPosX props.p...
https://gitee.com/openharmony/codelabs.git
c2ba223bdb7dd7493bb20c57c987328df38ea816
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
slice
Creates a slice of current BigUint64Array using range [begin, this.length). @param begin start index to be taken into slice @returns a new BigUint64Array with elements of current BigUint64Array[begin, this.length)
public slice(begin: number): BigUint64Array { return this.slice(begin as int) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public slice(begin: number): BigUint64Array { return this.slice(begin as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
d6444627b59710c5153d1cb75c0bba73e93e145e
gitee
LongLiveY96/chatcube
entry/src/main/ets/pages/ChatPage.ets
arkts
handleTranslate
处理翻译请求
handleTranslate(content: string, targetLang: string, callback: (result: string, errorMessage: string) => void): void { this.aiTaskService.translateText(content, targetLang).then((result) => { if (result.success) { callback(result.content, '') } else { callback('', result.errorMessage) ...
AST#program#Left AST#ERROR#Left AST#identifier#Left handleTranslate AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left content AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left targetLa...
handleTranslate(content: string, targetLang: string, callback: (result: string, errorMessage: string) => void): void { this.aiTaskService.translateText(content, targetLang).then((result) => { if (result.success) { callback(result.content, '') } else { callback('', result.errorMessage) ...
https://github.com/LongLiveY96/chatcube
d4ecde7e84fa957f864525b1fef288a416e81425
github
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets
arkts
getRevokeUrl
获取撤销令牌的URL(由子类重写) @return string | undefined 撤销URL
protected getRevokeUrl(): string | undefined { return undefined; }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getRevokeUrl 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_expressio...
protected getRevokeUrl(): string | undefined { return undefined; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L355-L357
259382fd940c2e8343f8feed3fd79e7f8daf1903
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an empty Int8Array. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor() { this(0) }
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
public constructor() { this(0) }
https://gitcode.com/iop123123/arkts-static-skills
058be3930d22948ef211b37b8d3501336c7cde34
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
updateDatabaseVersion
更新数据库版本
private async updateDatabaseVersion(version: number): Promise<void> { try { const store = this.getStore(); await store.executeSql(`PRAGMA user_version = ${version}`); } catch (error) { logger.error(TAG, `更新数据库版本失败: ${String(error)}`); throw error as Error; } }
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 updateDatabaseVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left version AST#identifier#Right AST#ERROR#Left AS...
private async updateDatabaseVersion(version: number): Promise<void> { try { const store = this.getStore(); await store.executeSql(`PRAGMA user_version = ${version}`); } catch (error) { logger.error(TAG, `更新数据库版本失败: ${String(error)}`); throw error as Error; } }
https://github.com/DaLongZhuaZi/manxia
31827dca5ff256079a14a4397058806ec491b28d
github
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
read
read @param bleDevice @param uuid_service @param uuid_read @param callback
public read(bleDevice: BleDevice, uuid_service: string, uuid_read: string, callback: BleReadCallback) { if (callback == null) { throw new EvalError("BleReadCallback can not be Null!"); } if (this.multipleBluetoothController !== null) { let bleBluetooth: BleBluetooth | null = this.multipleBluet...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left read AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bleDevice AST#identifier#Right AST#:#Left : ...
public read(bleDevice: BleDevice, uuid_service: string, uuid_read: string, callback: BleReadCallback) { if (callback == null) { throw new EvalError("BleReadCallback can not be Null!"); } if (this.multipleBluetoothController !== null) { let bleBluetooth: BleBluetooth | null = this.multipleBluet...
https://gitee.com/openharmony-sig/FastBle.git
9089f0699056fe2f16210dcd97a104eecec378dd
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Map.ets
arkts
values
Returns elements from the Map as an values Iterator @returns ValueIterator with map values
values(): ValuesIterator<V> { let en = treeToArray(this.tree); let ret = new V[en.length]; for (let i: int = 0; i < ret.length; i++) { ret[i] = en[i].value; } return new ValuesIterator<V>(ret); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left values 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#binary_expression#Left AS...
values(): ValuesIterator<V> { let en = treeToArray(this.tree); let ret = new V[en.length]; for (let i: int = 0; i < ret.length; i++) { ret[i] = en[i].value; } return new ValuesIterator<V>(ret); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e8c1dc5d04cdd81da69b705c9f9381fb295c70cc
gitee
SuppliedGoat435/NumberSlidingPuzzle
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
init
── 初始化游戏 ──────────────────────────────
init(difficulty: Difficulty) { this.size = difficulty as number this.steps = 0 this.seconds = 0 this.isCompleted = false this.isRunning = false this.stopTimer() const base = PuzzleUtil.generateBoard(this.size) this.board = PuzzleUtil.shuffle(base, this.size) this.startTimer() t...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Difficulty AST#identifier#Righ...
init(difficulty: Difficulty) { this.size = difficulty as number this.steps = 0 this.seconds = 0 this.isCompleted = false this.isRunning = false this.stopTimer() const base = PuzzleUtil.generateBoard(this.size) this.board = PuzzleUtil.shuffle(base, this.size) this.startTimer() t...
https://github.com/SuppliedGoat435/NumberSlidingPuzzle
f762e6c93f4e473dc6ff569df3568f93efd21614
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/http/HttpsCertPinPage.ets
arkts
getContent
加载文件内容
getContent(filePath: string): ArrayBuffer | undefined { let content: ArrayBuffer | undefined = undefined try { let buf = new ArrayBuffer(1024 * 64); let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let readLen = fs.readSync(file.fd, buf, { offset: 0 }); content = buf.slice(0, r...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
getContent(filePath: string): ArrayBuffer | undefined { let content: ArrayBuffer | undefined = undefined try { let buf = new ArrayBuffer(1024 * 64); let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let readLen = fs.readSync(file.fd, buf, { offset: 0 }); content = buf.slice(0, r...
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/http/HttpsCertPinPage.ets#L205-L217
9c1caa77ae00ecd80039ef15dcf5fa35bc6ef5f1
github
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/Classes/ScheduleManager.ets
arkts
rebuildDefaultIndex
根据课程列表重建默认页面展示的周索引 @param classes 课程列表 @returns undefined,但如果发生错误则返回错误信息的字符串
private rebuildDefaultIndex(classes: classAttribute[]): string | undefined { try { this.defaultIndex.clear(); for (const classItem of classes) { for (const week of classItem.weekOfTerm) { if (!this.defaultIndex.has(week)) { this.defaultIndex.set(week, new Map()); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rebuildDefaultIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left classes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr...
private rebuildDefaultIndex(classes: classAttribute[]): string | undefined { try { this.defaultIndex.clear(); for (const classItem of classes) { for (const week of classItem.weekOfTerm) { if (!this.defaultIndex.has(week)) { this.defaultIndex.set(week, new Map()); ...
https://github.com/Your-USTC/DailyNic_HMOS
f672b15dcd8a37413805c2ab1953fef5bd4ba22e
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/network/NetworkResponse.ets
arkts
constructor
构造函数,对接口返回做空值兜底 @param {Partial<NetworkResponse<T>>} payload - 接口原始数据
constructor(payload?: Partial<NetworkResponse<T>>) { this.data = payload?.data ?? null; this.code = payload?.code !== undefined ? Number(payload.code) : 1000; this.message = payload?.message ?? null; }
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 payload AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
constructor(payload?: Partial<NetworkResponse<T>>) { this.data = payload?.data ?? null; this.code = payload?.code !== undefined ? Number(payload.code) : 1000; this.message = payload?.message ?? null; }
https://github.com/Joker-x-dev/CoolMallArkTS
ac93074071e7f10a645fce3b301899736fa9461a
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/AvPlayManager.ets
arkts
initPlayer
初始化视频
async initPlayer(ctx: common.UIAbilityContext, surfaceId: string, callback: (avPlayer: media.AVPlayer) => void): Promise<void> { Logger.info(this.tag, `initPlayer==initCamera surfaceId== ${surfaceId}`); this.surfaceID = surfaceId; Logger.info(this.tag, `initPlayer==this.surfaceID surfaceId== ${this.su...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initPlayer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async initPlayer(ctx: common.UIAbilityContext, surfaceId: string, callback: (avPlayer: media.AVPlayer) => void): Promise<void> { Logger.info(this.tag, `initPlayer==initCamera surfaceId== ${surfaceId}`); this.surfaceID = surfaceId; Logger.info(this.tag, `initPlayer==this.surfaceID surfaceId== ${this.su...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
7441df898edd1d08d8198b0da03ac4a8058cc727
gitee
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
getCurrentMusic
获取当前播放音乐
getCurrentMusic(): MusicInfo | null { if (this.currentIndex >= 0 && this.currentIndex < this.playlist.length) { return this.playlist[this.currentIndex]; } return null; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentMusic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident...
getCurrentMusic(): MusicInfo | null { if (this.currentIndex >= 0 && this.currentIndex < this.playlist.length) { return this.playlist[this.currentIndex]; } return null; }
https://github.com/cpdd5201314/harmonyOS-music-app
5fadcaa7cf442b76a1277a066248ef840d01fff2
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets
arkts
buildCartList
构建购物车列表 @param {OrderGoods[]} goodsList - 订单商品列表 @returns {Cart[]} 购物车列表
private buildCartList(goodsList: OrderGoods[]): Cart[] { const groupedMap = new Map<number, OrderGoods[]>(); for (const goods of goodsList) { const existingList = groupedMap.get(goods.goodsId); if (existingList) { existingList.push(goods); } else { groupedMap.set(goods.goods...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildCartList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left goodsList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_...
private buildCartList(goodsList: OrderGoods[]): Cart[] { const groupedMap = new Map<number, OrderGoods[]>(); for (const goods of goodsList) { const existingList = groupedMap.get(goods.goodsId); if (existingList) { existingList.push(goods); } else { groupedMap.set(goods.goods...
https://github.com/Joker-x-dev/CoolMallArkTS
29965db45107b4cb87f74a393d9487c9b3948917
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
buildDataRow
Builds a data row for the specified index @param {number} rowIndex - Index of the row to build @returns {string} Formatted data row @private
private buildDataRow(rowIndex: int): string { const paddedIndex = `${rowIndex}`.padEnd(this._indexColumnWidth - 4); let row: string = `│ ${paddedIndex} │`; for (const col of this.tableModel.keys()) { const colWidth = this.columnWidths.get(col)!; const colContent = thi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildDataRow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rowIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#iden...
private buildDataRow(rowIndex: int): string { const paddedIndex = `${rowIndex}`.padEnd(this._indexColumnWidth - 4); let row: string = `│ ${paddedIndex} │`; for (const col of this.tableModel.keys()) { const colWidth = this.columnWidths.get(col)!; const colContent = thi...
https://gitcode.com/iop123123/arkts-static-skills
815d556405462c77a74fc5d3753613eebfea9ac1
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/CrashLogService.ets
arkts
unsubscribeCrashEvent
取消订阅崩溃事件
public unsubscribeCrashEvent(): void { if (this.watcher) { try { hiAppEvent.removeWatcher(this.watcher); hilog.info(DOMAIN, TAG, 'Crash event watcher removed'); } catch (error) { const err = error as BusinessError; hilog.error(DOMAIN, TAG, 'Failed to remove crash event ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unsubscribeCrashEvent 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#...
public unsubscribeCrashEvent(): void { if (this.watcher) { try { hiAppEvent.removeWatcher(this.watcher); hilog.info(DOMAIN, TAG, 'Crash event watcher removed'); } catch (error) { const err = error as BusinessError; hilog.error(DOMAIN, TAG, 'Failed to remove crash event ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L147-L158
8705f2929fa43ed5667c5629ca3b1a2d700affaa
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Parser.ets
arkts
skipWhitespace
跳过空白字符
private skipWhitespace(): void { while (this.pos < this.html.length && /\s/.test(this.html[this.pos])) { this.pos++; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left skipWhitespace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr...
private skipWhitespace(): void { while (this.pos < this.html.length && /\s/.test(this.html[this.pos])) { this.pos++; } }
https://github.com/DaLongZhuaZi/manxia
4710ccf3a51bb93923b4f36af7bca77529a850d4
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGRect.ets
arkts
getX
获取x坐标
public getX(): number{ return this._x; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getX AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public getX(): number{ return this._x; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
3724454746f32eef5a6783f1cce4e0a7115553e5
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
toReversed
Copying version of the reverse() method. It returns a new array with the elements in reversed order. @returns reversed copy of the current Array
public toReversed(): Array<T> { let arr = new T[this.data.length] let count = this.data.length - 1 for(let i = 0; i < this.data.length; i++) { arr[count] = this.data[i] count-- } return new Array<T>(arr) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#...
public toReversed(): Array<T> { let arr = new T[this.data.length] let count = this.data.length - 1 for(let i = 0; i < this.data.length; i++) { arr[count] = this.data[i] count-- } return new Array<T>(arr) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
805b7e57aed2a46673a9af7ec375136357c96238
gitee
Countly/countly-sdk-hos
library/src/main/ets/internal/RequestQueue.ets
arkts
enterBackoff
Enter backoff with exponential delay: bom_d, 2·bom_d, 4·bom_d, ... capped at 15 minutes. On the first success, `consecutiveBackedOff` resets so the next failure starts back at bom_d. The base is server-tunable via `bom_d` (default 60s); the multiplier and ceiling are not.
private enterBackoff(): void { const baseMs: number = this.config.serverConfig.bomDuration * 1000; const exponent: number = Math.min(this.consecutiveBackedOff, 8); const delay: number = Math.min(baseMs * Math.pow(2, exponent), BACKOFF_MAX_MS); this.backoffUntilMs = Date.now() + delay; this.consecu...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left enterBackoff 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#voi...
private enterBackoff(): void { const baseMs: number = this.config.serverConfig.bomDuration * 1000; const exponent: number = Math.min(this.consecutiveBackedOff, 8); const delay: number = Math.min(baseMs * Math.pow(2, exponent), BACKOFF_MAX_MS); this.backoffUntilMs = Date.now() + delay; this.consecu...
https://github.com/Countly/countly-sdk-hos
ab59b12e28cd8aff9d727ac2cbb7b9ec6900e51b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getMethod
Returns ith Method of this class @param {long} i index (using flat semantic) @throws {TypeError} when i greater then number of methods @returns {Method} ith method @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getMethod(i: long): Method { const td = TypeAPI.getMethodDescriptor(this.cls, i) if (td) { const methodType = Type.resolve(td, this.getContextLinker())! as MethodType const ownerClass = TypeAPI.getDeclaringClassImpl(methodType)! const ownerType = Type.resol...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMethod AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long AST#...
public getMethod(i: long): Method { const td = TypeAPI.getMethodDescriptor(this.cls, i) if (td) { const methodType = Type.resolve(td, this.getContextLinker())! as MethodType const ownerClass = TypeAPI.getDeclaringClassImpl(methodType)! const ownerType = Type.resol...
https://gitcode.com/iop123123/arkts-static-skills
a2532601c30ac165b5c3ac8e76bc531b643c1b91
gitcode
CsCesium/KantaiHomo
entry/src/main/ets/app/pages/components/panel/battle/BattlePreviewPanel.ets
arkts
shipNameColor
已退避舰名 / HP 全部置灰,其余沿用原有损伤配色。
function shipNameColor(ship: ShipBattleStatus): string { if (ship.isSunk) return PanelColors.txtMuted; if (isShipEscaped(ship.uid)) return PanelColors.escapeHp; return ship.hasSinkRisk ? PanelColors.hpSinkRisk : PanelColors.txtPrimary; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left shipNameColor AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ship AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function shipNameColor(ship: ShipBattleStatus): string { if (ship.isSunk) return PanelColors.txtMuted; if (isShipEscaped(ship.uid)) return PanelColors.escapeHp; return ship.hasSinkRisk ? PanelColors.hpSinkRisk : PanelColors.txtPrimary; }
https://github.com/CsCesium/KantaiHomo
06f6652f9f225c40cb252d3e32852c79a8072ab1
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGXMLChecker.ets
arkts
_readVersionInfo
读取Version信息
private _readVersionInfo(): void{ let _svgStringReader: StringReader = this._svgStringReader!; let version: boolean = Boolean(_svgStringReader.readStringFast(XMLConstants.XML_VERSION_KEY)) && this._readEqual(); let versionValue: string = this._readSystemLiteral() as string; let versionResult: string |...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readVersionInfo 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#ex...
private _readVersionInfo(): void{ let _svgStringReader: StringReader = this._svgStringReader!; let version: boolean = Boolean(_svgStringReader.readStringFast(XMLConstants.XML_VERSION_KEY)) && this._readEqual(); let versionValue: string = this._readSystemLiteral() as string; let versionResult: string |...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
e4d75d72784b0508c437c34b42bc572372eab2f2
gitee
SMAT-Lab/ArkAnalyzer-HapRay
test_hap/test_suite/src/main/ets/testcases/imageknife/pages/ImageCacheUtil.ets
arkts
generateFileName
生成URL的哈希值作为文件名
private static async generateFileName(url: string): Promise<string> { try { // 使用简单的哈希算法替代 cryptoFramework let hash = 0; for (let i = 0; i < url.length; i++) { const char = url.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; // Convert to 32bit inte...
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 generateFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef...
private static async generateFileName(url: string): Promise<string> { try { // 使用简单的哈希算法替代 cryptoFramework let hash = 0; for (let i = 0; i < url.length; i++) { const char = url.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; // Convert to 32bit inte...
https://github.com/SMAT-Lab/ArkAnalyzer-HapRay
4de326c6e208d8089ddddefd95ab6568d428f989
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/common/utils/PreferencesUtil.ets
arkts
getWeekFormIds
静态方法:异步获取周数据卡片的所有formId
static async getWeekFormIds(): Promise<string[]> { hilog.info(0x0000, TAG, `[PreferencesUtil] getWeekFormIds: 开始获取`); if (!globalContext) { hilog.error(0x0000, TAG, `[PreferencesUtil] getWeekFormIds: globalContext is null`); return []; } try { // 重要:先清除缓存,确保获取最新数据 hilog.info(0x...
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 getWeekFormIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static async getWeekFormIds(): Promise<string[]> { hilog.info(0x0000, TAG, `[PreferencesUtil] getWeekFormIds: 开始获取`); if (!globalContext) { hilog.error(0x0000, TAG, `[PreferencesUtil] getWeekFormIds: globalContext is null`); return []; } try { // 重要:先清除缓存,确保获取最新数据 hilog.info(0x...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
ce0350e0683283342d49b3c3797c150f9e1c39f0
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/view/LrcView.ets
arkts
aboutToAppear
Loads theme colors from resources, runs initial layout, and paints first frame.
aboutToAppear(): void { const host: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; const resMgr = host.resourceManager; try { this.emptyLyricPlaceholder = resMgr.getStringSync($r('app.string.lrc_empty_placeholder').id); } catch { this.emptyLyricP...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { const host: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; const resMgr = host.resourceManager; try { this.emptyLyricPlaceholder = resMgr.getStringSync($r('app.string.lrc_empty_placeholder').id); } catch { this.emptyLyricP...
https://gitcode.com/HarmonyOS_Samples/MusicHome
42aaaa807c43cfdbc0334c6eb42ee438ec41146b
gitcode
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterCallbackInformation.ets
arkts
lookupCallbackInformation
Get callback information for a given handle. @param handle the handle for the callback, generated by `PluginUtilities.getCallbackHandle` in `dart:ui`. @return an instance of FlutterCallbackInformation for the provided handle.
static lookupCallbackInformation(handle: number): FlutterCallbackInformation | null { return FlutterNapi.nativeLookupCallbackInformation(handle); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left lookupCallbackInformation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left handle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
static lookupCallbackInformation(handle: number): FlutterCallbackInformation | null { return FlutterNapi.nativeLookupCallbackInformation(handle); }
https://gitee.com/openharmony-sig/flutter_engine.git
79da68c4ca74189b2f1705fdfb38aead8dcddcbd
gitee
the-wwyang/kids-learning-app
src/main/ets/services/ParentalControlService.ets
arkts
getWeekUsageMinutes
获取本周使用时长(分钟)
public async getWeekUsageMinutes(): Promise<number> { const records = await this.getUsageRecords(); const weekAgo = this.getDaysAgoString(7); return records .filter(r => r.date >= weekAgo) .reduce((sum, r) => sum + r.totalMinutes, 0); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getWeekUsageMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
public async getWeekUsageMinutes(): Promise<number> { const records = await this.getUsageRecords(); const weekAgo = this.getDaysAgoString(7); return records .filter(r => r.date >= weekAgo) .reduce((sum, r) => sum + r.totalMinutes, 0); }
https://github.com/the-wwyang/kids-learning-app
85873a267faad307848e6a5da49e46bb158a87cd
github
UnbalancedCat/ohos-ssh-core
entry/src/main/ets/common/utils/TerminalParser.ets
arkts
parseTerminalData
Cleans ANSI escape codes and normalizes newlines/tabs from raw terminal text.
static parseTerminalData(text: string): string[] { // 1. Remove ANSI color/control codes, including OSC and BELL characters const ansiRegex = /\x1B\[[\x30-\x3F]*[\x20-\x2F]*[\x40-\x7E]|\x1B\][^\x07\x1B]*(?:\x07|\x1B\\)|\x1B[\x20-\x2F]*[\x40-\x7E]|\x07/g; let cleanText = text.replace(ansiRegex, ""); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseTerminalData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static parseTerminalData(text: string): string[] { // 1. Remove ANSI color/control codes, including OSC and BELL characters const ansiRegex = /\x1B\[[\x30-\x3F]*[\x20-\x2F]*[\x40-\x7E]|\x1B\][^\x07\x1B]*(?:\x07|\x1B\\)|\x1B[\x20-\x2F]*[\x40-\x7E]|\x07/g; let cleanText = text.replace(ansiRegex, ""); ...
https://github.com/UnbalancedCat/ohos-ssh-core
3d1f90a009c78eb6eff47afb1a8ddfc69338346c
github
HarmonyOS_Codelabs/arkts-basic-syntax-demo
entry/src/main/ets/pages/BasicPage.ets
arkts
showForStatements
for语句
function showForStatements() { let students: string[] = ['XiaoMing', 'XiaoZhang', 'XiaoWang', 'XiaoLi']; // 通过数组索引访问数组元素 for (let i = 0; i < students.length; i++) { console.log(students[i]); // 打印学生信息 } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left showForStatements 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#lexical_d...
function showForStatements() { let students: string[] = ['XiaoMing', 'XiaoZhang', 'XiaoWang', 'XiaoLi']; // 通过数组索引访问数组元素 for (let i = 0; i < students.length; i++) { console.log(students[i]); // 打印学生信息 } }
https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo
c6838e1553de73612e51097f2c2670e8bec315ba
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyStore.ets
arkts
migrateProfileKeys
对单个配置档案中的按键做旧坐标迁移 @returns true 如果有按键被迁移
private static migrateProfileKeys(profile: CustomKeyProfile): boolean { const displayInfo = display.getDefaultDisplaySync(); const screenWVp = px2vp(displayInfo.width); const screenHVp = px2vp(displayInfo.height); if (screenWVp <= 0 || screenHVp <= 0) return false; let migrated = false; for (...
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 migrateProfileKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left profile AST#identifier#Right AST#...
private static migrateProfileKeys(profile: CustomKeyProfile): boolean { const displayInfo = display.getDefaultDisplaySync(); const screenWVp = px2vp(displayInfo.width); const screenHVp = px2vp(displayInfo.height); if (screenWVp <= 0 || screenHVp <= 0) return false; let migrated = false; for (...
https://github.com/AlkaidLab/moonlight-harmony
e009be39c6e895af9362d58f2004c81d883e2da8
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test6_original_index.ets
arkts
testWeakRef
=== WeakRef Pattern ===
function testWeakRef(): string { let obj: Record<string, string> = {}; obj['key'] = 'value'; let ref: WeakRef<Record<string, string>> = new WeakRef(obj); let derefed: Record<string, string> | undefined = ref.deref(); if (derefed !== undefined) { return derefed['key']; } return 'collected'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testWeakRef 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 testWeakRef(): string { let obj: Record<string, string> = {}; obj['key'] = 'value'; let ref: WeakRef<Record<string, string>> = new WeakRef(obj); let derefed: Record<string, string> | undefined = ref.deref(); if (derefed !== undefined) { return derefed['key']; } return 'collected'; }
https://github.com/miaochiahao/ark-ghidra
526cb075d5c5fd05f30fc8fd144a10f2851c59f7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EBookParser.ets
arkts
parseEpubNavigationItems
直接解析已解压 EPUB 的目录结构(nav.xhtml / toc.ncx) 返回已经映射到 spine 索引的目录项
public static parseEpubNavigationItems( extractedRoot: string, spineItems: EBookChapter[] ): EpubNavigationItem[] { if (!extractedRoot || extractedRoot.trim().length === 0 || spineItems.length <= 0) { return []; } const parser = new ReaderKitEBookParser('', EBookFormat.EPUB); return pa...
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 parseEpubNavigationItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left extractedRoot AST#identifier#Right AST#ERROR#...
public static parseEpubNavigationItems( extractedRoot: string, spineItems: EBookChapter[] ): EpubNavigationItem[] { if (!extractedRoot || extractedRoot.trim().length === 0 || spineItems.length <= 0) { return []; } const parser = new ReaderKitEBookParser('', EBookFormat.EPUB); return pa...
https://github.com/DaLongZhuaZi/manxia
cd74108c7cf3f452a7fdf1a77d32508f20292b95
github
openharmony/codelabs
Media/AudioPlayer/entry/src/main/ets/common/utils/BackgroundTaskUtil.ets
arkts
stopContinuousTask
Stopping a Long-Time Task in the Background. @param context context.
public static stopContinuousTask(context: Context) { if (context === undefined) { Logger.info(TAG, 'stopContinuousTask fail,context is empty.'); return; } try { backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info(TAG, 'stopBackgroundRunning succeeded'); ...
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 stopContinuousTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#L...
public static stopContinuousTask(context: Context) { if (context === undefined) { Logger.info(TAG, 'stopContinuousTask fail,context is empty.'); return; } try { backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info(TAG, 'stopBackgroundRunning succeeded'); ...
https://gitee.com/openharmony/codelabs.git
c40bd8a6dabb6e574383b184dcefb384364da99d
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
includes
Checks if specified argument is in Int32Array @param e search element @param fromIndex start index to search from @returns true if e is in Int32Array, false otherwise
public includes(e: number, fromIndex: number): boolean { return this.includes(e as double as int as int, fromIndex as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST...
public includes(e: number, fromIndex: number): boolean { return this.includes(e as double as int as int, fromIndex as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
10d3c49318056d815513c463bebf78652c46dc62
gitee
apap6628114/nga_oh
entry/src/main/ets/store/SettingsStore.ets
arkts
setTheme
--- Theme ---
setTheme(theme: string): void { this.themeSettings.setTheme(theme) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left theme AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)...
setTheme(theme: string): void { this.themeSettings.setTheme(theme) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/SettingsStore.ets#L131-L131
da268fd51c78cdbca3291f40c02c89528f7547c3
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/HelpFormatter.ets
arkts
getLongOptPrefix
Gets the 'longOptPrefix'. @return the 'longOptPrefix'
public getLongOptPrefix(): string{ return this.defaultLongOptPrefix; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLongOptPrefix 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 AS...
public getLongOptPrefix(): string{ return this.defaultLongOptPrefix; }
https://gitee.com/openharmony-sig/commons-cli.git
18f928430c8181e8d4bf06a08c942edf3cd073cb
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpBackgroundService.ets
arkts
start
Start the background service
async start(): Promise<boolean> { if (isRunning) { console.info(`${TAG}: Service already running, skip start`); return true; } console.info(`${TAG}: Starting background service`); try { // Create WantAgent for notification click action const wantAgentInfo: wantAgent.WantAgent...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef...
async start(): Promise<boolean> { if (isRunning) { console.info(`${TAG}: Service already running, skip start`); return true; } console.info(`${TAG}: Starting background service`); try { // Create WantAgent for notification click action const wantAgentInfo: wantAgent.WantAgent...
https://github.com/tangwengang-del/freerdp-harmonyos
af5629863797a1c488183db8262bdce5757f2bd2
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/files_manager/external_manager.ets
arkts
del_external_song
删除歌曲 //
async del_external_song(del_list: string[]) { // 遍历删除 // let count: number = 0 for (const i of del_list) { try { await fs.unlink(i) count++ } catch {continue} } // 缓存更新 // await this.scan_data() log(`删除 ${count} 首`) notice(`成功删除 ${count} 首歌曲`) }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left del_external_song AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left del_list AST#identifier#Right AST#type_annotation#Le...
async del_external_song(del_list: string[]) { // 遍历删除 // let count: number = 0 for (const i of del_list) { try { await fs.unlink(i) count++ } catch {continue} } // 缓存更新 // await this.scan_data() log(`删除 ${count} 首`) notice(`成功删除 ${count} 首歌曲`) }
https://github.com/Nekofox-POT/LinMusic
3229a6c6b241bf9ca16f8a3fe4e4cadd5c109cbe
github
Gramony/Gramony
features/home/src/main/ets/utils/push.ets
arkts
saveLastRegisterTime
保存最后注册时间
async saveLastRegisterTime(): Promise<boolean> { try { const dataPreferences = await preferences.getPreferences(this.context, 'push_settings'); await dataPreferences.put(PUSH_LAST_REGISTER_TIME_KEY, Date.now()); await dataPreferences.flush(); return true; } catch (e) { Logger.err...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveLastRegisterTime 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...
async saveLastRegisterTime(): Promise<boolean> { try { const dataPreferences = await preferences.getPreferences(this.context, 'push_settings'); await dataPreferences.put(PUSH_LAST_REGISTER_TIME_KEY, Date.now()); await dataPreferences.flush(); return true; } catch (e) { Logger.err...
https://github.com/Gramony/Gramony
07f20ba2dedbf346201cf05b3371cbf458454f3a
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryExecutor.ets
arkts
resolveColumnName
解析列名(属性名或数据库列名) @param metadata 实体元数据 @param column 列名或属性名 @returns 数据库列名,未找到返回 null
private resolveColumnName(metadata: EntityMetadata, column: string): string | null { const columnByName = metadata.getColumnByName(column) if (columnByName !== null) { return columnByName.columnName } const columnByProperty = metadata.getColumnByProperty(column) if (columnByProperty !== null...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveColumnName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left metadata AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private resolveColumnName(metadata: EntityMetadata, column: string): string | null { const columnByName = metadata.getColumnByName(column) if (columnByName !== null) { return columnByName.columnName } const columnByProperty = metadata.getColumnByProperty(column) if (columnByProperty !== null...
https://github.com/offlinecat-dev/OCNetORM
cb46124df10d3ffdfba4f4b3f3730fac812b8074
github
offlinecat-dev/OCNetORM
src/main/ets/types/EntityHooks.ets
arkts
constructor
构造函数 @param beforeSave 保存前钩子 @param afterLoad 加载后钩子 @param beforeDelete 删除前钩子 @param beforeInsert 插入前钩子 @param afterInsert 插入后钩子 @param beforeUpdate 更新前钩子 @param afterUpdate 更新后钩子 @param afterDelete 删除后钩子 @param afterSave 保存后钩子 @param beforeRestore 恢复前钩子 @param afterRestore 恢复后钩子
constructor( beforeSave?: HookCallback | null, afterLoad?: HookCallback | null, beforeDelete?: HookCallback | null, beforeInsert?: HookCallback | null, afterInsert?: HookCallback | null, beforeUpdate?: HookCallback | null, afterUpdate?: HookCallback | null, afterDelete?: HookCallback |...
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 beforeSave AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_express...
constructor( beforeSave?: HookCallback | null, afterLoad?: HookCallback | null, beforeDelete?: HookCallback | null, beforeInsert?: HookCallback | null, afterInsert?: HookCallback | null, beforeUpdate?: HookCallback | null, afterUpdate?: HookCallback | null, afterDelete?: HookCallback |...
https://github.com/offlinecat-dev/OCNetORM
4f3e8196812f3b1bb88ad5e93498674dd5969f7f
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/JArrayList.ets
arkts
next
将当前位置向后移一位
next() { if (this.pos <= (this.listSize - 1)) { ++this.pos; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left next AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left if...
next() { if (this.pos <= (this.listSize - 1)) { ++this.pos; } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e943f11b8f4b4d08338be1374b89bbdb5420486a
gitee
Joker-x-dev/HarmonyKit
feature/main/src/main/ets/view/AboutPage.ets
arkts
build
构建关于页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.about"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.AboutContent(); }...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.about"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.AboutContent(); }...
https://github.com/Joker-x-dev/HarmonyKit
006b2ce276f767cb68013c08f61ee7b09e803021
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/googledrive/GoogleOAuth2Provider.ets
arkts
getRevokeUrl
获取撤销令牌的URL @return string | undefined 撤销URL
protected getRevokeUrl(): string | undefined { return 'https://oauth2.googleapis.com/revoke'; }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getRevokeUrl 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_expressio...
protected getRevokeUrl(): string | undefined { return 'https://oauth2.googleapis.com/revoke'; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/googledrive/GoogleOAuth2Provider.ets#L76-L78
f0063fc232302ba91fff05b079e8d0442471dafb
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/DevKeyVerifier.ets
arkts
verify
验证激活码是否正确(同步)
static verify(deviceId: string, inputKey: string): boolean { if (!deviceId || !inputKey) { return false; } const expectedKey = DevKeyVerifier.computeKey(deviceId); return expectedKey === inputKey.toUpperCase().trim(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left verify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right A...
static verify(deviceId: string, inputKey: string): boolean { if (!deviceId || !inputKey) { return false; } const expectedKey = DevKeyVerifier.computeKey(deviceId); return expectedKey === inputKey.toUpperCase().trim(); }
https://github.com/AlkaidLab/moonlight-harmony
90adb7f39291710fd4befc675685fe0e7c91b745
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/BarLineChartTouchListener.ets
arkts
performDrag
Performs all necessary operations needed for dragging. @param event
private performDrag(isTouchEvent: boolean, event: TouchEvent | GestureEvent, distanceX: number, distanceY: number) { this.mLastGesture = ChartGesture.DRAG; this.mMatrix.set(this.mSavedMatrix); let l: OnChartGestureListener | null = this.mChart.getOnChartGestureListener(); // check if axis is inver...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left performDrag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#...
private performDrag(isTouchEvent: boolean, event: TouchEvent | GestureEvent, distanceX: number, distanceY: number) { this.mLastGesture = ChartGesture.DRAG; this.mMatrix.set(this.mSavedMatrix); let l: OnChartGestureListener | null = this.mChart.getOnChartGestureListener(); // check if axis is inver...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c5c3c3beaf5c4b03c13fbde89b6bb4370d73f282
gitee
openharmony-sig/online_event
college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/MainAbility/pages/music2.ets
arkts
onChangeMusicProgress
音乐进度变化 currentTimes -- 自己定义的滑块目前进度 currentTime 播放的时间 totalTime 总时间 这三个为自己定义的变量
onChangeMusicProgress(value: number, mode: SliderChangeMode) { // 保护手段 if (this.isSwitching) { CommonLog.info('onChangeMusicProgress ignored, isSwitching'); return; } this.isSwitching = true CommonLog.info('value:' + value + 'mode:' + mode.toString()) this.currentTimes = value ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onChangeMusicProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identif...
onChangeMusicProgress(value: number, mode: SliderChangeMode) { // 保护手段 if (this.isSwitching) { CommonLog.info('onChangeMusicProgress ignored, isSwitching'); return; } this.isSwitching = true CommonLog.info('value:' + value + 'mode:' + mode.toString()) this.currentTimes = value ...
https://gitee.com/openharmony-sig/online_event.git
11af2bb7bfb408b7d9cba58787b6aba599573501
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnFormViewModel.ets
arkts
setBasicPhone
设置基础表单手机号 @param value 手机号值
setBasicPhone(value: string): void { this.basicForm.phone = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBasicPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ...
setBasicPhone(value: string): void { this.basicForm.phone = value; }
https://github.com/codelably/tuniao-ui
d05cb5f2a04420e4c48360353f4e237162820fc4
github
CLMC2025/Vignette
entry/src/main/ets/database/repositories/BaseRepository.ets
arkts
logError
Helper to log database errors
protected logError(operation: string, error: Error | string | object): void { const repoName = this.constructor.name; const errMsg = error instanceof Error ? error.message : String(error); console.error(`[${repoName}] ${operation} failed: ${errMsg}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left logError AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri...
protected logError(operation: string, error: Error | string | object): void { const repoName = this.constructor.name; const errMsg = error instanceof Error ? error.message : String(error); console.error(`[${repoName}] ${operation} failed: ${errMsg}`); }
https://github.com/CLMC2025/Vignette
4fa7b6433a69aac8a136660903bceb9a77e2beac
github
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/pages/LauncherPage.ets
arkts
jumpToIndexPage
跳转到主页
jumpToIndexPage(): void { this.timerId = setTimeout(() => { this.isJumpToIndex = true; this.getUIContext().getRouter().replaceUrl({ url: CommonConstants.INDEX_PAGE_URL }).catch((error: Error) => { Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'Jump to index error: ' +...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left jumpToIndexPage 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...
jumpToIndexPage(): void { this.timerId = setTimeout(() => { this.isJumpToIndex = true; this.getUIContext().getRouter().replaceUrl({ url: CommonConstants.INDEX_PAGE_URL }).catch((error: Error) => { Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'Jump to index error: ' +...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
4e0f9a680c21dcddde7d855a54bf484bad6849b0
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setBorderWidth
Sets the width of the border lines in vp. @param width
public setBorderWidth(width: number): void { if (this.mBorderPaint) { this.mBorderPaint.setStrokeWidth(Utils.handleDataValues(width)); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBorderWidth 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 ...
public setBorderWidth(width: number): void { if (this.mBorderPaint) { this.mBorderPaint.setStrokeWidth(Utils.handleDataValues(width)); } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
8ac99fa5d7627f708fdf87c3a0c42a875ca7c38f
gitee
openharmony-sig/applications_filemanager
entry/src/main/ets/Components/ClassityList.ets
arkts
getPercentage
获取使用内存比例
getPercentage(num:number, total:number) { if (num == 0 || total == 0) { return 0 } return Number(Number((num / total)*100).toFixed(2)) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getPercentage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right ...
getPercentage(num:number, total:number) { if (num == 0 || total == 0) { return 0 } return Number(Number((num / total)*100).toFixed(2)) }
https://gitee.com/openharmony-sig/applications_filemanager.git
e7147b3ef8f20181d13c876f5ccff05a2a049235
gitee
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmManager.ets
arkts
getAllAlarmsToShow
获取用于页面展示的所有闹钟列表 在数据库返回的数据上,做进一步加工,用于页面展示 @return 用于页面展示的闹钟列表
async getAllAlarmsToShow(): Promise<AlarmInfoToShow[]> { const alarmClockListFromDatabase: AlarmInfo[] = await this.getAllAlarms(); const preferences = await preferencesUtil.getPreferences(GlobalContext.getContext() .getObject('clockContext') as Context, APP_CONFIG); const preSetAlarmIds = await pre...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllAlarmsToShow 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#g...
async getAllAlarmsToShow(): Promise<AlarmInfoToShow[]> { const alarmClockListFromDatabase: AlarmInfo[] = await this.getAllAlarms(); const preferences = await preferencesUtil.getPreferences(GlobalContext.getContext() .getObject('clockContext') as Context, APP_CONFIG); const preSetAlarmIds = await pre...
https://gitee.com/openharmony-sig/applications_clock.git
98fd3469bd4ea586d3b15d3402c7cb8d15623fa4
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
readDoubleLE
Reads a 64-bit double from the buffer at the specified offset using little-endian format @param {int} [offset=0] - Number of bytes to skip before reading @returns {double} The read value
public readDoubleLE(offset: int = 0): double { let lengthOffset: int = this.length - 8; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${l...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readDoubleLE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expres...
public readDoubleLE(offset: int = 0): double { let lengthOffset: int = this.length - 8; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${l...
https://gitcode.com/iop123123/arkts-static-skills
4441b640a7081c4e03deb119d693a886bdb88868
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets
arkts
httpRequest
HTTP请求
private async httpRequest(url: string, options: OnlineLoadOptions): Promise<image.PixelMap | null> { // 首先尝试原始URL try { return await this.doHttpRequest(url, options); } catch (error) { const errObj = error as Object; const errCode = (errObj as Record<string, Object>)['code']; const...
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 httpRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST...
private async httpRequest(url: string, options: OnlineLoadOptions): Promise<image.PixelMap | null> { // 首先尝试原始URL try { return await this.doHttpRequest(url, options); } catch (error) { const errObj = error as Object; const errCode = (errObj as Record<string, Object>)['code']; const...
https://github.com/DaLongZhuaZi/manxia
0d48356793bbc43ebb7b8f79d65c9dcc7bfe1811
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
getUint16
Gets an unsigned short. @param byteOffset The byte offset. @param littleEndian If the value is little endian. @returns The value.
getUint16(byteOffset: number, littleEndian?: boolean): number { return this.dataView?.getUint16(byteOffset, littleEndian) || 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUint16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#R...
getUint16(byteOffset: number, littleEndian?: boolean): number { return this.dataView?.getUint16(byteOffset, littleEndian) || 0 }
https://gitee.com/openharmony-sig/flutter_engine.git
068e87cd0fe0f0c2f668c97cb356ff5e882629e1
gitee
openharmony/codelabs
ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets
arkts
notifyClearListeners
通知所有清空数据监听者(新增)
private notifyClearListeners(): void { console.info(`ItemStore: 通知 ${this.clearListeners.length} 个清空数据监听器`); this.clearListeners.forEach(callback => { try { callback(); } catch (error) { console.error('ItemStore: 执行清空数据监听回调出错:', error); } }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyClearListeners AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
private notifyClearListeners(): void { console.info(`ItemStore: 通知 ${this.clearListeners.length} 个清空数据监听器`); this.clearListeners.forEach(callback => { try { callback(); } catch (error) { console.error('ItemStore: 执行清空数据监听回调出错:', error); } }); }
https://gitcode.com/openharmony/codelabs
080c779d830d9c3c478ea82b240c1d5ee6efc9f3
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
blink
The blink() method creates a string that embeds a string in a <blink> element (<blink>str</blink>), which causes a string to be displayed in a big font.
public blink(): String{ return this.CreateHTMLString("blink", "") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left blink AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public blink(): String{ return this.CreateHTMLString("blink", "") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4c0da0784b2704d5ab5de5ce21e0e20348d0c9fe
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
calcMinMax
Calc minimum and maximum values (both x and y) over all DataSets.
public calcMinMax() { if (this.mDataSets == null) return; this.mYMax = -Number.MAX_VALUE; this.mYMin = Number.MAX_VALUE; this.mXMax = -Number.MAX_VALUE; this.mXMin = Number.MAX_VALUE; for (let dataSet of this.mDataSets.dataSource) { this.calcMinMax1(dataSet); } this.mLe...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calcMinMax AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AS...
public calcMinMax() { if (this.mDataSets == null) return; this.mYMax = -Number.MAX_VALUE; this.mYMin = Number.MAX_VALUE; this.mXMax = -Number.MAX_VALUE; this.mXMin = Number.MAX_VALUE; for (let dataSet of this.mDataSets.dataSource) { this.calcMinMax1(dataSet); } this.mLe...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f77885ac71ee45c9ae4621c2c4355a21147acde2
gitee
ZestBox-18/kitebook-frontend
features/profile/src/main/ets/components/ThemeColorItem.ets
arkts
aboutToAppear
组件初始化
aboutToAppear(): void { this.updateAnimationState(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { this.updateAnimationState(); }
https://github.com/ZestBox-18/kitebook-frontend
1fa7d1f1bc827b849b57d53130de99a893ebfc47
github
arkui-x/samples
CodeLab/ArkTSComponentCollection/entry/src/main/ets/pages/universal/events/customEventSample/CustomScrollingEvent.ets
arkts
aboutToAppear
0代表滚动到List顶部,1代表中间值,2代表滚动到List底部。
aboutToAppear() { for (let i = 1; i <= 30; i++) { let file: string = "file" + i.toString(); this.files.push(file); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { for (let i = 1; i <= 30; i++) { let file: string = "file" + i.toString(); this.files.push(file); } }
https://gitcode.com/arkui-x/samples
85821990296a59deb57d5943074b196f2e99105f
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
sort
Sorts in-place according to the numeric ordering @returns sorted Int16Array
public sort(): Int16Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as short const b1 = b as double as int as short return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public sort(): Int16Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as short const b1 = b as double as int as short return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b203c466d9a06211bae72f3bf7896271f9bf2e29
gitee
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
getVideoEncoderCodec
获取 Rust 层内部视频编码器实际使用的编解码器
public getVideoEncoderCodec(): string { if (!this.client) return ''; return this.client.getVideoEncoderCodec(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getVideoEncoderCodec 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 strin...
public getVideoEncoderCodec(): string { if (!this.client) return ''; return this.client.getVideoEncoderCodec(); }
https://github.com/tdcare/tdwebrtc
ef0381fb74386f7960ffc0a2c6045c213b38d6e8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TarPackager.ets
arkts
extractTarArchive
解压 tar 包 @param tarPath tar 文件路径(.mxbackup) @param outputDir 输出目录 [修复] 正确处理文件和目录条目,添加详细日志
async extractTarArchive(tarPath: string, outputDir: string): Promise<void> { try { logger.info(TAG, `正在解压tar归档: ${tarPath}`); // 确保输出目录存在 if (!SafeFileUtils.accessSync(outputDir)) { SafeFileUtils.mkdirSyncStrict(outputDir, true); } const tarFile = SafeFileUtils....
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left extractTarArchive AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tarPath AST#identifier#Right AST#type_annotation#Lef...
async extractTarArchive(tarPath: string, outputDir: string): Promise<void> { try { logger.info(TAG, `正在解压tar归档: ${tarPath}`); // 确保输出目录存在 if (!SafeFileUtils.accessSync(outputDir)) { SafeFileUtils.mkdirSyncStrict(outputDir, true); } const tarFile = SafeFileUtils....
https://github.com/DaLongZhuaZi/manxia
e5120aef2702dc57379d67c280511ef7de15139e
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
getByLedgerId
获取账本的活动记录
static async getByLedgerId(ledgerId: number, limit: number = 50): Promise<MemberActivity[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(MemberActivity.tableName); predicates....
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 getByLedgerId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async getByLedgerId(ledgerId: number, limit: number = 50): Promise<MemberActivity[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(MemberActivity.tableName); predicates....
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
7b4267adfb0ba58fc2e6f30309ca52957ec92aea
github
Harrisonls2004/WaterFlow
entry/src/main/ets/pages/MainPage.ets
arkts
onPageShow
页面显示时(包括从其他页面返回),刷新当前Tab数据
onPageShow(): void { console.log('MainPage: onPageShow, currentIndex =', this.currentIndex); // 检查是否需要切换到指定Tab(从其他页面返回时) if (this.switchToTab >= 0 && this.switchToTab <= 3) { this.currentIndex = this.switchToTab; this.tabsController.changeIndex(this.switchToTab); this.switchToTab = ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
onPageShow(): void { console.log('MainPage: onPageShow, currentIndex =', this.currentIndex); // 检查是否需要切换到指定Tab(从其他页面返回时) if (this.switchToTab >= 0 && this.switchToTab <= 3) { this.currentIndex = this.switchToTab; this.tabsController.changeIndex(this.switchToTab); this.switchToTab = ...
https://github.com/Harrisonls2004/WaterFlow
de7fa4c466d3f26393dab0b2283ac868bc415ded
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/DownloadDirManager.ets
arkts
loadDownloadDir
加载已保存的下载目录
private async loadDownloadDir(): Promise<void> { if (!this.dataPreferences) return; try { this.downloadDirPath = await this.dataPreferences.get(KEY_DOWNLOAD_DIR_PATH, '') as string; this.downloadDirUri = await this.dataPreferences.get(KEY_DOWNLOAD_DIR_URI, '') as string; console.info(`${TAG...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadDownloadDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async loadDownloadDir(): Promise<void> { if (!this.dataPreferences) return; try { this.downloadDirPath = await this.dataPreferences.get(KEY_DOWNLOAD_DIR_PATH, '') as string; this.downloadDirUri = await this.dataPreferences.get(KEY_DOWNLOAD_DIR_URI, '') as string; console.info(`${TAG...
https://github.com/richshaw2015/nds
825f7f4a48c53cfab88b83f05dfa51ee6e38348e
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/ParentApiClient.ets
arkts
listPendingLessonDrafts
Backwards-compatible thin wrapper. V0.7 callers should prefer `listLessonDraftsByStatus` directly so the cron-pending / extract-failed buckets can be queried alongside the parent-review queue.
async listPendingLessonDrafts(page: number, size: number): Promise<LessonDraftListPage> { return this.listLessonDraftsByStatus('pending', page, size); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left listPendingLessonDrafts AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier...
async listPendingLessonDrafts(page: number, size: number): Promise<LessonDraftListPage> { return this.listLessonDraftsByStatus('pending', page, size); }
https://github.com/terryma2024/happyword
88b6cf31a51d300c6dd5c7f145649a843801b165
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
getVariables
获取变量(用于JS执行)
private getVariables(sourceId: string): Record<string, string> { const cookies = this.getCookies(sourceId); const result: Record<string, string> = {}; result['cookie'] = this.getCookieString(sourceId); // 复制cookies到result const keys = Object.keys(cookies); for (let i = 0; i < keys.length; i++)...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getVariables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
private getVariables(sourceId: string): Record<string, string> { const cookies = this.getCookies(sourceId); const result: Record<string, string> = {}; result['cookie'] = this.getCookieString(sourceId); // 复制cookies到result const keys = Object.keys(cookies); for (let i = 0; i < keys.length; i++)...
https://github.com/DaLongZhuaZi/manxia
7190467697f6598e185973e71f3e07a4b9a7c4f4
github