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
openharmony-sig/knowledge_demo_travel
FA/OpenHarmonyCarSystem_OHCar/entry/src/main/ets/MainAbility/pages/gauge.ets
arkts
resolveIP
解析本地ip
resolveIP(ip) { if (ip < 0 || ip > 0xFFFFFFFF) { throw ("The number is not normal!"); } return (ip >>> 24) + "." + (ip >> 16 & 0xFF) + "." + (ip >> 8 & 0xFF) + "." + (ip & 0xFF); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resolveIP AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ip AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_...
resolveIP(ip) { if (ip < 0 || ip > 0xFFFFFFFF) { throw ("The number is not normal!"); } return (ip >>> 24) + "." + (ip >> 16 & 0xFF) + "." + (ip >> 8 & 0xFF) + "." + (ip & 0xFF); }
https://gitee.com/openharmony-sig/knowledge_demo_travel.git
d0d5751cfe0a053ce869ddc360fb704fea5f0923
gitee
offlinecat-dev/OCNetORM
src/main/ets/repository/Repository.ets
arkts
removeById
根据主键删除实体 如果实体启用了软删除,则执行软删除(设置 deleted_at 字段) 否则执行物理删除 @param id 主键值 @returns Promise<DeleteResult>
async removeById(id: ValueType): Promise<DeleteResult> { this.ensureWritePathAllowed('REMOVE_BY_ID') return await this.withSessionStore(async (repo) => { const result = await repo.deleteOperations.removeById(id) return repo.ensureDeleteResultSuccess(result, 'REMOVE_BY_ID') }) }
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 removeById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#...
async removeById(id: ValueType): Promise<DeleteResult> { this.ensureWritePathAllowed('REMOVE_BY_ID') return await this.withSessionStore(async (repo) => { const result = await repo.deleteOperations.removeById(id) return repo.ensureDeleteResultSuccess(result, 'REMOVE_BY_ID') }) }
https://github.com/offlinecat-dev/OCNetORM
763606f44ecd5091dea3666c3f4c41847bc99c3b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/ImageProcessing/JinmantiantangDescrambler.ets
arkts
shouldDescramble
检查是否需要解扰
shouldDescramble(url: string, parameters: JinmantiantangParameters): boolean { const threshold = parameters.scrambleIdThreshold !== undefined ? parameters.scrambleIdThreshold : this.DEFAULT_SCRAMBLE_ID; return url.includes('media/photos') && parameters.aid >= threshold; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shouldDescramble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,...
shouldDescramble(url: string, parameters: JinmantiantangParameters): boolean { const threshold = parameters.scrambleIdThreshold !== undefined ? parameters.scrambleIdThreshold : this.DEFAULT_SCRAMBLE_ID; return url.includes('media/photos') && parameters.aid >= threshold; }
https://github.com/DaLongZhuaZi/manxia
cff44ae131c09e1ef7238738d7ecc49b0beed0a6
github
yanglfree/CopoHub-Multi
flutter/ohos/entry/src/main/ets/plugins/IapPlugin.ets
arkts
productSnapshot
── Private helpers ──────────────────────────────────────────────────────────
private productSnapshot(product: iap.Product): Record<string, Object> { let localPrice = this.formatPrice(product.localPrice || product.price); let originalLocalPrice = this.formatPrice(product.originalLocalPrice || ''); if (!originalLocalPrice) { originalLocalPrice = localPrice; } const sna...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left productSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left product AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST...
private productSnapshot(product: iap.Product): Record<string, Object> { let localPrice = this.formatPrice(product.localPrice || product.price); let originalLocalPrice = this.formatPrice(product.originalLocalPrice || ''); if (!originalLocalPrice) { originalLocalPrice = localPrice; } const sna...
https://github.com/yanglfree/CopoHub-Multi
d67af3d8b67dfa9e6d335b01a0461bc6e12acf74
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
constructor
Creates an Uint8ClampedArray with respect to length. @param { number } length - Number of elements @throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(length: number) { if (length < 0 || length > (Int.MAX_VALUE / Uint8ClampedArray.BYTES_PER_ELEMENT)) { throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer") } this.lengthInt = length.toInt() this.byteLengthInt = t...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
public constructor(length: number) { if (length < 0 || length > (Int.MAX_VALUE / Uint8ClampedArray.BYTES_PER_ELEMENT)) { throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer") } this.lengthInt = length.toInt() this.byteLengthInt = t...
https://gitcode.com/iop123123/arkts-static-skills
33b30ebe1b40e9eb0b23a22947f13be3ca2386ad
gitcode
openharmony/third_party_typescript
tests/arkTSTest/testcase/arkts-shared-module-exports/shared-module.ets
arkts
fun
error, ns is not sendable type
function fun: boolean() {}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fun AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#fo...
function fun: boolean() {}
https://gitee.com/openharmony/third_party_typescript.git
596aaebdfe1e6bf62c326d3d005642e4222d0b41
gitee
offlinecat-dev/OCNetORM
src/main/ets/database/DatabaseManager.ets
arkts
applyRuntimeConfigForTesting
应用运行时配置(测试桥接)
applyRuntimeConfigForTesting(config: DatabaseConfig): void { this.config = config this.applyRuntimeConfig(config) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyRuntimeConfigForTesting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DatabaseConfig AST#identi...
applyRuntimeConfigForTesting(config: DatabaseConfig): void { this.config = config this.applyRuntimeConfig(config) }
https://github.com/offlinecat-dev/OCNetORM
eb73187f32a6e08ecca2f0182e18b6c0b0552435
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets
arkts
generateXmlMetadata
生成XML格式元数据
private generateXmlMetadata(metadata: ArchiveMetadata): string { return `<?xml version="1.0" encoding="UTF-8"?> <ComicInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Title>${this.escapeXml(metadata.title)}</Title> <Series>${this.escapeXml(metadata.seri...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateXmlMetadata 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#ident...
private generateXmlMetadata(metadata: ArchiveMetadata): string { return `<?xml version="1.0" encoding="UTF-8"?> <ComicInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Title>${this.escapeXml(metadata.title)}</Title> <Series>${this.escapeXml(metadata.seri...
https://github.com/DaLongZhuaZi/manxia
4f5bcc64cbb288dffebfb75529ff1943e885b2f9
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/PaginationManager.ets
arkts
nextGeneration
推进 generation 计数器并返回新值。翻页前调用以标记一次新的异步会话, 响应到达后通过 getGeneration 比对以丢弃过期结果。 @returns 新的 generation 值
nextGeneration(): number { this.generation++ return this.generation }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left nextGeneration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme...
nextGeneration(): number { this.generation++ return this.generation }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/PaginationManager.ets#L32-L35
98825f7d3dff0600a56b14cc4e632f3dbd568bd8
github
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
setDefaultModel
写某个 role 的 default model:Preferences 持久化 + state 同步
async setDefaultModel(role: ModelRole, config: DefaultModelConfig): Promise<void> { const keys = this.preferenceKeysFor(role) if (keys === null) { return } await this.preferences.setString(keys.modelIdKey, config.modelId) await this.preferences.setString(keys.providerIdKey, config.providerId...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setDefaultModel AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left role AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async setDefaultModel(role: ModelRole, config: DefaultModelConfig): Promise<void> { const keys = this.preferenceKeysFor(role) if (keys === null) { return } await this.preferences.setString(keys.modelIdKey, config.modelId) await this.preferences.setString(keys.providerIdKey, config.providerId...
https://github.com/LongLiveY96/chatcube
f8fdabb8a4537c6120c4d32621a93dc152dd5744
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnPickerViewModel.ets
arkts
onMultiColumnConfirm
多列数组选择器确认回调 @param values 各列选中值
onMultiColumnConfirm(values: Array<string | number>): void { const labels: string[] = []; for (let i = 0; i < values.length; i++) { labels.push(String(values[i])); } this.multiColumnLabel = labels.join(" - "); this.multiColumnOpen = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMultiColumnConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left...
onMultiColumnConfirm(values: Array<string | number>): void { const labels: string[] = []; for (let i = 0; i < values.length; i++) { labels.push(String(values[i])); } this.multiColumnLabel = labels.join(" - "); this.multiColumnOpen = false; }
https://github.com/codelably/tuniao-ui
0d622c8ebf364f4f3834338f89995faabc7e4c03
github
YANGZX22/Voot
entry/src/main/ets/pages/PolishPage.ets
arkts
syncScrollToPolished
同步滚动处理
syncScrollToPolished(yOffset: number) { this.polishedScroller.scrollTo({ xOffset: 0, yOffset: yOffset }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left syncScrollToPolished AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left yOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Rig...
syncScrollToPolished(yOffset: number) { this.polishedScroller.scrollTo({ xOffset: 0, yOffset: yOffset }); }
https://github.com/YANGZX22/Voot
3bafce10035cc86a0debbc28b7e38fa281fc59a6
github
HarmonyOS_Codelabs/arkts-intermediate-syntax
entry/src/main/ets/model/AirConditioner.ets
arkts
setTemperature
setTemperature方法:设置温度(添加边界约束,避免无效值) @param temp 目标温度(16°C~30°C范围内)
setTemperature(temp: number): void { // 若设备已开机,打印温度更新日志 if (this.status === 'on') { if (temp < 16) { this.temperature = 16; } else if (temp > 30) { this.temperature = 30; } else { this.temperature = temp; } logAction(`${this.getInfo()} 温度已调整为:${this.temperature}°C`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTemperature AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left temp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ...
setTemperature(temp: number): void { // 若设备已开机,打印温度更新日志 if (this.status === 'on') { if (temp < 16) { this.temperature = 16; } else if (temp > 30) { this.temperature = 30; } else { this.temperature = temp; } logAction(`${this.getInfo()} 温度已调整为:${this.temperature}°C`); } }
https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax
1530e9246924fa234d52d40cce0b2d6e0bf449dd
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
constructor
Creates a new instance of Array based on Object[] @param d Array initializer
public constructor(d: T[]) { this.initFromArray(d); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Le...
public constructor(d: T[]) { this.initFromArray(d); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5d9d476942204f0c831482e1be57f9f4c6a933b7
gitee
pangpang20/antennaPodHM
entry/src/main/ets/service/DatabaseService.ets
arkts
getQueueEpisodes
获取队列中的所有Episode
async getQueueEpisodes(): Promise<Episode[]> { if (!this.rdbStore) return []; try { // 联合查询获取队列中的Episode const sql = ` SELECT e.* FROM ${Constants.TABLE_EPISODE} e INNER JOIN ${Constants.TABLE_QUEUE} q ON e.id = q.episodeId ORDER BY q.position ASC `; const resu...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getQueueEpisodes 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 : ...
async getQueueEpisodes(): Promise<Episode[]> { if (!this.rdbStore) return []; try { // 联合查询获取队列中的Episode const sql = ` SELECT e.* FROM ${Constants.TABLE_EPISODE} e INNER JOIN ${Constants.TABLE_QUEUE} q ON e.id = q.episodeId ORDER BY q.position ASC `; const resu...
https://github.com/pangpang20/antennaPodHM
7873fa789eefa4d6aa02c8fdfa60ad787e31529b
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
createNode
TreeViewNodeItemFactory create default node @returns NodeItemView
public createNode(): NodeItemView { return { imageNode: undefined, inputText: new InputText(), mainTitleNode: new MainTitleNode(''), imageCollapse: undefined, fontColor: undefined, } as NodeItemView; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left NodeItemVie...
public createNode(): NodeItemView { return { imageNode: undefined, inputText: new InputText(), mainTitleNode: new MainTitleNode(''), imageCollapse: undefined, fontColor: undefined, } as NodeItemView; }
https://gitcode.com/openharmony/arkui_ace_engine
95d53193ff5c4faca60f76ad5f206d72cb562c49
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
isPageCached
检查页面是否已缓存
public isPageCached(mangaTitle: string, chapterTitle: string, pageIndex: number): boolean { try { const pagePath = this.getPageCachePath(mangaTitle, chapterTitle, pageIndex); return this.isReadableFile(pagePath); } catch (_error) { return false; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPageCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string...
public isPageCached(mangaTitle: string, chapterTitle: string, pageIndex: number): boolean { try { const pagePath = this.getPageCachePath(mangaTitle, chapterTitle, pageIndex); return this.isReadableFile(pagePath); } catch (_error) { return false; } }
https://github.com/DaLongZhuaZi/manxia
8aa4cf575696d7e6e6c6f4f3ee8ebe8f4dc75fad
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
extendTo
Extends the Array with new elements up to the specified length. @param { int } arrayLength The new length of the array. @param { T } initialValue The initial value for the added elements. @throws { RangeError } Throws a RangeError if the array length is negative. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public extendTo(arrayLength: int, initialValue: T): void { if(arrayLength < 0){ throw new RangeError("Parameter error.Invalid array length.") } const delta: int = arrayLength - this.actualLength if (delta <= 0) { return } this.ensureUnusedCapac...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left extendTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left arrayLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifi...
public extendTo(arrayLength: int, initialValue: T): void { if(arrayLength < 0){ throw new RangeError("Parameter error.Invalid array length.") } const delta: int = arrayLength - this.actualLength if (delta <= 0) { return } this.ensureUnusedCapac...
https://gitcode.com/iop123123/arkts-static-skills
1e59b339560044c4fe2087dad497b24c51c8ce2f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/pages/EBookDetailPage.ets
arkts
onPageShow
页面显示时自动刷新数据 确保从阅读器返回时能正确显示最新的阅读进度 @deprecated 使用 NavDestination.onShown 代替
onPageShow(): void { logger.lifecycle(TAG, '📱 页面显示,自动刷新电子书数据'); // 如果已有电子书数据,静默刷新 if (this.ebook && this.ebook.id) { this.loadEBookDetail(this.ebook.id); } }
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 { logger.lifecycle(TAG, '📱 页面显示,自动刷新电子书数据'); // 如果已有电子书数据,静默刷新 if (this.ebook && this.ebook.id) { this.loadEBookDetail(this.ebook.id); } }
https://github.com/DaLongZhuaZi/manxia
f45d6ac92c1c8eb6713a905d9500e804ee32b738
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/HelpFormatter.ets
arkts
printWrapped
Print the specified text to the specified PrintWriter. @param nextLineTabStop The position on the next line for the first tab. @param text The text to be written to the PrintWriter
public printWrapped(width: number, nextLineTabStop: number, text: string):void { let sb = this.renderWrappedTextBlock(width, nextLineTabStop, text); for (let index = 0;index < sb.length; index++) { console.log("commons-cli:" + sb[index]); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left printWrapped 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 nu...
public printWrapped(width: number, nextLineTabStop: number, text: string):void { let sb = this.renderWrappedTextBlock(width, nextLineTabStop, text); for (let index = 0;index < sb.length; index++) { console.log("commons-cli:" + sb[index]); } }
https://gitee.com/openharmony-sig/commons-cli.git
4deb300ae30ab855122ed28168bb8bcf5f678dd1
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/05.casting_contexts/boxing.ets
arkts
main
--- desc: Casting contexts allow the use of the boxing conversion. ---
function main(): int { {%- for t in c['types'] %} let p{{loop.index}}: {{t.ptype}} = {{t.expr|safe}}; let r{{loop.index}}: {{t.rtype}} = p{{loop.index}} as {{t.rtype}};
AST#program#Left AST#expression_statement#Left AST#as_expression#Left AST#function_expression#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left...
function main(): int { {%- for t in c['types'] %} let p{{loop.index}}: {{t.ptype}} = {{t.expr|safe}}; let r{{loop.index}}: {{t.rtype}} = p{{loop.index}} as {{t.rtype}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
caf80282682bbdf32c4c43a675eab222b4a11ed1
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets
arkts
analyzeJsAsync
执行 @js: 和 <js></js> 格式的JS代码(异步版本)
private async analyzeJsAsync(ruleUrl: string): Promise<string> { let result = ruleUrl; let start = 0; let iterationCount = 0; const maxIterations = 24; // 循环处理所有JS代码块 while (true) { iterationCount++; if (iterationCount > maxIterations) { logger.warn(TAG, `JS规则解析达到安全上限,...
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 analyzeJsAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleUrl AST#identifier#Right AST#ERROR#Left AST#:#Lef...
private async analyzeJsAsync(ruleUrl: string): Promise<string> { let result = ruleUrl; let start = 0; let iterationCount = 0; const maxIterations = 24; // 循环处理所有JS代码块 while (true) { iterationCount++; if (iterationCount > maxIterations) { logger.warn(TAG, `JS规则解析达到安全上限,...
https://github.com/DaLongZhuaZi/manxia
6538d49ea4e98119c77a58a0ab33b6f5cd5f65e4
github
webabcd/HarmonyDemo
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onConfigurationUpdate
全局的环境配置发生变化时的回调(比如系统语言,深色浅色模式等) 注:在 AbilityStage 中也有此回调
onConfigurationUpdate(newConfig: Configuration): void { MyLog.d(`ability onConfigurationUpdate ${JSON.stringify(newConfig)}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onConfigurationUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newConfig AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Configuration AST#identifier#...
onConfigurationUpdate(newConfig: Configuration): void { MyLog.d(`ability onConfigurationUpdate ${JSON.stringify(newConfig)}`); }
https://github.com/webabcd/HarmonyDemo
e9849ad4c22f7924e377b9d66176d1524b43dce5
github
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets
arkts
onConnectStateChange
订阅连接状态变化事件
private onConnectStateChange() { Log.showInfo(TAG, `onConnectStateChange`); if (!this.mGattServer) { Log.showInfo(TAG, `onConnectStateChange: mGattServer is null`); return; } try { this.mGattServer.on('connectionStateChange', async (data: ble.BLEConnectionChangeState) => { L...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onConnectStateChange 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 AS...
private onConnectStateChange() { Log.showInfo(TAG, `onConnectStateChange`); if (!this.mGattServer) { Log.showInfo(TAG, `onConnectStateChange: mGattServer is null`); return; } try { this.mGattServer.on('connectionStateChange', async (data: ble.BLEConnectionChangeState) => { L...
https://gitcode.com/arkui-x/samples
13c2bcc239300a3c3be29e14723daafd8cd42633
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPDriveManager.ets
arkts
getTransferTasks
获取传输任务列表
public getTransferTasks(): FileTransferTask[] { return Array.from(this.transferTasks.values()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTransferTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left FileT...
public getTransferTasks(): FileTransferTask[] { return Array.from(this.transferTasks.values()); }
https://github.com/AetheriumSimulator/qemu-hmos
b768c22c7c67c881f99fe659dc05115d0551ec9c
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartCategory.ets
arkts
getRecommendationsAbove
获取指定置信度以上的推荐
getRecommendationsAbove(threshold: number): CategoryRecommendation[] { const result: CategoryRecommendation[] = []; for (let i = 0; i < this.recommendations.length; i++) { if (this.recommendations[i].confidence >= threshold) { result.push(this.recommendations[i]); } } return result...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRecommendationsAbove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left threshold AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERRO...
getRecommendationsAbove(threshold: number): CategoryRecommendation[] { const result: CategoryRecommendation[] = []; for (let i = 0; i < this.recommendations.length; i++) { if (this.recommendations[i].confidence >= threshold) { result.push(this.recommendations[i]); } } return result...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
9de9f59ac9951f6fe6f69d6d80480fdf96d0d19a
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
arkts
checkCapabilities
检查服务端 ABR 能力(串流开始前调用一次)
async checkCapabilities(): Promise<AbrCapabilities> { const caps = await this.nvHttp.getAbrCapabilities(); this.serverSupported = caps.supported; console.info(`${TAG} 服务端 ABR: supported=${caps.supported}, version=${caps.version}, features=${JSON.stringify(caps.features)}`); return caps; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkCapabilities 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#ge...
async checkCapabilities(): Promise<AbrCapabilities> { const caps = await this.nvHttp.getAbrCapabilities(); this.serverSupported = caps.supported; console.info(`${TAG} 服务端 ABR: supported=${caps.supported}, version=${caps.version}, features=${JSON.stringify(caps.features)}`); return caps; }
https://github.com/AlkaidLab/moonlight-harmony
0dbcf048435190956996358a45db0cdd1e57742f
github
honjow/Next2V
shared/src/main/ets/backup/BackupAccountAdapter.ets
arkts
restoreNetworkProxy
Restore network-proxy profiles (incl. credentials) — independent of accounts, so it runs even when the backup carries no accounts. Mirrors the proxy settings page's upsert + activate flow.
private static async restoreNetworkProxy( context: common.UIAbilityContext, section: BackupUserInfoSection, ): Promise<void> { const proxy = section.networkProxy if (!proxy || !Array.isArray(proxy.profiles)) { return } for (const p of proxy.profiles) { const snapshot: NetworkProx...
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 restoreNetworkProxy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#...
private static async restoreNetworkProxy( context: common.UIAbilityContext, section: BackupUserInfoSection, ): Promise<void> { const proxy = section.networkProxy if (!proxy || !Array.isArray(proxy.profiles)) { return } for (const p of proxy.profiles) { const snapshot: NetworkProx...
https://github.com/honjow/Next2V
cc8e6be22132bd9283b139c681bca6728beefa32
github
LongLiveY96/chatcube
entry/src/main/ets/services/registry/matcher.ets
arkts
isLowerLetter
============ Model id 分词 + 评分(rikkahub ModelDsl 思路移植) ============
function isLowerLetter(code: number): boolean { return code >= 97 && code <= 122 // a-z }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isLowerLetter AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left code AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function isLowerLetter(code: number): boolean { return code >= 97 && code <= 122 // a-z }
https://github.com/LongLiveY96/chatcube
48affb2320045a3441c4425d185788a0f668d402
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
reduce
Reduces data into a single value using left-to-right traversal @param fn condition @returns reduction result
public reduce(fn: (acc: byte, curVal: byte, curIndex: int, array: Int8Array) => byte): byte { let acc = this.at(0) for (let i = 1; i < this.length; ++i) { acc = fn(acc, this.at(i), i, this) } return acc }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
public reduce(fn: (acc: byte, curVal: byte, curIndex: int, array: Int8Array) => byte): byte { let acc = this.at(0) for (let i = 1; i < this.length; ++i) { acc = fn(acc, this.at(i), i, this) } return acc }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
3390ea8add097c7c27c30488e8fc925c36977e55
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/SettingsUtil.ets
arkts
saveNurseToken
==================== 护士相关方法 ==================== 保存护士Token
async saveNurseToken(token: string): Promise<void> { if (this.dataPreferences === null) { return; } try { await this.dataPreferences.put('nurse_token', token); await this.dataPreferences.flush(); } catch (e) { console.error('SettingsUtil - save nurse token failed:', e); } ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveNurseToken AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left token AST#identifier#Right AST...
async saveNurseToken(token: string): Promise<void> { if (this.dataPreferences === null) { return; } try { await this.dataPreferences.put('nurse_token', token); await this.dataPreferences.flush(); } catch (e) { console.error('SettingsUtil - save nurse token failed:', e); } ...
https://github.com/LJ666-ui/harmony-health-care
d1a3e7a99384af0296a92ff245031698f9049849
github
Cool_foolisher1/ArkTSRepository
ArkTSDemo/common/src/main/ets/utils/BreakpointSystem.ets
arkts
unregister
注销监听器
public unregister() { this.smListener?.off('change', this.isBreakpointSM) this.mdListener?.off('change', this.isBreakpointMD) this.lgListener?.off('change', this.isBreakpointLG) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregister 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 unregister() { this.smListener?.off('change', this.isBreakpointSM) this.mdListener?.off('change', this.isBreakpointMD) this.lgListener?.off('change', this.isBreakpointLG) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
3dc26fc3526472c03ef9d9cd7f2c93f80a367ade
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateFactory.ets
arkts
createEntryFromPresetId
从预置模板ID创建条目 @param templateId 预置模板ID @param parentGroup 目标分组 @param options 应用选项 @returns 创建的条目,如果模板不存在则返回null
createEntryFromPresetId( templateId: string, parentGroup: KdbxGroup, options?: TemplateApplyOptions ): KdbxEntry | null { const templates = this.presetStrategy.getTemplates(); let template: IPresetTemplate | undefined = undefined; for (let i = 0; i < templates.length; i++) { if (templa...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left createEntryFromPresetId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left templateId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left stri...
createEntryFromPresetId( templateId: string, parentGroup: KdbxGroup, options?: TemplateApplyOptions ): KdbxEntry | null { const templates = this.presetStrategy.getTemplates(); let template: IPresetTemplate | undefined = undefined; for (let i = 0; i < templates.length; i++) { if (templa...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateFactory.ets#L160-L177
0723041099a5cfbe8aa6ce96be2e46d014e59b6b
github
mqxu/HarmonyOS_In_Action
examples/01_foundation/F002_state_management/entry/src/main/ets/utils/StateManager.ets
arkts
formatPercentage
格式化百分比显示 @param value 当前值 @param max 最大值 @returns 百分比字符串
static formatPercentage(value: number, max: number): string { if (max === 0) { return '0%'; } const percentage = Math.round((value / max) * 100); return `${percentage}%`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatPercentage 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#Lef...
static formatPercentage(value: number, max: number): string { if (max === 0) { return '0%'; } const percentage = Math.round((value / max) * 100); return `${percentage}%`; }
https://github.com/mqxu/HarmonyOS_In_Action
20fa1750b74ebde9c9807d36115592642f77b1cd
github
openharmony-tpc/VCard
library/src/main/ets/components/VCardParserImpl_V21.ets
arkts
readBeginVCard
@return True when successful. False when reaching the end of line @throws IOException @throws VCardException
protected readBeginVCard(allowGarbage: boolean): boolean { // TODO: use consructPropertyLine(). let line: string | null; do { while (true) { line = this.getLine(); if (line == null) { return false; } else if (lin...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left readBeginVCard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left allowGarbage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boo...
protected readBeginVCard(allowGarbage: boolean): boolean { // TODO: use consructPropertyLine(). let line: string | null; do { while (true) { line = this.getLine(); if (line == null) { return false; } else if (lin...
https://gitee.com/openharmony-tpc/VCard.git
9daa0dc0fc3695cd24509b50c9269e81dd3e35dc
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Int8Array with respect to buf. @param buf data initializer
public constructor(buf: Buffer) { this(buf, 0, buf.getByteLength() / Int8Array.BYTES_PER_ELEMENT) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe...
public constructor(buf: Buffer) { this(buf, 0, buf.getByteLength() / Int8Array.BYTES_PER_ELEMENT) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
903d7d252a3cbd052f8ff82396801ac28c003695
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
addAll
Adds all values from another LightWeightSet to this LightWeightSet @param set the LightWeightSet to add values from @returns true if all values were added, false otherwise
addAll(set: LightWeightSet<T>): boolean { let result: boolean = false; set.forEach((value: T): void => { result |= this.add(value); }); return result; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left LightWeightSet A...
addAll(set: LightWeightSet<T>): boolean { let result: boolean = false; set.forEach((value: T): void => { result |= this.add(value); }); return result; }
https://gitcode.com/iop123123/arkts-static-skills
2849ab956091920a19298ee0043d3ca425b431ba
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
setExtraRightOffset
Set an extra offset to be appended to the viewport's right
public setExtraRightOffset(offset: number) { this.mExtraRightOffset = Utils.handleDataValues(offset); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setExtraRightOffset 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#identifier...
public setExtraRightOffset(offset: number) { this.mExtraRightOffset = Utils.handleDataValues(offset); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
db59d0c28c93b749a0d3e08f75b4b996a23ce724
gitee
openharmony/applications_mms
entry/src/main/ets/service/NotificationService.ets
arkts
sendNotify
Send Notifications @param actionData
sendNotify(actionData) { // Creating Want Information let wantAgentInfo = this.buildWantAgentInfo(actionData); // Constructing a Send Request let notificationRequest = this.buildNotificationRequest(actionData); this.getWantAgent(wantAgentInfo, (data) => { notifica...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendNotify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left actionData AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#ex...
sendNotify(actionData) { // Creating Want Information let wantAgentInfo = this.buildWantAgentInfo(actionData); // Constructing a Send Request let notificationRequest = this.buildNotificationRequest(actionData); this.getWantAgent(wantAgentInfo, (data) => { notifica...
https://gitee.com/openharmony/applications_mms.git
336af8947f2dd34a9223d1f6bab67dabcef7ab75
gitee
openharmony-sig/applications_clock
common/src/main/ets/manager/SoundPool.ets
arkts
setErrorCallback
设置错误类型监听
setErrorCallback(): void { this.soundPool.on('error', (error) => { LogUtil.info(TAG, `error happened,message is: ${error.message},code=${error.code},name=${error.name}`); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setErrorCallback 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...
setErrorCallback(): void { this.soundPool.on('error', (error) => { LogUtil.info(TAG, `error happened,message is: ${error.message},code=${error.code},name=${error.name}`); }); }
https://gitee.com/openharmony-sig/applications_clock.git
6fedbf766f936a41cae61cb6ed77c769d2a77577
gitee
yang-kun-long/HarmonyAccounting
entry/src/main/ets/view/DialogComponent.ets
arkts
TabBuilder
构建选项卡界面的函数 该函数用于根据传入的索引值构建一个选项卡界面,索引值决定了当前显示的内容 @param index 选项卡的索引值,用于决定显示的内容 @returns 返回构建的选项卡界面元素
TabBuilder(index: number) { // 定义一个列布局,用于容纳选项卡的文本内容 Column() { // 根据索引值显示不同的文本内容,索引为0时显示支付文本,否则显示收入文本 Text(index === 0 ? $r('app.string.pay_text') : $r('app.string.income_text')) // 设置文本字体大小 .fontSize($r('app.float.font_size_M')) // 根据当前选项卡是否为选中状态,设置文本颜色,选中时显示主色调,否则显示灰色 ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left TabBuilder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A...
TabBuilder(index: number) { // 定义一个列布局,用于容纳选项卡的文本内容 Column() { // 根据索引值显示不同的文本内容,索引为0时显示支付文本,否则显示收入文本 Text(index === 0 ? $r('app.string.pay_text') : $r('app.string.income_text')) // 设置文本字体大小 .fontSize($r('app.float.font_size_M')) // 根据当前选项卡是否为选中状态,设置文本颜色,选中时显示主色调,否则显示灰色 ...
https://github.com/yang-kun-long/HarmonyAccounting
1e0d425aa4f7059aa40ff1e632b139b5f25669c7
github
openharmony-sig/knowledge_demo_entainment
FA/BombGame/entry/src/main/ets/MainAbility/pages/RemoteDeviceManager.ets
arkts
forcedUpdateList
强制更新deviceList UI视图
forcedUpdateList(){ this.deviceList.push(new RemoteDevice("update","update",1,RemoteDeviceStatus.UNTRUSTED)) this.deviceList.pop() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left forcedUpdateList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
forcedUpdateList(){ this.deviceList.push(new RemoteDevice("update","update",1,RemoteDeviceStatus.UNTRUSTED)) this.deviceList.pop() }
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
9ad8a8a64cf717b441b9c9eaa3a804f0571e0ee9
gitee
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets
arkts
accelerate
加速插值器 动画开始慢,然后加速
static accelerate(factor: number = 1.0): curves.ICurve { return AnimationInterpolator.cubicBezier(factor * 0.4, 0, 1, 1); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left accelerate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left factor AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressi...
static accelerate(factor: number = 1.0): curves.ICurve { return AnimationInterpolator.cubicBezier(factor * 0.4, 0, 1, 1); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
6bb1cabae2daeb808a5e8ad64ef9e911f2f2ce51
gitcode
Joker-x-dev/HarmonyKit
feature/main/src/main/ets/viewmodel/NavigationViewModel.ets
arkts
shouldShowResult
是否展示结果区域 @returns {boolean} 是否展示
shouldShowResult(): boolean { return this.hasResultTitle() || this.hasResultDesc(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shouldShowResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#st...
shouldShowResult(): boolean { return this.hasResultTitle() || this.hasResultDesc(); }
https://github.com/Joker-x-dev/HarmonyKit
219ebd059a384ce4c29c511ab986e31cda911f81
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
syncHorizontalAngle
Sync horizontal angle. @param angle
syncHorizontalAngle(angle: number) { this.horizontalAngle = angle; let points = MathUtils.rectToPoints(this.cropRect); let origin = this.getDisplayCenter(); let totalAngle = -(this.rotationAngle + this.horizontalAngle); let rotated = MathUtils.rotatePoints(points, totalAngle, origin); let sca...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left syncHorizontalAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left angle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifie...
syncHorizontalAngle(angle: number) { this.horizontalAngle = angle; let points = MathUtils.rectToPoints(this.cropRect); let origin = this.getDisplayCenter(); let totalAngle = -(this.rotationAngle + this.horizontalAngle); let rotated = MathUtils.rotatePoints(points, totalAngle, origin); let sca...
https://gitee.com/openharmony/codelabs.git
eaf074fe0cdf972edb0cff19d47af28f2f0715d2
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_than/greater_than_ushort.ets
arkts
main
--- desc: check greater operation for two unsigned short integers ---
function main(): void { const a: ushort = {{v.left}} const b: ushort = {{v.right}} assert (a > b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ushort = {{v.left}} const b: ushort = {{v.right}} assert (a > b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1e3ae60093d05e7fae4e5f084e9b1990d48bd1cd
gitee
offlinecat-dev/OCNetORM
src/main/ets/schema/SchemaBuilder.ets
arkts
generateCreateJoinTableSql
生成多对多中间表的 CREATE TABLE SQL
private generateCreateJoinTableSql(relation: ManyToManyMetadata): string { const joinTable = this.escapeIdentifier(relation.joinTable) const joinSourceKey = this.escapeIdentifier(relation.joinSourceKey) const joinTargetKey = this.escapeIdentifier(relation.joinTargetKey) const sourceType = this.resolve...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateCreateJoinTableSql AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left relation AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
private generateCreateJoinTableSql(relation: ManyToManyMetadata): string { const joinTable = this.escapeIdentifier(relation.joinTable) const joinSourceKey = this.escapeIdentifier(relation.joinSourceKey) const joinTargetKey = this.escapeIdentifier(relation.joinTargetKey) const sourceType = this.resolve...
https://github.com/offlinecat-dev/OCNetORM
8220ae39dc72d0fecf20a81d814170802d5b33f5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
of
Returns Type of value @param {long} v value @returns {Type} Type instance of this value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(v: long): Type { return LongType.VAL }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#...
public static of(v: long): Type { return LongType.VAL }
https://gitcode.com/iop123123/arkts-static-skills
3bd4a21bfdde5325937a6c48224354797c05b7ca
gitcode
CPF-ApplicationTPC/imageknifepro
library/src/main/ets/ImageKnife.ets
arkts
getCurrentCacheNum
获取文件或者内存缓存当前缓存的图片数量 @param cacheStrategy 指定需要查询类型。CacheStrategy.FILE为查询文件缓存,其余枚举为查询内存缓存 @param cacheName 需要操作的文件缓存名称,默认名称为空即操作大端文件缓存, 不为空则匹配小端文件缓存 @returns 文件或者内存缓存图片数量,获取文件缓存图片数量返回值为-1时,文件缓存初始化未完成获取不到结果
getCurrentCacheNum(cacheStrategy : CacheStrategy, cacheName?:string): number | undefined { return nativeNode.getCurrentCacheNum(cacheStrategy, cacheName); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentCacheNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheStrategy AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Ca...
getCurrentCacheNum(cacheStrategy : CacheStrategy, cacheName?:string): number | undefined { return nativeNode.getCurrentCacheNum(cacheStrategy, cacheName); }
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L230-L232
38209f8a3c991f0907fd6106cef027a707e9f064
gitcode
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets
arkts
checkAndRequestMicrophonePermission
检查并请求麦克风权限
private async checkAndRequestMicrophonePermission(): Promise<boolean> { if (!this.context) { Logger.error(TAG, 'Context is null, cannot request permission') return false } const permission: Permissions = 'ohos.permission.MICROPHONE' try { const atManager = abilityAccessCtrl.createA...
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 checkAndRequestMicrophonePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#cal...
private async checkAndRequestMicrophonePermission(): Promise<boolean> { if (!this.context) { Logger.error(TAG, 'Context is null, cannot request permission') return false } const permission: Permissions = 'ohos.permission.MICROPHONE' try { const atManager = abilityAccessCtrl.createA...
https://gitcode.com/openharmony/codelabs
8b33e220ad349e86a16440fca7d607c376c8524c
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
getMimeTypeFromExtension
响应头类型 @param filePath @returns
public static getMimeTypeFromExtension(filePath: string): string { const extension = filePath.split('.').pop()?.toLowerCase() ?? ''; const mimeMap: Record<string, string> = { 'txt': 'text/plain', 'pdf': 'application/pdf', 'jpg': 'image/jpeg', 'jpeg': 'image/jpeg', 'png': 'image/...
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 getMimeTypeFromExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left ...
public static getMimeTypeFromExtension(filePath: string): string { const extension = filePath.split('.').pop()?.toLowerCase() ?? ''; const mimeMap: Record<string, string> = { 'txt': 'text/plain', 'pdf': 'application/pdf', 'jpg': 'image/jpeg', 'jpeg': 'image/jpeg', 'png': 'image/...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L51-L81
ee496fe9d2cf8f58084f4fa6e922a7cd0ab0633d
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/historyrecord/HistoryRecordController.ets
arkts
getExpDataSource
retrun expDataSource @return expDataSource
getExpDataSource(): ExpressionsDataSource { return this.expDataSource; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getExpDataSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ExpressionsDataSource AST#identifier#Right AS...
getExpDataSource(): ExpressionsDataSource { return this.expDataSource; }
https://gitee.com/openharmony-sig/applications_calculator.git
c15a2d74898726dbc9b96f54d3732d11a108e97b
gitee
offlinecat-dev/OCNetORM
src/main/ets/repository/Repository.ets
arkts
findPaginated
分页查询实体 如果实体启用了软删除,默认只查询未删除的数据 查询成功后对每条记录执行 afterLoad 钩子 @param page 页码(从 1 开始) @param pageSize 每页数量 @param includeDeleted 是否包含已删除的数据,默认 false @returns Promise<PaginatedResult> Requirements: 2.7
async findPaginated(page: number, pageSize: number, includeDeleted: boolean = false): Promise<PaginatedResult> { const startTime = Date.now() return await this.withSessionStore(async (repo) => { try { // 创建查询构建器 const queryBuilder = repo.createQueryBuilder() // 设置分页参数 qu...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left findPaginated AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left page AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async findPaginated(page: number, pageSize: number, includeDeleted: boolean = false): Promise<PaginatedResult> { const startTime = Date.now() return await this.withSessionStore(async (repo) => { try { // 创建查询构建器 const queryBuilder = repo.createQueryBuilder() // 设置分页参数 qu...
https://github.com/offlinecat-dev/OCNetORM
b95388ca064080906fb6e876f0240de0d28586cd
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/DateUtil.ets
arkts
getCurrentTime
获取当前时间 格式: HH:mm:ss
static getCurrentTime(): string { const date = new Date(); const hours = String(date.getHours()).padStart(2, '0'); const minutes = String(date.getMinutes()).padStart(2, '0'); const seconds = String(date.getSeconds()).padStart(2, '0'); return `${hours}:${minutes}:${seconds}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentTime 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 AST#...
static getCurrentTime(): string { const date = new Date(); const hours = String(date.getHours()).padStart(2, '0'); const minutes = String(date.getMinutes()).padStart(2, '0'); const seconds = String(date.getSeconds()).padStart(2, '0'); return `${hours}:${minutes}:${seconds}`; }
https://github.com/qiuhaotc/HarmonyOSPlayground
dd046fc11a9a8d3d66eeca7219a178c82272a8af
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getComicSourcesByIds
[性能优化] 批量获取图源记录 用于书库冷启动时一次性补齐在线漫画的图源名称、pkg 等信息
async getComicSourcesByIds(sourceIds: number[]): Promise<Map<number, ComicSourceDatabaseRecord>> { const result: Map<number, ComicSourceDatabaseRecord> = new Map<number, ComicSourceDatabaseRecord>(); if (sourceIds.length <= 0) { return result; } const uniqueSourceIds: number[] = []; const s...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getComicSourcesByIds AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceIds AST#identifier#Right AST#type_annotation#Left AS...
async getComicSourcesByIds(sourceIds: number[]): Promise<Map<number, ComicSourceDatabaseRecord>> { const result: Map<number, ComicSourceDatabaseRecord> = new Map<number, ComicSourceDatabaseRecord>(); if (sourceIds.length <= 0) { return result; } const uniqueSourceIds: number[] = []; const s...
https://github.com/DaLongZhuaZi/manxia
0284bc9d72766559e0eedfb1b95984e6cf1d4002
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets
arkts
extractAuthorFromFileName
从文件名提取作者
private static extractAuthorFromFileName(fileName: string): string { // 移除时间戳前缀 let cleanName = fileName.replace(/^\d{10,}_/, ''); // 尝试提取"《书名》作者:xxx"格式 const authorMatch = cleanName.match(/作者[::]([^.]+)/); if (authorMatch && authorMatch[1]) { const author = authorMatch[1].replace(/\.(t...
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 extractAuthorFromFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#L...
private static extractAuthorFromFileName(fileName: string): string { // 移除时间戳前缀 let cleanName = fileName.replace(/^\d{10,}_/, ''); // 尝试提取"《书名》作者:xxx"格式 const authorMatch = cleanName.match(/作者[::]([^.]+)/); if (authorMatch && authorMatch[1]) { const author = authorMatch[1].replace(/\.(t...
https://github.com/DaLongZhuaZi/manxia
19a78119651547f3ea7c517c49a392155b7527e3
github
YANGZX22/Voot
entry/src/main/ets/storage/OnboardingStorage.ets
arkts
resetOnboarding
重置引导状态(用于测试或用户请求重新引导) @param ctx UI Ability Context
static async resetOnboarding(ctx: common.UIAbilityContext): Promise<void> { const prefs = await OnboardingStorage.getPrefs(ctx); await prefs.put(OnboardingStorage.KEY_COMPLETED, false); await prefs.put(OnboardingStorage.KEY_SETUP_COMPLETED, false); await prefs.flush(); }
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 resetOnboarding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AS...
static async resetOnboarding(ctx: common.UIAbilityContext): Promise<void> { const prefs = await OnboardingStorage.getPrefs(ctx); await prefs.put(OnboardingStorage.KEY_COMPLETED, false); await prefs.put(OnboardingStorage.KEY_SETUP_COMPLETED, false); await prefs.flush(); }
https://github.com/YANGZX22/Voot
5b3f9b813ed9f26e394148eeb88161188768d3b1
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
toExponential
Return a string representing the value of this Decimal in exponential notation rounded to `decimalPlaces` fixed decimal places using rounding mode `rounding`. @param { double } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. @retur...
public toExponential(decimalPlaces: double, rounding: Rounding): string { Utils.checkInt32(decimalPlaces, 0, MAX_DIGITS); Utils.checkInt32(rounding, 0, 8); let x = Utils.finalise(new Decimal(this), decimalPlaces + 1, rounding); let str = x.finiteToString(true, decimalPlaces + 1); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toExponential AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left decimalPlaces AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left double AS...
public toExponential(decimalPlaces: double, rounding: Rounding): string { Utils.checkInt32(decimalPlaces, 0, MAX_DIGITS); Utils.checkInt32(rounding, 0, 8); let x = Utils.finalise(new Decimal(this), decimalPlaces + 1, rounding); let str = x.finiteToString(true, decimalPlaces + 1); ...
https://gitcode.com/iop123123/arkts-static-skills
37a56e5851740b685c460be7d9204290a81a1e6e
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
updateCategoryCovers
更新分类的封面图片
async updateCategoryCovers(categoryId: string, coverImages: string[]): Promise<void> { const category = this.categories.find(c => c.id === categoryId); if (category) { category.coverImages = coverImages.slice(0, 4); // 最多4张 category.updateTime = Date.now(); await this.saveCategories(); }...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateCategoryCovers AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left categoryId AST#identifier#Right AST#type_annotation#Left A...
async updateCategoryCovers(categoryId: string, coverImages: string[]): Promise<void> { const category = this.categories.find(c => c.id === categoryId); if (category) { category.coverImages = coverImages.slice(0, 4); // 最多4张 category.updateTime = Date.now(); await this.saveCategories(); }...
https://github.com/DaLongZhuaZi/manxia
821ab78286d30e13984b7d98b3ca506fffcaf24b
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/common/CustomComponentDemo.ets
arkts
onPlaceChildren
通过 onPlaceChildren() 指定每个子组件的位置(注:先 onMeasureSize 再 onPlaceChildren) selfLayoutInfo - 父组件的布局信息(一个 GeometryInfo 对象) width, height, borderWidth, margin, padding children - 子组件数组(一个 Layoutable 对象数组) measureResult - 获取指定的子组件的尺寸(注:此尺寸是在 onMeasureSize 中测量出的结果) layout() - 设置指定的子组件的位置 getMargin(), getPadding(), getBorderWidth(...
onPlaceChildren(selfLayoutInfo: GeometryInfo, children: Array<Layoutable>, constraint: ConstraintSizeOptions) { let posY = 0; children.forEach((child) => { // 通过 x, y 设置 child 的位置 child.layout({ x: 0, y: posY }) // 通过 measureResult 获取 child 的尺寸(注:此尺寸是在 onMeasureSize 中测量出的结果) posY = pos...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPlaceChildren AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selfLayoutInfo AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left GeometryInfo AST#identifier#Rig...
onPlaceChildren(selfLayoutInfo: GeometryInfo, children: Array<Layoutable>, constraint: ConstraintSizeOptions) { let posY = 0; children.forEach((child) => { // 通过 x, y 设置 child 的位置 child.layout({ x: 0, y: posY }) // 通过 measureResult 获取 child 的尺寸(注:此尺寸是在 onMeasureSize 中测量出的结果) posY = pos...
https://github.com/webabcd/HarmonyDemo
577c0b25289b0b4e5606b69899ec7526bb47599c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
set
Copies all elements of arr to the current Uint16Array starting from insertPos. {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} @param { FixedArray<int> } arr - array to copy data from @param { int } insertPos - start index where data from arr will be inserted @thr...
public set(arr: FixedArray<int>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint16Array.length") } for (let i = 0; i < arr.length; i++) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: FixedArray<int>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint16Array.length") } for (let i = 0; i < arr.length; i++) { ...
https://gitcode.com/iop123123/arkts-static-skills
af62f6cca32b3d7dff40237184b7dc85d7700f54
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
updateSourceConfigInDatabase
更新数据库中的源配置
private async updateSourceConfigInDatabase(sourceId: string, config: WebViewSourceConfig): Promise<void> { try { const updateData: UpdateRecordData = { id: sourceId, userAgent: config.userAgent, enableJavaScript: config.enableJavaScript ? 1 : 0, enableImages: config.enableIma...
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 updateSourceConfigInDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR...
private async updateSourceConfigInDatabase(sourceId: string, config: WebViewSourceConfig): Promise<void> { try { const updateData: UpdateRecordData = { id: sourceId, userAgent: config.userAgent, enableJavaScript: config.enableJavaScript ? 1 : 0, enableImages: config.enableIma...
https://github.com/DaLongZhuaZi/manxia
b3d0eef0a69ab8e31532dfbf98198febf251d34c
github
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/services/PreferencesStore.ets
arkts
startVoluntaryOTSession
Starts a new voluntary OT session. Resets accumulated if the stored date is stale.
public async startVoluntaryOTSession(): Promise<void> { const today: string = this.dateStringToday() const storedDate: string = await this.loadVoluntaryOTDate() if (storedDate !== today) { await this.saveVoluntaryOTAccumulated(0) await this.saveVoluntaryOTDate(today) } const nowSec: nu...
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 startVoluntaryOTSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
public async startVoluntaryOTSession(): Promise<void> { const today: string = this.dateStringToday() const storedDate: string = await this.loadVoluntaryOTDate() if (storedDate !== today) { await this.saveVoluntaryOTAccumulated(0) await this.saveVoluntaryOTDate(today) } const nowSec: nu...
https://github.com/OMGCA/sakipay
3d60e6bbf9d563361cac546de9c0ed78b72dcccc
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/AccountKitService.ets
arkts
isExpired
判断凭据是否过期 Access Token 过期后进行判断; ID Token 通常有效期为 1 小时
isExpired(): boolean { if (!this.credential || this.credential.loginTime === 0) { return true; } // 如果有 Access Token, 按 tokenExpiresAt 判断 if (this.credential.accessToken && this.credential.tokenExpiresAt > 0) { return Date.now() > this.credential.tokenExpiresAt; } // 否则按 ID Token 典型有效期 (1小时)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isExpired AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement...
isExpired(): boolean { if (!this.credential || this.credential.loginTime === 0) { return true; } // 如果有 Access Token, 按 tokenExpiresAt 判断 if (this.credential.accessToken && this.credential.tokenExpiresAt > 0) { return Date.now() > this.credential.tokenExpiresAt; } // 否则按 ID Token 典型有效期 (1小时)...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
415c31b47e1e63dabf708c907cca178e6400f0dc
github
YANGZX22/Voot
entry/src/main/ets/pages/Index.ets
arkts
onContinuityRestored
跨端流转状态恢复回调(@Watch 触发)
onContinuityRestored(): void { // 避免重复处理 const now = Date.now(); if (!this.continuityRestored || now - this.lastContinuityRestoreTs < 1000) { return; } this.lastContinuityRestoreTs = now; console.info('[Index] onContinuityRestored triggered via @Watch'); const stateJson = AppStorage...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onContinuityRestored 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#stateme...
onContinuityRestored(): void { // 避免重复处理 const now = Date.now(); if (!this.continuityRestored || now - this.lastContinuityRestoreTs < 1000) { return; } this.lastContinuityRestoreTs = now; console.info('[Index] onContinuityRestored triggered via @Watch'); const stateJson = AppStorage...
https://github.com/YANGZX22/Voot
9e69c97c9acd37e726e093bf91b6040084c11468
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
extractCustomShelfTagsAndAuthors
提取自定义书架内容的标签和作者 - 已废弃,使用extractShelfTagsAndAuthors
private extractCustomShelfTagsAndAuthors(): void { this.extractShelfTagsAndAuthors(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractCustomShelfTagsAndAuthors 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#ER...
private extractCustomShelfTagsAndAuthors(): void { this.extractShelfTagsAndAuthors(); }
https://github.com/DaLongZhuaZi/manxia
3509a401ff688e08d38aa6aa12c6e35f002e99a7
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitDouble
访问 double 字段 Wire type: 1 (64-bit)
visitDouble(value: number, fieldNumber: number): void { this.writer.tag(fieldNumber, 1).double(value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitDouble 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#identifier#Right AST#,#Left , AS...
visitDouble(value: number, fieldNumber: number): void { this.writer.tag(fieldNumber, 1).double(value) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
e0855457e627b0d1c0fa030ec7ead0e179c151ee
gitcode
ZestBox-18/kitebook-frontend
features/home/src/main/ets/components/IncomeExpenseCardComponent.ets
arkts
IncomeExpenseBlock
构建单个收支指标块。
private IncomeExpenseBlock(icon: Resource, tone: string, label: string, value: string, accent: boolean) { Column({ space: 10 }) { Row() { SymbolGlyph(icon) .fontSize(this.compactLayout ? 20 : 22) .fontColor([tone]) } .width(this.compactLayout ? 40 : 44) .height(...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left IncomeExpenseBlock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left icon AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private IncomeExpenseBlock(icon: Resource, tone: string, label: string, value: string, accent: boolean) { Column({ space: 10 }) { Row() { SymbolGlyph(icon) .fontSize(this.compactLayout ? 20 : 22) .fontColor([tone]) } .width(this.compactLayout ? 40 : 44) .height(...
https://github.com/ZestBox-18/kitebook-frontend
bb4e37c6c89d80f00f291f02690c9b418ffeef64
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/events/EventsProcessor.ets
arkts
isCalendarContainSameId
检查待插入的 event 与 calendar 表中是否存在相同 calendar_id 的元组 @param rdbStore rdb数据库 @param values 插入操作的数据 @return true 相同 false 不相同
async function isCalendarContainSameId(rdbStore: data_rdb.RdbStore, values: data_rdb.ValuesBucket): Promise<boolean> { Log.debug(TAG, 'isCalendarContainSameId start'); let resultSet = await queryCalendarIdAndCreatorByEvent(rdbStore, values); if (resultSet === null || resultS...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left isCalendarContainSameId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#R...
async function isCalendarContainSameId(rdbStore: data_rdb.RdbStore, values: data_rdb.ValuesBucket): Promise<boolean> { Log.debug(TAG, 'isCalendarContainSameId start'); let resultSet = await queryCalendarIdAndCreatorByEvent(rdbStore, values); if (resultSet === null || resultS...
https://gitee.com/openharmony/applications_calendar_data.git
37b8282c6015b21bb1d889e922459c346c5ba82e
gitee
openharmony/codelabs
Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets
arkts
insertValues
Insert steps to database. @param {number} stepsValue Value of steps. @param {DataRdb.RdbStore} rdbStore RDB database.
async insertValues(stepsValue: number, rdbStore: DataRdb.RdbStore) { let now: string = DateUtils.getDate(0); let sensorData: SensorData = new SensorData(); sensorData.date = now; sensorData.stepsValue = stepsValue; // Check whether there is data today. let todayData: SensorData = await this.ge...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertValues AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left stepsValue AST#identifier#Right AST#type_annotation#Left ...
async insertValues(stepsValue: number, rdbStore: DataRdb.RdbStore) { let now: string = DateUtils.getDate(0); let sensorData: SensorData = new SensorData(); sensorData.date = now; sensorData.stepsValue = stepsValue; // Check whether there is data today. let todayData: SensorData = await this.ge...
https://gitee.com/openharmony/codelabs.git
596f50b9b4aa7133b7bd045f5b126485c822bbf7
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
applyGlobalSettingsIfNew
对于新电子书,应用电子书全局默认阅读设置。 TXT/小说阅读器默认值由小说阅读设置链路单独处理。
private async applyGlobalSettingsIfNew(bookId: string, settings: EBookReadingSettings): Promise<EBookReadingSettings> { try { const existingSql = ` SELECT bookId FROM ebook_reading_settings WHERE bookId = ? AND userId = ? ORDER BY updateTime DESC, createTime DESC, id DESC ...
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 applyGlobalSettingsIfNew AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right ...
private async applyGlobalSettingsIfNew(bookId: string, settings: EBookReadingSettings): Promise<EBookReadingSettings> { try { const existingSql = ` SELECT bookId FROM ebook_reading_settings WHERE bookId = ? AND userId = ? ORDER BY updateTime DESC, createTime DESC, id DESC ...
https://github.com/DaLongZhuaZi/manxia
9f4ef8b59f732af2033526e7dac482413eb6a120
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/FileUtils.ets
arkts
saveLocalFile
使用保存弹框选择保存位置保存本地文件 @param path 文件路径 @param content 文件内容 @returns 结果
public static saveLocalFile(fileName: string, createContent: (filePath: string) => Promise<ArrayBuffer>): Promise<void> { // 使用文件选择器让用户选择保存位置 const documentPicker = new picker.DocumentViewPicker(CommonUtils.getContext()); const options = new picker.DocumentSaveOptions(); options.newFileNames = [fileNa...
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 saveLocalFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public static saveLocalFile(fileName: string, createContent: (filePath: string) => Promise<ArrayBuffer>): Promise<void> { // 使用文件选择器让用户选择保存位置 const documentPicker = new picker.DocumentViewPicker(CommonUtils.getContext()); const options = new picker.DocumentSaveOptions(); options.newFileNames = [fileNa...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FileUtils.ets#L92-L118
aac03c2d1f1128fe159c1da66530cdaf87404f96
github
Cool_foolisher1/ArkTSRepository
RandomNumberSimulator/entry/src/main/ets/common/utils/PreferenceUtils.ets
arkts
getPreferences
获取首选项实例 @param context 应用上下文 @param name 首选项文件名 @returns 首选项实例
private static getPreferences(context: Context = new UIContext().getHostContext() as Context, name: string): preferences.Preferences { return preferences.getPreferencesSync(context, { name: name }) }
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 getPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le...
private static getPreferences(context: Context = new UIContext().getHostContext() as Context, name: string): preferences.Preferences { return preferences.getPreferencesSync(context, { name: name }) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
526cb69e12525b7650f39b384b1add8df1125aa5
gitcode
YANGZX22/Voot
entry/src/main/ets/services/ModelDownloadService.ets
arkts
downloadSingleFile
下载单个文件
private async downloadSingleFile( context: common.UIAbilityContext, url: string, filePath: string, onProgress: (downloaded: number, total: number) => void ): Promise<void> { return new Promise((resolve, reject) => { const config: request.DownloadConfig = { url: url, filePat...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left downloadSingleFile AST#identifier#Right AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left context AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Rig...
private async downloadSingleFile( context: common.UIAbilityContext, url: string, filePath: string, onProgress: (downloaded: number, total: number) => void ): Promise<void> { return new Promise((resolve, reject) => { const config: request.DownloadConfig = { url: url, filePat...
https://github.com/YANGZX22/Voot
fba747a2ab7b96eb7b6e20f4744ec84e96b46188
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Description.ets
arkts
setTextAlign
Sets the text alignment of the description text. Default RIGHT. @param align
public setTextAlign(align: CanvasTextAlign) { this.mTextAlign = align; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTextAlign AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left align AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ca...
public setTextAlign(align: CanvasTextAlign) { this.mTextAlign = align; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
8234f860a11b5312258867c770355068e8018a2f
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
parseCookieString
解析Cookie字符串并保存
private parseCookieString(sourceId: string, cookieStr: string): void { const cookies: Record<string, string> = {}; const parts = cookieStr.split(';'); for (let i = 0; i < parts.length; i++) { const part = parts[i].trim(); const eqIndex = part.indexOf('='); if (eqIndex > 0) { cons...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseCookieString 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#...
private parseCookieString(sourceId: string, cookieStr: string): void { const cookies: Record<string, string> = {}; const parts = cookieStr.split(';'); for (let i = 0; i < parts.length; i++) { const part = parts[i].trim(); const eqIndex = part.indexOf('='); if (eqIndex > 0) { cons...
https://github.com/DaLongZhuaZi/manxia
0d3132ba0f5095e49d3d97e13e989b6efe3aa703
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
createTables
建表 (列名无下划线, 符合 AGC 限制)
private async createTables(): Promise<void> { if (!this.store) { return; } await this.store.executeSql(` CREATE TABLE IF NOT EXISTS remotehosts ( id TEXT PRIMARY KEY, userid TEXT, label TEXT, protocol TEXT, host TEXT, port INTEGER, username TEXT, ...
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 createTables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async createTables(): Promise<void> { if (!this.store) { return; } await this.store.executeSql(` CREATE TABLE IF NOT EXISTS remotehosts ( id TEXT PRIMARY KEY, userid TEXT, label TEXT, protocol TEXT, host TEXT, port INTEGER, username TEXT, ...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
a5c5690d7b8f09e4253dcb04d038a13ec2f00b6f
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyTypes.ets
arkts
buildDigitalStickPresets
构建数字摇杆预设列表
function buildDigitalStickPresets(): KeyPreset[] { const list: KeyPreset[] = [ { label: 'WASD数字摇杆', action: { type: 'digitalStick', upAction: { type: 'keyboard', vk: 0x57 } as KeyboardAction, downAction: { type: 'keyboard', vk: 0x53 } as KeyboardAction, leftAction: { ty...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildDigitalStickPresets 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#ar...
function buildDigitalStickPresets(): KeyPreset[] { const list: KeyPreset[] = [ { label: 'WASD数字摇杆', action: { type: 'digitalStick', upAction: { type: 'keyboard', vk: 0x57 } as KeyboardAction, downAction: { type: 'keyboard', vk: 0x53 } as KeyboardAction, leftAction: { ty...
https://github.com/AlkaidLab/moonlight-harmony
88f5f1a0e5be852ecb843926cf69929fa42b5725
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/hybrid/ViewState.ets
arkts
getProperty
NOTE: Per-property style readback (e.g. fill-mode) is not yet wired to native. Until the native side exposes a typed property reader, getProperty() returns a default StyleItem and downstream style dispatch in HybridBaseProperty is a no-op. Custom components should read styles via the JSON snapshot from getPropertiesJso...
getProperty(cls: PseudoClass, key: number): StyleItem { return new StyleItem(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cls AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PseudoClass AST#identifier#Right AST#,#Left ,...
getProperty(cls: PseudoClass, key: number): StyleItem { return new StyleItem(); }
https://github.com/AGenUI/AGenUI
f7db22ac63185fb470fbc6408d39500c5ffbb226
github
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getCardType
获取指定卡槽SIM卡的卡类型。使用Promise异步回调。 @param slotId 卡槽ID(0-卡槽1、1-卡槽2)。 默认移动数据的SIM卡。 @returns
static async getCardType(slotId?: number): Promise<sim.CardType> { slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //默认移动数据的SIM卡 return sim.getCardType(slotId); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getCardType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ? AST...
static async getCardType(slotId?: number): Promise<sim.CardType> { slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //默认移动数据的SIM卡 return sim.getCardType(slotId); }
https://github.com/tdcare/tdwebrtc
158a19d519d0791b591e41a2d41d2385837cb4a6
github
openharmony-sig/earth
hpauditor/tests/issues/expected/issue259.ets.audit.ets
arkts
onPageHide
建issue
onPageHide() { if (this.isBack) { this.stopStreaming() } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageHide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
onPageHide() { if (this.isBack) { this.stopStreaming() } }
https://gitee.com/openharmony-sig/earth.git
b64546c20a30a4a0cfbf097dc6401f9823ddf171
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Image/CoverImageManager.ets
arkts
getCacheSize
获取缓存大小
getCacheSize(): number { return coverCache.size; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCacheSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement...
getCacheSize(): number { return coverCache.size; }
https://github.com/DaLongZhuaZi/manxia
b2141d482044d91dc5775979aad2bff7f73ecd45
github
kumaleap/ArkLuban
library/src/main/ets/luban/Luban.ets
arkts
filterPaths
过滤需要压缩的文件路径 @returns 过滤后的文件路径列表
private filterPaths(): string[] { if (!this.config.filter) { return this.config.paths; } return this.config.paths.filter(path => this.config.filter!(path)); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left filterPaths AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left string ...
private filterPaths(): string[] { if (!this.config.filter) { return this.config.paths; } return this.config.paths.filter(path => this.config.filter!(path)); }
https://github.com/kumaleap/ArkLuban
774e63b39db16b0249b9055817f32fb930ce789c
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test20_original_index.ets
arkts
testNestedTernary
--- Nested ternary ---
function testNestedTernary(): string { let x: number = 15; let result: string = x > 20 ? 'big' : x > 10 ? 'medium' : x > 5 ? 'small' : 'tiny'; return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedTernary 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#predefine...
function testNestedTernary(): string { let x: number = 15; let result: string = x > 20 ? 'big' : x > 10 ? 'medium' : x > 5 ? 'small' : 'tiny'; return result; }
https://github.com/miaochiahao/ark-ghidra
aa8ca4e8756ddf9e715549770061c740572c9241
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/InvisibleWebViewComponent.ets
arkts
clearAll
清理所有实例
clearAll(): void { this.webViewMap.clear(); logger.info(TAG, '清理所有WebView实例'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef...
clearAll(): void { this.webViewMap.clear(); logger.info(TAG, '清理所有WebView实例'); }
https://github.com/DaLongZhuaZi/manxia
250931d48568cb93da944e867ba717442341d6d4
github
arkui-x/samples
CodeLab/Cases/feature/applicationexception/src/main/ets/model/PreferencesManager.ets
arkts
putFaultSign
存储数据异常标识
public static async putFaultSign(): Promise<void> { logger.info(TAG, `putFaultSign start`); try { // TODO:知识点:通过 dataPreferencesManager.put方法存储数据 dataPreferencesManager.setValue('faultSign', true) } catch (err) { logger.error(TAG, "putFaultSign Failed to put value of 'catch err'....
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left putFaultSign AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#R...
public static async putFaultSign(): Promise<void> { logger.info(TAG, `putFaultSign start`); try { // TODO:知识点:通过 dataPreferencesManager.put方法存储数据 dataPreferencesManager.setValue('faultSign', true) } catch (err) { logger.error(TAG, "putFaultSign Failed to put value of 'catch err'....
https://gitcode.com/arkui-x/samples
c7a59183724715d692f803922f33a23c34eb65e9
gitcode
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/ResourceUtil.ets
arkts
getDataFromRawfile
Obtains the raw file resource corresponding to the specified resource path. @param context Context. @param path the resource relative path. @returns the raw file resource corresponding to the specified resource path.
public static getDataFromRawfile(context: Context, path: string): Promise<object> { return new Promise((resolve, reject) => { if (!context) { Logger.error(TAG, 'getDataFromRawfile context is null'); reject(); return; } if (!path || path.length === 0) { Logger.erro...
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 getDataFromRawfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#L...
public static getDataFromRawfile(context: Context, path: string): Promise<object> { return new Promise((resolve, reject) => { if (!context) { Logger.error(TAG, 'getDataFromRawfile context is null'); reject(); return; } if (!path || path.length === 0) { Logger.erro...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
187950061b1be582c5bb25d106cc98151fad9505
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
assignableFrom
Checks if a type is assignable to this lambda type @param {Type} other Type to check @returns {boolean} True if type is assignable @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override assignableFrom(other: Type): boolean { if (super.assignableFrom(other)) { return true } if (!(other instanceof LambdaType)) { return false } let l = (this) let r = other as LambdaType if (l.getParametersNum() < r.getPara...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left assignableFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public override assignableFrom(other: Type): boolean { if (super.assignableFrom(other)) { return true } if (!(other instanceof LambdaType)) { return false } let l = (this) let r = other as LambdaType if (l.getParametersNum() < r.getPara...
https://gitcode.com/iop123123/arkts-static-skills
3330d32882e675d108af5a97b6cfb07fefe98165
gitcode
kumaleap/ArkLuban
library/src/main/ets/luban/Luban.ets
arkts
setMaxConcurrency
设置批量压缩最大并发数 @param count 并发数量,最小为 1 @returns 构建器实例
setMaxConcurrency(count: number): LubanBuilder { this.config.maxConcurrency = Math.max(1, Math.floor(count)); return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMaxConcurrency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Lef...
setMaxConcurrency(count: number): LubanBuilder { this.config.maxConcurrency = Math.max(1, Math.floor(count)); return this; }
https://github.com/kumaleap/ArkLuban
86d2cc805bd72fe6999f13e3cbb453a648d949f6
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HTMLElement.ets
arkts
removeChild
移除子节点
removeChild(node: Node): HTMLElement { const index = this.childNodes.indexOf(node); if (index >= 0) { this.childNodes.splice(index, 1); node.parentNode = null; } return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeChild AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left node AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Node AST#identifier#Right AST#)#Left ) AST#)...
removeChild(node: Node): HTMLElement { const index = this.childNodes.indexOf(node); if (index >= 0) { this.childNodes.splice(index, 1); node.parentNode = null; } return this; }
https://github.com/DaLongZhuaZi/manxia
685160069220fedf50c86574116b9b283cc8252d
github
offlinecat-dev/OCNetORM
src/main/ets/core/HooksProcessor.ets
arkts
executeAfterLoad
执行 afterLoad 钩子 在从数据库加载实体数据之后调用 @param entityName 实体名称 @param data 实体数据 @throws HookExecutionError 如果钩子执行失败
async executeAfterLoad(entityName: string, data: EntityData): Promise<void> { await this.executeHook(entityName, data, 'afterLoad') }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeAfterLoad AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entityName AST#identifier#Right AST#type_annotation#Left AST#:...
async executeAfterLoad(entityName: string, data: EntityData): Promise<void> { await this.executeHook(entityName, data, 'afterLoad') }
https://github.com/offlinecat-dev/OCNetORM
cf1973251375a8db1ad44c885320c474f37b7e7e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets
arkts
isNativeEngineReady
检查Native引擎是否就绪
isNativeEngineReady(): boolean { return this.nativeEngineReady; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isNativeEngineReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST...
isNativeEngineReady(): boolean { return this.nativeEngineReady; }
https://github.com/DaLongZhuaZi/manxia
37d80923d09b30457e76d30e17cde62588265f4e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ChangeSourceDialogComponent.ets
arkts
openChangeSourceDialog
==================== 对话框控制 ====================
openChangeSourceDialog(): void { if (!this.content || this.content.contentType !== UnifiedContentType.NOVEL) return; this.changeSourceKeyword = this.content.title; this.showChangeSourceDialog = true; this.getUIContext().animateTo({ duration: 260, curve: Curve.EaseOut }, () => { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openChangeSourceDialog 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#{#Left { AST#{#Right ...
openChangeSourceDialog(): void { if (!this.content || this.content.contentType !== UnifiedContentType.NOVEL) return; this.changeSourceKeyword = this.content.title; this.showChangeSourceDialog = true; this.getUIContext().animateTo({ duration: 260, curve: Curve.EaseOut }, () => { ...
https://github.com/DaLongZhuaZi/manxia
38794496b0a1197d76e168efccc68d9140324f98
github
openharmony/applications_mms
entry/src/main/ets/service/ContractService.ets
arkts
queryContact
Querying the contact list @param actionData @callback callback
queryContact(actionData, callback) { // Obtain rawContractIds and query contacts. globalThis.DataWorker.sendRequest('queryContact', { actionData: actionData, context: globalThis.mmsContext }, rawContractIds => { let result: LooseObject = {}; ac...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left actionData AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#Righ...
queryContact(actionData, callback) { // Obtain rawContractIds and query contacts. globalThis.DataWorker.sendRequest('queryContact', { actionData: actionData, context: globalThis.mmsContext }, rawContractIds => { let result: LooseObject = {}; ac...
https://gitee.com/openharmony/applications_mms.git
65608edc34e3c7adc3dc59414da0f2606a4d4056
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
from
Creates an Uint8ClampedArray from array-like argument @param o array-like object to initialize Uint8ClampedArray @returns new Uint8ClampedArray
public from(o: Object): Uint8ClampedArray { throw new Error("Uint8ClampedArray.from: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object): Uint8ClampedArray { throw new Error("Uint8ClampedArray.from: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a2ff3f8554dfb75ad4015b6eee74844df56c966e
gitee
wly5556/S1-Orange
entry/src/main/ets/api/request.ets
arkts
cache
从本地文件中提前获取响应。仅支持json。不会立即查找缓存,而是直到get()或post()被调用时再查找 @param callback 回调,data与从get()或post()方法获得的响应类型一致 @param updateCacheOnly 仅更新缓存, callback不会被调用 @param fromCacheOnly 仅从本地缓存中获取,仍需调用get()或post()来开始请求缓存,但将返回Promise.reject(fromCacheError)
cache(callback: (data: T) => void, updateCacheOnly = false, fromCacheOnly = false) { this.putCacheOnly = updateCacheOnly this.cacheCallback = callback this.fromCacheOnly = fromCacheOnly return this }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left cache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right...
cache(callback: (data: T) => void, updateCacheOnly = false, fromCacheOnly = false) { this.putCacheOnly = updateCacheOnly this.cacheCallback = callback this.fromCacheOnly = fromCacheOnly return this }
https://github.com/wly5556/S1-Orange
857cfa7d5fae264d3c101bbda397de0a355c064f
github
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
onRangeValueChanged
选取时间变动事件
onRangeValueChanged() { let x0: number = this.scroller.currentOffset().xOffset; let start: number = x0 + this.leftThumbRect[2] - this.leftThumbWidth; let end: number = start + this.transparentWidth; let startTime: number = start * CommonConstants.US_ONE_SECOND / this.msPxAvg; this.leftText = this...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onRangeValueChanged 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_bloc...
onRangeValueChanged() { let x0: number = this.scroller.currentOffset().xOffset; let start: number = x0 + this.leftThumbRect[2] - this.leftThumbWidth; let end: number = start + this.transparentWidth; let startTime: number = start * CommonConstants.US_ONE_SECOND / this.msPxAvg; this.leftText = this...
https://github.com/openharmony/applications_app_samples
aab2d0ed6a401842c00b301a939f5a2575c95406
github
HarmonyOS_Samples/guide-snippets
ArkTS/ArkTSModule/ArkModuleSideEffects/entry/src/main/ets/pages/PageEleven.ets
arkts
testHar
[End import_modulePartEleven]
function testHar() { console.info('One is ', One); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testHar AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statemen...
function testHar() { console.info('One is ', One); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
dd9163d4d16dd1f2801da3772f1b124f0da91510
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Float32Array with respect to data, byteOffset and length. @param { ArrayBuffer } buf - data initializer @param { Number | undefined } byteOffset - byte offset from begin of the buf @param { Number | undefined } length - size of elements of type float in newly created Float32Array @throws { RangeError } - Inp...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
https://gitcode.com/iop123123/arkts-static-skills
4ab102770c651abfefe33a5772323920b76c57c9
gitcode
openharmony-sig/applications_compass
feature/compass/src/main/ets/components/CompassView.ets
arkts
drawAngleNumber
Draw angle number.
private drawAngleNumber(): void { this.outsideContext.save(); this.outsideContext.beginPath(); this.outsideContext.font = this.outsideFont; this.outsideContext.textBaseline = this.textBaseline; this.outsideContext.textAlign = this.textAlign; for (let i = 0; i < this.angleNumbers.length; i++) {...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawAngleNumber 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#exp...
private drawAngleNumber(): void { this.outsideContext.save(); this.outsideContext.beginPath(); this.outsideContext.font = this.outsideFont; this.outsideContext.textBaseline = this.textBaseline; this.outsideContext.textAlign = this.textAlign; for (let i = 0; i < this.angleNumbers.length; i++) {...
https://gitee.com/openharmony-sig/applications_compass.git
33441e76aaaa4790e33de32f0d529e9e317329a6
gitee