nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony/update_update_app | feature/ota/src/main/ets/dialog/DialogHelper.ets | arkts | defaultNoTitleDialog | 默认无标题弹框
@param message 内容
@param operator 回调 | function defaultNoTitleDialog(message: string | Resource, operator ?: DialogOperator): void {
showDialog(null, message, $r('app.string.button_know'), operator);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left defaultNoTitleDialog AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left message AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | function defaultNoTitleDialog(message: string | Resource, operator ?: DialogOperator): void {
showDialog(null, message, $r('app.string.button_know'), operator);
} | https://gitee.com/openharmony/update_update_app.git | 03ed61f880dbbfe406650c305cd8b9eefffeb821 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayBlockingQueue.ets | arkts | getEnd | Returns the end element in a ArrayBlockingQueue.
@returns { T | undefined } the end element or undefined when the queue is empty. | public getEnd(): T | undefined {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
if (this.isQueueEmpty) {
return undefined;
}
let tailIdx = this.curTailIdx;
if (this.curTailIdx == 0) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat... | public getEnd(): T | undefined {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
if (this.isQueueEmpty) {
return undefined;
}
let tailIdx = this.curTailIdx;
if (this.curTailIdx == 0) {
... | https://gitcode.com/iop123123/arkts-static-skills | 343bfa7a8a82d66041d812b795362398cccf2ce3 | gitcode |
trueWangSyutung/Sensitive-Word-Blocking-Module-For-OHOS | sensitiveinput/src/main/ets/module/SensitiveWordChecker.ets | arkts | extractFromPosition | 从指定位置开始提取敏感词
@param text 文本
@param startPos 起始位置
@returns 找到的敏感词及类型 | private extractFromPosition(text: string, startPos: number): GeneratedTypeLiteralInterface_3 | null {
let currentNode = this.root;
let matchedWord = '';
for (let i = startPos; i < text.length; i++) {
const char = text[i];
matchedWord += char;
// 如果当前节点没有该字符的子节点,说明不匹配
if (!current... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractFromPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private extractFromPosition(text: string, startPos: number): GeneratedTypeLiteralInterface_3 | null {
let currentNode = this.root;
let matchedWord = '';
for (let i = startPos; i < text.length; i++) {
const char = text[i];
matchedWord += char;
// 如果当前节点没有该字符的子节点,说明不匹配
if (!current... | https://github.com/trueWangSyutung/Sensitive-Word-Blocking-Module-For-OHOS | f5e262a13e5e74c6dccd6869350a63c3db4ae774 | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/database/TransactionDao.ets | arkts | getMonthlyCategoryExpense | 统计某月某分类的总支出金额
@param year 年份
@param month 月份 (1-12)
@param categoryId 分类ID
@returns 总金额 | public async getMonthlyCategoryExpense(year: number, month: number, categoryId: number): Promise<number> {
const startDate: number = new Date(year, month - 1, 1).getTime();
const endDate: number = new Date(year, month, 1).getTime() - 1;
const sql: string = `
SELECT SUM(amount) as total
FROM $... | 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 getMonthlyCategoryExpense AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#... | public async getMonthlyCategoryExpense(year: number, month: number, categoryId: number): Promise<number> {
const startDate: number = new Date(year, month - 1, 1).getTime();
const endDate: number = new Date(year, month, 1).getTime() - 1;
const sql: string = `
SELECT SUM(amount) as total
FROM $... | https://github.com/fuhhhhhhhh/openharmony | 1ebda51b37e1b1f763035ae69d76dd3320a5face | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | getInt8 | === Int8 ===
Read bytes as they represent given type
@param { int } byteOffset zero index to read
@returns { int } return byteOffset's Int8 value
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getInt8(byteOffset: int): int {
return this.getInt8Big(byteOffset)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInt8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier... | public getInt8(byteOffset: int): int {
return this.getInt8Big(byteOffset)
} | https://gitcode.com/iop123123/arkts-static-skills | 42910e5ce425a3453d07a0077bbaa458569d10dc | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setDragDecelerationFrictionCoef | Deceleration friction coefficient in [0 ; 1] interval, higher values
indicate that speed will decrease slowly, for example if it set to 0, it
will stop immediately. 1 is an invalid value, and will be converted to
0.999f automatically.
@param newValue | public setDragDecelerationFrictionCoef(newValue: number) {
if (newValue < 0)
newValue = 0;
if (newValue >= 1)
newValue = 0.999;
this.mDragDecelerationFrictionCoef = newValue;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDragDecelerationFrictionCoef AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left ... | public setDragDecelerationFrictionCoef(newValue: number) {
if (newValue < 0)
newValue = 0;
if (newValue >= 1)
newValue = 0.999;
this.mDragDecelerationFrictionCoef = newValue;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0e6b3a16e2a07c47ab625fcc36fbf18aca19f701 | gitee |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/image/SmallAvatar.ets | arkts | build | 构建小尺寸头像
@returns {void} 无返回值 | build(): void {
Avatar({
src: this.src,
avatarSize: 36,
onTap: this.onTap
});
} | 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
Avatar({
src: this.src,
avatarSize: 36,
onTap: this.onTap
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | 3d6bdcfbb5a061dd6bf1fd7ccadbbe7f2b811645 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/DiskCacheManager.ets | arkts | loadIndex | 加载缓存索引 | private async loadIndex(): Promise<void> {
try {
const indexExists = await fs.access(this.indexFilePath);
if (indexExists) {
const file = await fs.open(this.indexFilePath, fs.OpenMode.READ_ONLY);
const stat = await fs.stat(this.indexFilePath);
const buffer = new ArrayBuffer(sta... | 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 loadIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | private async loadIndex(): Promise<void> {
try {
const indexExists = await fs.access(this.indexFilePath);
if (indexExists) {
const file = await fs.open(this.indexFilePath, fs.OpenMode.READ_ONLY);
const stat = await fs.stat(this.indexFilePath);
const buffer = new ArrayBuffer(sta... | https://github.com/DaLongZhuaZi/manxia | 8faf84400c9ac28fb576d2e6b362a9708c084da8 | github |
hiyuey3/Hixy_MyMemories | entry/src/main/ets/entrybackupability/EntryBackupAbility.ets | arkts | onBackup | 备份数据时触发 | async onBackup() {
hilog.info(DOMAIN, 'testTag', 'onBackup ok');
await Promise.resolve();
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expression_... | async onBackup() {
hilog.info(DOMAIN, 'testTag', 'onBackup ok');
await Promise.resolve();
} | https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets#L14-L17 | 827d587fe40235d0830b3c389a9aa7c53a423b60 | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | setAVPlayerCallback | Subscribes AVPlayer events (seek, error, time, state, volume). | private setAVPlayerCallback(): void {
if (!this.avPlayer) {
return;
}
this.avPlayer.on('seekDone', this.seekCall);
this.avPlayer.on('error', this.errorCall);
this.avPlayer.on('timeUpdate', this.updateTimeCall);
this.avPlayer.on('stateChange', this.stateCall);
this.avPlayer.on('vo... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setAVPlayerCallback 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 setAVPlayerCallback(): void {
if (!this.avPlayer) {
return;
}
this.avPlayer.on('seekDone', this.seekCall);
this.avPlayer.on('error', this.errorCall);
this.avPlayer.on('timeUpdate', this.updateTimeCall);
this.avPlayer.on('stateChange', this.stateCall);
this.avPlayer.on('vo... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 08f1ed1431b8d290097059b60648efa40e961837 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/list/ListDemo5.ets | arkts | <arrow> | 这个是 ForEach() 的第 3 个参数的生成键值的默认逻辑(即不指定第 3 个参数时的默认逻辑)
根据打印的日志理解
点击本例的按钮,在位置 0 处添加一项,会导致所有 item 的键值都发生变化
所以,实际开发时建议用每个 item 的唯一标识做键值 | (item: object, index: number) => {
return index + '__' + JSON.stringify(item);
}) | AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left AST#object#Left object AST#object#Right AST#predefined_type#Rig... | (item: object, index: number) => {
return index + '__' + JSON.stringify(item);
}) | https://github.com/webabcd/HarmonyDemo | ea19ff0d2494c528faa12679511ed8967ac83a55 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | setInt8 | Sets bytes as they represent given type
@param { int } byteOffset zero index to write (big endian)
@param { number } value
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setInt8(byteOffset: int, value: number): void {
this.setInt8Big(byteOffset, value)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setInt8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier... | public setInt8(byteOffset: int, value: number): void {
this.setInt8Big(byteOffset, value)
} | https://gitcode.com/iop123123/arkts-static-skills | bea1e185825e9764afe904bd3f9b7b9f09774251 | gitcode |
openharmony-sig/fluttertpc_flutter_qr_reader | ohos/src/main/ets/me/hetian/flutter_qr_reader/components/viewmodel/CustomScanViewModel.ets | arkts | processScanResult | 处理扫码结果
@param {Array<scanBarcode.ScanResult>} result 扫码结果数据
@returns {void} | processScanResult(scanResult: Array<scanBarcode.ScanResult>): void {
// 关闭相机闪光灯
this.tryCloseFlashLight();
if (scanResult.length > 0) {
// 获取到扫描结果后暂停相机流
setTimeout(() => {
this.stopCustomScan();
}, 10)
// 返回扫码结果
this.scanResultUpdateCb(scanResult[0])
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left processScanResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left scanResult AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AST#iden... | processScanResult(scanResult: Array<scanBarcode.ScanResult>): void {
// 关闭相机闪光灯
this.tryCloseFlashLight();
if (scanResult.length > 0) {
// 获取到扫描结果后暂停相机流
setTimeout(() => {
this.stopCustomScan();
}, 10)
// 返回扫码结果
this.scanResultUpdateCb(scanResult[0])
}
} | https://gitee.com/openharmony-sig/fluttertpc_flutter_qr_reader.git | 5f8bf6e7825c9fa3e22ed18b1d2e006f1a7b1264 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RejectedHandler.ets | arkts | apply | Invokes all registered handlers with the provided rejection reason and object.
Typically used when a promise or task is rejected and listeners should be notified.
@param reason rejection result of an object
@param obj the object itself | public apply(reason: Error, obj: Object): void {
for (const handler of this.handlers) {
handler(reason, obj);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left apply AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reason AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#i... | public apply(reason: Error, obj: Object): void {
for (const handler of this.handlers) {
handler(reason, obj);
}
} | https://gitcode.com/iop123123/arkts-static-skills | 3ffe9ad4f8d5535c646253a83c8e7c7d9bb29d13 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | startsWith | Checks that the substring of this string that starts from
the specified index starts with the specified prefix.
@param prefix prefix string
@param fromIndex index to start from
@throws NullPointerException if prefix param is null
@throws StringIndexOutOfBoundsException if fromIndex param is negative or >= length
@retur... | public startsWith(prefix: String, fromIndex: int): boolean {
if (fromIndex < 0) {
fromIndex = 0;
}
if (fromIndex + prefix.length() > this.length() && !prefix.isEmpty()) {
return false;
}
for (let i: int = 0; i < prefix.length(); i++) {
if (... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startsWith AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Str... | public startsWith(prefix: String, fromIndex: int): boolean {
if (fromIndex < 0) {
fromIndex = 0;
}
if (fromIndex + prefix.length() > this.length() && !prefix.isEmpty()) {
return false;
}
for (let i: int = 0; i < prefix.length(); i++) {
if (... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3b1436f334a7923eb88443d27312d700783e3bf6 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | getLastIndexOf | Gets the index of the last occurrence of the specified element.
@param element The element to locate.
@returns The index of the last occurrence of the element, or -1 if not found. | public getLastIndexOf(element: T): int {
let index: int = this.elementNum - 1;
let currentNode: ListNode<T> | undefined = this.tail;
while (currentNode !== undefined) {
if (currentNode!.element == element) {
return index;
}
currentNode = cu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifi... | public getLastIndexOf(element: T): int {
let index: int = this.elementNum - 1;
let currentNode: ListNode<T> | undefined = this.tail;
while (currentNode !== undefined) {
if (currentNode!.element == element) {
return index;
}
currentNode = cu... | https://gitcode.com/iop123123/arkts-static-skills | 3a75f91ee118511259fff520640c33c0c4a21bb1 | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/CleanerManager.ets | arkts | getScreenshotList | 获取屏幕截图列表 | async getScreenshotList() {
// 获取所有图片/视频
const photoAssets = await this.getAssets() as photoAccessHelper.PhotoAsset[]
// 截图相册目前不对第三方应用开放,可自己通过 filter 过滤出 screenshot 截图开头的图片资源实现
return photoAssets.filter(item => {
try {
if (canIUse('SystemCapability.FileManagement.PhotoAccessHelper.Core')... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getScreenshotList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AS... | async getScreenshotList() {
// 获取所有图片/视频
const photoAssets = await this.getAssets() as photoAccessHelper.PhotoAsset[]
// 截图相册目前不对第三方应用开放,可自己通过 filter 过滤出 screenshot 截图开头的图片资源实现
return photoAssets.filter(item => {
try {
if (canIUse('SystemCapability.FileManagement.PhotoAccessHelper.Core')... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | e78be6dae114351ead7a13d1d358fcc4ec6ffea6 | gitcode |
zmuxuny/ai-guardian-star | entry/src/main/ets/database/DatabaseHelper.ets | arkts | _querySingleUser | 内部:按谓词查单条用户并映射为 UserInfo | private async _querySingleUser(
predicates: relationalStore.RdbPredicates,
): Promise<UserInfo | null> {
let resultSet: relationalStore.ResultSet | undefined;
try {
resultSet = await this.getStore().query(predicates, [
"id",
"username",
"phone",
"password_hash",
... | 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 _querySingleUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#... | private async _querySingleUser(
predicates: relationalStore.RdbPredicates,
): Promise<UserInfo | null> {
let resultSet: relationalStore.ResultSet | undefined;
try {
resultSet = await this.getStore().query(predicates, [
"id",
"username",
"phone",
"password_hash",
... | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L297-L335 | d4ff41ce0c41a356a11107a01662483176f924b7 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PodcastService.ets | arkts | cleanText | 解码并清洗文本(去掉 CDATA 和 HTML 标签) | private cleanText(text: string): string {
if (!text) {
return '';
}
let value = text;
// 去掉 CDATA 包裹(处理各种情况)
value = value.replace(/<!\[CDATA\[/g, '');
value = value.replace(/\]\]>/g, '');
// 去掉简单 HTML 标签
value = value.replace(/<[^>]+>/g, '');
// 解码 HTML 实体
value = this.d... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left cleanText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | private cleanText(text: string): string {
if (!text) {
return '';
}
let value = text;
// 去掉 CDATA 包裹(处理各种情况)
value = value.replace(/<!\[CDATA\[/g, '');
value = value.replace(/\]\]>/g, '');
// 去掉简单 HTML 标签
value = value.replace(/<[^>]+>/g, '');
// 解码 HTML 实体
value = this.d... | https://github.com/pangpang20/antennaPodHM | e513a8eabc3230f9012734f07bc5e85f400baebf | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | length | Returns number of Entries with unique keys in the PlainArray
@returns number of Entries with unique keys in the PlainArray | public get length(): int {
return this.buckets.length.toInt();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left length AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS... | public get length(): int {
return this.buckets.length.toInt();
} | https://gitcode.com/iop123123/arkts-static-skills | 594364482c7728073095c69c33ff500beaca4cb2 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieDataSet.ets | arkts | getValueLinePart2Length | When valuePosition is OutsideSlice, indicates length of second half of the line
@Override | public getValueLinePart2Length(): number {
return this.mValueLinePart2Length;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueLinePart2Length 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 nu... | public getValueLinePart2Length(): number {
return this.mValueLinePart2Length;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 369af76841e8efb22fd0cc7f2b9ba7877db5e4f6 | gitee |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F001_hello_world/entry/src/main/ets/utils/I18nUtil.ets | arkts | switchLanguage | 切换系统语言
@param language 语言代码,如 'zh-CN' 或 'en-US' | static async switchLanguage(language: string): Promise<boolean> {
try {
i18n.System.setAppPreferredLanguage(language);
hilog.info(0x0000, 'I18nUtil', `语言已切换到: ${language}`);
return true;
} catch (err) {
const error = err as BusinessError;
hilog.error(0x0000, 'I18nUtil', `切换语言失败: ... | 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 switchLanguage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left language AST#identifier#Right AST#ERROR#Left AST#:#Left ... | static async switchLanguage(language: string): Promise<boolean> {
try {
i18n.System.setAppPreferredLanguage(language);
hilog.info(0x0000, 'I18nUtil', `语言已切换到: ${language}`);
return true;
} catch (err) {
const error = err as BusinessError;
hilog.error(0x0000, 'I18nUtil', `切换语言失败: ... | https://github.com/mqxu/HarmonyOS_In_Action | 2aed683f9a33062647cd516d7bcc8906d15a69c2 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/StepDao.ets | arkts | getAllStepRecords | 获取所有步数记录 | async getAllStepRecords(): Promise<StepRecord[]> {
const rdbStore = await this.initDatabase();
const records: StepRecord[] = [];
try {
const predicates = new relationalStore.RdbPredicates('step_records');
predicates.orderByDesc('date'); // 按日期降序排列
const resultSet = await rdbStore.query... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllStepRecords AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async getAllStepRecords(): Promise<StepRecord[]> {
const rdbStore = await this.initDatabase();
const records: StepRecord[] = [];
try {
const predicates = new relationalStore.RdbPredicates('step_records');
predicates.orderByDesc('date'); // 按日期降序排列
const resultSet = await rdbStore.query... | https://gitcode.com/openharmony/codelabs | 8c02698b0618dcda453621000bd2e8bffd56819a | gitcode |
richshaw2015/nds | ohos/entry/src/test/LayoutBackupProperty.test.ets | arkts | generateLayoutEntry | Generate a random LayoutEntry with the given target. | function generateLayoutEntry(rng: PRNG, target: string): LayoutEntry {
const entry: LayoutEntry = { target };
// Add random properties to simulate real layout data
const numProps = rng.nextInt(1, 5);
for (let i = 0; i < numProps; i++) {
const key = 'prop_' + rng.nextString(rng.nextInt(3, 8));
const valu... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateLayoutEntry AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rng AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function generateLayoutEntry(rng: PRNG, target: string): LayoutEntry {
const entry: LayoutEntry = { target };
// Add random properties to simulate real layout data
const numProps = rng.nextInt(1, 5);
for (let i = 0; i < numProps; i++) {
const key = 'prop_' + rng.nextString(rng.nextInt(3, 8));
const valu... | https://github.com/richshaw2015/nds | 8d994c89248591cd1527bc41c90e33aff4862094 | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/toast/TnToast.ets | arkts | autoClose | 设置自动关闭定时器
@param params 轻提示参数 | private autoClose(params: TnToastParams): void {
this.clearTimer();
this.timer = setTimeout(() => {
this.hide();
}, params.duration);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left autoClose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left T... | private autoClose(params: TnToastParams): void {
this.clearTimer();
this.timer = setTimeout(() => {
this.hide();
}, params.duration);
} | https://github.com/codelably/tuniao-ui | cd95d256eaee1f66bf87cbbc9e2aab68fee11ad3 | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseView.ets | arkts | toUpdateArkTsView | @final Do not override.
Updates view attributes, styles, and events. | public toUpdateArkTsView(updateStates: UpdateState[]): boolean {
if (!this.viewStatePtr) {
return false;
}
if (this.baseProperty) {
this.baseProperty.updateAttrsAndStyles(this.viewStatePtr, updateStates);
}
this.updateArkUI();
this.onUpdateViewFinished();
return true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toUpdateArkTsView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left updateStates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr... | public toUpdateArkTsView(updateStates: UpdateState[]): boolean {
if (!this.viewStatePtr) {
return false;
}
if (this.baseProperty) {
this.baseProperty.updateAttrsAndStyles(this.viewStatePtr, updateStates);
}
this.updateArkUI();
this.onUpdateViewFinished();
return true;
} | https://github.com/AGenUI/AGenUI | b9c4ccecf0a8fc8651c062764944875feb3b706b | github |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets | arkts | registerWindowSizeChange | ========== 私有方法 ========== | private registerWindowSizeChange(): void {
if (this.isListening || !this.mainWindow) {
return
}
try {
this.mainWindow.on('windowSizeChange', (data: window.Size) => {
if (!this.mainWindow) {
return
}
const properties = this.mainWindow.getWindowProperties()
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerWindowSizeChange 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 ... | private registerWindowSizeChange(): void {
if (this.isListening || !this.mainWindow) {
return
}
try {
this.mainWindow.on('windowSizeChange', (data: window.Size) => {
if (!this.mainWindow) {
return
}
const properties = this.mainWindow.getWindowProperties()
... | https://github.com/Xiwei753/xiezuoruanjian | e4d6669a3eb3de200661f8b028ff9e981b24ca19 | github |
openharmony/arkui_advanced_ui_component | customappbar/source/custom_app_bar.ets | arkts | onDidBuild | 触发构建回调
在ets无法实现,需要在编译后的js中加入对应的实现方法 | static onDidBuild(): void {
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left onDidBuild AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static onDidBuild(): void {
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | c52c9f5b439312db9de01802824c8962b8f3d99c | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | setUTCMilliseconds | Sets the milliseconds for a specified date according to universal time.
@param value new ms | public setUTCMilliseconds(value: short): void {
let ms = ecmaMsFromTime(this.ms);
this.ms -= ms;
this.ms += value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCMilliseconds 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#L... | public setUTCMilliseconds(value: short): void {
let ms = ecmaMsFromTime(this.ms);
this.ms -= ms;
this.ms += value;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cc40167449a343935fb8e9fed3a9aac3cb996897 | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/StatisticsService.ets | arkts | calculateAccuracy | 计算正确率
@param correctCount 正确数量
@param totalCount 总数量
@returns 正确率百分比 | static calculateAccuracy(correctCount: number, totalCount: number): number {
if (totalCount === 0) return 0;
return Math.round((correctCount / totalCount) * 100);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateAccuracy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left correctCount AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | static calculateAccuracy(correctCount: number, totalCount: number): number {
if (totalCount === 0) return 0;
return Math.round((correctCount / totalCount) * 100);
} | https://github.com/the-wwyang/kids-learning-app | 095009c24d65211fa9ebe0c29598c8ae88011939 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/pages/start/step_a.ets | arkts | closeDsaOverlay | DSD弹窗关闭动画 // | closeDsaOverlay(): void {
this.showDsaOverlay = false
setTimeout(() => { this.showDsaInfo = false }, 310) // 等待动画完成再销毁
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closeDsaOverlay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl... | closeDsaOverlay(): void {
this.showDsaOverlay = false
setTimeout(() => { this.showDsaInfo = false }, 310) // 等待动画完成再销毁
} | https://github.com/Nekofox-POT/LinMusic | 9bfe2129ef73c6838c4cf4b5ab0c09b526c37e59 | github |
CLMC2025/Vignette | entry/src/main/ets/sync/WebDavSyncManager.ets | arkts | safeYield | 安全的 yield 函数,处理 setTimeout 不可用的情况 | async function safeYield(): Promise<void> {
try {
await new Promise<void>((resolve) => setTimeout(resolve, 0));
} catch (e) {
// setTimeout 在某些环境中不可用,直接返回
console.warn('[WebDavSyncManager] setTimeout unavailable during yield');
}
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left safeYield AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef... | async function safeYield(): Promise<void> {
try {
await new Promise<void>((resolve) => setTimeout(resolve, 0));
} catch (e) {
// setTimeout 在某些环境中不可用,直接返回
console.warn('[WebDavSyncManager] setTimeout unavailable during yield');
}
} | https://github.com/CLMC2025/Vignette | c15c6da2135a56311c1e1316500bd908c84296aa | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | cosh | Return a new Decimal whose value is the hyperbolic cosine of `n`, rounded to precision
significant digits using rounding mode `rounding`.
@param { Value } n {double | string | Decimal} A value in radians.
@returns { Decimal } the Decimal type | static cosh(n: Value): Decimal {
return new Decimal(n).cosh();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left cosh AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | static cosh(n: Value): Decimal {
return new Decimal(n).cosh();
} | https://gitcode.com/iop123123/arkts-static-skills | 305889d5285760dd95afae77f3f5c36dd947d001 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets | arkts | sendTaskCompletionNotification | 发送任务完成通知 | private async sendTaskCompletionNotification(task: InternalTask): Promise<void> {
if (!task.options?.notification) {
return;
}
switch (task.options.notification.scene) {
case TaskNotificationScene.PDF_IMPORT:
logger.info(TAG, `发送 PDF 导入完成通知:id=${task.id},目标=${task.options.notification... | 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 sendTaskCompletionNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Ri... | private async sendTaskCompletionNotification(task: InternalTask): Promise<void> {
if (!task.options?.notification) {
return;
}
switch (task.options.notification.scene) {
case TaskNotificationScene.PDF_IMPORT:
logger.info(TAG, `发送 PDF 导入完成通知:id=${task.id},目标=${task.options.notification... | https://github.com/DaLongZhuaZi/manxia | 808fed5c075d3324dc626704fa5df0512c46b29f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | pemToDer | 将 PEM 格式证书转换为 DER | static pemToDer(pem: string): Uint8Array {
// 移除 PEM 头尾和所有空白字符
const lines = pem.split('\n');
let base64 = '';
for (const line of lines) {
const trimmed = line.trim();
if (trimmed.length === 0) continue;
if (trimmed.startsWith('-----BEGIN')) continue;
if (trimmed.startsWit... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left pemToDer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | static pemToDer(pem: string): Uint8Array {
// 移除 PEM 头尾和所有空白字符
const lines = pem.split('\n');
let base64 = '';
for (const line of lines) {
const trimmed = line.trim();
if (trimmed.length === 0) continue;
if (trimmed.startsWith('-----BEGIN')) continue;
if (trimmed.startsWit... | https://github.com/AlkaidLab/moonlight-harmony | 6c914a89da4feafb295dc322de4ed37f26d2ee17 | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V21.ets | arkts | handleType | ptypeval = knowntype / "X-" word | protected handleType(propertyData: VCardProperty, ptypeval: string): void {
if (!(this.getKnownTypeSet().has(ptypeval.toUpperCase())
|| ptypeval.startsWith("X-"))
&& !this.mUnknownTypeSet.has(ptypeval)) {
this.mUnknownTypeSet.add(ptypeval);
Log.w(this.LOG_TAG,... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left propertyData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | protected handleType(propertyData: VCardProperty, ptypeval: string): void {
if (!(this.getKnownTypeSet().has(ptypeval.toUpperCase())
|| ptypeval.startsWith("X-"))
&& !this.mUnknownTypeSet.has(ptypeval)) {
this.mUnknownTypeSet.add(ptypeval);
Log.w(this.LOG_TAG,... | https://gitee.com/openharmony-tpc/VCard.git | f404ed208b2f54a7ef5daa385602822eb18729b4 | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets | arkts | getFirst | Get whether the music is played for the first.
@returns isFirst | public getFirst() {
return this.isFirst;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFirst AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#... | public getFirst() {
return this.isFirst;
} | https://gitee.com/harmonyos/codelabs.git | 8e094e6e5a8024e3559c23327b733180e60c5d86 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | constructor | Private constructor for CharType
@param {RuntimeTypeDescriptor} td Type descriptor
@param {boolean} isValue Whether this is a value type
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private constructor(td: RuntimeTypeDescriptor, isValue: boolean) {
super(td, getBootRuntimeLinker())
this.isValue = isValue
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#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 td AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Run... | private constructor(td: RuntimeTypeDescriptor, isValue: boolean) {
super(td, getBootRuntimeLinker())
this.isValue = isValue
} | https://gitcode.com/iop123123/arkts-static-skills | 6c7b290ff7098f1c5596943b2d7b6a864223f98f | gitcode |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/call/common/CallStore.ets | arkts | updateParticipant | 更新参与者信息 | updateParticipant(info: CallParticipantInfo): void {
const index = this.allParticipants.findIndex(p => p.id === info.id);
if (index >= 0) {
this.allParticipants[index] = info;
} else {
this.allParticipants.push(info);
}
// 触发数组变更
this.allParticipants = [...this.allParticipants];
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateParticipant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CallParticipantInfo AST#identifier#Rig... | updateParticipant(info: CallParticipantInfo): void {
const index = this.allParticipants.findIndex(p => p.id === info.id);
if (index >= 0) {
this.allParticipants[index] = info;
} else {
this.allParticipants.push(info);
}
// 触发数组变更
this.allParticipants = [...this.allParticipants];
... | https://github.com/Tencent-RTC/TUIKit_Harmony | 956d11c2e8387c9296dccd04e83ad7097a9961a9 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | notifyListChanged | 通知电脑列表变化 | private notifyListChanged(): void {
if (this.onComputerListChanged) {
this.onComputerListChanged();
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyListChanged 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#e... | private notifyListChanged(): void {
if (this.onComputerListChanged) {
this.onComputerListChanged();
}
} | https://github.com/AlkaidLab/moonlight-harmony | 1ade74af4616c5c1ee47d508cd93bb89c9c43b16 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | destroy | 销毁数据服务 | public destroy(): void {
// 清理测试数据
if (this.testCache) {
this.testCache.clear();
}
if (this.testRecords) {
this.testRecords.clear();
}
this.dataManager.destroy();
DataService.instance = null;
logger.info(TAG, '数据服务已销毁');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroy 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 ... | public destroy(): void {
// 清理测试数据
if (this.testCache) {
this.testCache.clear();
}
if (this.testRecords) {
this.testRecords.clear();
}
this.dataManager.destroy();
DataService.instance = null;
logger.info(TAG, '数据服务已销毁');
} | https://github.com/DaLongZhuaZi/manxia | 3cf64435d44470035379d9cc5473a18cd3bcd676 | github |
bhengubv/aether-protocol | arkts/src/main/ets/incentive/MeshTipService.ets | arkts | sendTip | Builds, signs, and routes a TipPacket(24) addressed to `recipientUhid`.
`amount` is the caller's input verbatim (the invariant decimal string) — the
protocol imposes NO policy on it. It is signed into the payload and carried
as-is. Returns the signed MeshPacket that was routed onto the mesh. | async sendTip(
recipientUhid: string,
amount: string,
trafficType: string,
referenceId: string | null,
timestampUnixMs: bigint
): Promise<MeshPacket> {
const init = new TipPacketPayloadInit();
init.tipperUhid = this.sender.localUhid;
init.recipientUhid = recipientUhid;
init.amoun... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendTip AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left recipientUhid AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async sendTip(
recipientUhid: string,
amount: string,
trafficType: string,
referenceId: string | null,
timestampUnixMs: bigint
): Promise<MeshPacket> {
const init = new TipPacketPayloadInit();
init.tipperUhid = this.sender.localUhid;
init.recipientUhid = recipientUhid;
init.amoun... | https://github.com/bhengubv/aether-protocol | 0eecea4e23201b020fa875c8cfbf113a76ccf8f1 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets | arkts | showSpecModal | 显示规格选择弹窗
@returns {void} 无返回值 | showSpecModal(): void {
this.showSpecSelectModal = true;
// 显示弹窗时加载规格数据
this.loadGoodsSpecs();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showSpecModal 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... | showSpecModal(): void {
this.showSpecSelectModal = true;
// 显示弹窗时加载规格数据
this.loadGoodsSpecs();
} | https://github.com/Joker-x-dev/CoolMallArkTS | d67a0d83ff5a0733b53022c512a501146e005ecb | github |
openharmony/codelabs | GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets | arkts | checkOffsetXY | Check whether the offset exceeds the area. | private checkOffsetXY() {
this.offsetXLeft = this.offsetXLeft < this.blackAreaWidth ? this.blackAreaWidth : this.offsetXLeft;
this.offsetXRight = this.offsetXRight > this.screenWidth - this.blackAreaWidth ?
this.screenWidth - this.blackAreaWidth : this.offsetXRight;
this.offsetYTop = this.offsetYTop... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkOffsetXY 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#{#Lef... | private checkOffsetXY() {
this.offsetXLeft = this.offsetXLeft < this.blackAreaWidth ? this.blackAreaWidth : this.offsetXLeft;
this.offsetXRight = this.offsetXRight > this.screenWidth - this.blackAreaWidth ?
this.screenWidth - this.blackAreaWidth : this.offsetXRight;
this.offsetYTop = this.offsetYTop... | https://gitee.com/openharmony/codelabs.git | f38e27b9e78d9132499c1bce19e22356f5203587 | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/utils/WebUploadServer.ets | arkts | intToIp | 将整数 IP 转换为点分十进制格式
wifiManager.getIpInfo() 返回大端序(网络字节序)整数 | private intToIp(ipInt: number): string {
return `${(ipInt >> 24) & 0xff}.${(ipInt >> 16) & 0xff}.${(ipInt >> 8) & 0xff}.${ipInt & 0xff}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left intToIp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ipInt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | private intToIp(ipInt: number): string {
return `${(ipInt >> 24) & 0xff}.${(ipInt >> 16) & 0xff}.${(ipInt >> 8) & 0xff}.${ipInt & 0xff}`;
} | https://github.com/richshaw2015/nds | df5e75baf1208a360ced0f9b031fe0bf82b27234 | github |
openharmony/applications_mms | entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets | arkts | showAutoRetrieveMmsDialog | Displaying the 'Automatic Download MMS' dialog | showAutoRetrieveMmsDialog() {
// this.$element('auto-retrieve-mms-dialog').show();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showAutoRetrieveMmsDialog 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#statemen... | showAutoRetrieveMmsDialog() {
// this.$element('auto-retrieve-mms-dialog').show();
} | https://gitee.com/openharmony/applications_mms.git | e83ac48c58f45bdfbf5f33b88a7d45e5b7d7df9e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets | arkts | setEnabled | 设置启用状态 | public async setEnabled(enabled: boolean): Promise<void> {
this.settings.enabled = enabled;
await this.saveSettings();
logger.info(TAG, `阅读数据收集已${enabled ? '启用' : '禁用'}`);
} | 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 setEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST... | public async setEnabled(enabled: boolean): Promise<void> {
this.settings.enabled = enabled;
await this.saveSettings();
logger.info(TAG, `阅读数据收集已${enabled ? '启用' : '禁用'}`);
} | https://github.com/DaLongZhuaZi/manxia | 8556b6aa097b9376698c0b92dc17100e74aeca87 | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/pages/Index.ets | arkts | parseEnvironmentData | 解析温湿度数据 | parseEnvironmentData(dataStr: string) {
try {
// 使用正则表达式解析JSON字符串,避免any类型
const tempMatch = dataStr.match(/"temperature"\s*:\s*([\d.]+)/);
const humidityMatch = dataStr.match(/"humidity"\s*:\s*([\d.]+)/);
if (tempMatch && humidityMatch) {
const temperature = parseFloat(tempMatch[1... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left parseEnvironmentData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dataStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig... | parseEnvironmentData(dataStr: string) {
try {
// 使用正则表达式解析JSON字符串,避免any类型
const tempMatch = dataStr.match(/"temperature"\s*:\s*([\d.]+)/);
const humidityMatch = dataStr.match(/"humidity"\s*:\s*([\d.]+)/);
if (tempMatch && humidityMatch) {
const temperature = parseFloat(tempMatch[1... | https://github.com/chendi126/harmonyOS-TCP | 7e1a73b8dbc02b612b2c1f8502ff805d685d5595 | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/pages/LauncherPage.ets | arkts | getDataPreferences | 获取数据首选项 | getDataPreferences(): Promise<preferences.Preferences> {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
return preferences.getPreferences(context, CommonConstants.PREFERENCES_FILE_NAME);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDataPreferences 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#id... | getDataPreferences(): Promise<preferences.Preferences> {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
return preferences.getPreferences(context, CommonConstants.PREFERENCES_FILE_NAME);
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 6a73a5f1c29d04c9ec1a3ca4c80869ed786313a0 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Reader.ets | arkts | decrementRecursionDepth | 减少递归深度 | decrementRecursionDepth(): void {
this.recursionDepth--
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decrementRecursionDepth 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#stat... | decrementRecursionDepth(): void {
this.recursionDepth--
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 345e8997afe66c4c4dd77b369419330feb79281c | gitcode |
Yebingiscn/SweetVideo | entry/src/main/ets/database/Preferences.ets | arkts | getVideoMetaDataEncryption | 隐私空间视频数据 | static getVideoMetaDataEncryption(context: Context) {
return PreferencesUtil.getPreferencesValue(context, DATA_BASE_NAME, 'video_meta_data_encryption',
[]) as VideoMetadata[]
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getVideoMetaDataEncryption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | static getVideoMetaDataEncryption(context: Context) {
return PreferencesUtil.getPreferencesValue(context, DATA_BASE_NAME, 'video_meta_data_encryption',
[]) as VideoMetadata[]
} | https://github.com/Yebingiscn/SweetVideo | 25cac29c1bd851d517f606bb2a7460a8d4e052d5 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/service/ReimburseService.ets | arkts | getReimburseDetail | 获取报销详情 | getReimburseDetail(id: string): Promise<ReimburseInfo> {
return new Promise((resolve) => {
setTimeout(() => {
resolve({
id: id,
title: '报销详情',
amount: 5680.00,
applicant: '张三',
status: 'PENDING',
createTime: '2024-04-28',
updateTi... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getReimburseDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | getReimburseDetail(id: string): Promise<ReimburseInfo> {
return new Promise((resolve) => {
setTimeout(() => {
resolve({
id: id,
title: '报销详情',
amount: 5680.00,
applicant: '张三',
status: 'PENDING',
createTime: '2024-04-28',
updateTi... | https://github.com/David8Idira/AI-OA | aa99e3017e2e21735179ef57921097a82e963a3f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | searchAll | 搜索书籍(多个书源并行,限制并发数)
@param keyword 搜索关键词
@param page 页码
@param maxConcurrent 最大并发书源数,默认10 | async searchAll(keyword: string, page: number = 1, maxConcurrent: number = 10): Promise<NovelSearchResult[]> {
const enabledSources = this.getEnabledSources().filter(s => s.searchable);
const allResults: NovelSearchResult[] = [];
// 限制搜索的书源数量,避免同时搜索太多导致主线程阻塞
const sourcesToSearch = enabledSources... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async searchAll(keyword: string, page: number = 1, maxConcurrent: number = 10): Promise<NovelSearchResult[]> {
const enabledSources = this.getEnabledSources().filter(s => s.searchable);
const allResults: NovelSearchResult[] = [];
// 限制搜索的书源数量,避免同时搜索太多导致主线程阻塞
const sourcesToSearch = enabledSources... | https://github.com/DaLongZhuaZi/manxia | 58775a9ca0eda1249bd7c9728af71e9fa50d563c | github |
SJTUjinmao/PanGuFixer | arkts-auto-fix/repos/Homogram/features/home/src/main/ets/pages/Chat/ChatDetail.ets | arkts | build | @Builder
NavigationTitle() {
Row() {
Text(this.currentChatUserName)
.fontColor($r('sys.color.font_primary'))
.fontSize(HomeConstants.NAV_TITLE_FONT_SIZE_LARGE)
.lineHeight(41)
.fontWeight(700)
.gesture(GestureGroup(GestureMode.Exclusive,
TapGesture({ count: 2 })
.onAction(() => {
console.info('TapGesture 2');
let scrol... | build() {
NavDestination() {
Stack({ alignContent: Alignment.Bottom }) {
// Row() {
// ChatDetailTopSearch({
// currentChatUserName: this.currentChatUserName,
// })
// }
// .height(Adaptive.ContactItemHeight(this.currentBreakpoint))
// .expand... | 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() {
NavDestination() {
Stack({ alignContent: Alignment.Bottom }) {
// Row() {
// ChatDetailTopSearch({
// currentChatUserName: this.currentChatUserName,
// })
// }
// .height(Adaptive.ContactItemHeight(this.currentBreakpoint))
// .expand... | https://github.com/SJTUjinmao/PanGuFixer | 2e0a42c3e493d611ce8668062d9b6d214988af9f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/components/charts/base/BaseChart.ets | arkts | resetInteraction | 重置交互状态 | public resetInteraction(): void {
this.interaction = {
zoom: 1,
panX: 0,
panY: 0,
isInteracting: false
};
this.refresh();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetInteraction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expre... | public resetInteraction(): void {
this.interaction = {
zoom: 1,
panX: 0,
panY: 0,
isInteracting: false
};
this.refresh();
} | https://github.com/LJ666-ui/harmony-health-care | 20a0ebee6ee1134fef9670a59916d6767581da8f | github |
HarmonyOS_Samples/BestPracticeSnippets | DealStrideSolution/entry/src/main/ets/utils/CameraServiceOne.ets | arkts | createCameraInputFn | Create the cameraInput output object | createCameraInputFn(cameraManager: camera.CameraManager,
cameraDevice: camera.CameraDevice): camera.CameraInput | undefined {
Logger.info(TAG, 'createCameraInputFn is called.');
let cameraInput: camera.CameraInput | undefined = undefined;
try {
cameraInput = cameraManager.createCameraInput(camer... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createCameraInputFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#ERR... | createCameraInputFn(cameraManager: camera.CameraManager,
cameraDevice: camera.CameraDevice): camera.CameraInput | undefined {
Logger.info(TAG, 'createCameraInputFn is called.');
let cameraInput: camera.CameraInput | undefined = undefined;
try {
cameraInput = cameraManager.createCameraInput(camer... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 4e17093f36d31f04c90dc48429756cd13a09d996 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamLifecycleManager.ets | arkts | setEnableBackgroundTask | 设置是否启用后台保活
关闭后台保活时,从后台恢复会走重连路径而非 Flush+IDR | setEnableBackgroundTask(enabled: boolean): void {
this.enableBackgroundTask = enabled;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setEnableBackgroundTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right ... | setEnableBackgroundTask(enabled: boolean): void {
this.enableBackgroundTask = enabled;
} | https://github.com/AlkaidLab/moonlight-harmony | 6c9265bd16c3c99b335ce4c4b2a60bd7416bfd5b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets | arkts | calculatePriority | 计算优先级 | private calculatePriority(readingSpeed: string, forwardRatio: number): number {
let priority = 5;
if (readingSpeed === 'fast') {
priority += 2;
} else if (readingSpeed === 'slow') {
priority -= 1;
}
if (forwardRatio > 0.8) {
priority += 1;
}
if (this.isWiFi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculatePriority AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left readingSpeed AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ... | private calculatePriority(readingSpeed: string, forwardRatio: number): number {
let priority = 5;
if (readingSpeed === 'fast') {
priority += 2;
} else if (readingSpeed === 'slow') {
priority -= 1;
}
if (forwardRatio > 0.8) {
priority += 1;
}
if (this.isWiFi... | https://github.com/DaLongZhuaZi/manxia | 66a2d091a200396cde70bea40840ccf9771eaad5 | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/allowError.ets | arkts | fn2 | Incorrect because Wrapper.sub is not readonly | function fn2(arg: Wrapper) {} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fn2 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#typ... | function fn2(arg: Wrapper) {} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | e826e6ad86f397a23b66bce1e8fd93a42529630a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | createLongFromJSONValue | Creates a Long instance based on JSONValue
@param { Long } this JSONValue - a JSON representation
@param { JSONValue } json
@returns { Long } - true if JSON encodes true literal, false if JSON encodes false literal
@throws { JSONTypeError } if json does not encode a valid boolean literal | function createLongFromJSONValue(json: JSONValue): Long {
if (json instanceof JSONNumber) {
let num = (json as JSONNumber).value
let value = (json as JSONNumber).bigintValue
if (Double.isInteger(num) && Long.MIN_VALUE <= value && value <= Long.MAX_VALUE) {
return value.getLong()
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createLongFromJSONValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left json AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | function createLongFromJSONValue(json: JSONValue): Long {
if (json instanceof JSONNumber) {
let num = (json as JSONNumber).value
let value = (json as JSONNumber).bigintValue
if (Double.isInteger(num) && Long.MIN_VALUE <= value && value <= Long.MAX_VALUE) {
return value.getLong()
... | https://gitcode.com/iop123123/arkts-static-skills | 6ea565ab8f0c411962f0fc5f2a4b29b6099a1df9 | gitcode |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/loading/TnLoading.ets | arkts | build | 构建加载组件 | build() {
Column({ space: this.baseStyle.spaceXs }) {
this.LoadingIcon();
if (this.text.length > 0) {
Text(this.text)
.fontSize(this.getResolvedTextSize())
.fontColor(this.getResolvedTextColor())
.lineHeight(this.baseStyle.lineHeightXsm);
}
}
.visib... | 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({ space: this.baseStyle.spaceXs }) {
this.LoadingIcon();
if (this.text.length > 0) {
Text(this.text)
.fontSize(this.getResolvedTextSize())
.fontColor(this.getResolvedTextColor())
.lineHeight(this.baseStyle.lineHeightXsm);
}
}
.visib... | https://github.com/codelably/tuniao-ui | 708e13f1d02117d9a1c20b4e5be9a4f6292aa659 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateConstants.ets | arkts | getTemplateById | 根据ID获取预置模板 | static getTemplateById(id: string): IPresetTemplate | undefined {
return TemplateConstants.getAllTemplates().find(t => t.id === id);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTemplateById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static getTemplateById(id: string): IPresetTemplate | undefined {
return TemplateConstants.getAllTemplates().find(t => t.id === id);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateConstants.ets#L583-L585 | f8bea016562eb58c4c6094424db939983c14240c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | parseArchiveStructure | ==================== 增强的压缩包结构解析 ====================
解析压缩包结构(用于漫画导入)
支持检测多层嵌套、多章节结构
@param archivePath 压缩包路径
@returns 解析后的结构信息 | public async parseArchiveStructure(
archivePath: string,
options?: Partial<ExtractionOptions>
): Promise<ParsedArchiveStructure> {
const tempDirectories: string[] = [];
const warnings: string[] = [];
const detectedChapters: DetectedChapterInfo[] = [];
let hasComicInfo = false;
let comicI... | 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 parseArchiveStructure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left archivePath AST#identifier#Right AST#ERROR#Left A... | public async parseArchiveStructure(
archivePath: string,
options?: Partial<ExtractionOptions>
): Promise<ParsedArchiveStructure> {
const tempDirectories: string[] = [];
const warnings: string[] = [];
const detectedChapters: DetectedChapterInfo[] = [];
let hasComicInfo = false;
let comicI... | https://github.com/DaLongZhuaZi/manxia | 817a540f8581cf5519e57bf3078e60f530df993e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | saveBookMetadata | 保存书籍元数据 | async saveBookMetadata(bookId: string, bookName: string, author: string, coverUrl: string): Promise<void> {
try {
// 确保缓存目录已初始化
await this.ensureInitialized();
const bookDir = this.getBookCacheDir(bookId);
await this.sandboxManager.createDirectory(bookDir);
const metada... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveBookMetadata AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async saveBookMetadata(bookId: string, bookName: string, author: string, coverUrl: string): Promise<void> {
try {
// 确保缓存目录已初始化
await this.ensureInitialized();
const bookDir = this.getBookCacheDir(bookId);
await this.sandboxManager.createDirectory(bookDir);
const metada... | https://github.com/DaLongZhuaZi/manxia | a45ecc6b01839f3b19d3f00e63b6940b903f6fee | github |
openharmony-sig/applications_filemanager | entry/src/main/ets/pages/USBShowList.ets | arkts | mkdir | 添加文件夹 | mkdir(name) {
let uri = (this.vol['path'] ?this.vol['path']:this.vol['uri'])+'/'+name
usbModel.mkdir(uri,(status)=>{
if(status){
this.getDataList()
}
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left mkdir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left name AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_st... | mkdir(name) {
let uri = (this.vol['path'] ?this.vol['path']:this.vol['uri'])+'/'+name
usbModel.mkdir(uri,(status)=>{
if(status){
this.getDataList()
}
})
} | https://gitee.com/openharmony-sig/applications_filemanager.git | 1a5ca828f6591ba20a3f2fe916c305d4874c95cd | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSourceExecutor.ets | arkts | getAvailableSources | 获取所有可用的 Suwayomi 扩展源 | public async getAvailableSources(): Promise<SuwayomiExtensionSource[]> {
try {
const sources = await this.suwayomiSource.getSources();
// 缓存所有源的NSFW状态
for (const s of sources) {
this.sourceNsfwMap.set(s.id, s.isNsfw);
}
return sources.map((s): SuwayomiExtensionSource => {
... | 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 getAvailableSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | public async getAvailableSources(): Promise<SuwayomiExtensionSource[]> {
try {
const sources = await this.suwayomiSource.getSources();
// 缓存所有源的NSFW状态
for (const s of sources) {
this.sourceNsfwMap.set(s.id, s.isNsfw);
}
return sources.map((s): SuwayomiExtensionSource => {
... | https://github.com/DaLongZhuaZi/manxia | a40d516283913776e6425a3459187f23da1edf23 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets | arkts | ensureCacheCapacity | 确保缓存容量 | private ensureCacheCapacity(newItemSize: number): void {
// 检查项目数量限制
const currentItemCount = this.cacheItems.keys().length;
if (currentItemCount >= this.maxCacheItems) {
this.evictLeastRecentlyUsed(1);
}
// 检查大小限制
while (this.currentCacheSize + newItemSize > this.maxCacheSize) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureCacheCapacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newItemSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number... | private ensureCacheCapacity(newItemSize: number): void {
// 检查项目数量限制
const currentItemCount = this.cacheItems.keys().length;
if (currentItemCount >= this.maxCacheItems) {
this.evictLeastRecentlyUsed(1);
}
// 检查大小限制
while (this.currentCacheSize + newItemSize > this.maxCacheSize) {
... | https://github.com/DaLongZhuaZi/manxia | b920dbf709678b0d24f700714034e657fabbd455 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateFactory.ets | arkts | cloneEntry | 克隆条目
@param source 源条目
@param parentGroup 目标分组
@param options 克隆选项
@returns 克隆的条目 | cloneEntry(
source: KdbxEntry,
parentGroup: KdbxGroup,
options?: CloneOptions
): KdbxEntry {
const opts: CloneOptions = {
newUuid: options?.newUuid ?? true,
resetTimeInfo: options?.resetTimeInfo ?? true,
copyHistory: options?.copyHistory ?? false,
renameTitle: options?.rename... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cloneEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left KdbxEntry AST#identifier#Right AST#,#Left ,... | cloneEntry(
source: KdbxEntry,
parentGroup: KdbxGroup,
options?: CloneOptions
): KdbxEntry {
const opts: CloneOptions = {
newUuid: options?.newUuid ?? true,
resetTimeInfo: options?.resetTimeInfo ?? true,
copyHistory: options?.copyHistory ?? false,
renameTitle: options?.rename... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateFactory.ets#L204-L231 | 2618ec8aa5c2ef71e6e3cef7ed2ae62c9181bd29 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/utils/TimeUtils.ets | arkts | formatSmartDate | 格式化时间为智能日期标签 | static formatSmartDate(time: Date | null): string {
if (time === null) {
return '';
}
const now: Date = new Date();
const today: Date = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const date: Date = new Date(time.getFullYear(), time.getMonth(), time.getDate());
const toda... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatSmartDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressio... | static formatSmartDate(time: Date | null): string {
if (time === null) {
return '';
}
const now: Date = new Date();
const today: Date = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const date: Date = new Date(time.getFullYear(), time.getMonth(), time.getDate());
const toda... | https://github.com/Amaz1ny/HarmonyDO-public | fa4da3ca27f3f08eb81bf746d08cb7d348c2648a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/UIContextManager.ets | arkts | getSafeAreaInsets | 获取安全区域信息 | public getSafeAreaInsets(): SafeAreaInsets | null {
if (!this.uiContext) {
logger.warn(TAG, 'UI上下文未设置,无法获取安全区域信息');
return null;
}
try {
// 注意:实际的安全区域获取可能需要根据HarmonyOS的具体API调整
logger.debug(TAG, '获取安全区域信息');
const safeAreaInsets: SafeAreaInsets = { top: 0, bottom: 0, left: 0,... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSafeAreaInsets 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 getSafeAreaInsets(): SafeAreaInsets | null {
if (!this.uiContext) {
logger.warn(TAG, 'UI上下文未设置,无法获取安全区域信息');
return null;
}
try {
// 注意:实际的安全区域获取可能需要根据HarmonyOS的具体API调整
logger.debug(TAG, '获取安全区域信息');
const safeAreaInsets: SafeAreaInsets = { top: 0, bottom: 0, left: 0,... | https://github.com/DaLongZhuaZi/manxia | 83e12ccfe3c13a3e1edf82757fa62d81c08d58c6 | github |
openharmony/codelabs | ETSUI/LifeBalance/entry/src/main/ets/common/database/DietRecordDao.ets | arkts | insertRecord | 1. 插入一条记录 | async insertRecord(record: DietRecord): Promise<boolean> {
const store = RdbManager.getInstance().getRdbStore();
if (!store) {
return false;
}
const valueBucket: relationalStore.ValuesBucket = {
'id': record.id,
'foodId': record.foodId,
'foodName': record.foodName,
'meal... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left insertRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left record AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async insertRecord(record: DietRecord): Promise<boolean> {
const store = RdbManager.getInstance().getRdbStore();
if (!store) {
return false;
}
const valueBucket: relationalStore.ValuesBucket = {
'id': record.id,
'foodId': record.foodId,
'foodName': record.foodName,
'meal... | https://gitcode.com/openharmony/codelabs | 95ae491a77740f78cc7417d386b0aef393485f0c | gitcode |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/alerts/AlertsObserver.ets | arkts | setIsAlertTimerBeingCreated | 设置 创建线程方法屏蔽标志位,防止两次过近的调用创建多个定时器 | public setIsAlertTimerBeingCreated(isAlertTimerBeingCreated: boolean) {
this.isAlertTimerBeingCreated = isAlertTimerBeingCreated;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setIsAlertTimerBeingCreated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isAlertTimerBeingCreated AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | public setIsAlertTimerBeingCreated(isAlertTimerBeingCreated: boolean) {
this.isAlertTimerBeingCreated = isAlertTimerBeingCreated;
} | https://gitee.com/openharmony/applications_calendar_data.git | 78e72f01299959ea156ffb9f77d691c73cb020d2 | gitee |
openharmony-sig/ohos_axios | entry/src/main/ets/pages/Index.ets | arkts | put | put请求 | put() {
this.clear()
this.showUrl = this.putUrl;
this.startTime = new Date().getTime();
axios.put<string, AxiosResponse<string>, IdModel>(this.putUrl, { id: 590 }, {
connectTimeout: this.connectTimeout,
readTimeout: this.readTimeout,
maxBodyLength: this.maxBodyLength,
maxConte... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#cal... | put() {
this.clear()
this.showUrl = this.putUrl;
this.startTime = new Date().getTime();
axios.put<string, AxiosResponse<string>, IdModel>(this.putUrl, { id: 590 }, {
connectTimeout: this.connectTimeout,
readTimeout: this.readTimeout,
maxBodyLength: this.maxBodyLength,
maxConte... | https://gitee.com/openharmony-sig/ohos_axios.git | c23c9c635746b35416e9946d348f0cdc4c6a4ab1 | gitee |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | inflateRect | 计算增加边距后的矩形 | public inflateRect(rect: Rect): EdgeInsets {
return new EdgeInsets(
rect.left - this.left,
rect.top - this.top,
rect.right + this.right,
rect.bottom + this.bottom,
);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left inflateRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rect AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Rect... | public inflateRect(rect: Rect): EdgeInsets {
return new EdgeInsets(
rect.left - this.left,
rect.top - this.top,
rect.right + this.right,
rect.bottom + this.bottom,
);
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L541-L548 | d5cae1dfd553c97aae520743e844db5466481964 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | getPendingApproval | 获取待审批账单 | static async getPendingApproval(ledgerId: number): Promise<SharedBill[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SharedBill.tableName);
predicates.equalTo('ledger_id', le... | 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 getPendingApproval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#L... | static async getPendingApproval(ledgerId: number): Promise<SharedBill[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SharedBill.tableName);
predicates.equalTo('ledger_id', le... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 6b8aa70cc0d8048a48f9d7b17b3a669767a4a016 | github |
Kira-Yagami-Light/Kira-Projects | XuanyinMusic/entry/src/main/ets/utils/AVPlayerManager.ets | arkts | remove | 从播放列表中移除指定歌曲 | static async remove(index: number) {
if (AVPlayerManager.currentSong.playIndex === index) {
if (AVPlayerManager.currentSong.playList.length > 1) {
AVPlayerManager.currentSong.playList.splice(index, 1);
AVPlayerManager.currentSong.playIndex =
AVPlayerManager.currentSong.playIndex %
... | 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 remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Rig... | static async remove(index: number) {
if (AVPlayerManager.currentSong.playIndex === index) {
if (AVPlayerManager.currentSong.playList.length > 1) {
AVPlayerManager.currentSong.playList.splice(index, 1);
AVPlayerManager.currentSong.playIndex =
AVPlayerManager.currentSong.playIndex %
... | https://github.com/Kira-Yagami-Light/Kira-Projects | a850ba4e6b744a30d90af0dbad4a5ee822eb159b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | constructor | Creates a new `BigInt` instance from a byte value.
@param { byte } d The byte value to convert.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(d: byte) {
this.sign = d < 0 ? -1 : (d == 0 ? 0 : 1)
this.bytes = this.sign == 0 ? [] as ValueArray<int> : BigInt.fromLongHelper(d.toLong(), 8, this.sign)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left byte AST#identifier#Right AST#)#... | constructor(d: byte) {
this.sign = d < 0 ? -1 : (d == 0 ? 0 : 1)
this.bytes = this.sign == 0 ? [] as ValueArray<int> : BigInt.fromLongHelper(d.toLong(), 8, this.sign)
} | https://gitcode.com/iop123123/arkts-static-skills | c31ce33030eb92c067a8297f039513c2ec24bd8a | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/HttpClient.ets | arkts | setCsrfToken | 设置 CSRF Token | setCsrfToken(token: string): void {
this.csrfToken = token;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCsrfToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | setCsrfToken(token: string): void {
this.csrfToken = token;
} | https://github.com/Amaz1ny/HarmonyDO-public | 5ef7cf29cd16c8a35fb37ca6c3d786f431b0a342 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Initialization/DataInitializer.ets | arkts | reset | 重置初始化状态(用于测试或重新初始化) | public reset(): void {
this.isInitialized = false;
this.initializationPromise = null;
logger.debug(TAG, '初始化状态已重置');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset 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 reset(): void {
this.isInitialized = false;
this.initializationPromise = null;
logger.debug(TAG, '初始化状态已重置');
} | https://github.com/DaLongZhuaZi/manxia | 7860345521cbc967ba851e5f1fb3ec2e9f9ec319 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportTrackRecords | 导出第三方追踪记录 | private async exportTrackRecords(): Promise<TrackRecordBackup[]> {
try {
const sql = 'SELECT * FROM track_record ORDER BY updateTime DESC';
const results = await this.dbManager.querySql(sql);
const records: TrackRecordBackup[] = [];
for (const record of results) {
const rec = reco... | 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 exportTrackRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async exportTrackRecords(): Promise<TrackRecordBackup[]> {
try {
const sql = 'SELECT * FROM track_record ORDER BY updateTime DESC';
const results = await this.dbManager.querySql(sql);
const records: TrackRecordBackup[] = [];
for (const record of results) {
const rec = reco... | https://github.com/DaLongZhuaZi/manxia | b85d74e6192a5b484ff2dee4b43a7fea18ccb1ad | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/StringReader.ets | arkts | readByCount | 继续读取给定字符数,如果到达字符串末尾,则停止。读不到时返回空字符串
@param count 读取的字符数
@return 读取到的字符串 | public readByCount(count: number= 1): string {
let characters = this.peek(count);
this.moveNext(count);
return characters;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readByCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressi... | public readByCount(count: number= 1): string {
let characters = this.peek(count);
this.moveNext(count);
return characters;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 752bd6e07c2542c2579caa7d8c6e00cb61ff7232 | gitee |
xblLab/HarmonyProjectTemplate | products/phone/src/main/ets/common/WindowUtils.ets | arkts | offAvoidAreaChange | 取消窗口避让区域变化监听 | public static offAvoidAreaChange() {
try {
let windowStage = AppStorage.get('windowStage') as window.WindowStage;
if (windowStage) {
windowStage.getMainWindowSync().off('avoidAreaChange');
}
} catch (e) {
Logger.error(TAG, 'Failed to offAvoidAreaChange. Cause: ' + JSON.stringif... | 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 offAvoidAreaChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | public static offAvoidAreaChange() {
try {
let windowStage = AppStorage.get('windowStage') as window.WindowStage;
if (windowStage) {
windowStage.getMainWindowSync().off('avoidAreaChange');
}
} catch (e) {
Logger.error(TAG, 'Failed to offAvoidAreaChange. Cause: ' + JSON.stringif... | https://github.com/xblLab/HarmonyProjectTemplate | 1a53ceced091d727ea9df1d067182ebdcee11287 | github |
openharmony/applications_call | entry/src/main/ets/model/CallDataManager.ets | arkts | addCallList | addCallList
@param { object } callData | private addCallList(callData) {
this.callList.push(callData);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left addCallList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callData AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private addCallList(callData) {
this.callList.push(callData);
} | https://gitee.com/openharmony/applications_call.git | 2e44de51705de2d3de19c232cec9e4512c37aee9 | gitee |
OHPG/FinMusic | entry/src/main/ets/tool/LrcParser.ets | arkts | linesToLrc | 将歌词行数组转为 LRC 字符串
@param lines 歌词行数组
@returns LRC 格式字符串 | public static linesToLrc(lines: Array<LyricLine>): string {
let lrcLines = new Array<string>()
for (const line of lines) {
if (line.Text === undefined || line.Text === null) {
continue
}
if (line.Start !== undefined && line.Start !== null) {
let ms = line.Start / 10000 // tic... | 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 linesToLrc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lines AST#identifier#Right AST#:#Left : AST#... | public static linesToLrc(lines: Array<LyricLine>): string {
let lrcLines = new Array<string>()
for (const line of lines) {
if (line.Text === undefined || line.Text === null) {
continue
}
if (line.Start !== undefined && line.Start !== null) {
let ms = line.Start / 10000 // tic... | https://github.com/OHPG/FinMusic | e6a0dff3c59129a86c2bd5d203572b4c247983fb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelCoverGenerator.ets | arkts | generateCover | 生成封面图片
@param bookId 书籍ID
@param title 书籍标题
@param builderFunc 构建封面组件的函数
@returns 生成的封面路径,失败返回空字符串 | async generateCover(bookId: string, title: string, builderFunc: () => void, uiContext: UIContext): Promise<string> {
if (!this.isInitialized) {
logger.error(TAG, '封面生成器未初始化');
return '';
}
try {
logger.info(TAG, `开始生成封面: ${title}`);
// 使用 componentSnapshot.createFromBui... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left generateCover AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST... | async generateCover(bookId: string, title: string, builderFunc: () => void, uiContext: UIContext): Promise<string> {
if (!this.isInitialized) {
logger.error(TAG, '封面生成器未初始化');
return '';
}
try {
logger.info(TAG, `开始生成封面: ${title}`);
// 使用 componentSnapshot.createFromBui... | https://github.com/DaLongZhuaZi/manxia | ae20ad4f18f5f284023d1ad0e01d28d4524b817d | github |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/pages/TimeZoneUtil.ets | arkts | getAvailableTimeZoneIDs | 获取系统支持的时区ID集合 | static getAvailableTimeZoneIDs(): Array<string> {
return i18n.TimeZone.getAvailableIDs();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAvailableTimeZoneIDs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS... | static getAvailableTimeZoneIDs(): Array<string> {
return i18n.TimeZone.getAvailableIDs();
} | https://gitee.com/openharmony-sig/applications_clock.git | 1db1c24659107c2b72298738fe9fc8a27d952647 | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/ImageCompressor.ets | arkts | releaseQuietly | Best-effort native-resource release. Never throws — a release
failure is logged so the next leak is debuggable but never masks
the real (or successful) compression result. | private static async releaseQuietly(
packer: image.ImagePacker | null,
pixelMap: image.PixelMap | null,
source: image.ImageSource | null,
): Promise<void> {
if (packer !== null) {
try {
await packer.release();
} catch (e) {
const be: BusinessError = e as BusinessError;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left releaseQuietly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ... | private static async releaseQuietly(
packer: image.ImagePacker | null,
pixelMap: image.PixelMap | null,
source: image.ImageSource | null,
): Promise<void> {
if (packer !== null) {
try {
await packer.release();
} catch (e) {
const be: BusinessError = e as BusinessError;
... | https://github.com/terryma2024/happyword | ce3495b879d6e3833362769f1af8bbd2e17a1536 | github |
erosTeam/NextE | shared/src/main/ets/network/EhErrorClassifier.ets | arkts | hasMarker | Positive markers a real 200 page must carry. ex Sad Panda / login / cloudflare pages have none. | private static hasMarker(body: string, page: string): boolean {
if (page === 'generic') {
return true
}
if (page === 'list') {
return body.indexOf('class="itg') >= 0
}
// 'detail' (a /g/{gid}/{token} page, incl. ?p= preview pages)
return (
body.indexOf('<h1 id="gn"') >= 0 ||
... | 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 hasMarker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left body AST#identifier#Right AST#:#Left : AST... | private static hasMarker(body: string, page: string): boolean {
if (page === 'generic') {
return true
}
if (page === 'list') {
return body.indexOf('class="itg') >= 0
}
// 'detail' (a /g/{gid}/{token} page, incl. ?p= preview pages)
return (
body.indexOf('<h1 id="gn"') >= 0 ||
... | https://github.com/erosTeam/NextE | 888a03fd6161703420665349e20ba42ffa624c42 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Console.ets | arkts | println | Prints a double to the console and puts newline
@param i value to print | public println(i: double): void {
this.print(i);
this.println();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#... | public println(i: double): void {
this.print(i);
this.println();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a5ce729f21bc75a13ca61e4bd6afabb72e674e39 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSourceManagementPage.ets | arkts | toggleSourceSelection | 切换单个书源的选中状态 | toggleSourceSelection(sourceId: string, isSelected: boolean): void {
const newSet = new Set(this.selectedSourceIds);
if (isSelected) {
newSet.add(sourceId);
} else {
newSet.delete(sourceId);
}
this.selectedSourceIds = newSet;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleSourceSelection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left... | toggleSourceSelection(sourceId: string, isSelected: boolean): void {
const newSet = new Set(this.selectedSourceIds);
if (isSelected) {
newSet.add(sourceId);
} else {
newSet.delete(sourceId);
}
this.selectedSourceIds = newSet;
} | https://github.com/DaLongZhuaZi/manxia | a7d91197286c6a0fc617dc9cd1ac9af8b3326ef7 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/NetworkManager.ets | arkts | isPortAvailable | 检查端口是否可用 | public isPortAvailable(port: number): boolean {
// 这里应该实现实际的端口检查逻辑
// 目前返回简单的范围检查
return port > 1024 && port < 65536;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPortAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left port AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public isPortAvailable(port: number): boolean {
// 这里应该实现实际的端口检查逻辑
// 目前返回简单的范围检查
return port > 1024 && port < 65536;
} | https://github.com/AetheriumSimulator/qemu-hmos | 48b94f29a7c283d55172be2abea1d8edd5129df3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/ScraperManager.ets | arkts | setBangumiToken | ==================== 配置方法 ====================
设置Bangumi访问令牌 | public setBangumiToken(token: string): void {
this.bangumiScraper.setAccessToken(token);
logger.info(TAG, 'Bangumi访问令牌已设置');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBangumiToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setBangumiToken(token: string): void {
this.bangumiScraper.setAccessToken(token);
logger.info(TAG, 'Bangumi访问令牌已设置');
} | https://github.com/DaLongZhuaZi/manxia | 9aac781b412ef5ba97415be93afdbf07964c43ff | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | addField | Adds getter and optionally setter to `this` interface
@param fld property description
@returns this | public addField(fld: FieldCreator): InterfaceTypeCreator throws {
const getter = new MethodCreator(fld.name).addResult(fld.typ).addGetter()
this.addMethod(getter)
if (!fld.attrs.has(Attributes.READONLY)) {
const setter = new MethodCreator(fld.name).addParameter(new ParameterCreat... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addField AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fld AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FieldCre... | public addField(fld: FieldCreator): InterfaceTypeCreator throws {
const getter = new MethodCreator(fld.name).addResult(fld.typ).addGetter()
this.addMethod(getter)
if (!fld.attrs.has(Attributes.READONLY)) {
const setter = new MethodCreator(fld.name).addParameter(new ParameterCreat... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 826bf8fdbcd677b2c8a52094d90087b9c3f237a5 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets | arkts | compareTo | Compares this instance to other Short object
The result is less than 0 if this instance lesser than provided object
0 if they are equal, and greater than 0 otherwise.
@param { short } other Short object to compare with
@returns { int } result of the comparison, -1 if this instance is less than provided object,
0 if equ... | public override compareTo(other: Short): int {
if (this.value < other) {
return -1;
}
if (this.value == other) {
return 0;
}
return 1;
} | 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 compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST... | public override compareTo(other: Short): int {
if (this.value < other) {
return -1;
}
if (this.value == other) {
return 0;
}
return 1;
} | https://gitcode.com/iop123123/arkts-static-skills | 2187b010b0c203eae89ef4d524af3550d0ed97df | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/AppColors.ets | arkts | secondary | ==================== 次要色系 ==================== | static get secondary(): string { return getColorForCurrentTheme(ColorRole.SECONDARY); } | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left secondary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :... | static get secondary(): string { return getColorForCurrentTheme(ColorRole.SECONDARY); } | https://github.com/DaLongZhuaZi/manxia | 6a482f81650fde104521b43062d17280f8bc5a3f | github |
the-wwyang/kids-learning-app | src/main/ets/utils/ArrayUtils.ets | arkts | createRangeArray | 创建指定范围的数字数组 [start, start+1, ..., end-1]
@param start 起始值(包含)
@param end 结束值(不包含)
@returns 数字数组,如果 start >= end 则返回空数组
@example
ArrayUtils.createRangeArray(2, 6) // [2, 3, 4, 5] | static createRangeArray(start: number, end: number): number[] {
if (start >= end) {
return [];
}
const result: number[] = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createRangeArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static createRangeArray(start: number, end: number): number[] {
if (start >= end) {
return [];
}
const result: number[] = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
} | https://github.com/the-wwyang/kids-learning-app | e4cdc737c9baa4fab4323ab57c83471d5f10b1fc | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getPrivateOnlineComics | [新增] 获取隐私在线漫画列表
@returns Promise<OnlineComicInfo[]> 隐私在线漫画列表 | public async getPrivateOnlineComics(): Promise<OnlineComicInfo[]> {
try {
const records = await this.databaseManager.query(
'online_comic_info',
undefined,
'isPrivate = ?',
[1],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} 条隐私在线漫画`);
... | 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 getPrivateOnlineComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | public async getPrivateOnlineComics(): Promise<OnlineComicInfo[]> {
try {
const records = await this.databaseManager.query(
'online_comic_info',
undefined,
'isPrivate = ?',
[1],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} 条隐私在线漫画`);
... | https://github.com/DaLongZhuaZi/manxia | a8e1fff4738e2b21336c7632764dbc6b1edfae84 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getAppFontSize | 获取APP界面字号 | public static getAppFontSize(): number {
return FontAwareHelper.globalState.appFontSize;
} | 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 getAppFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static getAppFontSize(): number {
return FontAwareHelper.globalState.appFontSize;
} | https://github.com/DaLongZhuaZi/manxia | 95da7362f7154ee395a1418b4aa91f3ee5038d85 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | getStringProperty | 从对象中获取字符串属性,尝试多个可能的属性名
跳过空字符串,只返回有实际内容的值 | private getStringProperty(obj: Record<string, Object>, keys: string[]): string {
for (const key of keys) {
const value = obj[key];
if (value !== undefined && value !== null) {
const strValue = String(value).trim();
// 跳过空字符串,继续尝试下一个键
if (strValue.length > 0) {
return ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio... | private getStringProperty(obj: Record<string, Object>, keys: string[]): string {
for (const key of keys) {
const value = obj[key];
if (value !== undefined && value !== null) {
const strValue = String(value).trim();
// 跳过空字符串,继续尝试下一个键
if (strValue.length > 0) {
return ... | https://github.com/DaLongZhuaZi/manxia | b9e782f1f819fb29ae254948c340e6ccf59e12d5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets | arkts | loadPdfDocument | 加载PDF文档 | private async loadPdfDocument(): Promise<PdfImportResult> {
try {
const loadResult = this.openPdfDocumentSession('initial_load');
if (loadResult !== pdfService.ParseResult.PARSE_SUCCESS) {
return {
success: false,
errorMessage: `PDF加载失败,错误码: ${loadResult}`
};
... | 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 loadPdfDocument AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async loadPdfDocument(): Promise<PdfImportResult> {
try {
const loadResult = this.openPdfDocumentSession('initial_load');
if (loadResult !== pdfService.ParseResult.PARSE_SUCCESS) {
return {
success: false,
errorMessage: `PDF加载失败,错误码: ${loadResult}`
};
... | https://github.com/DaLongZhuaZi/manxia | 898dc1f951431830d7200c9558a31900e8ac4efc | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.