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 |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | emit | Emit event messages.
@param { string } event - Emit event.
@param { Object } [param] - The parameter of event callbacks. | emit(event: string, param?: Object): void {
if (this.handlers.has(event)) {
const funcList = this.handlers.get(event);
funcList!.forEach((callback: Function) => {
callback.unsafeCall(param);
})
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left emit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Rig... | emit(event: string, param?: Object): void {
if (this.handlers.has(event)) {
const funcList = this.handlers.get(event);
funcList!.forEach((callback: Function) => {
callback.unsafeCall(param);
})
}
} | https://gitcode.com/iop123123/arkts-static-skills | 361d67b806eba099c14642d2c9b1dcf5445f09a7 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | isSimActiveSync | 获取指定卡槽SIM卡是否激活
@param slotId 卡槽ID(0-卡槽1、1-卡槽2)。 默认移动数据的SIM卡。
@returns | static isSimActiveSync(slotId: number): boolean {
return sim.isSimActiveSync(slotId);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isSimActiveSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static isSimActiveSync(slotId: number): boolean {
return sim.isSimActiveSync(slotId);
} | https://github.com/tdcare/tdwebrtc | b92dbb97e382181e7a375f878bf2879cf0d88e87 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | copyWithin | Makes a copy of internal elements to targetPos from begin to end of BigInt64Array.
See rules of parameters normalization on
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin | MDN}
@param { int } target - insert index to place copied elements
@returns { BigInt64Arr... | public copyWithin(target: int): BigInt64Array {
this.copyWithinImpl(target, 0, this.lengthInt)
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public copyWithin(target: int): BigInt64Array {
this.copyWithinImpl(target, 0, this.lengthInt)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | 2981184d7acd54045a5f01cd2e9ebef2a8d78c8b | gitcode |
CLMC2025/Vignette | entry/src/main/ets/context/ContextValidator.ets | arkts | validatePunctuation | 验证标点符号 | private validatePunctuation(context: string, result: ValidationResult): void {
// 检查连续标点
if (/[.!?]{2,}/.test(context)) {
result.addIssue(new ValidationIssue(
ValidationIssueType.PUNCTUATION_ERROR,
IssueSeverity.WARNING,
'存在连续标点符号',
'移除多余的标点符号'
));
}
// 检查标... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validatePunctuation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left context AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private validatePunctuation(context: string, result: ValidationResult): void {
// 检查连续标点
if (/[.!?]{2,}/.test(context)) {
result.addIssue(new ValidationIssue(
ValidationIssueType.PUNCTUATION_ERROR,
IssueSeverity.WARNING,
'存在连续标点符号',
'移除多余的标点符号'
));
}
// 检查标... | https://github.com/CLMC2025/Vignette | f3c3d56dc2f3c2eaaa0c4c23a02a7d1269b6f8a2 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/ClientSessionManager.ets | arkts | hasActiveSession | Check if there is an active session | public hasActiveSession(): boolean {
return !!this.currentClient;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasActiveSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean ... | public hasActiveSession(): boolean {
return !!this.currentClient;
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | 5fb8978e20dc4e31aa36e8968b74c977b9e07639 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/model/TotpEntry.ets | arkts | displayLabel | 显示标签: issuer (account) 或仅 issuer | displayLabel(): string {
if (this.account !== '') {
return this.issuer + " (" + this.account + ")";
}
return this.issuer;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left displayLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement... | displayLabel(): string {
if (this.account !== '') {
return this.issuer + " (" + this.account + ")";
}
return this.issuer;
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 5d7743c7b84a3846af9536ed18024b4e39bd2b0f | github |
LongLiveY96/chatcube | entry/src/main/ets/services/WebDAVService.ets | arkts | uploadBackup | 上传备份文件 | async uploadBackup(
config: WebDAVConfig,
localZipPath: string,
remoteFileName: string,
onProgress?: BinaryProgressCallback,
controller?: HttpRequestController
): Promise<UploadResult> {
let buffer: ArrayBuffer
let size = 0
try {
const stat = fileIo.statSync(localZipPath)
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left uploadBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#... | async uploadBackup(
config: WebDAVConfig,
localZipPath: string,
remoteFileName: string,
onProgress?: BinaryProgressCallback,
controller?: HttpRequestController
): Promise<UploadResult> {
let buffer: ArrayBuffer
let size = 0
try {
const stat = fileIo.statSync(localZipPath)
... | https://github.com/LongLiveY96/chatcube | ee763dbf3f098b1963632e48151a3d27ce054777 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | getAllTasks | ==================== 查询方法 ====================
获取所有下载任务 | public getAllTasks(): UnifiedDownloadTask[] {
return Array.from(this.unifiedTasks.values());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left UnifiedDow... | public getAllTasks(): UnifiedDownloadTask[] {
return Array.from(this.unifiedTasks.values());
} | https://github.com/DaLongZhuaZi/manxia | 8db79aeb37e49f5d8bd16641ca485053d9cdb093 | github |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/utils/CityClockCardUtil.ets | arkts | initWorldClockCard | initWorldClockCard
@param cityIndexList cityIndexList
@returns | public static initWorldClockCard(cityIndexList: string[]): object {
const faCityFirst: FaCityData = CityClockCardUtil.getCityNameAndDate(cityIndexList[0]);
const faCitySecond: FaCityData = CityClockCardUtil.getCityNameAndDate(cityIndexList[1]);
const faCityThird: FaCityData = CityClockCardUtil.getCityName... | 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 initWorldClockCard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cityIndexList AST#identifier#Right AST#ERROR#Left A... | public static initWorldClockCard(cityIndexList: string[]): object {
const faCityFirst: FaCityData = CityClockCardUtil.getCityNameAndDate(cityIndexList[0]);
const faCitySecond: FaCityData = CityClockCardUtil.getCityNameAndDate(cityIndexList[1]);
const faCityThird: FaCityData = CityClockCardUtil.getCityName... | https://gitee.com/openharmony-sig/applications_clock.git | b2e72ba99cf888eb96cb48a46c6f4d0b3354acee | gitee |
openharmony-sig/knowledge_demo_travel | FA/WiFiScanner/entry/src/main/ets/MainAbility/common/utils/ToolUtil.ets | arkts | ipToInt | IP转int | ipToInt(ip){
let num = 0
ip = ip.split('.')
num = Number(ip[0]) * 256 * 256 * 256 + Number(ip[1]) * 256 * 256 + Number(ip[2]) * 256 + Number(ip[3])
num = num >>> 0
return num
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left ipToInt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ip AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_st... | ipToInt(ip){
let num = 0
ip = ip.split('.')
num = Number(ip[0]) * 256 * 256 * 256 + Number(ip[1]) * 256 * 256 + Number(ip[2]) * 256 + Number(ip[3])
num = num >>> 0
return num
} | https://gitee.com/openharmony-sig/knowledge_demo_travel.git | 5acd58d405563fead5c3e3d96b993a5228b9abd7 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/ScraperManager.ets | arkts | searchManga | 搜索漫画(多源) | public async searchManga(keyword: string, sources?: ScraperSource[]): Promise<MultiSourceSearchResult> {
return this.searchMultipleSources(keyword, ScraperContentType.MANGA, sources);
} | 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 searchManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public async searchManga(keyword: string, sources?: ScraperSource[]): Promise<MultiSourceSearchResult> {
return this.searchMultipleSources(keyword, ScraperContentType.MANGA, sources);
} | https://github.com/DaLongZhuaZi/manxia | 1190a5c4c96b251603c48f1a67e2788655a056f2 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets | arkts | getYMin | Returns the minimum y-value for the specified axis.
@param axis
@return | public getYMin(axis?: AxisDependency): number {
if (axis == null) {
return this.mYMin;
}
if (axis == AxisDependency.LEFT) {
if (this.mLeftAxisMin == Number.MAX_VALUE) {
return this.mRightAxisMin;
} else {
return this.mLeftAx... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYMin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left axis AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | public getYMin(axis?: AxisDependency): number {
if (axis == null) {
return this.mYMin;
}
if (axis == AxisDependency.LEFT) {
if (this.mLeftAxisMin == Number.MAX_VALUE) {
return this.mRightAxisMin;
} else {
return this.mLeftAx... | https://gitee.com/openharmony/developtools_profiler.git | 5aec8e9961a7d9a20359ca5e5e47e39a8633fb73 | gitee |
HarmonyOS_Samples/HMRouter | entry/src/main/ets/animation/CustomDifferentTransition.ets | arkts | build | [EndExclude comment_input_amimator] | build() {
Row() {
Image($r('app.media.icon_comments'))
.width(24)
.height(24)
.margin({ right: 16 })
.onClick(() => {
if (this.isLandscape) {
HMRouterMgr.to('liveComments')
.withNavigation(this.queryNavigationInfo()?.navigationId)
... | 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#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Row() {
Image($r('app.media.icon_comments'))
.width(24)
.height(24)
.margin({ right: 16 })
.onClick(() => {
if (this.isLandscape) {
HMRouterMgr.to('liveComments')
.withNavigation(this.queryNavigationInfo()?.navigationId)
... | https://gitcode.com/HarmonyOS_Samples/HMRouter | dfeeaebd9d84e24209bcd14951a7faa30a21ef4a | gitcode |
openharmony/codelabs | GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets | arkts | setXLocationType | Get x locationType.
@param offsetX | public setXLocationType(offsetX: number) {
if (offsetX > this.offsetXRight - CommonConstant.OFFSET_RANGE &&
offsetX < this.offsetXRight + CommonConstant.OFFSET_RANGE) {
this.xLocationType = XLocationEnum.XRight;
} else if (offsetX > this.offsetXLeft - CommonConstant.OFFSET_RANGE &&
offsetX <... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setXLocationType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | public setXLocationType(offsetX: number) {
if (offsetX > this.offsetXRight - CommonConstant.OFFSET_RANGE &&
offsetX < this.offsetXRight + CommonConstant.OFFSET_RANGE) {
this.xLocationType = XLocationEnum.XRight;
} else if (offsetX > this.offsetXLeft - CommonConstant.OFFSET_RANGE &&
offsetX <... | https://gitee.com/openharmony/codelabs.git | d817c8cef0578d656debedaa42bdc7df1b9c58af | gitee |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue132.ets.audit.ets | arkts | getData | HPAudit: Avoid using 'any' : hp-specs-no-any : 1 : 9 : issue132.ets | public getData(index: number): any {
return undefined
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | public getData(index: number): any {
return undefined
} | https://gitee.com/openharmony-sig/earth.git | 46933b7e8ef2cb41a0e378a1709724c5a4700d25 | gitee |
xiebyapps/ClipLink | entry/src/main/ets/services/ConfigService.ets | arkts | getConfig | Get current configuration | getConfig(): AppConfig {
return this.config;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left AppConfig AST#identifier#Right AST#ERROR#Right AST#s... | getConfig(): AppConfig {
return this.config;
} | https://github.com/xiebyapps/ClipLink | 2b901fa9a089988d72c16f2c44685a7c91908941 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | reduce | Calls the specified callback function for all the elements in an array.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduce method calls the call... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Float64Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = (this.getUnsafe(0)).toDoubl... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Float64Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = (this.getUnsafe(0)).toDoubl... | https://gitcode.com/iop123123/arkts-static-skills | bdeb96f13e346fb7949b18be4e74db48820cc099 | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/catstypicalframework/utils/catsLogger.ets | arkts | buildCrashLogFileName | Builds the crash log file name.
@param timestampMs The timestamp in milliseconds.
@returns The file name. | function buildCrashLogFileName(timestampMs: number) {
const date = new Date(timestampMs);
const pad = (num: number, len = 2) => String(num).padStart(len, '0');
const Y = date.getFullYear();
const M = pad(date.getMonth() + 1);
const D = pad(date.getDate());
const h = pad(date.getHours());
const m = pad(dat... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildCrashLogFileName AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left timestampMs AST#identifier#Right AST#type_annotation#Left AST#:#... | function buildCrashLogFileName(timestampMs: number) {
const date = new Date(timestampMs);
const pad = (num: number, len = 2) => String(num).padStart(len, '0');
const Y = date.getFullYear();
const M = pad(date.getMonth() + 1);
const D = pad(date.getDate());
const h = pad(date.getHours());
const m = pad(dat... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 82c2aea9daf09678e82067de01d6cf55a18db23c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrShareService.ets | arkts | compressToBase64 | =============================================================================
zlib 压缩 / 解压
=============================================================================
压缩 JSON 字符串 → base64 字符串(带 MLC: 前缀)
压缩率约 50-70%,使 QR 码版本大幅降低 | async function compressToBase64(json: string): Promise<string> {
const encoder = new util.TextEncoder();
const encResult = encoder.encodeInto(json);
const sourceBuffer = encResult.buffer as ArrayBuffer;
// 目标缓冲区:压缩数据通常不会比原始数据大
const destBuffer = new ArrayBuffer(sourceBuffer.byteLength + 128);
const zip = z... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left compressToBase64 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left json AST#identifier#Right AST#ty... | async function compressToBase64(json: string): Promise<string> {
const encoder = new util.TextEncoder();
const encResult = encoder.encodeInto(json);
const sourceBuffer = encResult.buffer as ArrayBuffer;
// 目标缓冲区:压缩数据通常不会比原始数据大
const destBuffer = new ArrayBuffer(sourceBuffer.byteLength + 128);
const zip = z... | https://github.com/AlkaidLab/moonlight-harmony | af605cf15eb9f71f688b2d9cc328b00a59e72a7e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Core/ErrorHandler.ets | arkts | updateRecoverySuccessRate | 更新恢复成功率 | private updateRecoverySuccessRate(success: boolean): void {
const recentAttempts = this.errorHistory.slice(-20);
const successCount = recentAttempts.filter(e => e.isRecoverable).length;
this.statistics.recoverySuccessRate = recentAttempts.length > 0
? (successCount / recentAttempts.length) * 100
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateRecoverySuccessRate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left success AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private updateRecoverySuccessRate(success: boolean): void {
const recentAttempts = this.errorHistory.slice(-20);
const successCount = recentAttempts.filter(e => e.isRecoverable).length;
this.statistics.recoverySuccessRate = recentAttempts.length > 0
? (successCount / recentAttempts.length) * 100
... | https://github.com/DaLongZhuaZi/manxia | 21536ad91ef1df64c70c46ffef2c7bfb9c386fab | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | batchInsert | 批量插入实体
使用 RdbStore.batchInsert API 批量插入数据
支持事务和钩子执行选项
@param entities 实体数据数组
@param options 批量插入选项(可选,默认使用事务和执行钩子)
@returns Promise<BatchInsertResult>
Requirements: 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8 | async batchInsert(
entities: Array<EntityData>,
options: BatchInsertOptions = BatchInsertOptions.createDefault()
): Promise<BatchInsertResult> {
this.ensureWritePathAllowed('BATCH_INSERT')
return await this.withSessionStore(async (repo) => {
const result = await repo.batchOperations.batchInser... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left batchInsert AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entiti... | async batchInsert(
entities: Array<EntityData>,
options: BatchInsertOptions = BatchInsertOptions.createDefault()
): Promise<BatchInsertResult> {
this.ensureWritePathAllowed('BATCH_INSERT')
return await this.withSessionStore(async (repo) => {
const result = await repo.batchOperations.batchInser... | https://github.com/offlinecat-dev/OCNetORM | 95efe6ccb3b3db8c77306f87a722cdcd621d5bf9 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | from | Creates an Float64Array from array-like argument
@param o array-like object to initialize Float64Array
@param mapFn function to apply for each
@returns new Float64Array | public from(o: Object, mapFn: (e: Object) => double): Float64Array {
let newF: (e: Object, index: int) => double =
(e: Object, index: int): double => { return mapFn(e) }
return this.from(o, newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | public from(o: Object, mapFn: (e: Object) => double): Float64Array {
let newF: (e: Object, index: int) => double =
(e: Object, index: int): double => { return mapFn(e) }
return this.from(o, newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8aeec4c2cb7d7149ae1b5e3928e81a3f7b2ecf9d | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpBackgroundService.ets | arkts | showNotification | Show notification | private async showNotification(title: string, content: string): Promise<void> {
try {
const notificationRequest: notificationManager.NotificationRequest = {
id: NOTIFICATION_ID,
content: {
notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left showNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Lef... | private async showNotification(title: string, content: string): Promise<void> {
try {
const notificationRequest: notificationManager.NotificationRequest = {
id: NOTIFICATION_ID,
content: {
notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
... | https://github.com/tangwengang-del/freerdp-harmonyos | ab75baf771dcaec12bcc6544a1bda75f9eb2b01e | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/model/HouseSunshineModel.ets | arkts | getSunshinePercent | 获取日照百分比 | getSunshinePercent(): string {
if (this.totalSunshineTime === 0) {
return '100.000';
}
return ((this.exactSunshineTime / this.totalSunshineTime) * 100).toFixed(3);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSunshinePercent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta... | getSunshinePercent(): string {
if (this.totalSunshineTime === 0) {
return '100.000';
}
return ((this.exactSunshineTime / this.totalSunshineTime) * 100).toFixed(3);
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | e7e1a20d9b252279273f9537c73cbc950317d51f | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | resetForNewCall | 重置状态以准备新的呼叫
关闭旧连接并重新初始化,确保 SDP 生成正确 | public resetForNewCall(): void {
// 清空轨道状态
this.localTracks = [];
this.peerRoomMap.clear();
this.offerPending = false;
this.negotiatedVideoCodec = null; // v24: 清除上次的协商结果
this.cachedIceCandidates = []; // v42: 清空缓存的 ICE 候选
// 如果已有客户端,关闭并重新创建
if (this.client !== null) {
LogUt... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetForNewCall 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#expres... | public resetForNewCall(): void {
// 清空轨道状态
this.localTracks = [];
this.peerRoomMap.clear();
this.offerPending = false;
this.negotiatedVideoCodec = null; // v24: 清除上次的协商结果
this.cachedIceCandidates = []; // v42: 清空缓存的 ICE 候选
// 如果已有客户端,关闭并重新创建
if (this.client !== null) {
LogUt... | https://github.com/tdcare/tdwebrtc | d8eb29c61b7b9abfc0ecdb1185eed38a82c01036 | github |
offlinecat-dev/OCNetORM | example/UsageExample.ets | arkts | countExample | 统计查询示例 | async function countExample(): Promise<void> {
const repository = new Repository('ArticleEntity')
// 1. 统计所有文章
const totalCount = await repository.count()
console.info(`文章总数: ${totalCount}`)
// 2. 使用 QueryExecutor 统计
const queryBuilder = repository.createQueryBuilder()
.where('isPublished', ConditionO... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left countExample AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#... | async function countExample(): Promise<void> {
const repository = new Repository('ArticleEntity')
// 1. 统计所有文章
const totalCount = await repository.count()
console.info(`文章总数: ${totalCount}`)
// 2. 使用 QueryExecutor 统计
const queryBuilder = repository.createQueryBuilder()
.where('isPublished', ConditionO... | https://github.com/offlinecat-dev/OCNetORM | a72587d62e20e1ac9c0a1cef7fdff15d4d274d32 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/SyncService.ets | arkts | applySyncChanges | 应用同步变更 | private async applySyncChanges(changes: SyncRecord[]): Promise<void> {
for (let i = 0; i < changes.length; i++) {
const change = changes[i];
await this.applyChange(change);
}
} | 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 applySyncChanges AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left changes AST#identifier#Right AST#:#L... | private async applySyncChanges(changes: SyncRecord[]): Promise<void> {
for (let i = 0; i < changes.length; i++) {
const change = changes[i];
await this.applyChange(change);
}
} | https://github.com/LJ666-ui/harmony-health-care | 6b2926e15db20fbc9f69419684defadd05e2023e | github |
apap6628114/nga_oh | entry/src/main/ets/service/api/AuthApi.ets | arkts | extractNickName | 从 set-cookie 头中提取 passport 编码昵称 | function extractNickName(setCookies: string[]): string {
for (let i = 0; i < setCookies.length; i++) {
const match = setCookies[i].match(/ngaPassportUrlencodedUname=([^;]+)/);
if (match) {
try {
return decodeURIComponent(match[1]);
} catch (e) {
return '';
}
}
}
retur... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractNickName AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left setCookies AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | function extractNickName(setCookies: string[]): string {
for (let i = 0; i < setCookies.length; i++) {
const match = setCookies[i].match(/ngaPassportUrlencodedUname=([^;]+)/);
if (match) {
try {
return decodeURIComponent(match[1]);
} catch (e) {
return '';
}
}
}
retur... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/service/api/AuthApi.ets#L142-L154 | 579a07a5edc6edcdf7a15229469d6ee1d37d2ad8 | github |
xiebyapps/ClipLink | entry/src/main/ets/services/HistoryStorageService.ets | arkts | clearAll | Clear all records | async clearAll(): Promise<void> {
try {
const store = await this.ensureStore();
await store.executeSql(`DELETE FROM ${this.TABLE_NAME}`);
} catch (error) {
console.error('[HistoryStorage] clearAll error:', JSON.stringify(error));
throw error instanceof Error ? error : new Error(String(... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async clearAll(): Promise<void> {
try {
const store = await this.ensureStore();
await store.executeSql(`DELETE FROM ${this.TABLE_NAME}`);
} catch (error) {
console.error('[HistoryStorage] clearAll error:', JSON.stringify(error));
throw error instanceof Error ? error : new Error(String(... | https://github.com/xiebyapps/ClipLink | ef6a440ef3244de06e8ac29cce3bf48e4014523b | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/stability/StabilityScenarioEngine.ets | arkts | executeRound | Execute one round of the specified stress scenario.
Returns fixture/result string or null. | executeRound(scenario: string): string | null {
switch (scenario) {
case 'SESSION_STORM':
return this.executeSessionStorm();
case 'STREAM_MARATHON':
return this.executeStreamMarathon();
case 'MULTI_SURFACE':
return this.executeMultiSurface();
case 'ACTION_FLOOD':
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left executeRound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scenario AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | executeRound(scenario: string): string | null {
switch (scenario) {
case 'SESSION_STORM':
return this.executeSessionStorm();
case 'STREAM_MARATHON':
return this.executeStreamMarathon();
case 'MULTI_SURFACE':
return this.executeMultiSurface();
case 'ACTION_FLOOD':
... | https://github.com/AGenUI/AGenUI | 66455f6e7d37528319b7b93a59a218a70ba5e380 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | convertRecordToComicSource | 数据库记录转换为业务对象的工具方法 | private convertRecordToComicSource(record: ComicSourceDatabaseRecord): ComicSource {
// 处理configJson属性的类型转换
const defaultConfig: ConfigObject = {};
let config: ConfigObject = defaultConfig;
if (record.configJson) {
if (typeof record.configJson === 'string') {
config = safeJsonParse<Confi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertRecordToComicSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private convertRecordToComicSource(record: ComicSourceDatabaseRecord): ComicSource {
// 处理configJson属性的类型转换
const defaultConfig: ConfigObject = {};
let config: ConfigObject = defaultConfig;
if (record.configJson) {
if (typeof record.configJson === 'string') {
config = safeJsonParse<Confi... | https://github.com/DaLongZhuaZi/manxia | 6243aa98f63f819c54777a81f227c9812cf51a2c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets | arkts | clearTask | 清除指定章节的预加载任务 | public clearTask(chapterId: string): void {
this.tasks.delete(chapterId);
logger.debug(TAG, `清除预加载任务: ${chapterId}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | public clearTask(chapterId: string): void {
this.tasks.delete(chapterId);
logger.debug(TAG, `清除预加载任务: ${chapterId}`);
} | https://github.com/DaLongZhuaZi/manxia | c517a1e4604247336bd843b53f012db66bb48d2c | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/SettingsManager.ets | arkts | getMaterialType | ========== 材质效果相关方法 ========== | getMaterialType(): number {
return this.materialType
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMaterialType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statem... | getMaterialType(): number {
return this.materialType
} | https://github.com/LongLiveY96/chatcube | c0b48adf1867021b7a210cdf391be0b9276a832d | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | every | / === with element lambda functions ===
Checks that all elements of Int8Array satisfy the passed function
@param fn check function
@returns true if all elements satisfy fn | public every(fn: (element: byte) => boolean): boolean {
let newF: (element: byte, index: int, array: Int8Array) => boolean =
(element: byte, index: int, array: Int8Array): boolean => { return fn(element) }
return this.every(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Rig... | public every(fn: (element: byte) => boolean): boolean {
let newF: (element: byte, index: int, array: Int8Array) => boolean =
(element: byte, index: int, array: Int8Array): boolean => { return fn(element) }
return this.every(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d3bf044d7db83b677b61c4fe035876e966a4e63d | gitee |
openharmony/xts_tools | sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets | arkts | constructor | 播放音频的文件名称 | constructor(audioId: number, audioName: string, audioIcon: Resource, audioAuthorName: string, audioTime: string, audioNum: string, audio: string) {
this.audioId = audioId;
this.audioName = audioName;
this.audioIcon = audioIcon;
this.audioAuthorName = audioAuthorName;
this.audioTime = audioTime;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left audioId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#... | constructor(audioId: number, audioName: string, audioIcon: Resource, audioAuthorName: string, audioTime: string, audioNum: string, audio: string) {
this.audioId = audioId;
this.audioName = audioName;
this.audioIcon = audioIcon;
this.audioAuthorName = audioAuthorName;
this.audioTime = audioTime;
... | https://gitee.com/openharmony/xts_tools.git | 8946d251affb59b38830d40fd0ffd20dca5da986 | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | hasH264Support | Check if H.264 is supported | static hasH264Support(): boolean {
if (!ensureNativeLoaded()) {
return false;
}
return hasH264Support;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasH264Support AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AS... | static hasH264Support(): boolean {
if (!ensureNativeLoaded()) {
return false;
}
return hasH264Support;
} | https://github.com/tangwengang-del/freerdp-harmonyos | f03558ad8a4961ad5a10c57065dccab502a0cc32 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | loadStartKeyMenuSetting | 加载长按 Start 键显示返回菜单的设置 | private async loadStartKeyMenuSetting(): Promise<void> {
try {
this.enableStartKeyMenu = await PreferencesUtil.get<boolean>(SettingsKeys.ENABLE_START_KEY_MENU, true);
} catch (e) {
this.enableStartKeyMenu = true;
}
} | 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 loadStartKeyMenuSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | private async loadStartKeyMenuSetting(): Promise<void> {
try {
this.enableStartKeyMenu = await PreferencesUtil.get<boolean>(SettingsKeys.ENABLE_START_KEY_MENU, true);
} catch (e) {
this.enableStartKeyMenu = true;
}
} | https://github.com/AlkaidLab/moonlight-harmony | 5dd4b553970d88d66333a2a191995015e446dcbe | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | checkIsAbsolute | Indicates whether this URI is an absolute URI.
@returns { boolean } boolean Indicates whether the URI is an absolute URI (whether the scheme component is defined). | checkIsAbsolute(): boolean {
return this.uriEntry.isAbsolute();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkIsAbsolute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#sta... | checkIsAbsolute(): boolean {
return this.uriEntry.isAbsolute();
} | https://gitcode.com/iop123123/arkts-static-skills | f594992e93b49bec6ff83baaa5075471805009ae | gitcode |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/view/PlaylistSplitHero.ets | arkts | build | Builds the horizontal hero row with primary actions aligned to the bottom of the cover stack. | build() {
Row({ space: 32 }) {
Image($r('app.media.ic_list_cover'))
.width(268)
.height(268)
.borderRadius(12)
.objectFit(ImageFit.Fill)
Column() {
Column({ space: 8 }) {
Text($r('app.string.playlist_detail_title'))
.fontSize(48)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Row({ space: 32 }) {
Image($r('app.media.ic_list_cover'))
.width(268)
.height(268)
.borderRadius(12)
.objectFit(ImageFit.Fill)
Column() {
Column({ space: 8 }) {
Text($r('app.string.playlist_detail_title'))
.fontSize(48)
... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 3ad4eb696697cb749437c342bd5f8ad6f9271f75 | gitcode |
LZZLHY/hlib | entry/src/main/ets/api/HttpClient.ets | arkts | exportCookieHeader | 给 WebView/阅读器复用的整段 cookie 字符串。 | exportCookieHeader(): string {
return this.buildCookieHeader(false);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exportCookieHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta... | exportCookieHeader(): string {
return this.buildCookieHeader(false);
} | https://github.com/LZZLHY/hlib | f64b9cae5675640ab6eef7072ba9929ee0b1a415 | github |
openharmony/xts_acts | ability/ability_runtime/actsabilityerrcodequery/actsabilityerrcodequerytest/entry/src/ohosTest/ets/test/UIAbilityContext.test.ets | arkts | generateLargeString | 生成一个指定长度的字符串 | function generateLargeString(length: number): string {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength)... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateLargeString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left length AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | function generateLargeString(length: number): string {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength)... | https://gitee.com/openharmony/xts_acts.git | d573255cb5074f8e7a79a04075d2b8727bca16eb | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/HttpService.ets | arkts | head | HEAD 请求 | async head(
url: string,
headers: Record<string, string> = {},
options?: HttpRequestRuntimeOptions
): Promise<HttpResponse> {
const config: HttpRequestConfig = {
url: url,
method: HttpMethod.HEAD,
headers: headers,
body: '',
timeout: options?.timeout !== undefined && op... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left head AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | async head(
url: string,
headers: Record<string, string> = {},
options?: HttpRequestRuntimeOptions
): Promise<HttpResponse> {
const config: HttpRequestConfig = {
url: url,
method: HttpMethod.HEAD,
headers: headers,
body: '',
timeout: options?.timeout !== undefined && op... | https://github.com/LongLiveY96/chatcube | e20488b4ae15931a10ae3da085c6f408220ad7c2 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitUint32 | 访问 uint32 字段
Wire type: 0 (varint) | visitUint32(value: number, fieldNumber: number): void {
this.writer.tag(fieldNumber, 0).uint32(value)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitUint32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AS... | visitUint32(value: number, fieldNumber: number): void {
this.writer.tag(fieldNumber, 0).uint32(value)
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 1b9f731cc8f17437d856e2fc80a4fbae945b1edf | gitcode |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_tuple/user/main.ets | arkts | testMakeStringPair | ====== Test 5: StringPair - string types in tuple ====== | function testMakeStringPair() {
let pair = TupleTest.makeStringPair("hello", "world");
console.log("makeStringPair: [" + pair[0] + ", " + pair[1] + "]");
arktest.assertEQ(pair[0], "hello");
arktest.assertEQ(pair[1], "world");
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMakeStringPair AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_... | function testMakeStringPair() {
let pair = TupleTest.makeStringPair("hello", "world");
console.log("makeStringPair: [" + pair[0] + ", " + pair[1] + "]");
arktest.assertEQ(pair[0], "hello");
arktest.assertEQ(pair[1], "world");
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | d8f5fc3ca788e9f6d5a9d579569d5f059a499e59 | gitcode |
LZZLHY/hlib | entry/src/main/ets/api/HttpClient.ets | arkts | ping | 简单可达性探测。返回延迟(ms);失败返回 -1。
不会污染 cookie jar,不抛异常。 | async ping(domain: string, timeoutMs: number = 8000): Promise<number> {
const cleanedDomain: string = domain.replace(/^https?:\/\//, '').replace(/\/$/, '');
const url: string = `https://${cleanedDomain}/eapi/info/languages`;
const req: http.HttpRequest = http.createHttp();
const start: number = Date.n... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left ping AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left domain AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | async ping(domain: string, timeoutMs: number = 8000): Promise<number> {
const cleanedDomain: string = domain.replace(/^https?:\/\//, '').replace(/\/$/, '');
const url: string = `https://${cleanedDomain}/eapi/info/languages`;
const req: http.HttpRequest = http.createHttp();
const start: number = Date.n... | https://github.com/LZZLHY/hlib | 41aee5971c26b707abfd22c06eea7c909126fcbd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | of | Returns a new array from a set of elements.
@param { FixedArray<long> } items - a set of elements to include in the new array object.
@returns { Uint32Array } - a new Uint32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(...items: FixedArray<long>): Uint32Array {
let res = new Uint32Array(items.length.toInt())
res.ofLong(stub.toValueArray(items))
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR... | public static of(...items: FixedArray<long>): Uint32Array {
let res = new Uint32Array(items.length.toInt())
res.ofLong(stub.toValueArray(items))
return res
} | https://gitcode.com/iop123123/arkts-static-skills | ada51b3c0af8ac7c51eaef759383774fe28da212 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets | arkts | constructor | Constructs a new error instance with provided name, code, message and options
@param { String } name - Error name
@param { int } code - Error code
@param { String } [message] - Error text
@param { ErrorOptions } [options] - Error options
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(name: String, code: int, message?: String, options?: ErrorOptions) {
this.code_ = code
this.message_ = (message == undefined) ? "" : message
this.cause_ = (options == undefined) ? undefined : options.cause
this.name_ = name
this.stackLines = StackTrace.provisionSt... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AST#identifier#Right A... | constructor(name: String, code: int, message?: String, options?: ErrorOptions) {
this.code_ = code
this.message_ = (message == undefined) ? "" : message
this.cause_ = (options == undefined) ? undefined : options.cause
this.name_ = name
this.stackLines = StackTrace.provisionSt... | https://gitcode.com/iop123123/arkts-static-skills | 7888205922f57d0241d342d4472c51bf525fcdbb | gitcode |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/setting.ets | arkts | delChatMessage | 删除'我和某个人的整个的聊天记录' | async delChatMessage(userId: string) {
const store = this.getStore()
store.deleteSync(`${UserRecord_KEY}_${userId}`)
await store.flush()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delChatMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userId AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async delChatMessage(userId: string) {
const store = this.getStore()
store.deleteSync(`${UserRecord_KEY}_${userId}`)
await store.flush()
} | https://github.com/SMAT-Lab/PhantomRendering | 1cef03d767d98c10805ccb4683abc8d853365d1e | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets | arkts | getLunarDayColor | 获取日期农历字体颜色(仅用于月视图和周视图)
@param day 日期信息
@param month 月
@param currentSelectDay 当前选择的日期
@param calendarViewType 日历视图类型
@param CalendarStyle 自定义日历样式
@returns 返回颜色 | static getLunarDayColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType,
CalendarStyle: CalendarStyle): Color | number | string | Resource {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month &&... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLunarDayColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left day AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static getLunarDayColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType,
CalendarStyle: CalendarStyle): Color | number | string | Resource {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month &&... | https://gitcode.com/arkui-x/samples | a0da615e6df184f451464a2bdc4ee75a41cfc02d | gitcode |
openharmony/arkui_ace_engine | examples/EventProject/entry/src/main/ets/pages/springloading/SpringLoading.ets | arkts | handleSpringLoading | Spring Loading处理入口
[Start springLoading_handleSpringLoading] | handleSpringLoading(context: SpringLoadingContext) {
// BEGIN 状态时检查拖拽数据类型
if (context.state == dragController.DragSpringLoadingState.BEGIN) {
//[StartExclude springLoading_handleSpringLoading]
if (this.handleBeginState(context)) {
// 我们已经在onDragEnter时刷新了提醒色,进入Spring Loading状态时,恢复UI,提醒用户继续保... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleSpringLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SpringLoadingConte... | handleSpringLoading(context: SpringLoadingContext) {
// BEGIN 状态时检查拖拽数据类型
if (context.state == dragController.DragSpringLoadingState.BEGIN) {
//[StartExclude springLoading_handleSpringLoading]
if (this.handleBeginState(context)) {
// 我们已经在onDragEnter时刷新了提醒色,进入Spring Loading状态时,恢复UI,提醒用户继续保... | https://gitcode.com/openharmony/arkui_ace_engine | 4f032481314fa7bc430ee690b8e955ab769e16ff | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | updateProfile | 更新用户资料(昵称和头像)
@param nickname 新昵称
@param avatarPath 新头像路径 | static async updateProfile(nickname: string, avatarPath: string): Promise<boolean> {
const session = await UserSessionService.getCurrentSession();
if (!session) {
console.error('[UserSessionService] 未登录,无法更新资料');
return false;
}
try {
await UserDAO.updateProfile(session.userId, nick... | 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 updateProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left nickname AST#identifier#Right AST#ERROR#Left AST#:#Left :... | static async updateProfile(nickname: string, avatarPath: string): Promise<boolean> {
const session = await UserSessionService.getCurrentSession();
if (!session) {
console.error('[UserSessionService] 未登录,无法更新资料');
return false;
}
try {
await UserDAO.updateProfile(session.userId, nick... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3f6492bfec6eacdd468956eebbc4962c897949ec | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getSimSpn | 获取指定卡槽SIM卡的服务提供商名称(Service Provider Name,SPN)。使用Promise异步回调。
@param slotId 卡槽ID(0-卡槽1、1-卡槽2)。 默认移动数据的SIM卡。
@returns | static async getSimSpn(slotId?: number): Promise<string> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //默认移动数据的SIM卡
return sim.getSimSpn(slotId);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getSimSpn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ? AST#?... | static async getSimSpn(slotId?: number): Promise<string> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //默认移动数据的SIM卡
return sim.getSimSpn(slotId);
} | https://github.com/tdcare/tdwebrtc | a600db328ff9286ea3c1af5586b43eb6c88b528a | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | constructor | The Duplex constructor. | constructor() {
super();
this._writable = new Writable();
this._writable.doWriteFunc = this.doWrite;
this._writable.doWritevFunc = this.doWritev;
} | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
super();
this._writable = new Writable();
this._writable.doWriteFunc = this.doWrite;
this._writable.doWritevFunc = this.doWritev;
} | https://gitcode.com/iop123123/arkts-static-skills | 594cd4dbbf080ca38a3b0802994b35cc5e27454e | gitcode |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/BillStatisticsUtil.ets | arkts | getCategoryPercentage | 获取分类占比 | static getCategoryPercentage(categoryAmount: number, totalAmount: number): string {
if (totalAmount === 0) {
return '0.00';
}
const percentage = (categoryAmount / totalAmount) * 100;
return percentage.toFixed(2);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCategoryPercentage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryAmount AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb... | static getCategoryPercentage(categoryAmount: number, totalAmount: number): string {
if (totalAmount === 0) {
return '0.00';
}
const percentage = (categoryAmount / totalAmount) * 100;
return percentage.toFixed(2);
} | https://github.com/qiuhaotc/HarmonyOSPlayground | 8b3b9d349453fa9bad43f73ed87f5425bbb937ce | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | save_data | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
外部函数 //
//////////
保存配置文件 // | save_data() {
if (this.global_config!.reset) {return}
if (this.writing) {return} else {this.writing = true}
// 保存播放列表 //
save_array(this.play_list, audio_player_path + '/play_list.json')
// 保存其他数据 //
save_array([
`${this.play_list_index}`, // 播放指针
`${this.current_time}`, //... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left save_data AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | save_data() {
if (this.global_config!.reset) {return}
if (this.writing) {return} else {this.writing = true}
// 保存播放列表 //
save_array(this.play_list, audio_player_path + '/play_list.json')
// 保存其他数据 //
save_array([
`${this.play_list_index}`, // 播放指针
`${this.current_time}`, //... | https://github.com/Nekofox-POT/LinMusic | e121b178b4be7a8b7007a08c909d483f317e2c72 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableObjectArray.ets | arkts | constructor | Constructs new empty UndefinableObjectArray
@syscap SystemCapability.Utils.Lang | constructor() {
this(UndefinableObjectArray.ArrayInitSize)
} | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this(UndefinableObjectArray.ArrayInitSize)
} | https://gitcode.com/iop123123/arkts-static-skills | 001152afc37cc171ea09e103fa096dbc04774b39 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Atomics.ets | arkts | fetchSub | Atomically subtracts the given value from the current value and returns the previous value.
This operation is performed as a single atomic action that cannot be interrupted by other threads.
@param { double } val - The value to subtract from the current atomic double value
@returns { double } The previous value before ... | public fetchSub(val: double): double {
let current: double = this.load();
let expected: double = 0;
do {
expected = current;
current = this.compareAndSwap(expected, expected - val);
} while(current != expected)
return expected;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fetchSub AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double A... | public fetchSub(val: double): double {
let current: double = this.load();
let expected: double = 0;
do {
expected = current;
current = this.compareAndSwap(expected, expected - val);
} while(current != expected)
return expected;
} | https://gitcode.com/iop123123/arkts-static-skills | bfac4db21f7f4d41e09e9a2bf9bfc3336045eb75 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | simpleHash | 简单哈希算法 | private simpleHash(str: string): string {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // 转换为32位整数
}
return Math.abs(hash).toString(36);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left simpleHash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | private simpleHash(str: string): string {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // 转换为32位整数
}
return Math.abs(hash).toString(36);
} | https://github.com/DaLongZhuaZi/manxia | c4e389eef1e8cb0cbb3aca0649d83cf72944915f | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPDriveManager.ets | arkts | copyToVMShared | 复制文件从宿主到 VM 共享目录 | public async copyToVMShared(vmName: string, sourcePath: string, targetFileName?: string): Promise<boolean> {
try {
const sharedPath = this.getVMSharedPath(vmName);
const fileName = targetFileName || this.getFileName(sourcePath);
const targetPath = `${sharedPath}/${fileName}`;
// 创建传... | 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 copyToVMShared AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : ... | public async copyToVMShared(vmName: string, sourcePath: string, targetFileName?: string): Promise<boolean> {
try {
const sharedPath = this.getVMSharedPath(vmName);
const fileName = targetFileName || this.getFileName(sourcePath);
const targetPath = `${sharedPath}/${fileName}`;
// 创建传... | https://github.com/AetheriumSimulator/qemu-hmos | 92698f0989fb0954fe778b0daeea7bd182e9d4f5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | reduce | Calls the specified callback function for all the elements in an array.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduce method calls the call... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint8Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = this.$_get(0).toDouble()
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint8Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = this.$_get(0).toDouble()
... | https://gitcode.com/iop123123/arkts-static-skills | 389601fcf92a4e8576f77ca627dc5d83489b5692 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | initCircleRadius | 设置悬浮球直径 | initCircleRadius(): void {
this.circleDiameter = this.getMinWidth();
// 获取半径
this.circleRadius = this.circleDiameter / 2;
this.circleOffsetX = this.circleRadius;
// 悬浮球 y 轴偏移直径的 三分之一
this.circleOffsetY = this.circleDiameter / 3;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initCircleRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | initCircleRadius(): void {
this.circleDiameter = this.getMinWidth();
// 获取半径
this.circleRadius = this.circleDiameter / 2;
this.circleOffsetX = this.circleRadius;
// 悬浮球 y 轴偏移直径的 三分之一
this.circleOffsetY = this.circleDiameter / 3;
} | https://gitcode.com/arkui-x/samples | de215041eb4f2ff9ef78c0241f1696859438ff80 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Char.ets | arkts | isDecDigit | isDecDigit() checks whether the char represents a decimal digit.
@param value a char to check.
@returns true if the char is a decimal digit. | public static isDecDigit(value: char): boolean {
let diff: int = value - c'0';
return (0 <= diff) && (diff <= 9);
} | 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 isDecDigit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public static isDecDigit(value: char): boolean {
let diff: int = value - c'0';
return (0 <= diff) && (diff <= 9);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e0d6bdbf035c6fdb7ef2175959f1f0019aedf144 | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/tree/index.ets | arkts | onCheckedChange | 子节点选中切换 | onCheckedChange(data: IBestTreeData, level: number, selected?: boolean, indeterminate?: boolean){
this.data.selected = this.data.children?.every(e => e.selected)
this.data.isIndeterminate = !this.data.selected && this.data.children!.some(e => e.selected || e.isIndeterminate)
this.onSelectCha... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCheckedChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IBestTreeData AST#identif... | onCheckedChange(data: IBestTreeData, level: number, selected?: boolean, indeterminate?: boolean){
this.data.selected = this.data.children?.every(e => e.selected)
this.data.isIndeterminate = !this.data.selected && this.data.children!.some(e => e.selected || e.isIndeterminate)
this.onSelectCha... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/tree/index.ets#L394-L398 | 86648dbde9edb1c6911a8779b2b7cb020bac790e | github |
openharmony-tpc/mp4parser | library/src/main/ets/mp4parser/MP4Parser.ets | arkts | videoMerge | Video synthesis
@param sourcePath
@param outPath
@param callBack | static videoMerge(filePath_one: string, filePath_two: string, outPath: string, callBack: ICallBack): void {
let fileCachePathCallBack: IFileCachePathCallBack = {
callBackResult(path: string) {
mp4parser_napi.exeFFmpegCmd("ffmpeg -y -f concat -safe 0 -i " + path + " -c copy " + outPath)
.th... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left videoMerge AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath_one AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | static videoMerge(filePath_one: string, filePath_two: string, outPath: string, callBack: ICallBack): void {
let fileCachePathCallBack: IFileCachePathCallBack = {
callBackResult(path: string) {
mp4parser_napi.exeFFmpegCmd("ffmpeg -y -f concat -safe 0 -i " + path + " -c copy " + outPath)
.th... | https://gitee.com/openharmony-tpc/mp4parser.git | aff0ccec85ad6d1f56a2cd4999cd2b8b17270216 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheConstants.ets | arkts | getOnlyCache | 获取是否仅使用本地缓存
@returns 是否仅使用缓存 | static getOnlyCache(): boolean {
return AppStorage.get<boolean>(CacheConstants.ONLY_CACHE_KEY) ?? false;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getOnlyCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#... | static getOnlyCache(): boolean {
return AppStorage.get<boolean>(CacheConstants.ONLY_CACHE_KEY) ?? false;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L162-L164 | 3a4f14a95237d7a3ffb05bafacda3f710486bbba | github |
who7708/harmonyos-codelabs | HmosWorld/commons/common/src/main/ets/service/datasource/network/agc/FuncNetwork.ets | arkts | getHomeResources | @returns NetworkNewsResources | public getHomeResources(): Promise<NetworkNewsResources> {
const params: UserIdParams = {
userId: (AppStorage.get<UserAccount>('user') as UserAccount)?.id
};
return new Promise((resolve: (value: NetworkNewsResources | PromiseLike<NetworkNewsResources>) => void,
reject: (reas... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHomeResources 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 getHomeResources(): Promise<NetworkNewsResources> {
const params: UserIdParams = {
userId: (AppStorage.get<UserAccount>('user') as UserAccount)?.id
};
return new Promise((resolve: (value: NetworkNewsResources | PromiseLike<NetworkNewsResources>) => void,
reject: (reas... | https://github.com/who7708/harmonyos-codelabs | 35dd576e526b73647f9ec14e0f596ff0cbb70d6c | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | ceil | Return a new Decimal whose value is `n` rounded to an integer using `ROUND_CEIL`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type | static ceil(n: Value): Decimal {
return new Decimal(n).ceil();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left ceil 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 ceil(n: Value): Decimal {
return new Decimal(n).ceil();
} | https://gitcode.com/iop123123/arkts-static-skills | ffe8a1f628f619f6096b79a5ab80ab5d87bc46d7 | gitcode |
ChangJing01/HarmonyOS-FinalProject | entry/src/main/ets/pages/ShoppingCartPage.ets | arkts | deleteItem | 删除单个物品 | deleteItem(id: number) {
this.cartItems = this.cartItems.filter(item => item.id !== id);
// 删除后重新判断全选状态
this.isAllSelected = this.cartItems.length > 0 ? this.cartItems.every(item => item.selected) : false;
this.calculateTotalPrice();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteItem 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 number AST#identifier#Right AST#... | deleteItem(id: number) {
this.cartItems = this.cartItems.filter(item => item.id !== id);
// 删除后重新判断全选状态
this.isAllSelected = this.cartItems.length > 0 ? this.cartItems.every(item => item.selected) : false;
this.calculateTotalPrice();
} | https://github.com/ChangJing01/HarmonyOS-FinalProject | 119dafbae80ee036c8ad5d17d89b41696051f848 | github |
zhangmeng1847/Preference | entry/src/main/ets/utils/MyPreferenceUtil.ets | arkts | deletePreferenceValue | 删除指定名称的preferences对象中存储的指定的key的数据 | async deletePreferenceValue(name: string, key: string){
if (!this.preferenceMap.has(name)) {
console.log('preferencesUtilTag', `Preferences[${name}]尚未初始化!`)
return
}
try {
let preference = this.preferenceMap.get(name)
// 读数据
if(preference.has(key)){
let value = await ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deletePreferenceValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Rig... | async deletePreferenceValue(name: string, key: string){
if (!this.preferenceMap.has(name)) {
console.log('preferencesUtilTag', `Preferences[${name}]尚未初始化!`)
return
}
try {
let preference = this.preferenceMap.get(name)
// 读数据
if(preference.has(key)){
let value = await ... | https://github.com/zhangmeng1847/Preference | 84591dd0a71a49d61d7f39788bc417215dfd2983 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableObjectArray.ets | arkts | popBack | Pops a value from the end of the List
@returns { UndefinableObject } Popped value
@throws { RangeError } When the array is empty, attempting to pop an element will throw this exception
@syscap SystemCapability.Utils.Lang | public popBack(): UndefinableObject {
if (this.curSize === 0) {
throw new RangeError("No data to popBack from UndefinableObjectArray!")
}
--this.curSize
return this.data[this.curSize]
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left popBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left UndefinableObj... | public popBack(): UndefinableObject {
if (this.curSize === 0) {
throw new RangeError("No data to popBack from UndefinableObjectArray!")
}
--this.curSize
return this.data[this.curSize]
} | https://gitcode.com/iop123123/arkts-static-skills | 4ec22e3908fb3862d04273b5f7bddd3b5c705d98 | gitcode |
daugf2527/harmonyos-libretro-emulator | entry/src/main/ets/common/LibraryMetadataMigration.ets | arkts | mergeMetadataIntoLibraryRecord | 合并 metadata 字段到 LibraryRecord
冲突解决:优先保留 LibraryRecord 中已有的非空值 | function mergeMetadataIntoLibraryRecord(
record: LibraryRecord,
metadata: GameMetadataRecord
): LibraryRecord {
const hasReleaseYear = record.releaseYear !== undefined && record.releaseYear > 0
const hasPublisher = record.publisher !== undefined && record.publisher.length > 0
// ArkTS 禁对象 spread(arkts-no-spr... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mergeMetadataIntoLibraryRecord AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left record AST#identifier#Right AST#type_annotation#Left AS... | function mergeMetadataIntoLibraryRecord(
record: LibraryRecord,
metadata: GameMetadataRecord
): LibraryRecord {
const hasReleaseYear = record.releaseYear !== undefined && record.releaseYear > 0
const hasPublisher = record.publisher !== undefined && record.publisher.length > 0
// ArkTS 禁对象 spread(arkts-no-spr... | https://github.com/daugf2527/harmonyos-libretro-emulator | 6af7f108616e3da2f44915bff9fd31192841ce10 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets | arkts | getXMin | returns the minimum x-value this DataSet holds
@return | getXMin(): number {
return 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getXMin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_bloc... | getXMin(): number {
return 0;
} | https://gitee.com/openharmony/developtools_profiler.git | 8d0c3f6287bbb62cd6e8f0fb603173113a30fa47 | gitee |
apap6628114/nga_oh | entry/src/main/ets/store/AppStore.ets | arkts | flushAll | 后台时刷盘 | async flushAll(): Promise<void> {
await this.writeQueue.enqueue(async (): Promise<void> => {})
await this.store.flush()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left flushAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async flushAll(): Promise<void> {
await this.writeQueue.enqueue(async (): Promise<void> => {})
await this.store.flush()
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AppStore.ets#L83-L86 | 4ec5511c3d7f0c20fe396f1db742c22faf26f0a9 | github |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets | arkts | callRingSnoozeCallBack | callRingSnoozeCallBack
@param state | private async callRingSnoozeCallBack(state: call.CallState): Promise<void> {
const isFiring = await AlarmStateManager.isFiring();
if (state === call.CallState.CALL_STATE_RINGING && isFiring) {
LogUtil.info(TAG, 'CALL_STATE_RINGING');
const alarmInfo: AlarmInfo = ((GlobalContext.getContext()
... | 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 callRingSnoozeCallBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST... | private async callRingSnoozeCallBack(state: call.CallState): Promise<void> {
const isFiring = await AlarmStateManager.isFiring();
if (state === call.CallState.CALL_STATE_RINGING && isFiring) {
LogUtil.info(TAG, 'CALL_STATE_RINGING');
const alarmInfo: AlarmInfo = ((GlobalContext.getContext()
... | https://gitee.com/openharmony-sig/applications_clock.git | fe5f39ade7a661192f011d18f43f377dd133c378 | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | updateDisplaySettings | Update display settings | updateDisplaySettings(width: number, height: number, bpp: number): void {
this.desktopWidth = width;
this.desktopHeight = height;
this.colorDepth = bpp;
console.info(`SessionState: Display settings updated: ${width}x${height}@${bpp}bpp`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateDisplaySettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,... | updateDisplaySettings(width: number, height: number, bpp: number): void {
this.desktopWidth = width;
this.desktopHeight = height;
this.colorDepth = bpp;
console.info(`SessionState: Display settings updated: ${width}x${height}@${bpp}bpp`);
} | https://github.com/tangwengang-del/freerdp-harmonyos | fd7eb75428e38a5e93c638ae2a473d700ceb1316 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/SettingsUtil.ets | arkts | getFamilyTokenSync | 同步获取家属Token | getFamilyTokenSync(): string {
if (this.dataPreferences === null) {
return '';
}
try {
const value: preferences.ValueType = this.dataPreferences.getSync('family_token', '');
return value as string;
} catch (e) {
console.error('SettingsUtil - get family token sync failed:', e);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFamilyTokenSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta... | getFamilyTokenSync(): string {
if (this.dataPreferences === null) {
return '';
}
try {
const value: preferences.ValueType = this.dataPreferences.getSync('family_token', '');
return value as string;
} catch (e) {
console.error('SettingsUtil - get family token sync failed:', e);
... | https://github.com/LJ666-ui/harmony-health-care | d49751764e2540bab590da2e7ab2d66ff07688a7 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/FTPHandler.ets | arkts | isClosed | 检查是否已关闭 | public isClosed(): boolean {
return !this.client;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isClosed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool... | public isClosed(): boolean {
return !this.client;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/FTPHandler.ets#L61-L63 | 84f80a55bf7daf51aeefec8a1c46847d07a54da8 | github |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/MusicDbApi.ets | arkts | getPlaylistSongItems | Resolves songs for a playlist in stored id order.
@param playlistId Playlist id.
@returns Song DTOs; empty if playlist is unknown. | public getPlaylistSongItems(playlistId: number): SongApiDto[] {
const playlist = this.store.playlists.find((playlistRow) => playlistRow.playlistId === playlistId);
if (playlist === undefined) {
return [];
}
const out: SongApiDto[] = [];
for (let index = 0; index < playlist.songIds.length; in... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPlaylistSongItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left playlistId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS... | public getPlaylistSongItems(playlistId: number): SongApiDto[] {
const playlist = this.store.playlists.find((playlistRow) => playlistRow.playlistId === playlistId);
if (playlist === undefined) {
return [];
}
const out: SongApiDto[] = [];
for (let index = 0; index < playlist.songIds.length; in... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 92b539ecb52263cf3f449093b30edf7779dd79a3 | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | moveCropRect | move crop rect.
@param offsetX
@param offsetY | moveCropRect(offsetX: number, offsetY: number) {
// crop rect in fixed mode
if (this.ratio.isValid()) {
this.moveInFixedMode(offsetX, offsetY);
} else {
this.moveInFreeMode(offsetX, offsetY);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left moveCropRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,... | moveCropRect(offsetX: number, offsetY: number) {
// crop rect in fixed mode
if (this.ratio.isValid()) {
this.moveInFixedMode(offsetX, offsetY);
} else {
this.moveInFreeMode(offsetX, offsetY);
}
} | https://gitee.com/openharmony/codelabs.git | 18a45136dcc66557b1da9be509ed23f0b514bd9e | gitee |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/utils/HttpClient.ets | arkts | setBaseUrl | 设置服务器地址 | setBaseUrl(url: string): void {
this.baseUrl = url;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBaseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | setBaseUrl(url: string): void {
this.baseUrl = url;
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 94998c3d03e781171faf88302f70bc3d817f3c51 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets | arkts | createTables | 创建数据表 | private async createTables(): Promise<void> {
if (!this.rdbStore) {
return
}
// 日程表
const createScheduleTable = `
CREATE TABLE IF NOT EXISTS ${AppConstants.TABLE_SCHEDULE} (
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
description TEXT,
startTime INTEGER NOT N... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left createTables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | private async createTables(): Promise<void> {
if (!this.rdbStore) {
return
}
// 日程表
const createScheduleTable = `
CREATE TABLE IF NOT EXISTS ${AppConstants.TABLE_SCHEDULE} (
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
description TEXT,
startTime INTEGER NOT N... | https://gitcode.com/openharmony/codelabs | 3c59f2e2e19027ee35f61428ebcd33710031ce70 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/RadarDataSet.ets | arkts | getHighlightCircleStrokeColor | / Returns the stroke color for highlight circle.
/ If Utils.COLOR_NONE, the color of the dataset is taken. | public getHighlightCircleStrokeColor(): number {
return this.mHighlightCircleStrokeColor;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHighlightCircleStrokeColor 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#L... | public getHighlightCircleStrokeColor(): number {
return this.mHighlightCircleStrokeColor;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ff01bce46ffa56174a968077c1202aaa8c035e89 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | cleanupExpiredCovers | 清理过期封面
@param daysToKeep 保留天数
@returns 清理的文件数量 | async cleanupExpiredCovers(daysToKeep: number = 30): Promise<number> {
try {
const cutoffTime = Date.now() - (daysToKeep * 24 * 60 * 60 * 1000);
const sql = `SELECT * FROM temp_manga_info WHERE lastAccessTime < ? AND localCoverPath IS NOT NULL`;
const records = await this.dbManager.querySql(sql,... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cleanupExpiredCovers AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left daysToKeep AST#identifier#Right AST#type_annotation#Left A... | async cleanupExpiredCovers(daysToKeep: number = 30): Promise<number> {
try {
const cutoffTime = Date.now() - (daysToKeep * 24 * 60 * 60 * 1000);
const sql = `SELECT * FROM temp_manga_info WHERE lastAccessTime < ? AND localCoverPath IS NOT NULL`;
const records = await this.dbManager.querySql(sql,... | https://github.com/DaLongZhuaZi/manxia | a887b51b69b9d07a2e7b53684622d8eefd804a6b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | hideStatusBar | 只隐藏状态栏,保留导航栏
@param uiContext 可选的UIContext,推荐在组件中传入 | static hideStatusBar(uiContext?: UIContext): void {
try {
const mainWindow = uiContext ?
WindowManager.getMainWindowFromUIContext(uiContext) :
WindowManager.getMainWindow();
if (!mainWindow) {
logger.error(WindowManager.TAG, '❌ 无法获取主窗口,隐藏状态栏失败');
return;
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hideStatusBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERRO... | static hideStatusBar(uiContext?: UIContext): void {
try {
const mainWindow = uiContext ?
WindowManager.getMainWindowFromUIContext(uiContext) :
WindowManager.getMainWindow();
if (!mainWindow) {
logger.error(WindowManager.TAG, '❌ 无法获取主窗口,隐藏状态栏失败');
return;
... | https://github.com/DaLongZhuaZi/manxia | 537c865473e61f480a65fc20678167a8f4ee5b4c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | restoreNovelSourcesFromFiles | 从legadoextensions目录恢复书源
使用NovelSourceManager的导入流程 | private async restoreNovelSourcesFromFiles(legadoDir: string): Promise<void> {
let importedCount = 0;
let failedCount = 0;
try {
const files = SafeFileUtils.listFileSync(legadoDir);
for (const file of files) {
if (!file.endsWith('.json')) continue;
const fi... | 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 restoreNovelSourcesFromFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left legadoDir AST#identifier#Right AST#ERRO... | private async restoreNovelSourcesFromFiles(legadoDir: string): Promise<void> {
let importedCount = 0;
let failedCount = 0;
try {
const files = SafeFileUtils.listFileSync(legadoDir);
for (const file of files) {
if (!file.endsWith('.json')) continue;
const fi... | https://github.com/DaLongZhuaZi/manxia | 671e33d8c021f80da1ca4916e639488932c11680 | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/view/OrderConfirmPage.ets | arkts | build | 构建订单确认页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.order_confirm"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset
}
}) {
this.PageContent();... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.order_confirm"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset
}
}) {
this.PageContent();... | https://github.com/Joker-x-dev/CoolMallArkTS | 9070f7388df7e95c03f10fb00c78ea1df184cf29 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets | arkts | constructor | Constructs a new error instance with provided message and cause
@param { String } [message] - Error text
@param { ErrorOptions } [options] - Error options
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(message?: String, options?: ErrorOptions) {
this("Error", 0, message, options)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
this("Error", 0, message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | aa43efad866fbedc12dc4a8f37fbadcda942329c | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | buffer | buffer
@returns { ArrayBuffer } get the dateview's arraybuffer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get buffer(): ArrayBuffer {
return this.buffer_
} | 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 buffer 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 buffer(): ArrayBuffer {
return this.buffer_
} | https://gitcode.com/iop123123/arkts-static-skills | 82b00b7b368ef109b1020ce4f5da4490fef01e4f | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/FamilyService.ets | arkts | loadRelations | 加载家属-患者关系 | private async loadRelations(): Promise<void> {
try {
const params: Record<string, string> = {
'familyId': this.currentFamilyId
};
const response = await HttpUtil.get<FamilyPatientRelation[]>('/family/relations', params);
if (response.success && response.data) {
respo... | 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 loadRelations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async loadRelations(): Promise<void> {
try {
const params: Record<string, string> = {
'familyId': this.currentFamilyId
};
const response = await HttpUtil.get<FamilyPatientRelation[]>('/family/relations', params);
if (response.success && response.data) {
respo... | https://github.com/LJ666-ui/harmony-health-care | 8b47c7d29401185c882cf553855761e0f44471b0 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleContent.ets | arkts | parseResponse | -- Response parsing -- | private parseResponse(body: string, density: number): ContentData | null {
let obj: Record<string, Object>;
try {
const parsed: Object = JSON.parse(body);
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) return null;
obj = parsed as Record<string, Object>;
} ca... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left body AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private parseResponse(body: string, density: number): ContentData | null {
let obj: Record<string, Object>;
try {
const parsed: Object = JSON.parse(body);
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) return null;
obj = parsed as Record<string, Object>;
} ca... | https://github.com/Countly/countly-sdk-hos | 35446d2fea158bdaf9cb7eb97a957db872026561 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/FavoriteViewModel.ets | arkts | loadFollowData | 加载关注 (支持全部/公开/隐藏) | async loadFollowData(isLoadMore: boolean = false) {
if (!isLoadMore && this.hasLoadedFollow && this.lastFilterIndex === this.filterIndex) return;
try {
const userId = PixState.currentUser?.id || 0;
let newData: UserPreview[] = [];
if (this.filterIndex === 0) {
const results = await ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadFollowData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isLoadMore AST#identifier#Righ... | async loadFollowData(isLoadMore: boolean = false) {
if (!isLoadMore && this.hasLoadedFollow && this.lastFilterIndex === this.filterIndex) return;
try {
const userId = PixState.currentUser?.id || 0;
let newData: UserPreview[] = [];
if (this.filterIndex === 0) {
const results = await ... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/FavoriteViewModel.ets#L231-L269 | 56bc13be3dcf53b3058db78710c1f36ebaab67bf | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/store/AppStore.ets | arkts | updateHealthStats | Action: 更新健康统计 | public updateHealthStats(stats: Partial<HealthStats>): void {
if (this.state.healthStats) {
const updatedStats: HealthStats = {
totalRecords: stats.totalRecords !== undefined ? stats.totalRecords : this.state.healthStats.totalRecords,
avgBloodPressure: stats.avgBloodPressure !== undefined ? ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateHealthStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stats AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation... | public updateHealthStats(stats: Partial<HealthStats>): void {
if (this.state.healthStats) {
const updatedStats: HealthStats = {
totalRecords: stats.totalRecords !== undefined ? stats.totalRecords : this.state.healthStats.totalRecords,
avgBloodPressure: stats.avgBloodPressure !== undefined ? ... | https://github.com/LJ666-ui/harmony-health-care | 6a29970588390a61415a105931d24c10cec957e3 | github |
the-wwyang/kids-learning-app | src/main/ets/services/DataBackupService.ets | arkts | collectBackupData | 收集备份数据 | private async collectBackupData(): Promise<BackupData> {
// 获取用户档案
const profile = profileService.getCurrentProfile();
// 获取用户数据
const userData = appStorage.getCurrentUser();
// 获取学习进度
const learningProgress = await appStorage.getAllLearningProgress();
// 获取成就数据
const achievements =... | 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 collectBackupData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async collectBackupData(): Promise<BackupData> {
// 获取用户档案
const profile = profileService.getCurrentProfile();
// 获取用户数据
const userData = appStorage.getCurrentUser();
// 获取学习进度
const learningProgress = await appStorage.getAllLearningProgress();
// 获取成就数据
const achievements =... | https://github.com/the-wwyang/kids-learning-app | 8c0e118d7fd5e2adc268dab72fdba5ddf437845e | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheConstants.ets | arkts | listCacheFiles | 列出缓存目录中的所有文件
@param cacheDir 缓存目录路径
@returns 文件路径列表 | private static listCacheFiles(cacheDir: string): string[] {
const files: string[] = [];
try {
const entries = fs.listFileSync(cacheDir);
for (const entry of entries) {
files.push(cacheDir + '/' + entry);
}
} catch {
// 目录不存在或无法读取
}
return files;
} | 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 listCacheFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheDir AST#identifier#Right AST#ERROR#Left AST#:#L... | private static listCacheFiles(cacheDir: string): string[] {
const files: string[] = [];
try {
const entries = fs.listFileSync(cacheDir);
for (const entry of entries) {
files.push(cacheDir + '/' + entry);
}
} catch {
// 目录不存在或无法读取
}
return files;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L136-L147 | 8b9e07e1fde0bfc06eecaf86063f880f596a7770 | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | notBetween | 设置单个字段的 NOT BETWEEN 条件
@param field 字段
@param start 起始值
@param end 结束值
@returns Wrapper | notBetween(field: string, start: relationalStore.ValueType, end: relationalStore.ValueType,
condition: boolean = true): Wrapper {
if (condition) {
this.whereList.push(`and ${field} not between ? and ?`)
this.valueList.push(start)
this.valueList.push(end)
}
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notBetween AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | notBetween(field: string, start: relationalStore.ValueType, end: relationalStore.ValueType,
condition: boolean = true): Wrapper {
if (condition) {
this.whereList.push(`and ${field} not between ? and ?`)
this.valueList.push(start)
this.valueList.push(end)
}
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L172-L180 | 524630c236f03433ffd6102bb3140d56c64cc827 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/Node.ets | arkts | rawText | 设置原始文本内容(子类需要重写) | set rawText(_val: string) {
// 子类实现
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left rawText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left _val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identi... | set rawText(_val: string) {
// 子类实现
} | https://github.com/DaLongZhuaZi/manxia | bef2e211ba75aa0cea84b74846cec04cbfda3be2 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/mock/smartwardMock_realdata.ets | arkts | generateRoom301 | 获取301病房完整数据(包含8台设备和患者信息) | public generateRoom301(): SmartWardRoom {
return {
roomId: 'ROOM_301',
roomNumber: '301',
bedId: 'BED_301_B1',
patientInfo: this.getPatient201(),
devices: this.generateDevices301(),
environmentData: this.getEnvironment301(),
lastUpdated: Date.now()
};
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateRoom301 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left SmartW... | public generateRoom301(): SmartWardRoom {
return {
roomId: 'ROOM_301',
roomNumber: '301',
bedId: 'BED_301_B1',
patientInfo: this.getPatient201(),
devices: this.generateDevices301(),
environmentData: this.getEnvironment301(),
lastUpdated: Date.now()
};
} | https://github.com/LJ666-ui/harmony-health-care | 026c07b735b979bbd2456bb3b730d4056410f586 | github |
wly5556/S1-Orange | entry/src/main/ets/common/component/ImageContainer.ets | arkts | resize | @param componentWidth 单位px | resize(componentWidth: number) {
if (!this.imgSize) {
return
}
let resizeTo: RectSize
if (this.constrainSize) { // 限制高度的情况下contain fit
if (this.lastConstrainSizeWidth == this.constrainSize.w) {
return
}
this.lastConstrainSizeWidth = this.constrainSize.w
const cont... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#... | resize(componentWidth: number) {
if (!this.imgSize) {
return
}
let resizeTo: RectSize
if (this.constrainSize) { // 限制高度的情况下contain fit
if (this.lastConstrainSizeWidth == this.constrainSize.w) {
return
}
this.lastConstrainSizeWidth = this.constrainSize.w
const cont... | https://github.com/wly5556/S1-Orange | b7e4514a7a9816ba94dd6711b35028f2560a039b | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets | arkts | update | update
@param valueBucket
@param predicates
@param callback | update(valueBucket: relationalStore.ValuesBucket, predicates: relationalStore.RdbPredicates,
callback: Callback<number> | null) {
if (!rdbStore) {
return;
}
rdbStore!.update(valueBucket, predicates).then((affectedRowCount: number) => {
LogUtil.info(TAG, "update success, affectedRowCou... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left valueBucket AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left ... | update(valueBucket: relationalStore.ValuesBucket, predicates: relationalStore.RdbPredicates,
callback: Callback<number> | null) {
if (!rdbStore) {
return;
}
rdbStore!.update(valueBucket, predicates).then((affectedRowCount: number) => {
LogUtil.info(TAG, "update success, affectedRowCou... | https://gitee.com/openharmony/applications_notes.git | 23a9dbea5314f8153c994744dbc4e9e9fbae71e7 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | isSet | Check whether the entered value is of type set.
@param { Object } value - A Set instance value
@returns { boolean } Returns true if the value is a built-in Set instance. | isSet(value: Object): boolean {
return value instanceof Set;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST#identifier#Right AST#)#Left ) AST#)#Ri... | isSet(value: Object): boolean {
return value instanceof Set;
} | https://gitcode.com/iop123123/arkts-static-skills | fd83f0b2f5716a24bbcda50066919fd37d3db196 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.