nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Privacy/Note/NoteFormPage.ets | arkts | onBackPress | 当用户点击返回按钮时触发 | onBackPress(): boolean | void {
// 如果有 id 表示修改,修改时使用默认返回逻辑
if (this.routerParams.id) {
return false
}
// 自己处理返回逻辑
this.promptAction.showDialog({
title: '温馨提示',
message: '您输入的内容还没有保存,是否放弃?',
alignment: DialogAlignment.Center,
buttons: [
{ text: '取消', color: $r(... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#R... | onBackPress(): boolean | void {
// 如果有 id 表示修改,修改时使用默认返回逻辑
if (this.routerParams.id) {
return false
}
// 自己处理返回逻辑
this.promptAction.showDialog({
title: '温馨提示',
message: '您输入的内容还没有保存,是否放弃?',
alignment: DialogAlignment.Center,
buttons: [
{ text: '取消', color: $r(... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 3de2bd6d2163010cc36dca2ba1247fb9394ed860 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/components/TextReaderComponent.ets | arkts | aboutToAppear | 注册自定义字体(如果有) | aboutToAppear(): void {
logger.info(TAG, '文本阅读器组件初始化');
// 获取电量
this.registerCustomFontIfNeeded();
// 记录初始内容和章节索引
this.startTimeUpdate();
// 记录初始内容和章节索引
this.updateBatteryLevel();
// 记录初始内容和章节索引
this.lastContent = this.content;
this.lastChapterIndex = this.currentChapterIndex;
... | 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 {
logger.info(TAG, '文本阅读器组件初始化');
// 获取电量
this.registerCustomFontIfNeeded();
// 记录初始内容和章节索引
this.startTimeUpdate();
// 记录初始内容和章节索引
this.updateBatteryLevel();
// 记录初始内容和章节索引
this.lastContent = this.content;
this.lastChapterIndex = this.currentChapterIndex;
... | https://github.com/DaLongZhuaZi/manxia | 9c28dc33d9d726592186b147b9ef6a0e0b909512 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets | arkts | onDetachedFromNAPI | Invoked when the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@link
DartExecutor} detaches from JNI.
<p>When detached from JNI, this {@link DartExecutor} stops handling 2-way communication to/from
the Dart execution context. | onDetachedFromNAPI(): void {
Log.d(TAG, "Detached from NAPI. De-registering the platform message handler for this Dart execution context.");
this.flutterNapi.setPlatformMessageHandler(null);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDetachedFromNAPI 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... | onDetachedFromNAPI(): void {
Log.d(TAG, "Detached from NAPI. De-registering the platform message handler for this Dart execution context.");
this.flutterNapi.setPlatformMessageHandler(null);
} | https://gitee.com/openharmony-sig/flutter_engine.git | 083c9cc9837b8a159e26471ccc649318614f32df | gitee |
CPF-ApplicationTPC/mp4parser | library/src/main/ets/mp4parser/MP4Parser.ets | arkts | getFrame | get video frames
@param option
@param callBack
@returns | static getFrame(option: FrameOption, frameCallBack: IFrameCallBack) {
let messageCallBack = (data: ArrayBuffer, timeUs: number) => {
frameCallBack.callBackResult(data, timeUs);
}
mp4parser_napi.getFrame(option, messageCallBack)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFrame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Frame... | static getFrame(option: FrameOption, frameCallBack: IFrameCallBack) {
let messageCallBack = (data: ArrayBuffer, timeUs: number) => {
frameCallBack.callBackResult(data, timeUs);
}
mp4parser_napi.getFrame(option, messageCallBack)
} | https://gitcode.com/CPF-ApplicationTPC/mp4parser/blob/8b2fe3e673fbebe03fb0fa8aa7c63c639a38f5ad/library/src/main/ets/mp4parser/MP4Parser.ets#L177-L182 | 57d69e0654d1e4fa1a5b14978c3e8c888e9fd68b | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RAManager.ets | arkts | enqueuePendingAchievement | 将失败的成就提交加入离线队列 | private async enqueuePendingAchievement(achievementId: number, isHardcore: boolean): Promise<void> {
try {
const pendingJson = await this.settingsManager.get<string>(RAManager.PENDING_KEY, '[]');
const pending: PendingAchievement[] = JSON.parse(pendingJson) as PendingAchievement[];
// 避免重复
... | 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 enqueuePendingAchievement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left achievementId AST#identifier#Right AST#ERR... | private async enqueuePendingAchievement(achievementId: number, isHardcore: boolean): Promise<void> {
try {
const pendingJson = await this.settingsManager.get<string>(RAManager.PENDING_KEY, '[]');
const pending: PendingAchievement[] = JSON.parse(pendingJson) as PendingAchievement[];
// 避免重复
... | https://github.com/richshaw2015/nds | d9696ebc8e73f56caca504a170386e35bc95d637 | github |
Lycorius03/studyos | apps/harmonyos/entry/src/main/ets/bridge/StudyOsBridge.ets | arkts | init | Opens (or creates) the database at `dbPath`. | init(dbPath: string): void {
if (this.initialized) {
return;
}
this.handle = nativeModule.studyosInitDb(dbPath);
if (this.handle === null) {
throw new Error('studyosInitDb returned null — check STUDYOS_MODEL_DIR');
}
this.initialized = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dbPath AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Ri... | init(dbPath: string): void {
if (this.initialized) {
return;
}
this.handle = nativeModule.studyosInitDb(dbPath);
if (this.handle === null) {
throw new Error('studyosInitDb returned null — check STUDYOS_MODEL_DIR');
}
this.initialized = true;
} | https://github.com/Lycorius03/studyos | 441c19eed788e1829334274ea46a993972ee116d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets | arkts | setSuite | Sets the test suite this test belongs to.
@param {ArkTestsuite} suite The test suite instance.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setSuite(suite: ArkTestsuite): void {
this.suite = suite;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSuite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left suite AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ArkTes... | public setSuite(suite: ArkTestsuite): void {
this.suite = suite;
} | https://gitcode.com/iop123123/arkts-static-skills | c43213c90084cf65b2ea3270f2c58a94304b58fb | gitcode |
openharmony/multimedia_image_standard | test/image_interface_demo/ets/stage/receiver/entry/src/main/ets/view/MediaItem.ets | arkts | build | getImgSrc() {
switch (this.media.mediaType) {
case mediaLibrary.MediaType.VIDEO:
return $r('app.media.video_poster')
case mediaLibrary.MediaType.AUDIO:
return $r('app.media.ic_play')
case mediaLibrary.MediaType.FILE:
return $r('app.media.ic_document')
break
default:
return this.media.uri
break
}
} | build() {
Row() {
Button({ type: ButtonType.Circle, stateEffect: true }) {
Column() {
Image($r('app.media.ic_rename'))
.objectFit(ImageFit.Contain)
.size({ width: 40, height: 40 })
}
}
.size({ width: 50, height: 50 })
.backgroundColor('#F5F... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Row() {
Button({ type: ButtonType.Circle, stateEffect: true }) {
Column() {
Image($r('app.media.ic_rename'))
.objectFit(ImageFit.Contain)
.size({ width: 40, height: 40 })
}
}
.size({ width: 50, height: 50 })
.backgroundColor('#F5F... | https://gitee.com/openharmony/multimedia_image_standard.git | ccfac28267f1a4ea3f6ae76449af6d3aff901abd | gitee |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | fixTopInFreeMode | In free mode fix top edge.
@param left
@param crop
@param imageLines
@returns fixedTop. | private fixTopInFreeMode(top: number, crop: RectF, imageLines: Array<LineSegment>): number {
let topLine = new LineSegment(new Point(crop.left, top), new Point(crop.right, top));
let adjacentLines: LineSegment[] = [];
adjacentLines.push(new LineSegment(new Point(crop.left, top), new Point(crop.left, crop.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fixTopInFreeMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left top AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private fixTopInFreeMode(top: number, crop: RectF, imageLines: Array<LineSegment>): number {
let topLine = new LineSegment(new Point(crop.left, top), new Point(crop.right, top));
let adjacentLines: LineSegment[] = [];
adjacentLines.push(new LineSegment(new Point(crop.left, top), new Point(crop.left, crop.... | https://gitee.com/openharmony/codelabs.git | 63404aed8a6468210de3cd8c775d1ddab624a7d6 | gitee |
openharmony-sig/flutter_inappwebview | flutter_inappwebview_ohos/ohos/src/main/ets/components/plugin/types/MarginsExt.ets | arkts | milsToPixels | public toMargins(): PrintAttributes.Margins {
return new PrintAttributes.Margins(
this.pixelsToMils(this.left!),
this.pixelsToMils(this.top!),
this.pixelsToMils(this.right!),
this.pixelsToMils(this.bottom!)
);
} | private milsToPixels(mils: number): number {
return mils * 0.09600001209449;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left milsToPixels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mils AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private milsToPixels(mils: number): number {
return mils * 0.09600001209449;
} | https://gitee.com/openharmony-sig/flutter_inappwebview.git | ba6a2592804762827f70ef4b627814cbe90e70bb | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | padStart | The padStart() method pads the current string with another string (multiple times, if needed)
until the resulting string reaches the given length.
The padding is applied from the start of the current string. | public padStart(end: int, ch: char): String {
let padLen = end - this.length();
if (padLen <= 0) {
return this;
}
let arr: char[] = new char[end]
for(let i = 0; i < padLen; i++){
arr[i] = ch
}
for (let i: int = 0; i < this.length(); i++... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left padStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left end AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#... | public padStart(end: int, ch: char): String {
let padLen = end - this.length();
if (padLen <= 0) {
return this;
}
let arr: char[] = new char[end]
for(let i = 0; i < padLen; i++){
arr[i] = ch
}
for (let i: int = 0; i < this.length(); i++... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a8f6e30896da57440fe59a7e41c8472ed618bbfe | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/DataInitializer.ets | arkts | addVariation | 添加随机波动
@param baseValue 基准值
@param variation 波动范围
@param decimalPlaces 小数位数 | private addVariation(baseValue: number, variation: number, decimalPlaces: number): number {
// 生成 -variation 到 +variation 的随机数
const randomVariation = (Math.random() * 2 - 1) * variation;
const result = baseValue + randomVariation;
return Number(result.toFixed(decimalPlaces));
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left addVariation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | private addVariation(baseValue: number, variation: number, decimalPlaces: number): number {
// 生成 -variation 到 +variation 的随机数
const randomVariation = (Math.random() * 2 - 1) * variation;
const result = baseValue + randomVariation;
return Number(result.toFixed(decimalPlaces));
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 92512f5864bd0d814f88d3a06d1be924dd1e45c6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/UnifiedContentAdapter.ets | arkts | toUnifiedContent | 将漫画数据转换为统一内容模型 | static toUnifiedContent(
manga: Manga,
chapters: MangaChapter[],
isFavorite: boolean = false,
readChapterIds: Set<string> = new Set(),
downloadedChapterIds: Set<string> = new Set(),
bookmarkedChapterIds: Set<string> = new Set(),
lastReadChapterIndex: number = -1,
sourceId?: string,
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left toUnifiedContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#iden... | static toUnifiedContent(
manga: Manga,
chapters: MangaChapter[],
isFavorite: boolean = false,
readChapterIds: Set<string> = new Set(),
downloadedChapterIds: Set<string> = new Set(),
bookmarkedChapterIds: Set<string> = new Set(),
lastReadChapterIndex: number = -1,
sourceId?: string,
... | https://github.com/DaLongZhuaZi/manxia | 57f7d6e2a0194d6f7a09da71819e39ccad9a9f75 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets | arkts | updateAccountInput | 更新账号输入
@param {string} value - 输入内容
@returns {void} 无返回值 | updateAccountInput(value: string): void {
this.accountInput = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateAccountInput 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#)#Le... | updateAccountInput(value: string): void {
this.accountInput = value;
} | https://github.com/Joker-x-dev/HarmonyKit | b14b57cb4a1eb09416e48d752c628b42f51c6ec6 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets | arkts | anticipateOvershoot | 预期过冲插值器
结合预期和过冲效果 | static anticipateOvershoot(tension: number = 2.0): curves.ICurve {
return curves.springCurve(1, 0.8, tension * 0.5, tension);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left anticipateOvershoot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tension AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignmen... | static anticipateOvershoot(tension: number = 2.0): curves.ICurve {
return curves.springCurve(1, 0.8, tension * 0.5, tension);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 412c152c6800db7fe0bd712d1ab039f625262de9 | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/model/NavDestBuilder.ets | arkts | getTopPathName | 获取路由栈栈顶的路由,在根视图中会返回null
@returns | public getTopPathName(): string | null {
this.updateCurrentStackName()
return this.routerMgr.getTopPathName()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTopPathName 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#express... | public getTopPathName(): string | null {
this.updateCurrentStackName()
return this.routerMgr.getTopPathName()
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L402-L405 | 5f493673ca453a5a7ecb9b8a91b7d0f0dc54f126 | github |
egavrin/arkts_agent_kit | examples/fslib/src/tests/fslib.test.ets | arkts | testReadWriteBytes | --- ArrayBuffer binary I/O --- | function testReadWriteBytes(): void {
ensureSetup()
let fs = new FileSystem()
let fpath: string = TMPDIR + "/bytes.bin"
let buf: ArrayBuffer = new ArrayBuffer(4)
let view: Uint8Array = new Uint8Array(buf)
view[0] = 65
view[1] = 66
view[2] = 0
view[3] = 67
fs.writeBytes(fpath, buf... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testReadWriteBytes 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#predefin... | function testReadWriteBytes(): void {
ensureSetup()
let fs = new FileSystem()
let fpath: string = TMPDIR + "/bytes.bin"
let buf: ArrayBuffer = new ArrayBuffer(4)
let view: Uint8Array = new Uint8Array(buf)
view[0] = 65
view[1] = 66
view[2] = 0
view[3] = 67
fs.writeBytes(fpath, buf... | https://gitcode.com/egavrin/arkts_agent_kit | fe0a43e175a15d4789205da7fdd37d7782a5cd98 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test52_original_index.ets | arkts | testChainedOps | --- Chained filter+map+reduce on numbers --- | function testChainedOps(): string {
let nums: number[] = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10];
let positives: number[] = nums.filter((n: number): boolean => {
return n > 0;
});
let squared: number[] = positives.map((n: number): number => {
return n * n;
});
let total: number = squared.reduce((sum: n... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testChainedOps 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_t... | function testChainedOps(): string {
let nums: number[] = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10];
let positives: number[] = nums.filter((n: number): boolean => {
return n > 0;
});
let squared: number[] = positives.map((n: number): number => {
return n * n;
});
let total: number = squared.reduce((sum: n... | https://github.com/miaochiahao/ark-ghidra | 6ce9c11819d425d4ea0a4847c0c01560a3ad3bc8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/TypeShelfManager.ets | arkts | isItemInShelf | 检查内容是否在指定书架中 | isItemInShelf(itemId: string, contentType: ContentType, shelfId: string): boolean {
return this.categoryManager.isItemInCategory(itemId, contentType, shelfId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isItemInShelf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,... | isItemInShelf(itemId: string, contentType: ContentType, shelfId: string): boolean {
return this.categoryManager.isItemInCategory(itemId, contentType, shelfId);
} | https://github.com/DaLongZhuaZi/manxia | de1374433823396578c65860ca4a774d8ceb0c7e | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitRepeatedFixed32 | 访问 repeated fixed32 字段
JSON: array of number | visitRepeatedFixed32(value: number[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = [...value] as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedFixed32 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#subscript_expression#Left AST#identifier#Left numb... | visitRepeatedFixed32(value: number[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = [...value] as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 97e64bbccefda210bbbfe78bced9063f5f218689 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | regAVPlayerCallback | 注册avplayer回调函数
@param avPlayer AVPlayer实例
@param timeUpdateCb 歌曲时间更新回调
@param stateUpdateCb avplayer状态更新回调
@param completeCb avplayer单曲完成回调
@returns {void} | private regAVPlayerCallback(avPlayer: media.AVPlayer, timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): void {
// seek操作结果回调函数
avPlayer.on('seekDone', (seekDoneTime: number) => {
logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
// error回调监听函数,当avPla... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left regAVPlayerCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left avPlayer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ... | private regAVPlayerCallback(avPlayer: media.AVPlayer, timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): void {
// seek操作结果回调函数
avPlayer.on('seekDone', (seekDoneTime: number) => {
logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
// error回调监听函数,当avPla... | https://gitcode.com/arkui-x/samples | ba7c96676c9ac931faafffc3a58af55756d34459 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/components/charts/base/BaseChart.ets | arkts | easeInOutCubic | 缓动函数:easeInOutCubic | protected easeInOutCubic(t: number): number {
return t < 0.5
? 4 * t * t * t
: 1 - Math.pow(-2 * t + 2, 3) / 2;
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left easeInOutCubic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | protected easeInOutCubic(t: number): number {
return t < 0.5
? 4 * t * t * t
: 1 - Math.pow(-2 * t + 2, 3) / 2;
} | https://github.com/LJ666-ui/harmony-health-care | 41d3d903a54153f967e890878fdaa7916f2c65bd | github |
pangpang20/antennaPodHM | entry/src/main/ets/pages/MainPage.ets | arkts | formatTime | 格式化播放时间 | formatTime(seconds: number): string {
const totalSeconds = Math.floor(seconds);
const mins = Math.floor(totalSeconds / 60);
const hours = Math.floor(mins / 60);
const remainingSeconds = totalSeconds % 60;
if (hours > 0) {
return `${hours}:${(mins % 60).toString().padStart(2, '0')}:${remaini... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig... | formatTime(seconds: number): string {
const totalSeconds = Math.floor(seconds);
const mins = Math.floor(totalSeconds / 60);
const hours = Math.floor(mins / 60);
const remainingSeconds = totalSeconds % 60;
if (hours > 0) {
return `${hours}:${(mins % 60).toString().padStart(2, '0')}:${remaini... | https://github.com/pangpang20/antennaPodHM | 0d53aede3b02a4e76f4790ae6e7b17c6403be61c | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/RecentFilesService.ets | arkts | addRecentFile | 当文件拥有持久性授权时,才能添加到最近访问中
@param recentFile 最近打开的文件
@returns 结果
@throws KeePassHoError 路经不存在或者没有持久性授权 | public async addRecentFile(recentFile: RecentFile): Promise<void> {
if (recentFile.filePath === undefined || recentFile.filePath === '') {
throw new KeePassHoError(ErrorCodes.FILE_PATH_EMPTY);
}
if (!recentFile.filePath.startsWith("file://")) {
return this.doAdd(recentFile);
}
// 如果拥有持... | 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 addRecentFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left recentFile AST#identifier#Right AST#:#Left... | public async addRecentFile(recentFile: RecentFile): Promise<void> {
if (recentFile.filePath === undefined || recentFile.filePath === '') {
throw new KeePassHoError(ErrorCodes.FILE_PATH_EMPTY);
}
if (!recentFile.filePath.startsWith("file://")) {
return this.doAdd(recentFile);
}
// 如果拥有持... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L56-L88 | 279bfa5f5b7d595ffbae1df1106f1051579817e2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | onDestroy | 在Ability销毁时的清理工作(游戏引擎已移除) | onDestroy(): void {
logger.info('EntryAbility', 'onDestroy: app is being destroyed');
WindowManager.dispose();
try {
getErrorMonitorService().stop();
} catch (error) {
logger.warn('EntryAbility', `stop ErrorMonitorService failed: ${String(error)}`);
}
try {
getCrashRecorder... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy 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#Le... | onDestroy(): void {
logger.info('EntryAbility', 'onDestroy: app is being destroyed');
WindowManager.dispose();
try {
getErrorMonitorService().stop();
} catch (error) {
logger.warn('EntryAbility', `stop ErrorMonitorService failed: ${String(error)}`);
}
try {
getCrashRecorder... | https://github.com/DaLongZhuaZi/manxia | d473e4f45eeb5fd01743efc0f352616af578e2fc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Parameter.ets | arkts | getType | Gets the type of the parameter.
@returns { Type } The type object of the parameter.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getType(): Type {
return this.paramType!
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getType 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 Type AST#ident... | public getType(): Type {
return this.paramType!
} | https://gitcode.com/iop123123/arkts-static-skills | 66ab0c5d692a1d16ea4c4f4c0ef6d0b5c9bc7542 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/NewsRelease/entry/src/main/ets/common/utils/HttpUtil.ets | arkts | httpRequest | Initiates an HTTP request to a given URL.
@param url URL for initiating an HTTP request
@param method Request method.
@param extraData Additional data of the request.
@returns Returns {@link ResponseResult}. | function httpRequest(url: string, method: http.RequestMethod, params?: NewsData): Promise<ResponseResult> {
let httpRequest = http.createHttp();
let responseResult = httpRequest.request(url, {
method: method,
readTimeout: Constants.HTTP_READ_TIMEOUT,
header: {
'Content-Type': ContentType.JSON
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left httpRequest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function httpRequest(url: string, method: http.RequestMethod, params?: NewsData): Promise<ResponseResult> {
let httpRequest = http.createHttp();
let responseResult = httpRequest.request(url, {
method: method,
readTimeout: Constants.HTTP_READ_TIMEOUT,
header: {
'Content-Type': ContentType.JSON
... | https://gitee.com/harmonyos/codelabs.git | 9a64a7464431711175291b2b1bb56ea7f3d57ae5 | gitee |
arkui-x/samples | CodeLab/Cases/feature/componentstack/src/main/ets/view/ComponentStack.ets | arkts | build | 快截图标区域2 顶部偏移量 | build() {
Column() {
Row() {
// 上图下文字透明背景样式
IconList2({ ratio: this.ratio })
}
.width('100%')
.height(this.height2)
.opacity(this.opacity2)
// 商品列表组件
ProductList()
.width('100%')
.height(`calc((100% + ${SCROLL_OFFSET}vp ))`)
}
.mar... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Row() {
// 上图下文字透明背景样式
IconList2({ ratio: this.ratio })
}
.width('100%')
.height(this.height2)
.opacity(this.opacity2)
// 商品列表组件
ProductList()
.width('100%')
.height(`calc((100% + ${SCROLL_OFFSET}vp ))`)
}
.mar... | https://gitcode.com/arkui-x/samples | cea9760fdeb91b613161e805e93d0d54d7945845 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | join | Joins data to a string
@returns joined representation with comma separator | public join(): string {
return this.join(",")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left join AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public join(): string {
return this.join(",")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | bca94dd18d79021ff07135d2b8954ec828572b84 | gitee |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/client/tools/ClientStream.ets | arkts | prepareServerForNative | 为 Native 模式准备服务端:连接 ADB 并推送服务端。 | async prepareServerForNative(
context: Context, // 需要Context来获取AdbKeyManager
serverJarData: ArrayBuffer | null,
onWaitAuth?: () => void
): Promise<number> {
try {
this.isClosing = false;
// 1. 初始化 ADB 密钥管理器
const keyManager = AdbKeyManager.getInstance();
await keyManager.ini... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left prepareServerForNative AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AS... | async prepareServerForNative(
context: Context, // 需要Context来获取AdbKeyManager
serverJarData: ArrayBuffer | null,
onWaitAuth?: () => void
): Promise<number> {
try {
this.isClosing = false;
// 1. 初始化 ADB 密钥管理器
const keyManager = AdbKeyManager.getInstance();
await keyManager.ini... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | cac40897c195e6c71222341daceac1633df72cf5 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | updateWebSettings | Updates the UI settings for the web. | updateWebSettings() {
const oldForceDark = this.forceDark;
const newForceDark = forceDark(this.url);
if (oldForceDark != newForceDark) {
this.forceDark = newForceDark;
meow(`forceDark changed from [${oldForceDark}] to [${newForceDark}] for [${this.url}]!`, 'meowTabInfo][updateWebUiStatuses');
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateWebSettings 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#... | updateWebSettings() {
const oldForceDark = this.forceDark;
const newForceDark = forceDark(this.url);
if (oldForceDark != newForceDark) {
this.forceDark = newForceDark;
meow(`forceDark changed from [${oldForceDark}] to [${newForceDark}] for [${this.url}]!`, 'meowTabInfo][updateWebUiStatuses');
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | ee7f1f1e6f38f55ad060da6e55a85546b4c9848b | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/context/ContextUtil.ets | arkts | getHostCtx | 获得当前元能力的 Context
@returns {common.Context | undefined} hostContext;获取失败返回 undefined | static getHostCtx(): common.Context | undefined {
return ContextUtil.getUICtx().getHostContext();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getHostCtx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#... | static getHostCtx(): common.Context | undefined {
return ContextUtil.getUICtx().getHostContext();
} | https://github.com/Joker-x-dev/CoolMallArkTS | b6b33f095e375b5898412aa7ff867b8e91ecc224 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | valueOf | Returns the object itself
@returns { Int16Array }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public valueOf(): Int16Array {
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 Int16Array AST... | public valueOf(): Int16Array {
return this
} | https://gitcode.com/iop123123/arkts-static-skills | b4e24a8c0f409c2a90f2328262ea160175362826 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Math.ets | arkts | fround | "fround" returns nearest 32-bit single fp representation of a number
in a 64-bit form
Math.fround(1.337) == 1.337 // false, result would be 1.3370000123977661
Math.fround(1.5) == 1.5 // true
Math.fround(-5.05) == -5.05 //false, result would be -5.050000190734863
Math.fround(Infinity) // Infinity
Math.fround(NaN) // NaN | public static fround(x: double): double {
return fround(x);
} | 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 fround AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right ... | public static fround(x: double): double {
return fround(x);
} | https://gitcode.com/iop123123/arkts-static-skills | ff74298420a9202c4efb241cedfb68b716a97c62 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | loadAllSettings | ============================================================================
设置加载
============================================================================
加载所有设置到缓存 | private async loadAllSettings(): Promise<void> {
if (!this.dataPreferences) return;
try {
// 遍历所有定义的设置项
const keys = Object.keys(SETTINGS_DEFINITIONS);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const definition = SETTINGS_DEFINITIONS[key];
if (defi... | 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 loadAllSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async loadAllSettings(): Promise<void> {
if (!this.dataPreferences) return;
try {
// 遍历所有定义的设置项
const keys = Object.keys(SETTINGS_DEFINITIONS);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const definition = SETTINGS_DEFINITIONS[key];
if (defi... | https://github.com/richshaw2015/nds | 7e0b47b47de5a01d2116971ef5522cc919d06e2a | github |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | sanitizeSql | 对 SQL 语句中的敏感值进行脱敏
将字符串值和长数字替换为占位符
@param sql 原始 SQL 语句
@returns 脱敏后的 SQL | private sanitizeSql(sql: string): string {
// 将引号内的字符串值替换为 [***]
let result = sql.replace(/'[^']*'/g, "'[***]'")
result = this.maskSensitiveKeyValuePairs(result)
result = this.maskNumericTokens(result)
return result
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sanitizeSql AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sql AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | private sanitizeSql(sql: string): string {
// 将引号内的字符串值替换为 [***]
let result = sql.replace(/'[^']*'/g, "'[***]'")
result = this.maskSensitiveKeyValuePairs(result)
result = this.maskNumericTokens(result)
return result
} | https://github.com/offlinecat-dev/OCNetORM | 56fed2f8dbe9038d5e2e74cd7bba7713c412baa7 | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversationlist/conversationListController.ets | arkts | requestItem | Obtaining List Data in Pagination Mode | requestItem() {
if (this.page === 0) {
this.page++;
this.queryAllMessages();
} else {
HiLog.i(TAG, 'isLoading');
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | requestItem() {
if (this.page === 0) {
this.page++;
this.queryAllMessages();
} else {
HiLog.i(TAG, 'isLoading');
}
} | https://gitee.com/openharmony/applications_mms.git | 6043eb534674667ef52e4b1920a3b28f8cdd190c | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | final | Returns the byte at the specified index.
@param { int } pos The position in the buffer.
@returns { byte } The byte value.
@throws { IndexOutOfBoundsError } Throws if pos is out of bounds.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public final at(pos: int): byte {
if (this.data !== undefined) {
this.doBoundaryCheck(pos)
// NOTE(dslynko, #24647) research performance of managed code compared to intrinsics
return this.data![pos]
}
// Fallback to access through native pointer
re... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left final AST#identifier#Right AST#identifier#Left at AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identi... | public final at(pos: int): byte {
if (this.data !== undefined) {
this.doBoundaryCheck(pos)
// NOTE(dslynko, #24647) research performance of managed code compared to intrinsics
return this.data![pos]
}
// Fallback to access through native pointer
re... | https://gitcode.com/iop123123/arkts-static-skills | a7623c3fcf0f303b44016709686436db49611e39 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | $_invoke | Creates a new instance of a String from byte
@param { byte } value The value to be converted to a string.
@returns { string } A new String instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: byte): string {
return new String(value);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left byte AST#identifier#Ri... | static $_invoke(value: byte): string {
return new String(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 581b3ec899c6ae19c4e744d78119e49770cba42b | gitcode |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/pages/PlanDetailPage.ets | arkts | formatMinutesToHourMin | 时长:将“分钟数”格式化为“X小时Y分” | formatMinutesToHourMin(minutes: number): string {
const totalMinutes = Math.max(0, Math.floor(minutes));
const hours = Math.floor(totalMinutes / 60);
const remainMinutes = totalMinutes % 60;
if (hours <= 0) {
return `${remainMinutes} 分钟`;
}
if (remainMinutes <= 0) {
return `${hours... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatMinutesToHourMin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minutes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left... | formatMinutesToHourMin(minutes: number): string {
const totalMinutes = Math.max(0, Math.floor(minutes));
const hours = Math.floor(totalMinutes / 60);
const remainMinutes = totalMinutes % 60;
if (hours <= 0) {
return `${remainMinutes} 分钟`;
}
if (remainMinutes <= 0) {
return `${hours... | https://gitcode.com/openharmony/codelabs | 675688289838206789ae2c37c300046092696a48 | gitcode |
openharmony/app_samples | ETSUI/Gallery/entry/src/main/ets/MainAbility/pages/canvas/canvas.ets | arkts | hsv2rgb | HSV转RGB | hsv2rgb(hsv) {
let _l = hsv[0]
let _m = hsv[1]
let _n = hsv[2]
let newR
let newG
let newB
if (_m === 0) {
_l = _m = _n = Math.round(255 * _n / 100)
newR = _l
newG = _m
newB = _n
} else {
_m = _m / 100
_n = _n / 100
const p = Math.floor(_l / 60)... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left hsv2rgb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hsv AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_s... | hsv2rgb(hsv) {
let _l = hsv[0]
let _m = hsv[1]
let _n = hsv[2]
let newR
let newG
let newB
if (_m === 0) {
_l = _m = _n = Math.round(255 * _n / 100)
newR = _l
newG = _m
newB = _n
} else {
_m = _m / 100
_n = _n / 100
const p = Math.floor(_l / 60)... | https://gitee.com/openharmony/app_samples.git | fdf53cdc328cf1e9120c241b797bc56267ddaa5f | gitee |
honjow/Next2V | shared/src/main/ets/settings/ThemeSettings.ets | arkts | publishEffectiveDark | Single sink for THEME_EFFECTIVE_DARK: keeps the AppStorage theme key and the
V2 ThemeDisplayState mirror (read by @ComponentV2) in lockstep. | private static publishEffectiveDark(effectiveDark: boolean): void {
setAppStorageValue<boolean>(StorageKeys.THEME_EFFECTIVE_DARK, effectiveDark)
connectThemeDisplay().effectiveDark = effectiveDark
} | 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 publishEffectiveDark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left effectiveDark AST#identifier#Right AST#ERROR#L... | private static publishEffectiveDark(effectiveDark: boolean): void {
setAppStorageValue<boolean>(StorageKeys.THEME_EFFECTIVE_DARK, effectiveDark)
connectThemeDisplay().effectiveDark = effectiveDark
} | https://github.com/honjow/Next2V | bb29bfb4a48b2bfbe4c0efb285633b592497d232 | github |
ibestservices/ibest-ui | library/src/main/ets/components/button/index.ets | arkts | getBorderColor | 获取按钮边框的颜色 | getBorderColor() {
return this.btnBorderColor || this.btnBorder?.color || this.color || (this.type === COLOR_TYPE.DEFAULT ? GRAY_COLOR.GRAY_4 : this.baseStyle[this.type])
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getBorderColor 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... | getBorderColor() {
return this.btnBorderColor || this.btnBorder?.color || this.color || (this.type === COLOR_TYPE.DEFAULT ? GRAY_COLOR.GRAY_4 : this.baseStyle[this.type])
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/button/index.ets#L238-L240 | 0dff4fa37e936517069d26b737e78e7634d1c3be | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosBattleBridge.ets | arkts | handleEscape | Mirrors BattlePage.onEscapeBattle: force the clock past zero (Lost) and
hand the built result to the page immediately — no battle/end, no hold. | private handleEscape(): void {
const state: BattleState = this.engine.getState();
if (state.status === BattleStatus.Playing) {
this.engine.tick(state.remainingSeconds + 1);
}
if (this.finishNotified) {
return;
}
this.finishNotified = true;
const status: BattleStatus = this.engi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleEscape AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#voi... | private handleEscape(): void {
const state: BattleState = this.engine.getState();
if (state.status === BattleStatus.Playing) {
this.engine.tick(state.remainingSeconds + 1);
}
if (this.finishNotified) {
return;
}
this.finishNotified = true;
const status: BattleStatus = this.engi... | https://github.com/terryma2024/happyword | 8b123fd14ad5b175e7ce8294d67d6a666d081d10 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setDoubleTapToZoomEnabled | Set this to true to enable zooming in by double-tap on the chart.
Default: enabled
@param enabled | public setDoubleTapToZoomEnabled(enabled: boolean): void {
this.mDoubleTapToZoomEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDoubleTapToZoomEnabled 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#ide... | public setDoubleTapToZoomEnabled(enabled: boolean): void {
this.mDoubleTapToZoomEnabled = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 865ba82cbb447703cf586251f93654cd18c72fec | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | popListNode | Removes the first node from the linked queue.
Advances the sentinel head node to the next linked node.
@returns { void } No return value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private popListNode(firstNode: ListNode<T>): void {
let h = this.head;
h.next = h;
this.head = firstNode;
firstNode.element = undefined;
return;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left popListNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left firstNode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio... | private popListNode(firstNode: ListNode<T>): void {
let h = this.head;
h.next = h;
this.head = firstNode;
firstNode.element = undefined;
return;
} | https://gitcode.com/iop123123/arkts-static-skills | da2d0528cbcab2352828dcfe974373f760ba1552 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | getBackgroundImageUrl | 获取背景图 URL
注意:使用缓存避免频繁刷新背景图
@returns 背景图 URL | async getBackgroundImageUrl(): Promise<string> {
// 如果已加载,直接返回缓存的 URL(包括 DEFAULT 类型)
if (this.isLoaded && this.cachedUrl) {
return this.cachedUrl;
}
try {
this.cachedType = await PreferencesUtil.get<string>(
BACKGROUND_IMAGE_TYPE_KEY,
BackgroundImageType.DEFAULT
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBackgroundImageUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS... | async getBackgroundImageUrl(): Promise<string> {
// 如果已加载,直接返回缓存的 URL(包括 DEFAULT 类型)
if (this.isLoaded && this.cachedUrl) {
return this.cachedUrl;
}
try {
this.cachedType = await PreferencesUtil.get<string>(
BACKGROUND_IMAGE_TYPE_KEY,
BackgroundImageType.DEFAULT
... | https://github.com/AlkaidLab/moonlight-harmony | d1afc3d864a1f6bf5e980e7308ea67a781014d3a | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | slice | Creates a slice of current Uint16 with all elements.
@returns a new Uint16Array with elements of current Uint16Array | public slice(): Uint16Array {
return new Uint16Array(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public slice(): Uint16Array {
return new Uint16Array(this)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1ace799319adc550ed735cdb58f3ebdbe54efb85 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | getSourceCoverStats | 获取图源封面统计信息(统计新旧两种格式的目录) | async getSourceCoverStats(sourceId: number): Promise<CoverStats> {
try {
if (!await this.ensurePathInitialized()) {
const emptyStats: CoverStats = { count: 0, size: 0 };
return emptyStats;
}
// 先确保 pkg 已缓存
const pkg = await this.ensureSourcePkg(sourceId);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSourceCoverStats AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#... | async getSourceCoverStats(sourceId: number): Promise<CoverStats> {
try {
if (!await this.ensurePathInitialized()) {
const emptyStats: CoverStats = { count: 0, size: 0 };
return emptyStats;
}
// 先确保 pkg 已缓存
const pkg = await this.ensureSourcePkg(sourceId);
... | https://github.com/DaLongZhuaZi/manxia | 5f4ef854bb386ddc41f2159b42ff6b3687d4d1cc | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/DataSet.ets | arkts | setValues | /**
* This method is deprecated.
* Use setEntries(...) instead.
*
* @param values
@Deprecated | public setValues(values: JArrayList<T>): void {
this.setEntries(values);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres... | public setValues(values: JArrayList<T>): void {
this.setEntries(values);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f28da0d25b0e19c1f93128d838f3d7336577a971 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | onForeground | 应用进入前台时的回调
回到前台不需要主动停止长时任务,等业务完成后再停止 | onForeground(): void {
logger.lifecycle('EntryAbility', '应用进入前台');
// 清除后台状态(统一由WindowManager管理)
WindowManager.syncBackgroundState(false, '应用进入前台');
try {
widgetDataSync.init(this.context);
void widgetDataSync.syncAllDataThrottled();
} catch (error) {
logger.warn('EntryAbil... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground 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... | onForeground(): void {
logger.lifecycle('EntryAbility', '应用进入前台');
// 清除后台状态(统一由WindowManager管理)
WindowManager.syncBackgroundState(false, '应用进入前台');
try {
widgetDataSync.init(this.context);
void widgetDataSync.syncAllDataThrottled();
} catch (error) {
logger.warn('EntryAbil... | https://github.com/DaLongZhuaZi/manxia | ff73be94ae90766a55702e1bd9aa33bf829f26d1 | github |
LZZLHY/hlib | entry/src/main/ets/model/Book.ets | arkts | hasReadOnline | 是否在线可读 | hasReadOnline(): boolean {
return !!this.readOnlineUrl && this.readOnlineUrl.length > 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasReadOnline AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state... | hasReadOnline(): boolean {
return !!this.readOnlineUrl && this.readOnlineUrl.length > 0;
} | https://github.com/LZZLHY/hlib | a1cf1e8058e8df428f6de53b7f0b4bbd83719c52 | github |
openharmony/applications_mms | entry/src/main/ets/utils/MmsDatabaseHelper.ets | arkts | insert | New data | async insert(tableName, valueBucket) {
let rowId = 0;
if (this.mRdbStore !== null) {
let insertPromise = this.mRdbStore.insert(tableName, valueBucket);
insertPromise.then((ret) => {
HiLog.i(TAG, 'insert, first done: ' + rowId);
rowId = ret;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insert AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#,#Left , AST#,#Right AS... | async insert(tableName, valueBucket) {
let rowId = 0;
if (this.mRdbStore !== null) {
let insertPromise = this.mRdbStore.insert(tableName, valueBucket);
insertPromise.then((ret) => {
HiLog.i(TAG, 'insert, first done: ' + rowId);
rowId = ret;
... | https://gitee.com/openharmony/applications_mms.git | e60319ab67282411dee507bde649937c89091598 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | asBigInt | Gets an bigint value from an object by key.
@param {string} key - The key to look up
@returns {bigint} The integer value
@throws {JsonTypeError} If the value is not an bigint or if this element is not an object | asBigInt(): bigint {
if (this.jsonType != JsonType.JsonNumber) {
throw new JsonTypeError("This value's ValueKind is not Number.")
}
if (this.maybeLongValue != undefined) {
return BigInt(this.maybeLongValue!)
}
if (this.m... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left asBigInt 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 bigint AST#identifier#Right AST#ERROR#Right AST#state... | asBigInt(): bigint {
if (this.jsonType != JsonType.JsonNumber) {
throw new JsonTypeError("This value's ValueKind is not Number.")
}
if (this.maybeLongValue != undefined) {
return BigInt(this.maybeLongValue!)
}
if (this.m... | https://gitcode.com/iop123123/arkts-static-skills | 1b110b4bd9edd5210666a3c525a917eb7ceb2981 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CloudSyncRecordDAO.ets | arkts | getLastSuccessfulSync | 查询最近一次成功的同步记录 | static async getLastSuccessfulSync(userId: number): Promise<CloudSyncRecord | null> {
const store: relationalStore.RdbStore = DatabaseManager.getDatabase();
const sql: string = `SELECT * FROM ${CloudSyncRecord.tableName}
WHERE user_id = ? AND status = 'completed'
ORDER BY e... | 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 getLastSuccessfulSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#... | static async getLastSuccessfulSync(userId: number): Promise<CloudSyncRecord | null> {
const store: relationalStore.RdbStore = DatabaseManager.getDatabase();
const sql: string = `SELECT * FROM ${CloudSyncRecord.tableName}
WHERE user_id = ? AND status = 'completed'
ORDER BY e... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | c7320b41fbf05669868641149a30452a3a7fae25 | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/permission/PermissionUtils.ets | arkts | requestStoragePermission | 申请存储权限(读写用户存储)
用法示例:PermissionUtils.requestStoragePermission() { granted => ... }
@param callback 权限申请结果回调 | public async requestStoragePermission(callback: (granted: boolean) => void): Promise<void> {
const permissions: Permissions[] = [
"ohos.permission.READ_MEDIA",
"ohos.permission.WRITE_MEDIA"
];
await this.handlePermissionResult('存储权限', callback, permissions);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left requestStoragePermission AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERRO... | public async requestStoragePermission(callback: (granted: boolean) => void): Promise<void> {
const permissions: Permissions[] = [
"ohos.permission.READ_MEDIA",
"ohos.permission.WRITE_MEDIA"
];
await this.handlePermissionResult('存储权限', callback, permissions);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 087d9ccf1e95677d06895e787e605260787fd75e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an Uint32Array with respect to length.
@param { number } length - Number of elements
@throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / Uint32Array.BYTES_PER_ELEMENT)) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLengthInt = this.le... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / Uint32Array.BYTES_PER_ELEMENT)) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLengthInt = this.le... | https://gitcode.com/iop123123/arkts-static-skills | 238ffc3ce8062d2ba24bbc9b4b382b7adb28fe85 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationManager.ets | arkts | getHistoryLength | 获取导航历史长度
@returns number | public getHistoryLength(): number {
return this.navigationHistory.length;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHistoryLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AS... | public getHistoryLength(): number {
return this.navigationHistory.length;
} | https://github.com/LJ666-ui/harmony-health-care | 83df525eea7a14d4208ad17a2f0d0b7de8567aea | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieDataSet.ets | arkts | getHighlightColor | Gets the color for the highlighted sector
@Override
@Nullable | public getHighlightColor(): number | null {
return this.mHighlightColor;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHighlightColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Le... | public getHighlightColor(): number | null {
return this.mHighlightColor;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a8f35a416fa1275ba3c0602d0c28d9c28c83209b | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/StepManager.ets | arkts | calculateCalories | 计算卡路里消耗(估算值,基于平均值) | private calculateCalories(steps: number): number {
// 每1000步大约消耗40-60卡路里,这里取中间值50
return Math.round((steps / 1000) * 50 * 100) / 100; // 保留两位小数
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateCalories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left steps AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private calculateCalories(steps: number): number {
// 每1000步大约消耗40-60卡路里,这里取中间值50
return Math.round((steps / 1000) * 50 * 100) / 100; // 保留两位小数
} | https://gitcode.com/openharmony/codelabs | 54e40fa450d631c8fc321183c6cb2c7b38577bcb | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridViewManager.ets | arkts | registerViewCreator | Registers an ArkTS-side view factory.
@param viewTag View tag
@param viewCreator View factory | public registerViewCreator(viewTag: string, viewCreator: HybridViewCreator) {
this.viewCreatorRegistry.set(viewTag, viewCreator);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerViewCreator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left viewTag AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | public registerViewCreator(viewTag: string, viewCreator: HybridViewCreator) {
this.viewCreatorRegistry.set(viewTag, viewCreator);
} | https://github.com/AGenUI/AGenUI | 1394cdc7929e407ff137b2cb48e9bbbf985a9376 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | getNavigationState | 获取导航状态 | public getNavigationState(): ARNavigationState {
// 创建状态副本,避免spread操作符
const stateCopy: ARNavigationState = {
isActive: this.navigationState.isActive,
isPaused: this.navigationState.isPaused,
currentPath: this.navigationState.currentPath,
currentWaypointIndex: this.navigationState.curr... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNavigationState 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 ARN... | public getNavigationState(): ARNavigationState {
// 创建状态副本,避免spread操作符
const stateCopy: ARNavigationState = {
isActive: this.navigationState.isActive,
isPaused: this.navigationState.isPaused,
currentPath: this.navigationState.currentPath,
currentWaypointIndex: this.navigationState.curr... | https://github.com/LJ666-ui/harmony-health-care | 8bd22b6d2b55e92439469833eb25c2ba19a28c27 | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardBuilder.ets | arkts | appendSipAddresses | SIP (Session Initiation Protocol) is first supported in RFC 4770 as part of IMPP
support. vCard 2.1 and old vCard 3.0 may not able to parse it, or expect X-SIP
instead of "IMPP;sip:...".
We honor RFC 4770 and don't allow vCard 3.0 to emit X-SIP at all. | private appendSipAddresses(iContact: contact.Contact): VCardBuilder {
let useXProperty: boolean;
if (this.mIsV30OrV40) {
useXProperty = false;
} else if (this.mUsesDefactProperty) {
useXProperty = true;
} else {
return this;
}
if (... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendSipAddresses AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iContact AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member... | private appendSipAddresses(iContact: contact.Contact): VCardBuilder {
let useXProperty: boolean;
if (this.mIsV30OrV40) {
useXProperty = false;
} else if (this.mUsesDefactProperty) {
useXProperty = true;
} else {
return this;
}
if (... | https://gitee.com/openharmony-tpc/VCard.git | 94bcabcbe39ac96e993de021f1a7202bb7f78b63 | gitee |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/CommandLine.ets | arkts | getOptionValues | Retrieves the array of values, if any, of an option.
@param option string name of the option.
@return Values of the argument if option is set, and has an argument, otherwise null.
@since 1.5.0 | public getOptionValues(option: CliOption): string[]{
let values: JList<string> = new JList();
for (let index = 0;index < this.options.length(); index++) {
let processedOption: CliOption = this.options.get(index);
if (processedOption == option) {
let list = processedOption.getValuesList();
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOptionValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public getOptionValues(option: CliOption): string[]{
let values: JList<string> = new JList();
for (let index = 0;index < this.options.length(); index++) {
let processedOption: CliOption = this.options.get(index);
if (processedOption == option) {
let list = processedOption.getValuesList();
... | https://gitee.com/openharmony-sig/commons-cli.git | 9d93c57e6d88e4f71e6fee11ffab3f6b43f8da4b | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | getColorDepth | Get color depth | getColorDepth(): number {
return this.colorDepth;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getColorDepth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statemen... | getColorDepth(): number {
return this.colorDepth;
} | https://github.com/tangwengang-del/freerdp-harmonyos | da12056af6b4ad65c30ca046cb0cd1447636ac4b | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/ExtensionLoader.ets | arkts | installSshPublicKey | 安装公钥到远端服务器 (同步阻塞, 2-5秒, 调用方应显示 loading) | installSshPublicKey(host: string, port: number, username: string, password: string,
privateKeyPem: string, passphrase: string,
publicKey: string): SshPublicKeyInstallResult {
try {
return rdpnapi.installSshPublicKey(host, port, username, password,
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left installSshPublicKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left host AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Le... | installSshPublicKey(host: string, port: number, username: string, password: string,
privateKeyPem: string, passphrase: string,
publicKey: string): SshPublicKeyInstallResult {
try {
return rdpnapi.installSshPublicKey(host, port, username, password,
... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | b7f4eab258b9e6228119a464adf7303eb0d165d7 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | reload | 重新加载背景图设置
@returns 如果类型发生变化返回 true,否则返回 false | async reload(): Promise<boolean> {
// pendingTypeChange: 通过 setBackgroundImageType() 修改(singleton 共享,cachedType 已被更新)
// previousType 比较: 通过 saveSetting() 直接写 preferences(cachedType 未更新,需从 prefs 重新读取)
const dirtyFlag = this.pendingTypeChange;
this.pendingTypeChange = false;
const previousType = th... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reload AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#... | async reload(): Promise<boolean> {
// pendingTypeChange: 通过 setBackgroundImageType() 修改(singleton 共享,cachedType 已被更新)
// previousType 比较: 通过 saveSetting() 直接写 preferences(cachedType 未更新,需从 prefs 重新读取)
const dirtyFlag = this.pendingTypeChange;
this.pendingTypeChange = false;
const previousType = th... | https://github.com/AlkaidLab/moonlight-harmony | 200056abd679e709d65a4b4709fa39696c9b02c9 | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | setR2LDanmakuVisibility | �����Ƿ���ʾ���������Ļ
@param visible | public setR2LDanmakuVisibility(visible: boolean): DanmakuContext {
this.setDanmakuVisible(visible, BaseDanmaku.TYPE_SCROLL_RL);
this.setFilterData(DanmakuFilters.TAG_TYPE_DANMAKU_FILTER, this.mFilterTypes);
this.mGlobalFlagValues.updateFilterFlag();
if (this.R2LDanmakuVisibility != visible) {
th... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setR2LDanmakuVisibility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left visible AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | public setR2LDanmakuVisibility(visible: boolean): DanmakuContext {
this.setDanmakuVisible(visible, BaseDanmaku.TYPE_SCROLL_RL);
this.setFilterData(DanmakuFilters.TAG_TYPE_DANMAKU_FILTER, this.mFilterTypes);
this.mGlobalFlagValues.updateFilterFlag();
if (this.R2LDanmakuVisibility != visible) {
th... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 667ce0dd21d1460acea68deedfbcda51b0094d53 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | filter | Creates a new BigUint64Array from current BigUint64Array based on a condition fn.
@param { function } fn - the condition to apply for each element
@returns { BigUint64Array } - a new BigUint64Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public filter(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): BigUint64Array {
let markers : ValueArray<boolean> = new ValueArray<boolean>(this.lengthInt)
let resLen = 0
for (let i = 0; i < this.lengthInt; i++) {
markers[i] = fn(new BigInt(this.getUnsafe(i)), i,... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): BigUint64Array {
let markers : ValueArray<boolean> = new ValueArray<boolean>(this.lengthInt)
let resLen = 0
for (let i = 0; i < this.lengthInt; i++) {
markers[i] = fn(new BigInt(this.getUnsafe(i)), i,... | https://gitcode.com/iop123123/arkts-static-skills | 5c53858157ca0fa01cd423cbf2cb17b1e68defe5 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/core/ColumnMetadata.ets | arkts | setNullable | 设置是否允许为空
@param nullable 是否允许为空
@returns 当前实例,支持链式调用 | setNullable(nullable: boolean): ColumnMetadata {
this.isNullable = nullable
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setNullable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left nullable AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left ) AST#... | setNullable(nullable: boolean): ColumnMetadata {
this.isNullable = nullable
return this
} | https://github.com/offlinecat-dev/OCNetORM | 8ceda699f194119251e1b0a1b4fe6df81c5336ef | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets | arkts | calculateNextAssessmentDate | 计算下次评估时间 | private static calculateNextAssessmentDate(): Date {
const nextDate = new Date();
nextDate.setMonth(nextDate.getMonth() + 3); // 3个月后
return nextDate;
} | 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 calculateNextAssessmentDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expre... | private static calculateNextAssessmentDate(): Date {
const nextDate = new Date();
nextDate.setMonth(nextDate.getMonth() + 3); // 3个月后
return nextDate;
} | https://github.com/LJ666-ui/harmony-health-care | 69cc9cc96c0c3cbef08ffd8ae1d650437774abb7 | github |
openharmony-sig/flutter_sqflite | sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/DatabaseHelper.ets | arkts | getOnlyLocal | / 从已加载的列表里获取一个数据库 | private static getOnlyLocal(databaseName: string): relationalStore.RdbStore | null {
if (DatabaseHelper.databaseList.has(databaseName)) {
return DatabaseHelper.databaseList.get(databaseName) as relationalStore.RdbStore | null;
}
return null;
} | 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 getOnlyLocal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left databaseName AST#identifier#Right AST#ERROR#Left AST#:... | private static getOnlyLocal(databaseName: string): relationalStore.RdbStore | null {
if (DatabaseHelper.databaseList.has(databaseName)) {
return DatabaseHelper.databaseList.get(databaseName) as relationalStore.RdbStore | null;
}
return null;
} | https://gitee.com/openharmony-sig/flutter_sqflite.git | 551774545e17d11eea8835600179d74c90f6238d | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/YAxisRenderer.ets | arkts | drawZeroLine | Draws the zero line. | protected drawZeroLine(c: CanvasRenderingContext2D): void {
c.save();
if (this.mYAxis && this.mViewPortHandler && this.mTrans) {
this.mZeroLineClippingRect.set(this.mViewPortHandler.getContentRect().left, this.mViewPortHandler.getContentRect()
.top
, this.mViewPortHandler.getContentRect... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left drawZeroLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | protected drawZeroLine(c: CanvasRenderingContext2D): void {
c.save();
if (this.mYAxis && this.mViewPortHandler && this.mTrans) {
this.mZeroLineClippingRect.set(this.mViewPortHandler.getContentRect().left, this.mViewPortHandler.getContentRect()
.top
, this.mViewPortHandler.getContentRect... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a21d9148200bede5d6d56ca70d726d9c457a4ad8 | gitee |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | getSyntaxPrefix | Gets the 'syntaxPrefix'.
@return the 'syntaxPrefix' | public getSyntaxPrefix(): string {
return this.defaultSyntaxPrefix;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSyntaxPrefix 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... | public getSyntaxPrefix(): string {
return this.defaultSyntaxPrefix;
} | https://gitee.com/openharmony-sig/commons-cli.git | d4ea1429b75e2ac549366d4553cd19ee70b12c1e | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Object.ets | arkts | $_hashCode | Returns a hash code (integer representation) for this instance
@returns { int } The hash code value of this instance.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public final $_hashCode(): int {
return Runtime.getHashCode(this);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left final AST#identifier#Right AST#call_expression#Left AST#identifier#Left $_hashCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public final $_hashCode(): int {
return Runtime.getHashCode(this);
} | https://gitcode.com/iop123123/arkts-static-skills | 6d9c3833c6bc3abfb6795f5dd22526ab52136a0e | gitcode |
the-wwyang/kids-learning-app | src/main/ets/storage/LearningRecordStorageService.ets | arkts | loadCurrentSession | 加载当前学习会话
@returns 当前会话或null | static async loadCurrentSession(): Promise<LearningSession | null> {
try {
const hasData = await dataStorage.has(
LearningRecordStorageService.STORE_NAME,
LearningRecordStorageService.KEY_CURRENT_SESSION
);
if (!hasData) {
return null;
}
const session = awai... | 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 loadCurrentSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | static async loadCurrentSession(): Promise<LearningSession | null> {
try {
const hasData = await dataStorage.has(
LearningRecordStorageService.STORE_NAME,
LearningRecordStorageService.KEY_CURRENT_SESSION
);
if (!hasData) {
return null;
}
const session = awai... | https://github.com/the-wwyang/kids-learning-app | 14e46855c8298bd4c962423361a356c72f22145a | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/DownloadVM.ets | arkts | init | ─── 启动时把持久化的历史回灌 AppStorage ─── | static async init(ctx?: common.UIAbilityContext): Promise<void> {
try {
await DownloadRepository.loadHistoryToStorage();
// 重接未完成任务
await DownloadVM.restoreTasks(ctx);
} catch (e) {
Logger.w(TAG, `init failed: ${(e as Error).message}`);
}
} | 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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#?#Left ? AST#?#Right A... | static async init(ctx?: common.UIAbilityContext): Promise<void> {
try {
await DownloadRepository.loadHistoryToStorage();
// 重接未完成任务
await DownloadVM.restoreTasks(ctx);
} catch (e) {
Logger.w(TAG, `init failed: ${(e as Error).message}`);
}
} | https://github.com/LZZLHY/hlib | 856757e339b250742062d1118f6d4e4c909af95b | github |
751496032/ZRouter | RouterApi/src/main/ets/api/RouterMgr.ets | arkts | popToNameWithResult | 关闭到指定名称页面,并携带结果
@param name
@param result
@param animated
@returns | public popToNameWithResult<T>(name: string, result?: T, animated: boolean = true) {
if (ObjectUtil.isNull(result)) {
result = new Object() as T
}
return this.popToNameInternal(name, result, animated)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#binary_expression#Left AST#identifier#Left popToNameWithResult AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left (... | public popToNameWithResult<T>(name: string, result?: T, animated: boolean = true) {
if (ObjectUtil.isNull(result)) {
result = new Object() as T
}
return this.popToNameInternal(name, result, animated)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L435-L440 | cb5e4bea3b36a0b8c22ea393235139a7ec30041f | github |
Goway-Hui/harmonyos-next-dev | harmonyos-next-dev/assets/network-request-template.ets | arkts | handleUnauthorized | ==================== 处理未授权 ==================== | private handleUnauthorized(): void {
this.clearToken();
// 跳转登录页
promptAction.showToast({ message: '登录已过期' });
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleUnauthorized 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#... | private handleUnauthorized(): void {
this.clearToken();
// 跳转登录页
promptAction.showToast({ message: '登录已过期' });
} | https://github.com/Goway-Hui/harmonyos-next-dev | 556cfc94b6ffe45482e2f84ec9010b8892e9eb76 | github |
CLMC2025/Vignette | entry/src/main/ets/context/TemplateManager.ets | arkts | getAvailableDifficulties | 获取所有可用难度级别 | getAvailableDifficulties(): DifficultyLevel[] {
const levels: DifficultyLevel[] = [
DifficultyLevel.BEGINNER,
DifficultyLevel.CET4,
DifficultyLevel.CET6,
DifficultyLevel.POSTGRADUATE,
DifficultyLevel.IELTS,
DifficultyLevel.TOEFL,
DifficultyLevel.SAT,
DifficultyLevel... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAvailableDifficulties 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 Difficu... | getAvailableDifficulties(): DifficultyLevel[] {
const levels: DifficultyLevel[] = [
DifficultyLevel.BEGINNER,
DifficultyLevel.CET4,
DifficultyLevel.CET6,
DifficultyLevel.POSTGRADUATE,
DifficultyLevel.IELTS,
DifficultyLevel.TOEFL,
DifficultyLevel.SAT,
DifficultyLevel... | https://github.com/CLMC2025/Vignette | 5dbf3e0c7d0d3c60f7f364e5618fed141339e012 | github |
ibestservices/ibest-ui | library/src/main/ets/components/cascader/index.ets | arkts | getSelectedOptions | 获取当前已选中的选项 | getSelectedOptions(): IBestCascaderOption[] {
let arr: IBestCascaderOption[] = []
this.optionsInstance.forEach((e: IBestCascaderOptionInstance[]) => {
arr = arr.concat(e.filter(f => f.actived).map(g => {
let obj: IBestCascaderOption = {
text: getResourceStr(g.text),
value: g.value
}
return... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSelectedOptions 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 IBestCascaderOption AST#identifier#Right AS... | getSelectedOptions(): IBestCascaderOption[] {
let arr: IBestCascaderOption[] = []
this.optionsInstance.forEach((e: IBestCascaderOptionInstance[]) => {
arr = arr.concat(e.filter(f => f.actived).map(g => {
let obj: IBestCascaderOption = {
text: getResourceStr(g.text),
value: g.value
}
return... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/cascader/index.ets#L204-L216 | ebcb8ba3f48c17acd7e52a7c70995881481f6245 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVNativeClient.ets | arkts | getNativeModule | 获取Native模块的辅助函数 | function getNativeModule(): WebDAVNativeModule {
checkNativeModule();
if (!webdavNativeModule) {
throw new Error(`WebDAV Native模块未加载: ${nativeModuleLoadError}`);
}
return webdavNativeModule;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getNativeModule 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#type_identi... | function getNativeModule(): WebDAVNativeModule {
checkNativeModule();
if (!webdavNativeModule) {
throw new Error(`WebDAV Native模块未加载: ${nativeModuleLoadError}`);
}
return webdavNativeModule;
} | https://github.com/DaLongZhuaZi/manxia | dcf808a146364cd9dcf54d13931070631871f33e | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets | arkts | setCustomCurve | 设置自定义动画曲线
@param curve 自定义曲线 | setCustomCurve(curve: curves.ICurve): AnimationConfig {
this.customCurve = curve;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCustomCurve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left curve AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left curves AST#id... | setCustomCurve(curve: curves.ICurve): AnimationConfig {
this.customCurve = curve;
return this;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | f50903cab12d6d44137b89f9fcc2b5c508de8971 | gitcode |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | divide | Division operator | divide(operand: number): Offset {
return new Offset(this.dx / operand, this.dy / operand);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left divide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operand AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Right A... | divide(operand: number): Offset {
return new Offset(this.dx / operand, this.dy / operand);
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L133-L135 | 3baa7dcea9f2686b112826dd25a455c6cd8dc05e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets | arkts | constructor | NOTE(templin.konstantin): Temporary workaround due #20944 internal issue
if we remove this constructor we got error on "readonly K[]" branch
at constructor from union type
Creates a new Set instance from an array.
@param { K[] } values - The array used for initialization.
@syscap SystemCapability.Utils.Lang
@FaAndStage... | constructor(values: K[]) {
this.elements = new FinalMap<K, K>()
for (let i = 0; i < values.length; ++i) {
this.elements.set(values[i], values[i])
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left values AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#[#Left [ AST#[#R... | constructor(values: K[]) {
this.elements = new FinalMap<K, K>()
for (let i = 0; i < values.length; ++i) {
this.elements.set(values[i], values[i])
}
} | https://gitcode.com/iop123123/arkts-static-skills | 3680c3adc28aee96a1eaa6a902047a3229f97a15 | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/service/AlgorithmService.ets | arkts | getComponentDetailByPreference | 从首选项获取组件详情
@param componentId number
@returns Promise<ComponentDetailModel> | public getComponentDetailByPreference(componentId: number): Promise<ComponentDetailModel> {
return new Promise((resolve: (value: ComponentDetailModel) => void,
reject: (reason?: Object) => void) => {
PreferenceUtil.getInstance()
.getValue<Record<string, ComponentDetailModel>>(AlgorithmService.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getComponentDetailByPreference AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Lef... | public getComponentDetailByPreference(componentId: number): Promise<ComponentDetailModel> {
return new Promise((resolve: (value: ComponentDetailModel) => void,
reject: (reason?: Object) => void) => {
PreferenceUtil.getInstance()
.getValue<Record<string, ComponentDetailModel>>(AlgorithmService.... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 1a75c3048d8d6bc556f812e5868c4ba838abb9a9 | gitcode |
openharmony/arkui_ace_engine | advanced_ui_component/imageGeneratorDialog/source/image_generator_dialog_project/image_generator_dialog/src/main/ets/general/components/CanvasComplete.ets | arkts | snapOffsetToBounds | Snap offset values back within bounds | snapOffsetToBounds(): void {
// If image is smaller than container, don't allow dragging (center display)
if (this.imageWidth * this.imageScale < this.containerWidth) {
this.offsetX = 0;
} else {
// Calculate and limit maximum allowed offset
let maxOffsetX = Math.max(0, (this.imageWidth ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left snapOffsetToBounds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#... | snapOffsetToBounds(): void {
// If image is smaller than container, don't allow dragging (center display)
if (this.imageWidth * this.imageScale < this.containerWidth) {
this.offsetX = 0;
} else {
// Calculate and limit maximum allowed offset
let maxOffsetX = Math.max(0, (this.imageWidth ... | https://gitcode.com/openharmony/arkui_ace_engine | 7293cc32296d04f894ca062bcc88bbb94bb85e2d | gitcode |
ChangJing01/HarmonyOS-FinalProject | entry/src/main/ets/viewmodel/InitialData.ets | arkts | getGoodReviewText | 获取好评率显示文本 | getGoodReviewText(): string {
if (this.salesCount === 0) return '暂无评价';
const rate = Math.floor((this.goodReviewCount / this.salesCount) * 100);
return `好评${this.goodReviewCount}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGoodReviewText 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#stat... | getGoodReviewText(): string {
if (this.salesCount === 0) return '暂无评价';
const rate = Math.floor((this.goodReviewCount / this.salesCount) * 100);
return `好评${this.goodReviewCount}`;
} | https://github.com/ChangJing01/HarmonyOS-FinalProject | 1a35becd323f039fd3d24ed3c79411a2b7f31531 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/CrashRecorderService.ets | arkts | saveCrashSummary | 保存崩溃摘要(供下次启动快速读取) | private saveCrashSummary(
timestamp: number,
errorMessage: string,
stackTrace: string,
logFileName: string
): void {
try {
this.ensureCrashLogsDir();
const summaryPath = `${this.crashLogsDir}/last_crash_summary.json`;
const summary: string = JSON.stringify({
crashTime: ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveCrashSummary 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#... | private saveCrashSummary(
timestamp: number,
errorMessage: string,
stackTrace: string,
logFileName: string
): void {
try {
this.ensureCrashLogsDir();
const summaryPath = `${this.crashLogsDir}/last_crash_summary.json`;
const summary: string = JSON.stringify({
crashTime: ... | https://github.com/DaLongZhuaZi/manxia | 769a1f75b632a629867c4dbcad98b85dfca5d8a7 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets | arkts | $_iterator | Returns an iterator that iterates over bit vector.
@returns { IterableIterator<int> } A new iterable iterator object. | public override $_iterator(): IterableIterator<int> {
return new BitVectorIterator(this);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left $_iterator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public override $_iterator(): IterableIterator<int> {
return new BitVectorIterator(this);
} | https://gitcode.com/iop123123/arkts-static-skills | a358305d09002da4d05650c19f63e304cd05c954 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/json.ets | arkts | stringify | Converts longs array to JSON format
@param d: long[] - longs array to be converted to a JSON as an Array of Numbers
@returns String - JSON representation of longs array | public static stringify(d: long[]): String {
let s = new StringBuilder("[")
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append(d[i])
s.append(',')
}
if (d.length > 0) {
s.append(d[last_elem])
}
s.app... | 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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: long[]): String {
let s = new StringBuilder("[")
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append(d[i])
s.append(',')
}
if (d.length > 0) {
s.append(d[last_elem])
}
s.app... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cc7bd295836a137036187562bda68edfa09df1cd | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | updateLastActive | 更新最后活跃时间 | static async updateLastActive(memberId: number): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
last_active_at: new Date().toISOString(),
updated_at: new Date().toISOString()
};
const predicates = new r... | 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 updateLastActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left memberId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | static async updateLastActive(memberId: number): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
last_active_at: new Date().toISOString(),
updated_at: new Date().toISOString()
};
const predicates = new r... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | debfe80b73d85b9e6f6d5454c89cf385e0749007 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | querySelector | ==================== CSS 选择器查询 ====================
使用 CSS 选择器查询单个元素 | querySelector(selector: string): HTMLElement | null {
const results = this.querySelectorAll(selector);
return results.length > 0 ? results[0] : null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left querySelector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin... | querySelector(selector: string): HTMLElement | null {
const results = this.querySelectorAll(selector);
return results.length > 0 ? results[0] : null;
} | https://github.com/DaLongZhuaZi/manxia | 16026d72b3d8cead83c93fe4dcade6fbe4fefb72 | github |
apap6628114/nga_oh | entry/src/main/ets/common/datasource/BaseLazyDataSource.ets | arkts | unregisterDataChangeListener | 注销数据变更监听器。
@param listener - 监听器实例 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos: number = this.listeners.indexOf(listener)
if (pos >= 0) {
this.listeners.splice(pos, 1)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos: number = this.listeners.indexOf(listener)
if (pos >= 0) {
this.listeners.splice(pos, 1)
}
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/BaseLazyDataSource.ets#L46-L51 | b759a271182ca9d1b76cc7a0791d4460d29cd942 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/registry/matcher.ets | arkts | sequenceMatchLength | 顺序子序列匹配:tokens 中按顺序包含 specTokens 即视为命中,得分等于 specTokens.length | function sequenceMatchLength(modelTokens: string[], specTokens: string[]): number | null {
if (specTokens.length === 0) {
return null
}
let si = 0
for (let i = 0; i < modelTokens.length; i++) {
if (modelTokens[i] === specTokens[si]) {
si++
if (si === specTokens.length) {
return specT... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left sequenceMatchLength AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left modelTokens AST#identifier#Right AST#type_annotation#Left AST#:#Le... | function sequenceMatchLength(modelTokens: string[], specTokens: string[]): number | null {
if (specTokens.length === 0) {
return null
}
let si = 0
for (let i = 0; i < modelTokens.length; i++) {
if (modelTokens[i] === specTokens[si]) {
si++
if (si === specTokens.length) {
return specT... | https://github.com/LongLiveY96/chatcube | 918583e930007f0657f2d1c93be9c560ef133400 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/pages/WishlistPage.ets | arkts | onBackPress | V0.3.9: while the GiftBox modal is up the system Back press
must not pop the page (parent-vs-child intent: animations and
persistence have already committed; we only need to outlast
the celebration). Returning true from onBackPress consumes
the event so the router does not navigate. | onBackPress(): boolean {
if (this.giftBoxVisible) {
return true;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | onBackPress(): boolean {
if (this.giftBoxVisible) {
return true;
}
return false;
} | https://github.com/terryma2024/happyword | e90f27d42e1ade1b25099cbaa1d05967517b7ca2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | ecmaMakeDay | @see ECMA-262, 21.4.1.15
@param year
@param month
@param day
@returns Elapsed number of days since Unix Epoch. | function ecmaMakeDay(year: double, month: double, day: double): long {
let y = trunc(year).toLong();
let m = trunc(month).toLong();
let d = trunc(day).toLong();
return ecmaMakeDay(y, m, d);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaMakeDay AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function ecmaMakeDay(year: double, month: double, day: double): long {
let y = trunc(year).toLong();
let m = trunc(month).toLong();
let d = trunc(day).toLong();
return ecmaMakeDay(y, m, d);
} | https://gitcode.com/iop123123/arkts-static-skills | 724a5f4b4e1da84ccb5f65025673f763880e125e | gitcode |
xblLab/HarmonyProjectTemplate | commons/lib_account/src/main/ets/services/AccountApi.ets | arkts | getThirdPartyInfo | 查询第三方信息共享清单
@returns | public getThirdPartyInfo() {
return ProtocolData.thirdPartyInfo;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getThirdPartyInfo 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#{#Le... | public getThirdPartyInfo() {
return ProtocolData.thirdPartyInfo;
} | https://github.com/xblLab/HarmonyProjectTemplate | 6a6d29fc04f009e94e3f87a955821457209369ca | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | updateDetailAddress | 更新详细地址
@param {string} value - 详细地址
@returns {void} 无返回值 | updateDetailAddress(value: string): void {
this.detailAddress = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateDetailAddress 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#)#L... | updateDetailAddress(value: string): void {
this.detailAddress = value;
} | https://github.com/Joker-x-dev/CoolMallArkTS | e865688773e6a930c0cf5f11bc97e4960b441490 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ThemeService.ets | arkts | getAllThemes | 获取所有主题列表 | getAllThemes(): ThemeInfo[] {
return ALL_THEMES
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllThemes 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 ThemeInfo AST#identifier#Right AST... | getAllThemes(): ThemeInfo[] {
return ALL_THEMES
} | https://github.com/LongLiveY96/chatcube | 5a52404018172559abe49cc9ceefc51cf8d92f6b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.