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
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Reader.ets
arkts
string
Read length-delimited UTF-8 string
string(): string { const l = this.uint32() const s = this.b.subarray(this.pos, this.pos + l) this.pos += l return decodeUTF8(s) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left string 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#string#Right AST#ERROR#Right AST#statement_block...
string(): string { const l = this.uint32() const s = this.b.subarray(this.pos, this.pos + l) this.pos += l return decodeUTF8(s) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
29c6d3cfa0f4564ef1b979dbcba3b4939b8865c5
gitcode
openharmony/xts_tools
sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/waterflow_fadingedge/WaterFlowDataSource.ets
arkts
addItem
在指定索引位置增加一个元素
public addItem(index: number): void { this.dataArray.splice(index, 0, this.dataArray.length); this.notifyDataAdd(index); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addItem 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 ...
public addItem(index: number): void { this.dataArray.splice(index, 0, this.dataArray.length); this.notifyDataAdd(index); }
https://gitee.com/openharmony/xts_tools.git
eccaa69626f97602d621124e71fb387161ecb7de
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets
arkts
lock
Acquires the read lock. Blocks if a writer holds the lock. @returns { Promise<void> } A promise that resolves when the read lock is acquired @syscap SystemCapability.Utils.Lang
public async lock(): Promise<void> { await this.rwl_.executeReadLock(); }
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 lock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS...
public async lock(): Promise<void> { await this.rwl_.executeReadLock(); }
https://gitcode.com/iop123123/arkts-static-skills
2ca61450f14f48efadda711ee60b22e078ca7128
gitcode
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/pages/StatisticsPage.ets
arkts
getDaysInMonth
获取指定年月的天数
getDaysInMonth(year: number, month: number): number { return new Date(year, month, 0).getDate(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDaysInMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ...
getDaysInMonth(year: number, month: number): number { return new Date(year, month, 0).getDate(); }
https://github.com/qiuhaotc/HarmonyOSPlayground
c8014831814272075e296f7ca8bee1efc7618cc6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets
arkts
ensureIndexFileExists
确保索引文件存在
private async ensureIndexFileExists(): Promise<void> { try { const exists = SafeFileUtils.accessSync(this.indexFilePath); if (!exists) { // 创建空的索引文件 const emptyIndex: SourceRepositoryIndex = { version: '1.0.0', lastUpdate: Date.now(), sources: [] }...
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 ensureIndexFileExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
private async ensureIndexFileExists(): Promise<void> { try { const exists = SafeFileUtils.accessSync(this.indexFilePath); if (!exists) { // 创建空的索引文件 const emptyIndex: SourceRepositoryIndex = { version: '1.0.0', lastUpdate: Date.now(), sources: [] }...
https://github.com/DaLongZhuaZi/manxia
2a87786735733f3956a9f260205f3b45b34a3fe2
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/by_ffmpeg_player.ets
arkts
seek
跳转 //
seek(time: number) { nativeModule.seek(time) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left seek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Le...
seek(time: number) { nativeModule.seek(time) }
https://github.com/Nekofox-POT/LinMusic
144a6cf74f51f5e85868c33deaa4b7c7d58692ba
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/NdsRomCache.ets
arkts
format
格式化为可读字符串
format(): string { if (this.bytes < 1024) { return `${this.bytes} B`; } else if (this.bytes < 1024 * 1024) { return `${(this.bytes / 1024).toFixed(1)} KB`; } else if (this.bytes < 1024 * 1024 * 1024) { return `${(this.bytes / (1024 * 1024)).toFixed(1)} MB`; } else { return `${(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left format 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#string#Right AST#ERROR#Right AST#statement_block...
format(): string { if (this.bytes < 1024) { return `${this.bytes} B`; } else if (this.bytes < 1024 * 1024) { return `${(this.bytes / 1024).toFixed(1)} KB`; } else if (this.bytes < 1024 * 1024 * 1024) { return `${(this.bytes / (1024 * 1024)).toFixed(1)} MB`; } else { return `${(...
https://github.com/richshaw2015/nds
f4d3eba68b9cfd9242108eaa9a8e0ed41ca3272f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
anchor
The anchor() method creates a string that embeds a string in an <a> element with a name (<a name="...">str</a>) @param { String } name @returns { String }A string beginning with an <a name="name"> start tag (double quotes in name are replaced with &quot;), then the text str, and then an </a> end tag. @syscap SystemCapa...
public anchor(name: String): String { return this.CreateHTMLString('a', ' name=\"' + name + '\"') }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left anchor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AS...
public anchor(name: String): String { return this.CreateHTMLString('a', ' name=\"' + name + '\"') }
https://gitcode.com/iop123123/arkts-static-skills
494c0d4753b23d7fac6e0f3a43ebc29947d8e0ec
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/view/HomeComponent.ets
arkts
onScrollAction
change navigator alpha when scrolling the Scroll component
onScrollAction() { this.yOffset = this.scroller.currentOffset().yOffset; if (this.yOffset > Const.DEFAULT_56) { this.naviAlpha = 1; } else { this.naviAlpha = this.yOffset / Const.DEFAULT_56; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onScrollAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
onScrollAction() { this.yOffset = this.scroller.currentOffset().yOffset; if (this.yOffset > Const.DEFAULT_56) { this.naviAlpha = 1; } else { this.naviAlpha = this.yOffset / Const.DEFAULT_56; } }
https://gitee.com/harmonyos/codelabs.git
d950f26019a83f055cb21139bfafaa3d0f24caae
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/TotpService.ets
arkts
generateToken
生成TOTP令牌 @param config TOTP配置 @param timestamp 可选时间戳(毫秒),默认为当前时间 @returns 生成的令牌
public async generateToken(config: TotpConfig, timestamp?: number): Promise<string> { // 使用当前时间戳(如果未提供) const currentTime = timestamp || Date.now(); // 根据令牌类型选择不同的生成方法 switch (config.type) { case TotpType.STEAM: return this.generateSteamToken(config, currentTime); case TotpType.RF...
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 generateToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : A...
public async generateToken(config: TotpConfig, timestamp?: number): Promise<string> { // 使用当前时间戳(如果未提供) const currentTime = timestamp || Date.now(); // 根据令牌类型选择不同的生成方法 switch (config.type) { case TotpType.STEAM: return this.generateSteamToken(config, currentTime); case TotpType.RF...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L115-L128
e0e654b4a3b6ec444ff64f5acac9fdca1420b03c
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/i18n/facades/I18nManagerFacade.ets
arkts
getTextAlign
获取与当前布局方向匹配的 TextAlign RTL 返回 TextAlign.End,LTR 返回 TextAlign.Start
getTextAlign(): TextAlign { return this.isRtl() ? TextAlign.End : TextAlign.Start; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTextAlign 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 TextAlign AST#identifier#Right AST#ERROR#Right AS...
getTextAlign(): TextAlign { return this.isRtl() ? TextAlign.End : TextAlign.Start; }
https://github.com/DaLongZhuaZi/NGF
278f17fffe403ea02b43fe113c1ba81ae7b76c5f
github
openharmony/third_party_typescript
tests/arkTSTest/testcase/arkts-no-implicit-return-types/arkts-no-implicit-return-types-2-ok.ets
arkts
callMultiplyFunction
The return type can be omitted, and it will be inferred based on the return type of the multiply function.
function callMultiplyFunction(a: number, b: number): number { return multiply(a, b) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left callMultiplyFunction AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function callMultiplyFunction(a: number, b: number): number { return multiply(a, b) }
https://gitee.com/openharmony/third_party_typescript.git
4e3b9b47d875c9940f29553e76f44d7cc8b15273
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Returns a new array from a set of elements. @param { FixedArray<number> } items - a set of elements to include in the new array object. @returns { Uint8Array } - a new Uint8Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<number>): Uint8Array { let res = new Uint8Array(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
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#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<number>): Uint8Array { let res = new Uint8Array(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
f7bee599a291f4f7a7858aa077cc16b5cf6ca842
gitcode
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/TokenStoreRepository.ets
arkts
clearToken
清除 Token @returns {Promise<void>} Promise<void>
clearToken(): Promise<void> { return this.dataSource.clearToken(); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left clearToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ide...
clearToken(): Promise<void> { return this.dataSource.clearToken(); }
https://github.com/Joker-x-dev/CoolMallArkTS
9734a694327c50a31f0780cb19f62855b0f859bf
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test13_original_index.ets
arkts
testArrayFind
--- Array.find ---
function testArrayFind(): string { let items: string[] = ['apple', 'banana', 'cherry', 'date']; let found: string | undefined; let i: number = 0; while (i < items.length) { if (items[i].startsWith('ch')) { found = items[i]; break; } i = i + 1; } if (found !== undefined) { return ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayFind AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_ty...
function testArrayFind(): string { let items: string[] = ['apple', 'banana', 'cherry', 'date']; let found: string | undefined; let i: number = 0; while (i < items.length) { if (items[i].startsWith('ch')) { found = items[i]; break; } i = i + 1; } if (found !== undefined) { return ...
https://github.com/miaochiahao/ark-ghidra
d3a4fe89502f095fe065d80c1f8b87fd36acbb0f
github
wuba/omni-ui
omni_component/src/main/ets/components/filterbar/util/OmniFilterUtil.ets
arkts
currentSelectListForEntity
/ 返回状态为选中的子节点
static currentSelectListForEntity(entity: OmniFilterItemBean): OmniFilterItemBean[] { let list: OmniFilterItemBean[] = []; for (let item of entity.children) { if (item.isSelected) { list.push(item); } } return list; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left currentSelectListForEntity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entity AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
static currentSelectListForEntity(entity: OmniFilterItemBean): OmniFilterItemBean[] { let list: OmniFilterItemBean[] = []; for (let item of entity.children) { if (item.isSelected) { list.push(item); } } return list; }
https://github.com/wuba/omni-ui
3b7fffa997e959f773f72bff40a9d6abf3645269
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/GenericHidController.ets
arkts
processHat
处理 HAT 开关 (D-Pad) 对于这款手柄 (VID 0x413D): - 空闲时 B6=0x00,所以 HAT=0 不是"上" - 需要检测实际的 HAT 编码格式 常见格式1 (数值): 0=N, 1=NE, 2=E, 3=SE, 4=S, 5=SW, 6=W, 7=NW, 8+=neutral 常见格式2 (位域): bit0=上, bit1=下, bit2=左, bit3=右 从日志看这款手柄可能用格式1,但空闲值也是0... 让我们尝试格式1,把 0x00 和 0x0F 都当作中心
private processHat(hat: number): void { // 清除方向键标志 this.buttonFlags &= ~(ButtonFlags.UP_FLAG | ButtonFlags.DOWN_FLAG | ButtonFlags.LEFT_FLAG | ButtonFlags.RIGHT_FLAG); // 空闲值检测: 0x00 或大于 7 都是中心 // 注意:某些手柄用 0x00 作为空闲,某些用 0x08 或 0x0F if (hat === 0 || hat > 7) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processHat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hat AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
private processHat(hat: number): void { // 清除方向键标志 this.buttonFlags &= ~(ButtonFlags.UP_FLAG | ButtonFlags.DOWN_FLAG | ButtonFlags.LEFT_FLAG | ButtonFlags.RIGHT_FLAG); // 空闲值检测: 0x00 或大于 7 都是中心 // 注意:某些手柄用 0x00 作为空闲,某些用 0x08 或 0x0F if (hat === 0 || hat > 7) { ...
https://github.com/AlkaidLab/moonlight-harmony
7318dfabdadd423e98f837813a2c0c6ebe139ecb
github
openharmony-sig/shimmer-ohos
library/src/main/ets/components/MainPage/Shimmer.ets
arkts
setFixedHeight
Sets the fixed height of the shimmer, in pixels.
setFixedHeight(fixedHeight: number): Shimmer { if (fixedHeight < 0) { throw new Error("Given invalid height: " + fixedHeight); } this.fixedHeight = fixedHeight; return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFixedHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fixedHeight AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A...
setFixedHeight(fixedHeight: number): Shimmer { if (fixedHeight < 0) { throw new Error("Given invalid height: " + fixedHeight); } this.fixedHeight = fixedHeight; return this }
https://gitee.com/openharmony-sig/shimmer-ohos.git
294ea4d9ee0edc3ed314501833c66af9e1b3cbc6
gitee
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/widget2/pages/Widget2Card.ets
arkts
onDataChange
数据变化时打印日志
onDataChange(): void { console.info(`[Widget2Card] onDataChange: shop1=${this.shop1}, count1=${this.count1}, shop2=${this.shop2}, count2=${this.count2}`) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDataChange 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...
onDataChange(): void { console.info(`[Widget2Card] onDataChange: shop1=${this.shop1}, count1=${this.count1}, shop2=${this.shop2}, count2=${this.count2}`) }
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
52cbf0ad09a82b0886af831644e9b174ad7c417f
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test_original_index.ets
arkts
testDoWhile
=== Do-While ===
function testDoWhile(): number { let count: number = 0; let n: number = 100; do { n = Math.floor(n / 2); count++; } while (n > 1); return count; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testDoWhile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type...
function testDoWhile(): number { let count: number = 0; let n: number = 100; do { n = Math.floor(n / 2); count++; } while (n > 1); return count; }
https://github.com/miaochiahao/ark-ghidra
b5e5608e85a8530c8445536958c8142aa2f72d31
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/DataRenderer.ets
arkts
applyValueTextStyle
public getPathPaint():PathPaint { return this.mPathPaint; } Applies the required styling (provided by the DataSet) to the value-paint object. @param set
protected applyValueTextStyle(dateSet: IDataSet<EntryOhos>) { if (dateSet.getValueTypeface()) { this.mValuePaint.setFontFamily(dateSet.getValueTypeface() !); } this.mValuePaint.setTextSize(dateSet.getValueTextSize()); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left applyValueTextStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dateSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
protected applyValueTextStyle(dateSet: IDataSet<EntryOhos>) { if (dateSet.getValueTypeface()) { this.mValuePaint.setFontFamily(dateSet.getValueTypeface() !); } this.mValuePaint.setTextSize(dateSet.getValueTextSize()); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d5951caffc47681a7af2fbb9c12877c61a304647
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets
arkts
getCurrentStep
获取当前步骤
public getCurrentStep(): GuideStep { return this.normalizeStep(this.currentStep); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentStep 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 GuideSt...
public getCurrentStep(): GuideStep { return this.normalizeStep(this.currentStep); }
https://github.com/DaLongZhuaZi/manxia
edfe999a3a2f13294cd3b127a27ee395042d3cd1
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/arkts/class/Class.ets
arkts
hello
必须要实现父抽象类的抽象方法
public hello() { return `hello: ${this.name}`; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left hello AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#L...
public hello() { return `hello: ${this.name}`; }
https://github.com/webabcd/HarmonyDemo
7798ceab4cab081aa10a6dd972cda3e5a5a0df51
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/CommentNode.ets
arkts
toString
转换为字符串
toString(): string { return `<!--${this._rawText}-->`; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString 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#string#Right AST#ERROR#Right AST#statement_blo...
toString(): string { return `<!--${this._rawText}-->`; }
https://github.com/DaLongZhuaZi/manxia
c3f4143d68b8eea27316189c32aa503f047e9c96
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
isUseAutoScaleMaxRestriction
Returns true if autoscale restriction for axis max value is enabled @Deprecated
public isUseAutoScaleMaxRestriction(): boolean { return this.mUseAutoScaleRestrictionMax; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isUseAutoScaleMaxRestriction 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#L...
public isUseAutoScaleMaxRestriction(): boolean { return this.mUseAutoScaleRestrictionMax; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
eb81cd60884a86af6b08d5712ffccaaac6a9de00
gitee
openharmony/codelabs
Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets
arkts
toEntryAbilitySecond
Navigate to the Second Page of EntryAbility.
toEntryAbilitySecond() { router.pushUrl({ url: 'pages/Second', params: { src: textMessage, count: CommonConstants.NUM_VALUES[0] } }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toEntryAbilitySecond 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_blo...
toEntryAbilitySecond() { router.pushUrl({ url: 'pages/Second', params: { src: textMessage, count: CommonConstants.NUM_VALUES[0] } }); }
https://gitee.com/openharmony/codelabs.git
724a0f0f3200920bf2e66299609b663f738a2223
gitee
openharmony/app_samples
Preset/DistributeCalc/entry/src/main/ets/MainAbility/model/RemoteDeviceModel.ets
arkts
startDeviceDiscovery
通过SUBSCRIBE_ID搜索分布式组网内的设备
startDeviceDiscovery() { SUBSCRIBE_ID = Math.floor(65536 * Math.random()) let info = { subscribeId: SUBSCRIBE_ID, mode: 0xAA, medium: 2, freq: 2, isSameAccount: false, isWakeRemote: true, capability: 0 } Logger.info(TAG, `startDeviceDiscovery ${SUBSCRIBE_ID}`)...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startDeviceDiscovery 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_blo...
startDeviceDiscovery() { SUBSCRIBE_ID = Math.floor(65536 * Math.random()) let info = { subscribeId: SUBSCRIBE_ID, mode: 0xAA, medium: 2, freq: 2, isSameAccount: false, isWakeRemote: true, capability: 0 } Logger.info(TAG, `startDeviceDiscovery ${SUBSCRIBE_ID}`)...
https://gitee.com/openharmony/app_samples.git
8279596d978f000fa66264459f929d25db1f2583
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/FontAware.ets
arkts
getBodyStyle
获取正文文字样式参数 @param mode 应用模式
public static getBodyStyle(mode: FontApplyMode = FontApplyMode.FONT_AND_SCALE): TextStyleParams { const baseFontSize = 14; return FontAwareHelper.buildTextStyle(baseFontSize, FontScene.APP_UI, mode); }
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 getBodyStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST...
public static getBodyStyle(mode: FontApplyMode = FontApplyMode.FONT_AND_SCALE): TextStyleParams { const baseFontSize = 14; return FontAwareHelper.buildTextStyle(baseFontSize, FontScene.APP_UI, mode); }
https://github.com/DaLongZhuaZi/manxia
d7c6b5ff32f352ec546c359035bba4d83032b88d
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/AlbumService.ets
arkts
filterWYMusicInfoList
处理网易云音乐歌曲信息列表 @param rawList 原始歌曲数据 @returns SongInfo[]
private static filterWYMusicInfoList(rawList: WYSongRawInfo[]): SongInfo[] { const list: SongInfo[] = []; rawList.forEach((item: WYSongRawInfo) => { const singer = item.ar.map(a => a.name).join('/'); const types: QualityType[] = [{ type: 'standard', size: '' }]; const _types = new Map<string...
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 filterWYMusicInfoList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rawList AST#identifier#Right A...
private static filterWYMusicInfoList(rawList: WYSongRawInfo[]): SongInfo[] { const list: SongInfo[] = []; rawList.forEach((item: WYSongRawInfo) => { const singer = item.ar.map(a => a.name).join('/'); const types: QualityType[] = [{ type: 'standard', size: '' }]; const _types = new Map<string...
https://github.com/cpdd5201314/harmonyOS-music-app
2e9696bbed811480b6d9046a29701bdc955aa2cf
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
buildMangaFromComicInfo
从ComicInfo构建Manga对象
private async buildMangaFromComicInfo(comicInfo: ComicInfo, chapters: MangaChapter[]): Promise<Manga> { const readingSettings = await ComicConverter.loadReadingSettings(comicInfo.id, 'default_user', String(comicInfo.sourceId)); const metadata: MangaMetadata = { authors: comicInfo.author ? [comicInf...
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 buildMangaFromComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left comicInfo AST#identifier#Righ...
private async buildMangaFromComicInfo(comicInfo: ComicInfo, chapters: MangaChapter[]): Promise<Manga> { const readingSettings = await ComicConverter.loadReadingSettings(comicInfo.id, 'default_user', String(comicInfo.sourceId)); const metadata: MangaMetadata = { authors: comicInfo.author ? [comicInf...
https://github.com/DaLongZhuaZi/manxia
6b0eb3dbeb5835cd31b6b8e54c338f502a83f7f6
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ai/AIOrchestrator.ets
arkts
handleImageAnalysis
处理图像分析(HiAI视觉)
private async handleImageAnalysis(request: AIRequest): Promise<AIResponse> { if (!request.data?.imageUri) { return this.createErrorResponse('MISSING_IMAGE', '缺少图像数据'); } console.info(`[AI-Orch] 执行图像分析`); // 使用HiAI进行视觉分析 const analysisResult = await hiAIVisionClient.analyzeMedicalImage(requ...
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 handleImageAnalysis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#...
private async handleImageAnalysis(request: AIRequest): Promise<AIResponse> { if (!request.data?.imageUri) { return this.createErrorResponse('MISSING_IMAGE', '缺少图像数据'); } console.info(`[AI-Orch] 执行图像分析`); // 使用HiAI进行视觉分析 const analysisResult = await hiAIVisionClient.analyzeMedicalImage(requ...
https://github.com/LJ666-ui/harmony-health-care
d1eecdc204a16122f8bc56178b492dcd6a5f55ba
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
valueOf
Returns the object itself @returns { Uint8ClampedArray } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public valueOf(): Uint8ClampedArray { return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf 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 Uint8ClampedAr...
public valueOf(): Uint8ClampedArray { return this }
https://gitcode.com/iop123123/arkts-static-skills
fcca4736c3babc88697077b1020bca9c42614d48
gitcode
richshaw2015/nds
ohos/entry/src/test/InputValidation.test.ets
arkts
truncateNickname
截断昵称到最大长度 @param nickname 昵称字符串 @returns 截断后的昵称
function truncateNickname(nickname: string): string { const MAX_NICKNAME_LENGTH = 10; return nickname.substring(0, MAX_NICKNAME_LENGTH); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left truncateNickname AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nickname AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function truncateNickname(nickname: string): string { const MAX_NICKNAME_LENGTH = 10; return nickname.substring(0, MAX_NICKNAME_LENGTH); }
https://github.com/richshaw2015/nds
dc0c08daea5847980235cfb40cedffdf8b508814
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/IndoorLocator.ets
arkts
getSignalStrength
获取信号强度
public getSignalStrength(): SignalStrength { return this.signalStrength; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSignalStrength 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 Sign...
public getSignalStrength(): SignalStrength { return this.signalStrength; }
https://github.com/LJ666-ui/harmony-health-care
c03de7eae7513768788160b8dcb4923f523b25c6
github
tdcare/tdwebrtc
src/main/ets/utils/LogUtil.ets
arkts
getLine
获取生成的日志边框
public static getLine(tag: string = '', length: number = 130): string { if (StrUtil.isNotEmpty(tag)) { return `┌${StrUtil.repeat('─', 15)}► ${tag} ◄${StrUtil.repeat('─', length - tag.length)}`; } else { return `└${StrUtil.repeat('─', 19)}${StrUtil.repeat('─', length)}`; } }
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 getLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Rig...
public static getLine(tag: string = '', length: number = 130): string { if (StrUtil.isNotEmpty(tag)) { return `┌${StrUtil.repeat('─', 15)}► ${tag} ◄${StrUtil.repeat('─', length - tag.length)}`; } else { return `└${StrUtil.repeat('─', 19)}${StrUtil.repeat('─', length)}`; } }
https://github.com/tdcare/tdwebrtc
6b0f1c4a344d566cd5677479cc103891376d60f1
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypedEntityData.ets
arkts
toEntityData
转换为普通 EntityData @returns EntityData 实例
toEntityData(): EntityData { const entityData = new EntityData(this.entityName) // 复制所有属性值 this.data.forEach((value, key) => { // 根据值类型推断属性类型 let propertyType = 'string' if (typeof value === 'number') { propertyType = 'number' } else if (typeof value === 'boolean') { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toEntityData 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 EntityData AST#identifier#Right AST#ERROR#Right A...
toEntityData(): EntityData { const entityData = new EntityData(this.entityName) // 复制所有属性值 this.data.forEach((value, key) => { // 根据值类型推断属性类型 let propertyType = 'string' if (typeof value === 'number') { propertyType = 'number' } else if (typeof value === 'boolean') { ...
https://github.com/offlinecat-dev/OCNetORM
b1968e04c42423b085e54352479f2ab8cbe040f5
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/search/GlobalSearchService.ets
arkts
globalSearch
全局搜索 - 搜索文章、关键词、模板、主题
static async globalSearch(query: string, options: SearchOptions): Promise<SearchResult[]> { const searchTerm = query.toLowerCase().trim() if (searchTerm.length === 0) { return [] } const results: SearchResult[] = [] try { // 搜索文章 const articles = await GlobalSearchService.sear...
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 globalSearch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST...
static async globalSearch(query: string, options: SearchOptions): Promise<SearchResult[]> { const searchTerm = query.toLowerCase().trim() if (searchTerm.length === 0) { return [] } const results: SearchResult[] = [] try { // 搜索文章 const articles = await GlobalSearchService.sear...
https://github.com/encorexin/WordPressCMS
a36b9db2b30d34e7003c44d25a911033d3cd4a2e
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/dialogs/classes/meowDialogManager.ets
arkts
requestOpen
Request an opening of a dialog. ONLY Expected to be called by function requestDialog defined below. @param req The request.
requestOpen(req: openDialogRequest) { if (req.ignoreOpened || this.isEmpty()) { this.lastRequest = req; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestOpen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left req AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left openDialogRequest AST#identifi...
requestOpen(req: openDialogRequest) { if (req.ignoreOpened || this.isEmpty()) { this.lastRequest = req; } }
https://github.com/awaLiny2333/LinysBrowser_NEXT
a009bb0cfc6141c014515175bcb624e0b138983f
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/common/VNCConnection.ets
arkts
createHandshakeMessage
创建VNC握手消息
static createHandshakeMessage(): ArrayBuffer { // VNC协议版本字符串 "RFB 003.008\n" const versionString = "RFB 003.008\n"; const buffer = new ArrayBuffer(versionString.length); const view = new Uint8Array(buffer); for (let i = 0; i < versionString.length; i++) { view[i] = versionString.charCod...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createHandshakeMessage 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...
static createHandshakeMessage(): ArrayBuffer { // VNC协议版本字符串 "RFB 003.008\n" const versionString = "RFB 003.008\n"; const buffer = new ArrayBuffer(versionString.length); const view = new Uint8Array(buffer); for (let i = 0; i < versionString.length; i++) { view[i] = versionString.charCod...
https://github.com/AetheriumSimulator/qemu-hmos
e9e76071b680fc7f45578fb503bef53eb6d347ad
github
CarGuo/GSYGithubAppOH
entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleBootLocaleInjection
测试通道:want.parameters.bootLocale=en|zh-CN|local, 用于生成 Compose/OH 同语言截图证据,不改变生产默认语言选择。
private handleBootLocaleInjection(want: Want): void { const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined; if (!params) { return; } const raw: Object | undefined = params[PARAM_BOOT_LOCALE]; if (typeof raw !== 'string') { return; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootLocaleInjection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private handleBootLocaleInjection(want: Want): void { const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined; if (!params) { return; } const raw: Object | undefined = params[PARAM_BOOT_LOCALE]; if (typeof raw !== 'string') { return; ...
https://github.com/CarGuo/GSYGithubAppOH
da5140e942bd986bbb3f5ec6b4d7c0af537a83de
github
HarmonyOS_Samples/BestPracticeSnippets
NdkDrawing/entry/src/main/ets/pages/Index.ets
arkts
setPixelMap
Set the background picture
setPixelMap(p: PixelMap): void { this.pMap = p; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PixelMap AST#identifier#Right AST#)#Left ) AST#...
setPixelMap(p: PixelMap): void { this.pMap = p; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
febf71795204992227e00f4a3f61335c5b1f3da4
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/WebDavClient.ets
arkts
mkDir
创建文件夹 @param path @returns
public async mkDir(path: string): Promise<ResultInfo> { if (!path.endsWith('/')) { path = path + '/'; } // 查询是否存在 const exists = await this.exists(path); if (exists) { const requestReturn: ResultInfo = new ResultInfo(); requestReturn.success = true; requestReturn.statusCode...
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 mkDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right...
public async mkDir(path: string): Promise<ResultInfo> { if (!path.endsWith('/')) { path = path + '/'; } // 查询是否存在 const exists = await this.exists(path); if (exists) { const requestReturn: ResultInfo = new ResultInfo(); requestReturn.success = true; requestReturn.statusCode...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebDavClient.ets#L317-L332
8439c217a9385fb60d1ff9167b13c2e60e7c2b24
github
fbinba3955/Flymby
common/src/main/ets/utils/DateUtil.ets
arkts
isToday
判断是否为今天 @param timestamp 时间戳 @returns 是否为今天
static isToday(timestamp: number): boolean { const today = new Date(); const targetDate = new Date(timestamp); return today.getFullYear() === targetDate.getFullYear() && today.getMonth() === targetDate.getMonth() && today.getDate() === targetDate.getDate(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isToday AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right...
static isToday(timestamp: number): boolean { const today = new Date(); const targetDate = new Date(timestamp); return today.getFullYear() === targetDate.getFullYear() && today.getMonth() === targetDate.getMonth() && today.getDate() === targetDate.getDate(); }
https://github.com/fbinba3955/Flymby
e7f8a52b35cfeaa1f783990a2d6cc8c2c37b6a6d
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ColorTemplate.ets
arkts
green
from Color green() @param color
public static green(color: number): number { return (color >> 8) & 0xFF; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left green AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#...
public static green(color: number): number { return (color >> 8) & 0xFF; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
65fb339ac1b1cb93a0081d25eb7ef25b1f386b53
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/ScraperManager.ets
arkts
searchWithSource
==================== 单源搜索方法 ==================== 使用指定源搜索
public async searchWithSource( source: ScraperSource, keyword: string, contentType?: ScraperContentType, limit: number = 25 ): Promise<ScraperSearchResult> { logger.info(TAG, `单源搜索: source=${source}, keyword=${keyword}, type=${contentType}`); switch (source) { case ScraperSource.BANGU...
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 searchWithSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left ...
public async searchWithSource( source: ScraperSource, keyword: string, contentType?: ScraperContentType, limit: number = 25 ): Promise<ScraperSearchResult> { logger.info(TAG, `单源搜索: source=${source}, keyword=${keyword}, type=${contentType}`); switch (source) { case ScraperSource.BANGU...
https://github.com/DaLongZhuaZi/manxia
8864a3aeb87c15f1bdb33e97a7d99f1c39d593b0
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
showToast
显示提示信息 @param message @param duration
public static showToast(message: ResourceStr | promptAction.ShowToastOptions, duration?: number): void { try { if (CommonUtils.uiContext) { CommonUtils.uiContext.getPromptAction().showToast(CommonUtils.toShowToastOptions(message, duration)); } else { promptAction.showToast(CommonUtils....
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 showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST...
public static showToast(message: ResourceStr | promptAction.ShowToastOptions, duration?: number): void { try { if (CommonUtils.uiContext) { CommonUtils.uiContext.getPromptAction().showToast(CommonUtils.toShowToastOptions(message, duration)); } else { promptAction.showToast(CommonUtils....
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L88-L98
03a71fa69d9ec3174df3d66eaf66f7fd85fa2652
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/YAxisRendererHorizontalBarChart.ets
arkts
computeAxis
Computes the axis values. @param yMin - the minimum y-value in the data object for this axis @param yMax - the maximum y-value in the data object for this axis
public computeAxis(yMin: number, yMax: number, inverted: boolean) { if (!this.mTrans || !this.mViewPortHandler) { return; } // calculate the starting and entry point of the y-labels (depending on // zoom / contentrect bounds) if (this.mViewPortHandler.contentHeight() > 10 && !this.mViewPort...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left computeAxis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left yMin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb...
public computeAxis(yMin: number, yMax: number, inverted: boolean) { if (!this.mTrans || !this.mViewPortHandler) { return; } // calculate the starting and entry point of the y-labels (depending on // zoom / contentrect bounds) if (this.mViewPortHandler.contentHeight() > 10 && !this.mViewPort...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
31c7a1d7eb8b5ca497e9adb53a16d25133cdb3c0
gitee
openharmony/communication_bluetooth_service
test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/subSppTest/sppClientTest.ets
arkts
strToArrayBuffer
字符串转arrayBuffer @param {*} str 需要转换的字符串 @returns 返回 arrayBuffer
strToArrayBuffer(str: string) { let array = new Uint8Array(str.length); for ( let i = 0 ; i < str.length ; i ++ ) { array[ i ] = str.charCodeAt(i); } return array.buffer }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left strToArrayBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Rig...
strToArrayBuffer(str: string) { let array = new Uint8Array(str.length); for ( let i = 0 ; i < str.length ; i ++ ) { array[ i ] = str.charCodeAt(i); } return array.buffer }
https://gitee.com/openharmony/communication_bluetooth_service.git
b2b60fa9524e47d1d6f32e689ba5cc2506d3cace
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
logType
输出对象类型
logType(any: any): void { if (any === null || any === undefined) { this.log('null'); } else { this.log(typeof any); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left any AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left any AST#identifier#Right AST#)#Left ) AST#)#Right...
logType(any: any): void { if (any === null || any === undefined) { this.log('null'); } else { this.log(typeof any); } }
https://github.com/DaLongZhuaZi/manxia
74b54c4ff958e77e09655d00bbda54b44a268eb3
github
iichen-bycode/ArkTsWanandroid
entry/src/main/ets/utils/StorageUtils.ets
arkts
delete
删除值 @param key @param preferenceName @returns
static async delete(key: string, preferenceName: string = defaultPreferenceName) { let preferences = await this.getPreferences(preferenceName) return await preferences.delete(key) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#delete#Left delete AST#delete#Right AST#ERROR#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#L...
static async delete(key: string, preferenceName: string = defaultPreferenceName) { let preferences = await this.getPreferences(preferenceName) return await preferences.delete(key) }
https://github.com/iichen-bycode/ArkTsWanandroid
d282d91b4c873c3d348d47bf94dc48317aed2464
github
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
addProviderIconColumnsIfNeeded
添加 is_preset 和 icon_path 字段(用于供应商图标管理)
private async addProviderIconColumnsIfNeeded(): Promise<void> { if (this.rdbStore === null) { return } try { await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.PROVIDERS} ADD COLUMN is_preset INTEGER DEFAULT 0`) } catch (error) { console.info('DatabaseService', 'is_preset colum...
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 addProviderIconColumnsIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_exp...
private async addProviderIconColumnsIfNeeded(): Promise<void> { if (this.rdbStore === null) { return } try { await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.PROVIDERS} ADD COLUMN is_preset INTEGER DEFAULT 0`) } catch (error) { console.info('DatabaseService', 'is_preset colum...
https://github.com/LongLiveY96/chatcube
18b7f2f4749d880099852ab6bf533564f02d593d
github
Nekofox-POT/LinMusic
entry/src/main/ets/pages/ui/web_ui.ets
arkts
aboutToDisappear
退出操作 //
aboutToDisappear(): void { log('web_ui销毁.') // 解锁手势 // this.back_gesture.pop() // 关闭监听 // try {this.switch_emitter(false)} catch {} // 保存数据 // }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
aboutToDisappear(): void { log('web_ui销毁.') // 解锁手势 // this.back_gesture.pop() // 关闭监听 // try {this.switch_emitter(false)} catch {} // 保存数据 // }
https://github.com/Nekofox-POT/LinMusic
cd8c69c618c233f0e1a2982afda67318efc68047
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Wrapper.ets
arkts
or
在查询条件中添加 OR 逻辑,传入的wrapper仅用来拼接where条件 @param wrapper 一个新的Wrapper @returns Wrapper
or(wrapper: Wrapper, condition: boolean = true): Wrapper { if (condition) { this.whereList.push('or (1=1 ') this.whereList.push(...wrapper.whereList) this.whereList.push(')') this.valueList.push(...wrapper.valueList) } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left or AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wrapper AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Wrapper AST#identifier#Right AST#,#Left , AST#,#Ri...
or(wrapper: Wrapper, condition: boolean = true): Wrapper { if (condition) { this.whereList.push('or (1=1 ') this.whereList.push(...wrapper.whereList) this.whereList.push(')') this.valueList.push(...wrapper.valueList) } return this }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L291-L299
f3a0103cbd0fb560a22e08a8b056b9e60daea837
github
HarmonyOS_Samples/BestPracticeSnippets
StabilityCodingSpecification/DevEcoStaticCheck/src/main/ets/pages/Index2.ets
arkts
bar
Here is an example of a naming style error, where foo is the incorrect class name used, and the correct class name should be Foo
bar() {}
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left bar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#}#Left } AST#}#Right AST#statemen...
bar() {}
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
70d0314e6aa23a9c2549ea0d03918e9b956b3f0b
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/TTSService.ets
arkts
init
初始化小艺朗读引擎
async init(context: common.Context): Promise<void> { if (this.isInitialized) { return } const readerParams: TextReader.ReaderParam = { isVoiceBrandVisible: true, // 显示品牌信息 businessBrandInfo: { panelName: 'AI 助手朗读' }, // 关键配置:启用在线音色支持 person: { tone: 0, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_an...
async init(context: common.Context): Promise<void> { if (this.isInitialized) { return } const readerParams: TextReader.ReaderParam = { isVoiceBrandVisible: true, // 显示品牌信息 businessBrandInfo: { panelName: 'AI 助手朗读' }, // 关键配置:启用在线音色支持 person: { tone: 0, ...
https://github.com/LongLiveY96/chatcube
17a230e9525668693ef996e3a21370f7609b4213
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_overload/user/main.ets
arkts
test_10param3
测试 10 param3
function test_10param3() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let arri8: byte[] = [1, 2, 3]; let mystruct: test_overload.Mystruct = { testNum: 2147483647, testStr: "path/to/source" }; let color = test_overload.Color.red; let nu...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_10param3 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_decla...
function test_10param3() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let arri8: byte[] = [1, 2, 3]; let mystruct: test_overload.Mystruct = { testNum: 2147483647, testStr: "path/to/source" }; let color = test_overload.Color.red; let nu...
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
b7cddde254c12c56cd3c6f018bc369efa4e6e202
gitcode
erosTeam/NextE
shared/src/main/ets/services/CoverColorService.ets
arkts
resolve
Returns the cached color, joins an in-flight extraction, or starts one. Resolves to 0 on failure.
async resolve(url: string): Promise<number> { if (url.length === 0) { return 0 } const hit: number | undefined = this.cache.get(url) if (hit !== undefined) { return hit } const pending: Promise<number> | undefined = this.inFlight.get(url) if (pending !== undefined) { retu...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left resolve AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_ann...
async resolve(url: string): Promise<number> { if (url.length === 0) { return 0 } const hit: number | undefined = this.cache.get(url) if (hit !== undefined) { return hit } const pending: Promise<number> | undefined = this.inFlight.get(url) if (pending !== undefined) { retu...
https://github.com/erosTeam/NextE
17a5d18173560202e1a4dc21429781e40ea26115
github
OHPG/FinMusic
entry/src/main/ets/player/AppPlayerContext.ets
arkts
buildQueue
─── 内部方法 ──────────────────────────────────────────────────────────────
private buildQueue(items: Array<BaseItemDto>): Array<avSession.AVQueueItem> { let queueItems = new Array<avSession.AVQueueItem>() items.forEach((dto: BaseItemDto, i: number) => { let mediaImage = this.repository.buildImage(dto, ImageType.Primary) // RunTimeTicks 是 100ns 单位,转为 ms let duratio...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
private buildQueue(items: Array<BaseItemDto>): Array<avSession.AVQueueItem> { let queueItems = new Array<avSession.AVQueueItem>() items.forEach((dto: BaseItemDto, i: number) => { let mediaImage = this.repository.buildImage(dto, ImageType.Primary) // RunTimeTicks 是 100ns 单位,转为 ms let duratio...
https://github.com/OHPG/FinMusic
5f37c537d1f52c7bc39e06e202fcb5985e8f218f
github
the-wwyang/kids-learning-app
src/main/ets/services/AnswerValidator.ets
arkts
validate
验证答案是否正确 @param userAnswer 用户输入的答案 @param correctAnswer 正确答案 @param questionType 题目类型 @returns 是否正确
static validate( userAnswer: string, correctAnswer: number | string, questionType: QuestionType ): boolean { if (!userAnswer || userAnswer === '') { return false; } // 比较题直接比较字符串 if (questionType === QuestionType.COMPARISON) { return userAnswer === correctAnswer; } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left userAnswer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
static validate( userAnswer: string, correctAnswer: number | string, questionType: QuestionType ): boolean { if (!userAnswer || userAnswer === '') { return false; } // 比较题直接比较字符串 if (questionType === QuestionType.COMPARISON) { return userAnswer === correctAnswer; } ...
https://github.com/the-wwyang/kids-learning-app
219ebfeaecce3631b1150336ee044a3bb1d83768
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/InvisibleWebViewComponent.ets
arkts
registerWebView
注册WebView实例
registerWebView( sourceId: string, controller: webview.WebviewController, config: WebViewSourceConfig, callbacks?: WebViewEventCallbacks ): void { const data: WebViewInstanceData = { controller, config, callbacks, createTime: Date.now(), lastUsedTime: Date.now() ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerWebView 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#string#Right AST#ERROR#Right AST#,#Left , AST...
registerWebView( sourceId: string, controller: webview.WebviewController, config: WebViewSourceConfig, callbacks?: WebViewEventCallbacks ): void { const data: WebViewInstanceData = { controller, config, callbacks, createTime: Date.now(), lastUsedTime: Date.now() ...
https://github.com/DaLongZhuaZi/manxia
a9bdad94f35431c699a5861c08a7532e2397afee
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_record/user/main.ets
arkts
testMapfunc51
function mapfunc51(op: (Record<string, string> | undefined)): Record<string, Record<string, string>>
function testMapfunc51() { let testData: Record<string, string> = {"key1": "value1", "key2": "value2"}; let result: Record<string, Record<string, string>> = record_test.Mapfunc51(testData); arktest.assertEQ(result.has("key1"), true); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapfunc51 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_decla...
function testMapfunc51() { let testData: Record<string, string> = {"key1": "value1", "key2": "value2"}; let result: Record<string, Record<string, string>> = record_test.Mapfunc51(testData); arktest.assertEQ(result.has("key1"), true); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
b84ce66002dc945cd003c1ac4841c88fe662ccda
gitcode
openharmony-tpc/ohos_coap
libcoap/src/main/ets/components/mainpage/CoapClient.ets
arkts
setPayload
客户端透传的内容 @param payload post,put透传的内容
setPayload(payload: string) { this.coapClient.setPayload(payload, this.classId); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setPayload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left payload AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#L...
setPayload(payload: string) { this.coapClient.setPayload(payload, this.classId); }
https://gitee.com/openharmony-tpc/ohos_coap.git
c13b36161f42bb6f2f1553ba55e0a82f8764c5e0
gitee
Joker-x-dev/HarmonyKit
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
updateTitleInput
更新标题输入 @param {string} value - 输入内容 @returns {void} 无返回值
updateTitleInput(value: string): void { this.titleInput = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateTitleInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left...
updateTitleInput(value: string): void { this.titleInput = value; }
https://github.com/Joker-x-dev/HarmonyKit
b4c2d71260ebb2fdbd1d0cb29436ac8553060bdf
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/PermissionUtil.ets
arkts
clearPermissionCache
清空权限缓存(在应用退出或需要刷新时调用)
static clearPermissionCache() { PermissionUtil.permissionCache.clear() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearPermissionCache 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#{...
static clearPermissionCache() { PermissionUtil.permissionCache.clear() }
https://github.com/Yebingiscn/SweetVideo
62261b1b471d5a6f96e3d68dea2b533cf8f9de30
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Legend.ets
arkts
setFormLineDashEffect
Sets the line dash path effect used for shapes that consist of lines. @param dashPathEffect
public setFormLineDashEffect(dashPathEffect: DashPathEffect): void { this.mFormLineDashEffect = dashPathEffect; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFormLineDashEffect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dashPathEffect AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
public setFormLineDashEffect(dashPathEffect: DashPathEffect): void { this.mFormLineDashEffect = dashPathEffect; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d2c783f7a7cf9012b811f43cd81577bcdc708d8b
gitee
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
entry/src/main/ets/model/ThemeManager.ets
arkts
getInstance
获取主题管理器实例 @returns ThemeManager实例
static getInstance(): ThemeManager { if (!ThemeManager.instance) { ThemeManager.instance = new ThemeManager(); } return ThemeManager.instance; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance 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 ThemeManag...
static getInstance(): ThemeManager { if (!ThemeManager.instance) { ThemeManager.instance = new ThemeManager(); } return ThemeManager.instance; }
https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
d527c7e7673242266793fe4697e4384f5b21ccf8
github
erosTeam/NextE
feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets
arkts
setToplistPeriod
Switch the toplist period (tl 11 all-time / 12 year / 13 month / 15 yesterday) and hard-reload from page 0. No-op if unchanged or not on the toplist source.
async setToplistPeriod(tl: number): Promise<void> { if (!this.isToplist() || this.toplistTl === tl) { return } this.toplistTl = tl await this.reload() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setToplistPeriod AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tl AST#identifier#Right AST#...
async setToplistPeriod(tl: number): Promise<void> { if (!this.isToplist() || this.toplistTl === tl) { return } this.toplistTl = tl await this.reload() }
https://github.com/erosTeam/NextE
0192bb933b4e9479599bf1668d6582364577f8f8
github
openharmony/arkui_ace_engine
examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets
arkts
deleteDataUseContent
根据内容查找并删除数据项
deleteDataUseContent(data: T): void { let delIndex: number = -1 for (let index = 0; index < this.originDataArray.length; index++) { const element = this.originDataArray[index]; if (data === element) { delIndex = index } } if (delIndex != -1) { this.deleteData(delIndex) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteDataUseContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left )...
deleteDataUseContent(data: T): void { let delIndex: number = -1 for (let index = 0; index < this.originDataArray.length; index++) { const element = this.originDataArray[index]; if (data === element) { delIndex = index } } if (delIndex != -1) { this.deleteData(delIndex) ...
https://gitee.com/openharmony/arkui_ace_engine.git
15c2f8cfa2f536ea747a52d232122e3efcc1bed0
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnImagePreviewViewModel.ets
arkts
updateLongPressIndex
更新长按索引 @param index 图片索引
updateLongPressIndex(index: number): void { this.longPressIndex = index; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateLongPressIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#...
updateLongPressIndex(index: number): void { this.longPressIndex = index; }
https://github.com/codelably/tuniao-ui
4d3e620bc7294ece4a9b6336ef67ebe50db2a3f5
github
openharmony-sig/flutter_packages
packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets
arkts
startPreviewWithPhoto
开启拍照预览
async startPreviewWithPhoto() { this.cameraOutputCapability = CameraUtils.getSupportedOutputCapability(this.cameraDevice!, camera.SceneMode.NORMAL_PHOTO, this.cameraManager) let captureSize: camera.Size = this.cameraFeatures.getResolution().getCaptureSize(); let previewProfile = this.cameraOutputCa...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left startPreviewWithPhoto AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
async startPreviewWithPhoto() { this.cameraOutputCapability = CameraUtils.getSupportedOutputCapability(this.cameraDevice!, camera.SceneMode.NORMAL_PHOTO, this.cameraManager) let captureSize: camera.Size = this.cameraFeatures.getResolution().getCaptureSize(); let previewProfile = this.cameraOutputCa...
https://gitee.com/openharmony-sig/flutter_packages.git
da3c3619dc589f6713745a150c50403598209420
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/LineDataSet.ets
arkts
setDrawCircleHole
Set this to true to allow drawing a hole in each data circle. @param enabled
public setDrawCircleHole(enabled: boolean): void { this.mDrawCircleHole = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawCircleHole AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public setDrawCircleHole(enabled: boolean): void { this.mDrawCircleHole = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
547c9f3177f4691a6835942f2ce630166a471bd5
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
convertToBill
转换为Bill
static convertToBill(resultSet: relationalStore.ResultSet): Bill { const bill = new Bill(); bill.billId = DAOHelper.getNumberValue(resultSet, 'bill_id'); bill.userId = DAOHelper.getNumberValue(resultSet, 'user_id'); bill.accountId = DAOHelper.getNumberValue(resultSet, 'account_id'); bill.categoryI...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expres...
static convertToBill(resultSet: relationalStore.ResultSet): Bill { const bill = new Bill(); bill.billId = DAOHelper.getNumberValue(resultSet, 'bill_id'); bill.userId = DAOHelper.getNumberValue(resultSet, 'user_id'); bill.accountId = DAOHelper.getNumberValue(resultSet, 'account_id'); bill.categoryI...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6e318008c2ba422470d637eb707401998ea61598
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/SizeViewModel.ets
arkts
getFixedHeightItems
获取固定高度列表 @returns {FixedSizeItem[]} 固定高度项数组
getFixedHeightItems(): FixedSizeItem[] { return [ new FixedSizeItem("tn_h_full", "100% 高度", "100%"), new FixedSizeItem("tn_h_auto", "自动高度", "auto"), new FixedSizeItem("tn_h_screen", "屏幕高度", "屏幕高度") ]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFixedHeightItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left FixedSizeItem AST#identifie...
getFixedHeightItems(): FixedSizeItem[] { return [ new FixedSizeItem("tn_h_full", "100% 高度", "100%"), new FixedSizeItem("tn_h_auto", "自动高度", "auto"), new FixedSizeItem("tn_h_screen", "屏幕高度", "屏幕高度") ]; }
https://github.com/codelably/tuniao-ui
d62d538bd1a2293851f4a5024d69dd09a007bdbf
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loading/LoadingStateManager.ets
arkts
getDefaultConfiguration
获取默认配置
private getDefaultConfiguration(): LoadingConfiguration { return { enableVerboseLogging: true, enablePerformanceMonitoring: true, autoRetryConfig: { enabled: true, defaultMaxRetries: 3, retryDelay: 1000, backoffFactor: 2.0 }, timeoutConfig: { p...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDefaultConfiguration 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#...
private getDefaultConfiguration(): LoadingConfiguration { return { enableVerboseLogging: true, enablePerformanceMonitoring: true, autoRetryConfig: { enabled: true, defaultMaxRetries: 3, retryDelay: 1000, backoffFactor: 2.0 }, timeoutConfig: { p...
https://github.com/DaLongZhuaZi/manxia
dff5d650233617b48dadb570debded9969d953a7
github
HarmonyOS_Samples/guide-snippets
ArkGraphics2D/DisplaySync/entry/src/main/ets/DisplaySync/CustomDrawDisplaySync.ets
arkts
CreateDisplaySyncSlow
[End display_sync_create_text_component] [Start display_sync_frame_rate_setting_and_subscription_function_registration]
CreateDisplaySyncSlow() { let range: ExpectedFrameRateRange = { expected: 30, min: 0, max: 120 }; let draw30 = (intervalInfo: displaySync.IntervalInfo) => { if (this.isBigger_30) { this.drawFirstSize += 1; if (this.drawFirstSize > 150) { this.isBigger_30 ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left CreateDisplaySyncSlow 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_bl...
CreateDisplaySyncSlow() { let range: ExpectedFrameRateRange = { expected: 30, min: 0, max: 120 }; let draw30 = (intervalInfo: displaySync.IntervalInfo) => { if (this.isBigger_30) { this.drawFirstSize += 1; if (this.drawFirstSize > 150) { this.isBigger_30 ...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
8c9d6bc17b2326f9b8c83fbdda7a8d7b52a7dd52
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
findLast
/ === with element lambda functions === Finds the last element in the Int16Array that satisfies the condition @param { function } fn - condition @returns { number } - the last element that satisfies fn @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLast(fn: (val: number) => boolean): number { let newF: (val: number, index: int, array: Int16Array) => boolean = (val: number, index: int, array: Int16Array): boolean => { return fn(val) } return (this.findLast(newF)).toDouble() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
public findLast(fn: (val: number) => boolean): number { let newF: (val: number, index: int, array: Int16Array) => boolean = (val: number, index: int, array: Int16Array): boolean => { return fn(val) } return (this.findLast(newF)).toDouble() }
https://gitcode.com/iop123123/arkts-static-skills
b7fc1ad576f47d8b04beab921c7df8c477efc936
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets
arkts
imageTextRemoveIcon
Display area icon in image_text mode
imageTextRemoveIcon(select: GridObjectSortComponentItem): Resource { const clickRemoveIcon: boolean = this.clickRemoveBtn && this.content.id === select.id; const icon = clickRemoveIcon ? $r('sys.symbol.plus_circle_fill') : $r('sys.symbol.minus_circle_fill'); return icon; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left imageTextRemoveIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left select AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GridObjectSortComponentItem AST#id...
imageTextRemoveIcon(select: GridObjectSortComponentItem): Resource { const clickRemoveIcon: boolean = this.clickRemoveBtn && this.content.id === select.id; const icon = clickRemoveIcon ? $r('sys.symbol.plus_circle_fill') : $r('sys.symbol.minus_circle_fill'); return icon; }
https://gitcode.com/openharmony/arkui_ace_engine
253408fbb4867d3750e734309193550b1c9995ae
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets
arkts
preload
批量预加载图片 @param tasks 预加载任务列表
public preload(tasks: Array<PreloadTask>): void { // 添加到预加载队列 for (const task of tasks) { // 跳过已缓存或正在加载的 if (this.cache.has(task.pageId) || this.loadingTasks.has(task.pageId)) { continue; } // 检查是否已在队列中 const existingIndex = this.preloadQueue.findIndex(t => t.pageI...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left preload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tasks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expressio...
public preload(tasks: Array<PreloadTask>): void { // 添加到预加载队列 for (const task of tasks) { // 跳过已缓存或正在加载的 if (this.cache.has(task.pageId) || this.loadingTasks.has(task.pageId)) { continue; } // 检查是否已在队列中 const existingIndex = this.preloadQueue.findIndex(t => t.pageI...
https://github.com/DaLongZhuaZi/manxia
83cc9009a438838326e91022e3a8ce7dc073c254
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MangaSettingsPage.ets
arkts
aboutToAppear
页面出现时声明本页窗口策略,确保沉浸式布局稳定。
aboutToAppear(): void { PageWindowCoordinator.applyPagePolicy('MangaSettingsPage', this.getUIContext()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { PageWindowCoordinator.applyPagePolicy('MangaSettingsPage', this.getUIContext()); }
https://github.com/DaLongZhuaZi/manxia
1cee9a6a4c204afcac746a17fe6999e061ac92e9
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/ImageLoadStateManager.ets
arkts
clearAll
清除所有状态
clearAll(): void { this.pageStates.clear(); this.pixelMaps.clear(); this.loadStates.clear(); this.loadingCount = 0; }
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.pageStates.clear(); this.pixelMaps.clear(); this.loadStates.clear(); this.loadingCount = 0; }
https://github.com/DaLongZhuaZi/manxia
3d26dc37482604739e3b48ac88f9d33881260bcf
github
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock.ets
arkts
generateWardOverview
生成病房概览信息
public generateWardOverview(rooms: SmartWardRoom[]): WardOverviewInfo[] { return rooms.map(room => { const monitorStatus = room.devices.get(`DEV_${room.roomNumber}_2`); const heartRate = monitorStatus?.properties.get('heartRate')?.value as number || 75; const oxygenSaturation = monitorStatus?.pr...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateWardOverview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rooms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_...
public generateWardOverview(rooms: SmartWardRoom[]): WardOverviewInfo[] { return rooms.map(room => { const monitorStatus = room.devices.get(`DEV_${room.roomNumber}_2`); const heartRate = monitorStatus?.properties.get('heartRate')?.value as number || 75; const oxygenSaturation = monitorStatus?.pr...
https://github.com/LJ666-ui/harmony-health-care
bdbcb2ef6b3148c59511fb6ea6f648a7801bd125
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test3_original_index.ets
arkts
testMultipleReturns
=== Multiple return paths ===
function testMultipleReturns(code: number): string { if (code === 1) { return 'one'; } if (code === 2) { return 'two'; } if (code === 3) { return 'three'; } return 'other'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMultipleReturns 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 : AS...
function testMultipleReturns(code: number): string { if (code === 1) { return 'one'; } if (code === 2) { return 'two'; } if (code === 3) { return 'three'; } return 'other'; }
https://github.com/miaochiahao/ark-ghidra
018811341c6afe209eefbeec0368dd40e0f33bc6
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/ExportService.ets
arkts
persistSupported
设备是否支持文件夹持久化授权(非 2in1 一般不支持)。
static persistSupported(): boolean { return canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization'); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left persistSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean ...
static persistSupported(): boolean { return canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization'); }
https://github.com/picklerick422/zju-learning-assistant-OH
00a267143c00bf6fec786cd12ccde01447492ddb
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/interceptor/InterceptorHttpClient.ets
arkts
close
Close the client by delegating to the underlying HttpClient.
close(): void { this.delegate.close(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left close AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
close(): void { this.delegate.close(); }
https://github.com/killetom/ktretrofit
58ce3fd6b16f7e8b6dc335e18d2abfa3890b2890
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/DiskCacheManager.ets
arkts
getStats
获取缓存统计信息
public getStats(): DiskCacheStats { const stats: DiskCacheStats = { count: this.cacheIndex.size, totalSize: this.totalSize, maxSize: this.MAX_CACHE_SIZE, usagePercent: (this.totalSize / this.MAX_CACHE_SIZE) * 100 }; return stats; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getStats 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 DiskCacheStat...
public getStats(): DiskCacheStats { const stats: DiskCacheStats = { count: this.cacheIndex.size, totalSize: this.totalSize, maxSize: this.MAX_CACHE_SIZE, usagePercent: (this.totalSize / this.MAX_CACHE_SIZE) * 100 }; return stats; }
https://github.com/DaLongZhuaZi/manxia
4f7fafbd504c2a062f361f16f30f31ec515c6a78
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/VideoOperateUtil.ets
arkts
saveVideoProperty
保存视频播放进度
static saveVideoProperty(context: Context, nowPlaying: VideoMetadata, options: SaveOptions) { SelectFileUtil.saveData(context, nowPlaying!, options) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveVideoProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static saveVideoProperty(context: Context, nowPlaying: VideoMetadata, options: SaveOptions) { SelectFileUtil.saveData(context, nowPlaying!, options) }
https://github.com/Yebingiscn/SweetVideo
5ec6c51f571329ba3fa294de7a18f1c32b3dec03
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
clearChapterCache
清除所有章节缓存
public clearChapterCache(): boolean { try { const chapterDir = this.getChapterPagesCacheDir(); this.clearDirectoryContents(chapterDir); logger.info(TAG, '章节缓存已清除'); return true; } catch (error) { logger.error(TAG, `清除章节缓存失败: ${error}`); return false; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearChapterCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean...
public clearChapterCache(): boolean { try { const chapterDir = this.getChapterPagesCacheDir(); this.clearDirectoryContents(chapterDir); logger.info(TAG, '章节缓存已清除'); return true; } catch (error) { logger.error(TAG, `清除章节缓存失败: ${error}`); return false; } }
https://github.com/DaLongZhuaZi/manxia
dc69726304172eb0f9e14bed37bb17d5c0847bac
github
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/imagingMock.ets
arkts
createMockLesion
创建Mock病灶数据
function createMockLesion( type: string, confidence: number, riskLevel: RiskLevel, location: string ): Lesion { return { id: generateUUID(), lesionType: type, confidence: confidence, riskLevel: riskLevel, boundingBox: { x: Math.random() * 100 + 50, y: Math.random() * 100 + 50, ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createMockLesion AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left type AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function createMockLesion( type: string, confidence: number, riskLevel: RiskLevel, location: string ): Lesion { return { id: generateUUID(), lesionType: type, confidence: confidence, riskLevel: riskLevel, boundingBox: { x: Math.random() * 100 + 50, y: Math.random() * 100 + 50, ...
https://github.com/LJ666-ui/harmony-health-care
02754d5f8f26f3243f87ec862e880e551f686032
github
harmonyos/codelabs
HarmonyOS_NEXT/StageAbilityDemo/entry/src/main/ets/viewmodel/ServicesViewModel.ets
arkts
loadGoodsService
Load the data of goods service for the GoodsServiceList view.
public loadGoodsService(): Service[] { return DataModel.GOOD_SERVICE; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left loadGoodsService 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#expre...
public loadGoodsService(): Service[] { return DataModel.GOOD_SERVICE; }
https://gitee.com/harmonyos/codelabs.git
70e718f5322fe2689f31b3d05f69b621cb502342
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/HtmlFormatter.ets
arkts
formatKeepImg
格式化HTML并保留图片标签 @param html HTML内容 @param baseUrl 基础URL,用于解析相对路径 @returns 格式化后的内容(保留img标签)
static formatKeepImg(html: string | null | undefined, baseUrl?: string): string { if (!html) return ''; const keepImgHtml = HtmlFormatter.format(html, true); let appendPos = 0; let result = ''; HtmlFormatter.formatImageRegex.lastIndex = 0; let match = HtmlFormatter.formatImageRegex.exec(k...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatKeepImg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#...
static formatKeepImg(html: string | null | undefined, baseUrl?: string): string { if (!html) return ''; const keepImgHtml = HtmlFormatter.format(html, true); let appendPos = 0; let result = ''; HtmlFormatter.formatImageRegex.lastIndex = 0; let match = HtmlFormatter.formatImageRegex.exec(k...
https://github.com/DaLongZhuaZi/manxia
80723b7c91ec51b5effb4744faa38f666eade930
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/StringReader.ets
arkts
moveNext
更新字符索引 @param count = 1 移动的字符数
public moveNext(count: number = 1): void { this.charIndex = Math.min(this._charCount, this.charIndex + count); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left moveNext 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#assignment_expression#...
public moveNext(count: number = 1): void { this.charIndex = Math.min(this._charCount, this.charIndex + count); }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
674ac4b100d74728d08a5d1376a74446c871ffb3
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
loadCustomThemeState
初始化自定义主题状态(从存储加载) 在ThemeManager初始化时调用
private async loadCustomThemeState(): Promise<void> { try { if (!this.preferencesStore) { return; } const isActive: boolean = await this.preferencesStore.get('custom_theme_active', false) as boolean; const themeId: string = await this.preferencesStore.get('custom_theme_id', ...
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 loadCustomThemeState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
private async loadCustomThemeState(): Promise<void> { try { if (!this.preferencesStore) { return; } const isActive: boolean = await this.preferencesStore.get('custom_theme_active', false) as boolean; const themeId: string = await this.preferencesStore.get('custom_theme_id', ...
https://github.com/DaLongZhuaZi/manxia
dd2e0bfe0b935d057164c42c6879e6327b8590f2
github
CsCesium/KantaiHomo
entry/src/main/ets/features/alerts/executor.ets
arkts
executeToast
========== 执行函数 ==========
async function executeToast(message: string, duration: number = 2000, textColor?: string): Promise<void> { try { if (textColor) { promptAction.showToast({ message, duration, textColor }); } else { promptAction.showToast({ message, duration }); } } catch (e) { console.warn('[AlertExecutor...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left executeToast AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left message AST#identifier#Right AST#typ...
async function executeToast(message: string, duration: number = 2000, textColor?: string): Promise<void> { try { if (textColor) { promptAction.showToast({ message, duration, textColor }); } else { promptAction.showToast({ message, duration }); } } catch (e) { console.warn('[AlertExecutor...
https://github.com/CsCesium/KantaiHomo
10de394c6b9210946eb470607cb53ae973f5536b
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/FollowManager.ets
arkts
unfollowUser
Unfollow a user
static async unfollowUser(follower: string, followee: string, followeeId?: number): Promise<boolean> { try { if (!FollowManager.preferencesInstance) { console.error('FollowManager: Preferences not initialized'); return false; } console.info(`FollowManager: unfollowUser called - ...
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 unfollowUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left follower AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
static async unfollowUser(follower: string, followee: string, followeeId?: number): Promise<boolean> { try { if (!FollowManager.preferencesInstance) { console.error('FollowManager: Preferences not initialized'); return false; } console.info(`FollowManager: unfollowUser called - ...
https://github.com/Harrisonls2004/WaterFlow
fb611fce45bb4bf0d8a98819c5c6b9129e9a3d29
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/AdbKeyManager.ets
arkts
modInverse
计算模逆:a^-1 mod m
private modInverse(a: bigint, m: bigint): bigint { const m0 = m; let x0 = 0n; let x1 = 1n; if (m === 1n) return 0n; let tempA = a; let tempM = m; while (tempA > 1n) { const q = tempA / tempM; let t = tempM; tempM = tempA % tempM; tempA = t; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left modInverse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bigin...
private modInverse(a: bigint, m: bigint): bigint { const m0 = m; let x0 = 0n; let x1 = 1n; if (m === 1n) return 0n; let tempA = a; let tempM = m; while (tempA > 1n) { const q = tempA / tempM; let t = tempM; tempM = tempA % tempM; tempA = t; ...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
7305576f9167713b16195e664729a224e1651caa
github
openharmony-sig/flutter_packages
packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets
arkts
setExposureOffset
设置曝光补偿
setExposureOffset(result: MethodResult, offset: number) { const exposureOffsetFeature: ExposureOffsetFeature = this.cameraFeatures.getExposureOffset(); exposureOffsetFeature.setValue(offset, this.photoSession!); try { this.getCurSession().setExposureBias(offset); result.success(exposureOffset...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setExposureOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MethodResult AST#iden...
setExposureOffset(result: MethodResult, offset: number) { const exposureOffsetFeature: ExposureOffsetFeature = this.cameraFeatures.getExposureOffset(); exposureOffsetFeature.setValue(offset, this.photoSession!); try { this.getCurSession().setExposureBias(offset); result.success(exposureOffset...
https://gitee.com/openharmony-sig/flutter_packages.git
af8224935d9261b6c14cbee5b94e7b3ddd9f900d
gitee
aimilin6688/KeePassHO
entry/src/main/ets/components/PasswordGeneratorDialog.ets
arkts
resetPassword
重新对密码进行设置
resetPassword() { if (this.password !== '') { this.passwordLength = this.password.length; this.evaluatePasswordStrength(); return; } this.generatePassword(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resetPassword 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...
resetPassword() { if (this.password !== '') { this.passwordLength = this.password.length; this.evaluatePasswordStrength(); return; } this.generatePassword(); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/PasswordGeneratorDialog.ets#L43-L50
011c43aabc6595c509f3f15921cb18f25ac75501
github
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/features/discover/src/main/ets/service/DiscoverNetFunc.ets
arkts
getHotList
@returns LearningResource[]
public getHotList(): Promise<LearningResource[]> { return new Promise((resolve: (value: LearningResource[] | PromiseLike<LearningResource[]>) => void, reject: (reason?: Object) => void) => { Request.call(DiscoverTrigger.RESOURCE_HOT).then((resourcesData: Object) => { Logger.i...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHotList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#instantiation_expression#Le...
public getHotList(): Promise<LearningResource[]> { return new Promise((resolve: (value: LearningResource[] | PromiseLike<LearningResource[]>) => void, reject: (reason?: Object) => void) => { Request.call(DiscoverTrigger.RESOURCE_HOT).then((resourcesData: Object) => { Logger.i...
https://gitcode.com/HarmonyOS_Samples/hmosworld
685b2ab86596f50bcb84ba21520671cd68ca6287
gitcode
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypedEntityData.ets
arkts
getString
获取字符串类型的属性值 @param key 属性名 @returns 属性值,如果不存在返回 null
getString(key: string): string | null { const value = this.data.get(key) if (value === undefined || value === null) { return null } if (typeof value === 'string') { return value } return String(value) }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
getString(key: string): string | null { const value = this.data.get(key) if (value === undefined || value === null) { return null } if (typeof value === 'string') { return value } return String(value) }
https://github.com/offlinecat-dev/OCNetORM
0bd39ae36598d62557638c7e0f4b5f5fde7e8261
github
openharmony/applications_contacts
entry/src/main/ets/model/ContactAbilityModel.ets
arkts
getAllUsually
Query call records @param {string} DAHelper @param {Object} callBack call records
async getAllUsually(callBack: Function, context?: common.UIAbilityContext | Context) { HiLog.i(TAG, 'getAllUsually start.'); if (context) { ContactRepository.getInstance().init(context); ContactRepository.getInstance().findAllUsually((callLog: CallLog[]) => { if (ArrayUtil.isEmpty(callLog)...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllUsually AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left callBack AST#identifier#Right AST#type_annotation#Left A...
async getAllUsually(callBack: Function, context?: common.UIAbilityContext | Context) { HiLog.i(TAG, 'getAllUsually start.'); if (context) { ContactRepository.getInstance().init(context); ContactRepository.getInstance().findAllUsually((callLog: CallLog[]) => { if (ArrayUtil.isEmpty(callLog)...
https://gitee.com/openharmony/applications_contacts.git
bc6722a04774f1ba79e15e46aa0f5f18d28ab1c3
gitee