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 |
|---|---|---|---|---|---|---|---|---|---|---|
LYM15/FireflyCompanion | entry/src/main/ets/utils/httpCore/http.ets | arkts | delete | 封装delete方法 | delete<T>(url: string, data?: object): Promise<ApiResponse<T>> {
return instance.delete<null, ApiResponse<T>>(url, data)
} | AST#program#Left AST#ERROR#Left AST#delete#Left delete AST#delete#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#>#Right AST#type_parameters#Right AST#formal_parameters#Left AST#(#Left ( AST#(... | delete<T>(url: string, data?: object): Promise<ApiResponse<T>> {
return instance.delete<null, ApiResponse<T>>(url, data)
} | https://github.com/LYM15/FireflyCompanion | a3b1ceb01be1646e3dcfbc625d9398e92e263c31 | github |
HarmonyOS_Samples/sample_in_harmonyos | features/devpractices/src/main/ets/model/ImageModel.ets | arkts | evaluateCenter | Calculates the percentage position of the current zoom center relative to the picture | evaluateCenter(centerX: number, centerY: number): [number, number] {
let imgDisplayWidth = this.imageWidth * this.lastScale;
let imgDisplayHeight = this.imageHeight * this.lastScale;
let imgX = (this.componentWidth - imgDisplayWidth) / 2 + this.lastOffsetX;
let imgY = (this.componentHeight - imgDispla... | AST#program#Left AST#expression_statement#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left evaluateCenter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left centerX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | evaluateCenter(centerX: number, centerY: number): [number, number] {
let imgDisplayWidth = this.imageWidth * this.lastScale;
let imgDisplayHeight = this.imageHeight * this.lastScale;
let imgX = (this.componentWidth - imgDisplayWidth) / 2 + this.lastOffsetX;
let imgY = (this.componentHeight - imgDispla... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 44a7b9de268e5b09f357a69f3ab700c4213e6ae0 | gitcode |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/Logger.ets | arkts | createTaggedLogger | 创建带特定标签的日志器 | public createTaggedLogger(tag: string): TaggedLogger {
return new TaggedLogger(this, tag);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createTaggedLogger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public createTaggedLogger(tag: string): TaggedLogger {
return new TaggedLogger(this, tag);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | e758ee3443f8483576bb17d29cf2dc04994413fd | gitcode |
azhu0001/localsend-harmony | entry/src/main/ets/utils/FileProvider.ets | arkts | isTransferringNow | @returns true: 正在处理文件传输请求 | static isTransferringNow(): boolean {
return AppStorage.get(Keys.CURRENTLY_TRANSFERRING_STATUS) || false
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isTransferringNow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean... | static isTransferringNow(): boolean {
return AppStorage.get(Keys.CURRENTLY_TRANSFERRING_STATUS) || false
} | https://gitcode.com/azhu0001/localsend-harmony | 01989a301ae288c78dd4376e1aee732cfdec183e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | isLoading | 检查页面是否正在加载 | isLoading(pageIndex: number): boolean {
return this.loading.has(pageIndex);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri... | isLoading(pageIndex: number): boolean {
return this.loading.has(pageIndex);
} | https://github.com/DaLongZhuaZi/manxia | c79a3eb2e45fa9f8e3894a1b9ce52e246cebe53b | github |
Delsin-Yu/JustPDF | entry/src/main/ets/components/PageInfo.ets | arkts | clearPreviewLruSlot | 预览光栅被释放时同步 LRU(由 PageInfo 全量淘汰等路径调用) | public clearPreviewLruSlot(pageIndex: number | undefined): void {
if (pageIndex === undefined || pageIndex < 0 || pageIndex >= this.pages.length) {
return;
}
this.removePreviewLru(pageIndex);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearPreviewLruSlot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ... | public clearPreviewLruSlot(pageIndex: number | undefined): void {
if (pageIndex === undefined || pageIndex < 0 || pageIndex >= this.pages.length) {
return;
}
this.removePreviewLru(pageIndex);
} | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L914-L919 | e067a3fb08dfef98631cf51b839e625b56e6a108 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AssistantService.ets | arkts | createAssistant | ============================================================================
写操作
============================================================================ | async createAssistant(assistant: Assistant): Promise<Assistant> {
await this.store.ensureAssistantsInitialized()
this.normalizeAssistant(assistant)
if (assistant.id === '') {
assistant.id = `assistant_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`
}
await this.store.upsertAssis... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createAssistant AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left assistant AST#identifier#Right AST#type_annotation#Left AST#:#L... | async createAssistant(assistant: Assistant): Promise<Assistant> {
await this.store.ensureAssistantsInitialized()
this.normalizeAssistant(assistant)
if (assistant.id === '') {
assistant.id = `assistant_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`
}
await this.store.upsertAssis... | https://github.com/LongLiveY96/chatcube | f394feafac9e2fa64d305ab5dcb506cbf29e6264 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test7_original_index.ets | arkts | testNullish | --- Nullish coalescing --- | function testNullish(a: number | undefined, b: string | undefined): string {
let x: number = a ?? 42;
let y: string = b ?? 'default';
return String(x) + ':' + y;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNullish AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A... | function testNullish(a: number | undefined, b: string | undefined): string {
let x: number = a ?? 42;
let y: string = b ?? 'default';
return String(x) + ':' + y;
} | https://github.com/miaochiahao/ark-ghidra | 8901b16c1f07ddedd531d8c196dd772dd378cb53 | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | isConnected | 是否已连接 | public get isConnected(): boolean {
return this.client?.isConnected() ?? false;
} | 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 isConnected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left... | public get isConnected(): boolean {
return this.client?.isConnected() ?? false;
} | https://github.com/tdcare/tdwebrtc | ae8249bed965399c1c609d38bbcfc985bd0cd1ca | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | equals | Checks if this BigInt is equal to another BigInt.
@param { BigInt } to The BigInt to compare with.
@returns { boolean } True if equal, false otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public equals(to: BigInt): boolean {
if (this.bytes.length != to.bytes.length) {
return false
}
if (this.sign != to.sign) {
return false
}
for (let i = 0; i < this.bytes.length; i++) {
if (this.bytes[i] != to.bytes[i]) {
ret... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left to AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BigInt AST#... | public equals(to: BigInt): boolean {
if (this.bytes.length != to.bytes.length) {
return false
}
if (this.sign != to.sign) {
return false
}
for (let i = 0; i < this.bytes.length; i++) {
if (this.bytes[i] != to.bytes[i]) {
ret... | https://gitcode.com/iop123123/arkts-static-skills | 995118f68cc1c8ec91c4adf38a2b43d9aae378c9 | gitcode |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | audioCodec | 设置音频编码器 | public audioCodec(codec: string): FFmpegCommandBuilder {
this.aCodec = codec;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left audioCodec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left codec AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | public audioCodec(codec: string): FFmpegCommandBuilder {
this.aCodec = codec;
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools | d12154fd8110ae7977009ca08486d85cfaaeadfe | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/FTPStorage.ets | arkts | read | 读取文件内容 | public async read(path: string): Promise<ArrayBuffer> {
const config = this.config;
try {
const fullPath = this.getFullPath(path);
const tempDir = CommonUtils.getContext().cacheDir;
const tempFilePath = tempDir + '/temp_' + Date.now() + '.tmp';
try {
const handler = await this... | 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 read AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right ... | public async read(path: string): Promise<ArrayBuffer> {
const config = this.config;
try {
const fullPath = this.getFullPath(path);
const tempDir = CommonUtils.getContext().cacheDir;
const tempFilePath = tempDir + '/temp_' + Date.now() + '.tmp';
try {
const handler = await this... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/FTPStorage.ets#L136-L171 | 71e295757f0e2b30d7909cc7a7d1c96ae199549d | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | readUint8Array | Reads the next array of unsigned bytes.
@param byteLength The byte length.
@returns The value. | readUint8Array(byteLength?: number): Uint8Array {
const value = this.getUint8Array(this.mByteOffset, byteLength)
this.mByteOffset += value.byteLength
return value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteLength AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ER... | readUint8Array(byteLength?: number): Uint8Array {
const value = this.getUint8Array(this.mByteOffset, byteLength)
this.mByteOffset += value.byteLength
return value
} | https://gitee.com/openharmony-sig/flutter_engine.git | 95693a2c172710462d23876b7d72c1460daeb7f2 | gitee |
iichen-bycode/ArkTsWanandroid | entry/src/main/ets/view/ViewStateComponent.ets | arkts | convertImage | 转换图片
@returns | convertImage() {
switch (this.viewState) {
case ViewStateConstant.VIEW_STATE_LOADING:
return $r('app.media.loading')
break;
case ViewStateConstant.VIEW_STATE_ERROR:
return $r('app.media.icon_net_error')
break;
case ViewStateConstant.VIEW_STATE_NETWORK_ERROR:
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left convertImage 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 ... | convertImage() {
switch (this.viewState) {
case ViewStateConstant.VIEW_STATE_LOADING:
return $r('app.media.loading')
break;
case ViewStateConstant.VIEW_STATE_ERROR:
return $r('app.media.icon_net_error')
break;
case ViewStateConstant.VIEW_STATE_NETWORK_ERROR:
... | https://github.com/iichen-bycode/ArkTsWanandroid | 5f7cad79481486c94fb6f07bf33b4a53c31faa47 | github |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/utils/NotificationUtil.ets | arkts | publishAlarmReminder | Send a notification after the alarm starts | static async publishAlarmReminder(alarmId: number | string, alarmTime: number, alarmTitle: string): Promise<void> {
if (!alarmTime) {
LogUtil.info(TAG, `alarmTime is diabled value is: ${alarmTime}`);
return;
}
const content = TimeUtil.getFormattedTime(alarmTime);
LogUtil.info(TAG, 'publis... | 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 publishAlarmReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmId AST#identifier#Right AST#:#... | static async publishAlarmReminder(alarmId: number | string, alarmTime: number, alarmTitle: string): Promise<void> {
if (!alarmTime) {
LogUtil.info(TAG, `alarmTime is diabled value is: ${alarmTime}`);
return;
}
const content = TimeUtil.getFormattedTime(alarmTime);
LogUtil.info(TAG, 'publis... | https://gitee.com/openharmony-sig/applications_clock.git | d92cb813d35757c1449961531688ec717b848cdc | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | replaceUrl | 替换页面
@param options
@param mode
@returns | public static replaceUrl(options: router.RouterOptions, mode?: router.RouterMode,): Promise<void> {
if (CommonUtils.uiContext) {
return CommonUtils.uiContext.getRouter().replaceUrl(options, mode).catch((error: Error) => {
hilog.error(DOMAIN, TAG, `uiContext replaceUrl error: ${error?.message}`);
... | 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 replaceUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AS... | public static replaceUrl(options: router.RouterOptions, mode?: router.RouterMode,): Promise<void> {
if (CommonUtils.uiContext) {
return CommonUtils.uiContext.getRouter().replaceUrl(options, mode).catch((error: Error) => {
hilog.error(DOMAIN, TAG, `uiContext replaceUrl error: ${error?.message}`);
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L164-L175 | 572b34c20b2125d3658517a4a62a41422b5e41c8 | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/SearchVM.ets | arkts | run | 单次搜索调用;上层捕获 ApiError 自行决定弹窗。 | static async run(options: SearchOptions): Promise<SearchPage> {
Logger.i(TAG, `search: q=${options.message} page=${options.page} order=${options.order}`);
const page: SearchPage = await ZLibraryClient.instance.search(options);
return page;
} | 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 run AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Righ... | static async run(options: SearchOptions): Promise<SearchPage> {
Logger.i(TAG, `search: q=${options.message} page=${options.page} order=${options.order}`);
const page: SearchPage = await ZLibraryClient.instance.search(options);
return page;
} | https://github.com/LZZLHY/hlib | e32c6c2ffd0b59bb8f89441bd9999a83ba586794 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/SFTPHandler.ets | arkts | downloadFrom | 下载文件到本地(支持大文件分块下载) | public async downloadFrom(remotePath: string, localPath: string): Promise<void> {
try {
hilog.info(DOMAIN, TAG, `Starting download: ${remotePath} -> ${localPath}`);
// 获取文件大小
const fileInfo = await this.getFileInfo(remotePath);
const fileSize = fileInfo.size;
hilog.info(DOMAIN, TAG... | 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 downloadFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left remotePath AST#identifier#Right AST#ERROR#Left AST#:#Left ... | public async downloadFrom(remotePath: string, localPath: string): Promise<void> {
try {
hilog.info(DOMAIN, TAG, `Starting download: ${remotePath} -> ${localPath}`);
// 获取文件大小
const fileInfo = await this.getFileInfo(remotePath);
const fileSize = fileInfo.size;
hilog.info(DOMAIN, TAG... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/SFTPHandler.ets#L220-L258 | 3b8c95def86e8cb66698cc288c381c57ddabf2b2 | github |
xiebyapps/ClipLink | entry/src/main/ets/services/SyncClipboardService.ets | arkts | uploadHistoryRecord | Upload new history record | async uploadHistoryRecord(record: HistoryRecordDto): Promise<HistoryRecordDto> {
const fields: MultipartField[] = [
{ key: 'hash', value: record.hash },
{ key: 'type', value: record.type }
];
if (record.text) {
fields.push({ key: 'text', value: record.text });
}
if (record.create... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left uploadHistoryRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left record AST#identifier#Right AST#type_annotation#Left AST#:#... | async uploadHistoryRecord(record: HistoryRecordDto): Promise<HistoryRecordDto> {
const fields: MultipartField[] = [
{ key: 'hash', value: record.hash },
{ key: 'type', value: record.type }
];
if (record.text) {
fields.push({ key: 'text', value: record.text });
}
if (record.create... | https://github.com/xiebyapps/ClipLink | f6fcba32298e072046eb091f6d283346ba3283dc | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/CrashRecorderService.ets | arkts | ensureCrashLogsDir | 确保崩溃日志目录存在 | private ensureCrashLogsDir(): void {
if (!this.crashLogsDir) {
return;
}
try {
const exists = SafeFileUtils.accessSync(this.crashLogsDir);
if (exists) {
return;
}
} catch (_) {
// ignore and try to create
}
try {
SafeFileUtils.mkdirSync(this.crashL... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureCrashLogsDir 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 A... | private ensureCrashLogsDir(): void {
if (!this.crashLogsDir) {
return;
}
try {
const exists = SafeFileUtils.accessSync(this.crashLogsDir);
if (exists) {
return;
}
} catch (_) {
// ignore and try to create
}
try {
SafeFileUtils.mkdirSync(this.crashL... | https://github.com/DaLongZhuaZi/manxia | 69f09fa1c590300997d4a499ed992a156a27d059 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/AppColors.ets | arkts | divider | ==================== 特殊用途 ==================== | static get divider(): string { return getColorForCurrentTheme(ColorRole.DIVIDER); } | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left divider AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A... | static get divider(): string { return getColorForCurrentTheme(ColorRole.DIVIDER); } | https://github.com/DaLongZhuaZi/manxia | 5c446c706e73880faf6a8bae6a55556fcd511817 | github |
Dige945/EmoCollector | entry/src/main/ets/model/DBManager.ets | arkts | initDB | 初始化数据库
创建数据库文件并建表
@param context 应用上下文(用于获取数据库路径) | public async initDB(context: common.Context): Promise<void> {
try {
// 配置数据库参数
const config: relationalStore.StoreConfig = {
name: this.DB_NAME,
securityLevel: relationalStore.SecurityLevel.S1 // S1 为公开级别
};
// 创建或打开数据库
this.rdbStore = await relationalStore.getRdbSto... | 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 initDB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#R... | public async initDB(context: common.Context): Promise<void> {
try {
// 配置数据库参数
const config: relationalStore.StoreConfig = {
name: this.DB_NAME,
securityLevel: relationalStore.SecurityLevel.S1 // S1 为公开级别
};
// 创建或打开数据库
this.rdbStore = await relationalStore.getRdbSto... | https://github.com/Dige945/EmoCollector | 434fb2fe45767818ea3b7ab6bc4cc7d8fd1d8aa7 | github |
codelably/HCompass | core/network/src/main/ets/NetworkResult.ets | arkts | constructor | 构造函数
@param rawResponse 原始响应数据
@param parser 响应解析器 | constructor(rawResponse: Unknown, parser?: ResponseParser<T>) {
const responseParser = parser ?? new DefaultResponseParser<T>();
this.rawResponse = rawResponse;
this.isSuccess = responseParser.isSuccess(rawResponse);
this.data = responseParser.getData(rawResponse);
this.message = responseParser.g... | 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 rawResponse AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Unknown AST#identifier#Right AST#ERROR... | constructor(rawResponse: Unknown, parser?: ResponseParser<T>) {
const responseParser = parser ?? new DefaultResponseParser<T>();
this.rawResponse = rawResponse;
this.isSuccess = responseParser.isSuccess(rawResponse);
this.data = responseParser.getData(rawResponse);
this.message = responseParser.g... | https://github.com/codelably/HCompass | 783b9e3f403df9675a61cd530b5b2e802d1e6b2d | github |
bhengubv/aether-protocol | harmonyos/teal/entry/src/main/ets/service/NearLinkTransportService.ets | arkts | stopServer | Stop the SSAP peripheral server and disconnect all connected clients. | stopServer(): void {
const server = this._server;
this._server = undefined;
this._connectedClients.clear();
if (server === undefined) {
return;
}
try {
// [VERIFY] server.close() — mirrors ble.GattServer.close().
server.close(); // [VERIFY] method name
hilog.info(DOMA... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopServer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | stopServer(): void {
const server = this._server;
this._server = undefined;
this._connectedClients.clear();
if (server === undefined) {
return;
}
try {
// [VERIFY] server.close() — mirrors ble.GattServer.close().
server.close(); // [VERIFY] method name
hilog.info(DOMA... | https://github.com/bhengubv/aether-protocol | 432c7a8e123d7b3babb5db66d959c7ebd4d1a843 | github |
aimilin6688/KeePassHO | entry/src/main/ets/pages/setting/Settings.ets | arkts | <arrow> | 分享完成回调 - 用户真正完成分享后才触发 | async () => {
hilog.info(DOMAIN, TAG, 'Crash log shared successfully, clearing logs');
// 分享成功后清除崩溃日志
await CrashLogService.getInstance().clearCrashLog();
this.hasCrashLog = false;
}, | AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#async#Left async AST#async#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#=>#Left => AST#=>#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#call_expre... | async () => {
hilog.info(DOMAIN, TAG, 'Crash log shared successfully, clearing logs');
// 分享成功后清除崩溃日志
await CrashLogService.getInstance().clearCrashLog();
this.hasCrashLog = false;
}, | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/pages/setting/Settings.ets#L63-L68 | c67c25b0fb779847d3476dfe069fbe11ecbc3004 | github |
erosTeam/NextE | shared/src/main/ets/settings/CustomProfilesSettings.ets | arkts | setSelected | Set the active tab and persist the selection. | static async setSelected(context: common.UIAbilityContext, uuid: string): Promise<void> {
connectCustomProfiles().selectedUuid = uuid
try {
await CustomProfilesRepository.saveSelected(context, uuid)
SyncScheduler.requestAfterLocalWrite(context, 'custom_profile_selection')
} catch (error) {
... | 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 setSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AS... | static async setSelected(context: common.UIAbilityContext, uuid: string): Promise<void> {
connectCustomProfiles().selectedUuid = uuid
try {
await CustomProfilesRepository.saveSelected(context, uuid)
SyncScheduler.requestAfterLocalWrite(context, 'custom_profile_selection')
} catch (error) {
... | https://github.com/erosTeam/NextE | 0e0948046ff6c025a9282ff2eda6cc085925654c | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | deleteDetail | Delete | deleteDetail() {
if (this.mmsList.length == 1) {
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_con_tip3');
} else {
this.hasDetailDelete = false;
this.isSelectStatus = true;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteDetail 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 ... | deleteDetail() {
if (this.mmsList.length == 1) {
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_con_tip3');
} else {
this.hasDetailDelete = false;
this.isSelectStatus = true;
}
} | https://gitee.com/openharmony/applications_mms.git | 0f58b10690455b02d44ed622e10e71d639af1c72 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/settings/classes/meowSettingsEntry.ets | arkts | valueToString | Converts the value to a string.
@returns The string representation in JSON compatible style of the value. Returns empty if the value is undefined. | private valueToString() {
if (this.value === undefined) {
return '';
}
switch (this.type) {
case meowSettingsEntryType.NUMBER:
return this.value?.toString() || '0';
case meowSettingsEntryType.STRING:
return escapeForJson(this.value?.toString()) || '';
case meowSetti... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left valueToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Lef... | private valueToString() {
if (this.value === undefined) {
return '';
}
switch (this.type) {
case meowSettingsEntryType.NUMBER:
return this.value?.toString() || '0';
case meowSettingsEntryType.STRING:
return escapeForJson(this.value?.toString()) || '';
case meowSetti... | https://github.com/awaLiny2333/LinysBrowser_NEXT | ce146d240a3471d71a89567cf4c02c424bc1806a | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | setBitrate | 动态调整码率
@param bitrateKbps 目标码率(kbps)
@returns 是否成功 | async setBitrate(bitrateKbps: number): Promise<boolean> {
try {
const url = this.buildUrl(await this.getHttpsBaseUrl(), 'bitrate', `bitrate=${bitrateKbps}`);
// 使用客户端证书
const response = await this.doRequest(url, { useClientCert: true });
const result = XmlUtil.getValue(response, 'bitrate')... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setBitrate AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bitrateKbps AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async setBitrate(bitrateKbps: number): Promise<boolean> {
try {
const url = this.buildUrl(await this.getHttpsBaseUrl(), 'bitrate', `bitrate=${bitrateKbps}`);
// 使用客户端证书
const response = await this.doRequest(url, { useClientCert: true });
const result = XmlUtil.getValue(response, 'bitrate')... | https://github.com/AlkaidLab/moonlight-harmony | caf4d8fc0cd4f03c4d38fa5cd65e79857e89f768 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | setLongOptPrefix | Sets the 'longOptPrefix'.
@param prefix the new value of 'longOptPrefix' | public setLongOptPrefix(prefix:string):void {
this.defaultLongOptPrefix = prefix;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLongOptPrefix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left prefix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | public setLongOptPrefix(prefix:string):void {
this.defaultLongOptPrefix = prefix;
} | https://gitee.com/openharmony-sig/commons-cli.git | 0f8deef8758bc15b48c6476803bdc77dfb1367c0 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | removeStateChangeListener | 移除状态变更监听器 | public removeStateChangeListener(listener: (event: LoadingStateChangeEvent) => void): void {
const index = this.stateChangeListeners.indexOf(listener);
if (index > -1) {
this.stateChangeListeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left removeStateChangeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#... | public removeStateChangeListener(listener: (event: LoadingStateChangeEvent) => void): void {
const index = this.stateChangeListeners.indexOf(listener);
if (index > -1) {
this.stateChangeListeners.splice(index, 1);
}
} | https://github.com/DaLongZhuaZi/manxia | c537d15f3b3c81345f2dbda5f45b2557a91e7046 | github |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/navdestination/AppNavDestination.ets | arkts | aboutToBeDeleted | 页面销毁时的生命周期回调
@returns {void} 无返回值 | aboutToBeDeleted(): void {
this.viewModel.aboutToBeDeleted();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToBeDeleted 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... | aboutToBeDeleted(): void {
this.viewModel.aboutToBeDeleted();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 55ce6614492e607714eea9cbd7830f56ec399336 | github |
CLMC2025/Vignette | entry/src/main/ets/manager/ReviewTimeManager.ets | arkts | startReview | 开始复习计时 | startReview(word: WordItem): ReviewTimeRecord | null {
const wordKey = `${word.id}_${word.word}`;
const now = Date.now();
// 检查是否已有活动的复习记录
if (this.activeReviews.has(wordKey)) {
const existingRecord = this.activeReviews.get(wordKey)!;
if (existingRecord.status === 'active') {
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left startReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Wo... | startReview(word: WordItem): ReviewTimeRecord | null {
const wordKey = `${word.id}_${word.word}`;
const now = Date.now();
// 检查是否已有活动的复习记录
if (this.activeReviews.has(wordKey)) {
const existingRecord = this.activeReviews.get(wordKey)!;
if (existingRecord.status === 'active') {
... | https://github.com/CLMC2025/Vignette | b5e6e5d45b9d31fea0f6a108d536668536e8f8b5 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toSignificantDigits | Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits`
significant digits using rounding mode `rounding`.
@param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
@param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
... | public toSignificantDigits(significantDigits: double, rounding: Rounding): Decimal {
Utils.checkInt32(significantDigits, 1, MAX_DIGITS);
Utils.checkInt32(rounding, 0, 8);
return Utils.finalise(new Decimal(this), significantDigits, rounding);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSignificantDigits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left significantDigits AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left... | public toSignificantDigits(significantDigits: double, rounding: Rounding): Decimal {
Utils.checkInt32(significantDigits, 1, MAX_DIGITS);
Utils.checkInt32(rounding, 0, 8);
return Utils.finalise(new Decimal(this), significantDigits, rounding);
} | https://gitcode.com/iop123123/arkts-static-skills | 1b5fe7e432771d75f6d810ba95fde8370f4dba3d | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/PodcastService.ets | arkts | searchPodcasts | 搜索播客
@param keyword 搜索关键词
@param offset 偏移量(iTunes API 不支持,保留为兼容)
@param limit 每页数量(默认50,最大200) | async searchPodcasts(keyword: string, offset: number = 0, limit: number = 50): Promise<Podcast[]> {
// iTunes Search API 不支持 offset 分页,只支持 limit
// 如果 offset > 0,返回空数组表示没有更多
if (offset > 0) {
return [];
}
const searchUrl = `https://itunes.apple.com/search?term=${encodeURIComponent(keywo... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchPodcasts AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async searchPodcasts(keyword: string, offset: number = 0, limit: number = 50): Promise<Podcast[]> {
// iTunes Search API 不支持 offset 分页,只支持 limit
// 如果 offset > 0,返回空数组表示没有更多
if (offset > 0) {
return [];
}
const searchUrl = `https://itunes.apple.com/search?term=${encodeURIComponent(keywo... | https://github.com/pangpang20/antennaPodHM | 71cfb15773cffe2e9540f9d224ca77b4dd230242 | github |
hefengbao/jingmo-for-HarmonyOS | commons/utils/src/main/ets/data/DbUtil.ets | arkts | getObjectiveRDB | init(context: Context) {
relationalStore.getRdbStore(context, DbConfigConst.STORE_CONFIG,
(error: BusinessError, rdbStore: relationalStore.RdbStore) => {
this.objectiveRDB = rdbStore
if (!this.objectiveRDB) {
this.objectiveRDB = rdbStore;
}
let storeVersion: number = rdbStore.version;
if (error) {
this.logger.error(`Ge... | async getObjectiveRDB(context: Context): Promise<relationalStore.RdbStore>{
let dmImpl: relationalStore.RdbStore | undefined = undefined
try {
dmImpl = await relationalStore.getRdbStore(context, DbConfigConst.STORE_CONFIG);
if (!this.objectiveRDB) {
this.objectiveRDB = dmImpl;
}
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getObjectiveRDB AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left ... | async getObjectiveRDB(context: Context): Promise<relationalStore.RdbStore>{
let dmImpl: relationalStore.RdbStore | undefined = undefined
try {
dmImpl = await relationalStore.getRdbStore(context, DbConfigConst.STORE_CONFIG);
if (!this.objectiveRDB) {
this.objectiveRDB = dmImpl;
}
... | https://github.com/hefengbao/jingmo-for-HarmonyOS | caac30fc2afe6451e556a1f95c27a59a98987f83 | github |
arkui-x/samples | CodeLab/Cases/feature/eraser/src/main/ets/model/RenderNodeModel.ets | arkts | draw | RenderNode进行绘制时会调用draw方法 | draw(context: DrawContext): void {
const canvas = context.canvas;
// 设置画笔的颜色混合模式,根据不同的混合模式实现涂鸦和擦除效果
this.pen.setBlendMode(this.blendMode);
// 设置画笔的线宽,单位px
this.pen.setStrokeWidth(this.lineStrokeWidth);
// 将Pen画笔设置到canvas中
canvas.attachPen(this.pen);
// 绘制path
canvas.drawPath(this.p... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left draw 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 DrawContext AST#identifier#Right AST#)#Left ) AS... | draw(context: DrawContext): void {
const canvas = context.canvas;
// 设置画笔的颜色混合模式,根据不同的混合模式实现涂鸦和擦除效果
this.pen.setBlendMode(this.blendMode);
// 设置画笔的线宽,单位px
this.pen.setStrokeWidth(this.lineStrokeWidth);
// 将Pen画笔设置到canvas中
canvas.attachPen(this.pen);
// 绘制path
canvas.drawPath(this.p... | https://gitcode.com/arkui-x/samples | 3534a23753b88ffa71671994a09094e49afe32a2 | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/carInput/index.ets | arkts | getIsFocus | 当前输入框是否聚焦 | getIsFocus(){
return this.isHighlightCurrent && this.focused && this.space && this.currentFocusIndex == this.index
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getIsFocus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | getIsFocus(){
return this.isHighlightCurrent && this.focused && this.space && this.currentFocusIndex == this.index
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/carInput/index.ets#L219-L221 | 73a66b67b887c17dec9a1a12a487a99003c3a58c | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/BillManager.ets | arkts | resolveCategoryIconKey | 从分类列表中解析账单展示应使用的图标键。 | private static resolveCategoryIconKey(categoryName: string, type: string, categories: CategoryBean[]): string {
for (let index = 0; index < categories.length; index++) {
const category: CategoryBean = categories[index];
if (category.name === categoryName && category.type === type) {
return cat... | 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 resolveCategoryIconKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryName AST#identifier#Right AST#ERROR#... | private static resolveCategoryIconKey(categoryName: string, type: string, categories: CategoryBean[]): string {
for (let index = 0; index < categories.length; index++) {
const category: CategoryBean = categories[index];
if (category.name === categoryName && category.type === type) {
return cat... | https://github.com/ZestBox-18/kitebook-frontend | 881930da7932529219dc758f6a1a1b94ba08820b | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/FolderUtil.ets | arkts | getNoteCount | Get Note Count
@param noteDataArray
@param folderUuid
@return number - Note Count | getNoteCount(noteDataArray: NoteData[], folderUuid: string): number {
let count = 0;
const folderTextMap: Record<string, (noteData: NoteData) => void> = {
"sys_def_allNotes_uuid": (noteData: NoteData) => {
noteData.is_deleted == Delete.No ? ++count : count;
},
"sys_def_recentDeletes_... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNoteCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left noteDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NoteData AST#identifier#Right AST#[#Left [ AST#[#R... | getNoteCount(noteDataArray: NoteData[], folderUuid: string): number {
let count = 0;
const folderTextMap: Record<string, (noteData: NoteData) => void> = {
"sys_def_allNotes_uuid": (noteData: NoteData) => {
noteData.is_deleted == Delete.No ? ++count : count;
},
"sys_def_recentDeletes_... | https://gitee.com/openharmony/applications_notes.git | f0a963f950ebdbc7482c0cc5795dea7693ff5bf4 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets | arkts | getInstanceMethod | Look up a instance method (including default methods from implemented interfaces) among the methods
declared in the class.
@param { string } name The method name to search for.
@param { FixedArray<Class> | undefined } [ signature ] Array of parameter classes defining the method signature.
@returns { reflect.InstanceMet... | public getInstanceMethod(name: string, signature?: FixedArray<Class>): reflect.InstanceMethod | undefined {
return this.getInstanceMethodInternal(name, signature, true)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInstanceMethod 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#Lef... | public getInstanceMethod(name: string, signature?: FixedArray<Class>): reflect.InstanceMethod | undefined {
return this.getInstanceMethodInternal(name, signature, true)
} | https://gitcode.com/iop123123/arkts-static-skills | 5ff532b7857d2d3103da7815f14b261a5a3d48c3 | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | getSurface | Returns the specified surface | public getSurface(surfaceId: string): Surface | null {
return this._surfaces.get(surfaceId) ?? null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSurface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | public getSurface(surfaceId: string): Surface | null {
return this._surfaces.get(surfaceId) ?? null;
} | https://github.com/AGenUI/AGenUI | 76709e3f8f3c79a6e43a6819271bd27017164883 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new StringIndexOutOfBoundsError instance with provided message and error specific information
@param { String | undefined } message - Error text
@param { ErrorOptions | undefined } options - Error options
@syscap SystemCapability.Utils.Lang | constructor(message?: String, options?: ErrorOptions) {
super(message, options)
this.name = "StringIndexOutOfBoundsError"
} | 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) {
super(message, options)
this.name = "StringIndexOutOfBoundsError"
} | https://gitcode.com/iop123123/arkts-static-skills | f4a14f5ae8c72722a3238e185c445fb02f8db74d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | removeCustomFont | 删除自定义字体 | async removeCustomFont(fontId: string): Promise<void> {
const index = this.customFonts.findIndex(f => f.id === fontId);
if (index === -1) {
throw new Error('字体不存在');
}
const customFont = this.customFonts[index];
// 检查是否正在使用
const isAppUsing = this.settings.appFontType === FontType.... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeCustomFont AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fontId AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async removeCustomFont(fontId: string): Promise<void> {
const index = this.customFonts.findIndex(f => f.id === fontId);
if (index === -1) {
throw new Error('字体不存在');
}
const customFont = this.customFonts[index];
// 检查是否正在使用
const isAppUsing = this.settings.appFontType === FontType.... | https://github.com/DaLongZhuaZi/manxia | d38575b7ea715b14a0028aa86824856f58a77a89 | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/viewmodels/SettingsViewModel.ets | arkts | parseDayOverrides | Parses day overrides from a JSON string. | private parseDayOverrides(json: string): DayOverride[] {
if (json.length === 0) {
return []
}
try {
const arr: object[] = JSON.parse(json) as object[]
const result: DayOverride[] = []
for (const item of arr) {
const obj = item as Record<string, Object>
const overrid... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseDayOverrides AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private parseDayOverrides(json: string): DayOverride[] {
if (json.length === 0) {
return []
}
try {
const arr: object[] = JSON.parse(json) as object[]
const result: DayOverride[] = []
for (const item of arr) {
const obj = item as Record<string, Object>
const overrid... | https://github.com/OMGCA/sakipay | b9d01a84c4e7abbeceb26327d021a54f04b334c8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | of | Returns a new array from a set of elements.
@param { FixedArray<number> } items - a set of elements to include in the new array object.
@returns { Int16Array } - a new Int16Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(...items: FixedArray<number>): Int16Array {
let res = new Int16Array(items.length.toInt())
res.ofNumber(stub.toValueArray(items))
return res
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR... | public static of(...items: FixedArray<number>): Int16Array {
let res = new Int16Array(items.length.toInt())
res.ofNumber(stub.toValueArray(items))
return res
} | https://gitcode.com/iop123123/arkts-static-skills | e09331cbf0cf7e1aa37b0362781db2265311312b | gitcode |
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 startPos to endPos.
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
@param { int } start - start inde... | public copyWithin(target: int, start: int, end?: int): Float64Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let coun... | 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, start: int, end?: int): Float64Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let coun... | https://gitcode.com/iop123123/arkts-static-skills | f9a6e119559794e6460adbbebc6d0567c9ff01b3 | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/MediaInfoApi.ets | arkts | closeLiveStream | closeLiveStream
@summary Closes a media source.
@param {MediaInfoApiCloseLiveStreamRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof MediaInfoApi | public async closeLiveStream(requestParameters: MediaInfoApiCloseLiveStreamRequest): Promise<void> {
return this.apiClient.post({path: "/LiveStreams/Close", parameters: requestParameters})
} | 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 closeLiveStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right A... | public async closeLiveStream(requestParameters: MediaInfoApiCloseLiveStreamRequest): Promise<void> {
return this.apiClient.post({path: "/LiveStreams/Close", parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | c3999102c4144449a4124ce12ea3c34796b56457 | github |
somnio-software/my-bot-pal | entry/src/main/ets/utils/VibratorManager.ets | arkts | triggerCustomVibration | Trigger a custom vibration from a configuration file
@param config - Custom vibration configuration | static async triggerCustomVibration(
config: CustomVibrationConfig
): Promise<void> {
return new Promise((resolve, reject) => {
try {
// Get file descriptor for the custom vibration config
let rawFd: resourceManager.RawFileDescriptor =
getContext().resourceManager.getRawFdSyn... | 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 triggerCustomVibration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:... | static async triggerCustomVibration(
config: CustomVibrationConfig
): Promise<void> {
return new Promise((resolve, reject) => {
try {
// Get file descriptor for the custom vibration config
let rawFd: resourceManager.RawFileDescriptor =
getContext().resourceManager.getRawFdSyn... | https://github.com/somnio-software/my-bot-pal | 322338a8526aa94427689372238249c38dd9c203 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | parseDateFromString | The `parseDateFromString()` static method parses a string representation of a date,
and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC
or throws `RangeError` if the string is unrecognized or, in some cases,
contains illegal date values (e.g. 2015-02-31).
Only the @link{https://tc39.es/ecma262/#s... | private static parseDateFromString(dateStr: String): long {
if (!Date.isIsoDate(dateStr)) {
const parser = new LegacyDateParser(dateStr)
const parsedDate = parser.parseDate()
if (parsedDate === INVALID_DATE) {
throw new FormatError(`Invalid time value: '${... | 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 parseDateFromString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateStr AST#identifier#Right AST#ERROR#Left AST... | private static parseDateFromString(dateStr: String): long {
if (!Date.isIsoDate(dateStr)) {
const parser = new LegacyDateParser(dateStr)
const parsedDate = parser.parseDate()
if (parsedDate === INVALID_DATE) {
throw new FormatError(`Invalid time value: '${... | https://gitcode.com/iop123123/arkts-static-skills | ca2a59a89f4506a7f3bb7717cb14ba49f1488fdd | gitcode |
openharmony-sig/applications_clock | feature/timer/src/main/ets/controller/TimerController.ets | arkts | start | Timer start | public async start() {
LogUtil.info(`${TAG} timer start `);
this.startTimestamp = new Date().getTime();
if (this.notifierId != -1) {
clearInterval(this.notifierId);
this.notifierId = -1;
}
if (this.beforePauseTime > 0) {
this.notifyTimeChanges();
}
this.notifierId = setIn... | 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 start AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Righ... | public async start() {
LogUtil.info(`${TAG} timer start `);
this.startTimestamp = new Date().getTime();
if (this.notifierId != -1) {
clearInterval(this.notifierId);
this.notifierId = -1;
}
if (this.beforePauseTime > 0) {
this.notifyTimeChanges();
}
this.notifierId = setIn... | https://gitee.com/openharmony-sig/applications_clock.git | bf531020d7d4ffcbcfc8959dbcf4efab31f27c1d | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | stopListening | 停止监听陀螺仪 | private stopListening(): void {
if (!this.sensorListening) return;
this.sensorService.setMotionEventState(LI_MOTION_TYPE_GYRO, 0);
this.sensorListening = false;
this.holdActive = false;
this.gyroStickX = 0;
this.gyroStickY = 0;
console.info('[GyroAssist] 体感助手已停止');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopListening 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#vo... | private stopListening(): void {
if (!this.sensorListening) return;
this.sensorService.setMotionEventState(LI_MOTION_TYPE_GYRO, 0);
this.sensorListening = false;
this.holdActive = false;
this.gyroStickX = 0;
this.gyroStickY = 0;
console.info('[GyroAssist] 体感助手已停止');
} | https://github.com/AlkaidLab/moonlight-harmony | b204874c2e3562b7ec46d891e59a61f1e1dcf617 | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets | arkts | getMetadata | Get metadata from a target | static getMetadata(metadataKey: string, target: Object, propertyKey?: string | symbol): any {
const targetKey = target.constructor.name + (propertyKey ? ':' + String(propertyKey) : '');
if (!this.metadataMap.has(targetKey)) {
return undefined;
}
const targetMetadata = this.metadataMap.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left metadataKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | static getMetadata(metadataKey: string, target: Object, propertyKey?: string | symbol): any {
const targetKey = target.constructor.name + (propertyKey ? ':' + String(propertyKey) : '');
if (!this.metadataMap.has(targetKey)) {
return undefined;
}
const targetMetadata = this.metadataMap.... | https://github.com/killetom/ktretrofit | 93482594aec19c556bf209814d048963101a8a80 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | fetchUserInfo | 获取个人积分,需要登录后访问
https://www.wanandroid.com/lg/coin/userinfo/json
@returns | public fetchUserInfo(): Promise<AxiosResponse<IWanCommonResponse<IUserInfo>>> {
return this.getRequest("/user/lg/userinfo/json")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fetchUserInfo 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#expressi... | public fetchUserInfo(): Promise<AxiosResponse<IWanCommonResponse<IUserInfo>>> {
return this.getRequest("/user/lg/userinfo/json")
} | https://github.com/RedRackham-R/WanAndroidHarmoney | 7dc926586e8d23d289bc639585bccd9c7df268da | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSourceExecutor.ets | arkts | getPages | 获取章节页面 | public async getPages(chapterId: string): Promise<PageInfo[]> {
try {
const cached = this.pagesCache.get(chapterId);
if (cached && this.isCacheValid(cached.timestamp, PAGES_CACHE_TTL_MS)) {
logger.debug(TAG, `Suwayomi 页面缓存命中: chapterId=${chapterId}, count=${cached.pages.length}`);
retu... | 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 getPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | public async getPages(chapterId: string): Promise<PageInfo[]> {
try {
const cached = this.pagesCache.get(chapterId);
if (cached && this.isCacheValid(cached.timestamp, PAGES_CACHE_TTL_MS)) {
logger.debug(TAG, `Suwayomi 页面缓存命中: chapterId=${chapterId}, count=${cached.pages.length}`);
retu... | https://github.com/DaLongZhuaZi/manxia | 11a15632c6df8e9971139b5b83ab106a220a7ea3 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets | arkts | getCurrentRecordingDuration | 获取当前录音时长 | getCurrentRecordingDuration(): number {
return this.recordingDuration
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentRecordingDuration 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#Righ... | getCurrentRecordingDuration(): number {
return this.recordingDuration
} | https://gitcode.com/openharmony/codelabs | 16023c41f187371444eb25199c859dfede45d184 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ArkUI/PureTabsExt/entry/src/main/ets/view/OutTabComponent.ets | arkts | build | [EndExclude tabs_clip] | build() {
Column() {
// [Start tabs_blur_style]
Tabs({
// [StartExclude tabs_blur_style]
// [StartExclude tabs_clip]
barPosition: BarPosition.End,
index: this.currentIndex,
controller: this.controller,
// [EndExclude tabs_clip]
barModifier: this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
// [Start tabs_blur_style]
Tabs({
// [StartExclude tabs_blur_style]
// [StartExclude tabs_clip]
barPosition: BarPosition.End,
index: this.currentIndex,
controller: this.controller,
// [EndExclude tabs_clip]
barModifier: this.... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | a165211c29b9485a404317fb76a5b3742eb85228 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/mock/smartwardMock_realdata.ets | arkts | getInstance | 获取真实数据生成器单例实例 | public static getInstance(): RealDataGenerator {
if (!RealDataGenerator.instance) {
RealDataGenerator.instance = new RealDataGenerator();
}
return RealDataGenerator.instance;
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): RealDataGenerator {
if (!RealDataGenerator.instance) {
RealDataGenerator.instance = new RealDataGenerator();
}
return RealDataGenerator.instance;
} | https://github.com/LJ666-ui/harmony-health-care | 63b315033f1015463078762148dd0059d043f7fe | github |
openharmony/security_privacy_center | entry/src/main/ets/common/utils/HiSysEventUtil.ets | arkts | reportClick | Click on the interface to operate the dots
@param eventName Event Name
@param params parameter | static async reportClick(eventName: string, params: Record<string, string | number>): Promise<void> {
let versionName: string = await GetSelfBundleInfoUtils.getVersionName();
params['PNAMEID'] = HiSysEventConstant.BUNDLE_NAME;
params['PVERSIONID'] = versionName;
let eventParams: Record<string, string ... | 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 reportClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async reportClick(eventName: string, params: Record<string, string | number>): Promise<void> {
let versionName: string = await GetSelfBundleInfoUtils.getVersionName();
params['PNAMEID'] = HiSysEventConstant.BUNDLE_NAME;
params['PVERSIONID'] = versionName;
let eventParams: Record<string, string ... | https://gitee.com/openharmony/security_privacy_center.git | fe46db3485cc2a4af35f15749e0fe2efeed89701 | gitee |
Joker-x-dev/CoolMallArkTS | feature/cs/src/main/ets/view/ChatPage.ets | arkts | build | 构建客服聊天页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "客服聊天",
viewModel: this.vm
}) {
this.ChatContent();
}
} | 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: "客服聊天",
viewModel: this.vm
}) {
this.ChatContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | 3a6fd1f5eabcccebb56cf4fc808160702b311a1c | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveClient.ets | arkts | updateOptions | 更新客户端配置
@param options 客户端配置选项 | public updateOptions(options: OneDriveClientOptions): void {
this.config = options;
const headers: Record<string, string> = {
'Accept': 'application/json',
'Content-Type': 'application/json'
};
if (options.accessToken) {
headers['Authorization'] = `Bearer ${options.accessToken}`;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public updateOptions(options: OneDriveClientOptions): void {
this.config = options;
const headers: Record<string, string> = {
'Accept': 'application/json',
'Content-Type': 'application/json'
};
if (options.accessToken) {
headers['Authorization'] = `Bearer ${options.accessToken}`;
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L164-L179 | c20fb4c770bad86cf7f13fa1428dbc145a4d4133 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets | arkts | initCanvas | 初始化Canvas上下文 | public initCanvas(context: CanvasRenderingContext2D, width: number, height: number): void {
this.renderingContext = context;
this.canvasWidth = width;
this.canvasHeight = height;
logger.debug(TAG, `Canvas初始化: ${width}x${height}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initCanvas 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 Ca... | public initCanvas(context: CanvasRenderingContext2D, width: number, height: number): void {
this.renderingContext = context;
this.canvasWidth = width;
this.canvasHeight = height;
logger.debug(TAG, `Canvas初始化: ${width}x${height}`);
} | https://github.com/DaLongZhuaZi/manxia | bb3c2bcbfa4453438feb7a4a51755daf24aa4678 | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | registerTextStyle | ==================== Style Registration + Highlight Spans ==================== | registerTextStyle(styleId: number, color: number,
backgroundColorOrFontStyle: number, fontStyle?: number): EditorActionResult {
const backgroundColor = fontStyle === undefined ? 0 : backgroundColorOrFontStyle;
const resolvedFontStyle = fontStyle === undefined ? backgroundColorOrFontStyle :... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerTextStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left styleId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AS... | registerTextStyle(styleId: number, color: number,
backgroundColorOrFontStyle: number, fontStyle?: number): EditorActionResult {
const backgroundColor = fontStyle === undefined ? 0 : backgroundColorOrFontStyle;
const resolvedFontStyle = fontStyle === undefined ? backgroundColorOrFontStyle :... | https://github.com/FinalScave/SweetEditor | 9ea2f9e3ddc3b62cd42712cc28a0acce586f9b3d | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/BarLineChartTouchListener.ets | arkts | spacing | returns the distance between two pointer touch points
@param event
@return | private static spacing(isTouchEvent: boolean, event: TouchEvent | GestureEvent): number {
let x: number = 0;
let y: number = 0;
if (isTouchEvent) {
event = event as TouchEvent;
if (!event.touches || event.touches.length < 2 || !event.touches[0] || !event.touches[1]) {
return 0;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left spacing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Left... | private static spacing(isTouchEvent: boolean, event: TouchEvent | GestureEvent): number {
let x: number = 0;
let y: number = 0;
if (isTouchEvent) {
event = event as TouchEvent;
if (!event.touches || event.touches.length < 2 || !event.touches[0] || !event.touches[1]) {
return 0;
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | fc28ff9e62f8e087f7fe5d3f2d7609a2ebb72b73 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | equals | Checks if this BigInt is equal to another value.
@param { Any } other The value to compare with.
@returns { boolean } true if the value is a BigInt and equal to this BigInt, false otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | equals(other: Any): boolean {
if (!(other instanceof BigInt)) {
return false
}
return this.equals(other as BigInt)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Any AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ... | equals(other: Any): boolean {
if (!(other instanceof BigInt)) {
return false
}
return this.equals(other as BigInt)
} | https://gitcode.com/iop123123/arkts-static-skills | 8d01c0bda2af63d4345e757439835dcd1c91bdf8 | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/viewmodel/BaseHomeViewModel.ets | arkts | getState | 获取状态
@returns T | public getState(): T {
return this.state
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getState 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 T AST#identif... | public getState(): T {
return this.state
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 08b5d28ebcec50e62a7ecdf737f0e6d60f7a1537 | gitcode |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/ListOnWillStopDragging/OnWillStopDragging.ets | arkts | isShortNews | 判断当前新闻是否为短新闻 | isShortNews(currentIndex: number): boolean {
return this.newsData[currentIndex].type === 'short';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isShortNews AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST... | isShortNews(currentIndex: number): boolean {
return this.newsData[currentIndex].type === 'short';
} | https://gitee.com/openharmony/arkui_ace_engine.git | 789340fb5077062d315bfc2f42947d563955a5c2 | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/PageViewModel.ets | arkts | getUnSelectAll | Do not select all data. | getUnSelectAll(checkList: Array<ListItemData>): Array<ListItemData> {
checkList.forEach((item: ListItemData) => {
item.checked = false;
});
return checkList;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUnSelectAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left checkList AST#identifier#Right AST#ERROR... | getUnSelectAll(checkList: Array<ListItemData>): Array<ListItemData> {
checkList.forEach((item: ListItemData) => {
item.checked = false;
});
return checkList;
} | https://gitee.com/harmonyos/codelabs.git | ee9594aacbe9ab9392c9d5cbe15bc03574dede14 | gitee |
HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | entry/src/main/ets/utils/Logger.ets | arkts | warn | Outputs warning-level logs
@param format format Indicates the log format string
@param args args Indicates the log parameters | warn(format: string, ...args: Object[]): void {
hilog.warn(this.domain, this.prefix, format, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left warn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Ri... | warn(format: string, ...args: Object[]): void {
hilog.warn(this.domain, this.prefix, format, args);
} | https://gitcode.com/HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | a1288cdd2778e749e7362253134a5b2de3b7e698 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | findLast | Finds the last element in the BigUint64Array that satisfies the condition
@param fn condition
@returns the last element that satisfies fn | public findLast(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): BigInt {
for (let i = this.length - 1; i >= 0; --i) {
let val = this.at(i)
if (fn(val, i, this)) {
return val
}
}
throw new Error("BigUint64Array.findLast: no... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | public findLast(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): BigInt {
for (let i = this.length - 1; i >= 0; --i) {
let val = this.at(i)
if (fn(val, i, this)) {
return val
}
}
throw new Error("BigUint64Array.findLast: no... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 069d30e218bea603ee358630eb25ff7e45d73407 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/NotificationManager.ets | arkts | getNotificationId | 根据任务ID生成通知ID | private getNotificationId(taskId: string): number {
// 同一任务必须稳定映射到同一通知 ID,才能用完成/失败通知覆盖进度通知。
let hash = 0;
for (let i = 0; i < taskId.length; i++) {
const char = taskId.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // Convert to 32bit integer
}
return TASK... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNotificationId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private getNotificationId(taskId: string): number {
// 同一任务必须稳定映射到同一通知 ID,才能用完成/失败通知覆盖进度通知。
let hash = 0;
for (let i = 0; i < taskId.length; i++) {
const char = taskId.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // Convert to 32bit integer
}
return TASK... | https://github.com/DaLongZhuaZi/manxia | 643fe0a336710e767410b8ba1f821dbea8db45ea | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SessionManager.ets | arkts | stopSessionRefresh | 停止会话刷新 | stopSessionRefresh(sourceId: number): void {
const timerId = this.refreshTimers.get(sourceId);
if (timerId) {
clearInterval(timerId);
this.refreshTimers.delete(sourceId);
logger.info(TAG, `停止会话刷新: sourceId=${sourceId}`);
}
// 更新状态
const state = this.sessionStates.get(sourceId);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopSessionRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) ... | stopSessionRefresh(sourceId: number): void {
const timerId = this.refreshTimers.get(sourceId);
if (timerId) {
clearInterval(timerId);
this.refreshTimers.delete(sourceId);
logger.info(TAG, `停止会话刷新: sourceId=${sourceId}`);
}
// 更新状态
const state = this.sessionStates.get(sourceId);
... | https://github.com/DaLongZhuaZi/manxia | 6c309830b19d22cb43dd560a4475b1780bafd78f | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | compressPNG | PNG 压缩 - 使用 HarmonyOS image API | private async compressPNG(data: ArrayBuffer): Promise<ArrayBuffer> {
try {
// 尝试使用 HarmonyOS image API
const imageSource = image.createImageSource(data)
const pixelMap = await imageSource.createPixelMap()
// 创建 ImagePacker 并压缩
const imagePacker = image.createImagePacker()
... | 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 compressPNG AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AS... | private async compressPNG(data: ArrayBuffer): Promise<ArrayBuffer> {
try {
// 尝试使用 HarmonyOS image API
const imageSource = image.createImageSource(data)
const pixelMap = await imageSource.createPixelMap()
// 创建 ImagePacker 并压缩
const imagePacker = image.createImagePacker()
... | https://github.com/AetheriumSimulator/qemu-hmos | 9ea6cdd1bbb7c27fd71610df5c61ed98930999a9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets | arkts | saveCategories | 保存分类列表 | private async saveCategories(): Promise<void> {
try {
// 检查SettingsManager是否已初始化
if (!this.settingsManager.isInitialized()) {
logger.warn(TAG, '跳过保存分类:SettingsManager未初始化');
return;
}
await this.settingsManager.setString(CATEGORIES_KEY, JSON.stringify(this.categories));
... | 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 saveCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async saveCategories(): Promise<void> {
try {
// 检查SettingsManager是否已初始化
if (!this.settingsManager.isInitialized()) {
logger.warn(TAG, '跳过保存分类:SettingsManager未初始化');
return;
}
await this.settingsManager.setString(CATEGORIES_KEY, JSON.stringify(this.categories));
... | https://github.com/DaLongZhuaZi/manxia | 34818d5e76eb249272ebb491fc108aa3710c23ec | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | equals | equals(Object) compares two Chars by their underlying primitive chars. Returns false if the argument
is not an instance of Char.
@param { Any } other a reference to object to be compared with.
@returns { boolean }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public equals(other: Any): boolean {
if (this === other) {
return true
}
if (!(other instanceof Char)) {
return false
}
return this.value == (other as Char).value
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Any AST#identifier#Right... | public equals(other: Any): boolean {
if (this === other) {
return true
}
if (!(other instanceof Char)) {
return false
}
return this.value == (other as Char).value
} | https://gitcode.com/iop123123/arkts-static-skills | 2ff0743e5a25bf68979a9a613c7d2e9e29192dcf | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets | arkts | executeCloudflareBypass | 执行Cloudflare绕过操作 | private async executeCloudflareBypass(action: CloudflareBypassAction, context: ActionContext): Promise<boolean> {
logger.info(TAG, `绕过Cloudflare: ${action.method}, maxWaitTime: ${action.maxWaitTime}`);
const result = await this.antiCrawler.bypassCloudflare(action.method, action.maxWaitTime);
return resul... | 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 executeCloudflareBypass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right A... | private async executeCloudflareBypass(action: CloudflareBypassAction, context: ActionContext): Promise<boolean> {
logger.info(TAG, `绕过Cloudflare: ${action.method}, maxWaitTime: ${action.maxWaitTime}`);
const result = await this.antiCrawler.bypassCloudflare(action.method, action.maxWaitTime);
return resul... | https://github.com/DaLongZhuaZi/manxia | d6de9e350c2b301abc3e253d7d2dd979c627f370 | github |
OpenHarmonyPCDeveloper/GitNext | entry/src/main/ets/utils/DebounceSingletonUtil.ets | arkts | constructor | 操作状态锁,true=正在执行 | private constructor() {
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ... | private constructor() {
} | https://gitcode.com/OpenHarmonyPCDeveloper/GitNext | 7aebe197ed47d4fca68595a7b9e96e30268261a6 | gitcode |
HarmonyOS_Samples/sample_in_harmonyos | features/devpractices/src/main/ets/model/ImageModel.ets | arkts | gestureEnd | Pan gestures callback during movement. | gestureEnd(): void {
this.lastScale = this.curScale;
this.lastOffsetX = this.curOffsetX;
this.lastOffsetY = this.curOffsetY;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left gestureEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | gestureEnd(): void {
this.lastScale = this.curScale;
this.lastOffsetX = this.curOffsetX;
this.lastOffsetY = this.curOffsetY;
} | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 94c26a12397e449969904a5fc52e175d211961a1 | gitcode |
openharmony/codelabs | Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets | arkts | insertUser | Save the encrypted user information to the database.
@param encryptPassword Ciphertext.
@param authTag GCM authTag. | insertUser(encryptPassword: string, authTag: string) {
let user = new User(null, this.username, encryptPassword, authTag);
this.userTableApi.insertUserData(user);
PromptUtil.promptMessage($r('app.string.message_register_success'), CommonConstants.PROMPT_TIME);
// After the registration is successful, ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left insertUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encryptPassword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right... | insertUser(encryptPassword: string, authTag: string) {
let user = new User(null, this.username, encryptPassword, authTag);
this.userTableApi.insertUserData(user);
PromptUtil.promptMessage($r('app.string.message_register_success'), CommonConstants.PROMPT_TIME);
// After the registration is successful, ... | https://gitee.com/openharmony/codelabs.git | 91d4ec5160ef2fa6290867b74e1d21b62ffe3ee4 | gitee |
kumaleap/ArkLuban | library/src/main/ets/luban/Luban.ets | arkts | compressSingleFile | 压缩单个文件
@param sourcePath 源文件路径
@param targetDir 目标目录
@returns 压缩结果 | private async compressSingleFile(sourcePath: string, targetDir: string): Promise<CompressResult> {
let processedSourcePath = sourcePath;
let shouldCleanTemp = false;
try {
// 预处理图片文件(处理 URI 权限问题)
const preprocessed = await LubanUtils.preprocessImageFileWithCleanup(sourcePath);
processed... | 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 compressSingleFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERROR#Left AS... | private async compressSingleFile(sourcePath: string, targetDir: string): Promise<CompressResult> {
let processedSourcePath = sourcePath;
let shouldCleanTemp = false;
try {
// 预处理图片文件(处理 URI 权限问题)
const preprocessed = await LubanUtils.preprocessImageFileWithCleanup(sourcePath);
processed... | https://github.com/kumaleap/ArkLuban | 5eb24b656b7d0943efffe2db94864c998d7b272c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | byteLength | byteLength
@returns { int } return the dateview's length
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get byteLength(): int {
return this.byteLength_
} | 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 byteLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ... | public get byteLength(): int {
return this.byteLength_
} | https://gitcode.com/iop123123/arkts-static-skills | c292308c825aef59eda4f8a8a2e1682396466987 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | of | Returns Type of value
@param {boolean} v value
@returns {Type} Type instance of this value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(v: boolean): Type {
return BooleanType.VAL
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#... | public static of(v: boolean): Type {
return BooleanType.VAL
} | https://gitcode.com/iop123123/arkts-static-skills | 99af220d7cd1fcede8bc5307ba5f8d39b48baca0 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLast | / === with element lambda functions ===
Finds the last element in the Int8Array that satisfies the condition
@param { function } fn - condition
@returns { number } - the last element that satisfies fn
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: number) => boolean): number {
let newF: (val: number, index: int, array: Int8Array) => boolean =
(val: number, index: int, array: Int8Array): boolean => { return fn(val) }
return (this.findLast(newF)).toDouble()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | public findLast(fn: (val: number) => boolean): number {
let newF: (val: number, index: int, array: Int8Array) => boolean =
(val: number, index: int, array: Int8Array): boolean => { return fn(val) }
return (this.findLast(newF)).toDouble()
} | https://gitcode.com/iop123123/arkts-static-skills | 6383d06e159481f9e10e07d8b54ed2bf52953435 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets | arkts | toString | Converts the primitive to a string
@param { short } v value to be converted
@returns { String } result of the conversion
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static toString(v: short): string {
return StringBuilder.toString(v);
} | 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 toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Righ... | public static toString(v: short): string {
return StringBuilder.toString(v);
} | https://gitcode.com/iop123123/arkts-static-skills | 643f53435afa466df0131b9f455cbfe4d41e33d0 | gitcode |
midori52000/ArkPilot | Agent/entry/src/main/ets/skills/SkillsBackendService.ets | arkts | searchSkillsSh | ================================================================
skills.sh 搜索
================================================================ | async searchSkillsSh(query: string, limit: number, offset: number): Promise<SkillsShSearchResult> {
const url = `${SKILLS_SH_API}?q=${encodeURIComponent(query)}&limit=${limit}&offset=${offset}`;
const httpRequest = http.createHttp();
const response = await httpRequest.request(url, {
method: http.Re... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchSkillsSh AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async searchSkillsSh(query: string, limit: number, offset: number): Promise<SkillsShSearchResult> {
const url = `${SKILLS_SH_API}?q=${encodeURIComponent(query)}&limit=${limit}&offset=${offset}`;
const httpRequest = http.createHttp();
const response = await httpRequest.request(url, {
method: http.Re... | https://github.com/midori52000/ArkPilot | 4c824d64a283b55ba500238a818fa8c2a8c866d0 | github |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/DefaultProcessor.ets | arkts | notifyChanges | 被观察者状态发生改变后,通知d订阅的所有观察者更新 | notifyChanges(message: ObserverMessage) {
this.mObserverList.forEach((observer) => {
observer.onChange(message);
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left notifyChanges AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ObserverMessage AST#iden... | notifyChanges(message: ObserverMessage) {
this.mObserverList.forEach((observer) => {
observer.onChange(message);
});
} | https://gitee.com/openharmony/applications_calendar_data.git | 79487498811fc4fc2f913c5e812f7600edb4f950 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/DeviceTypeUtil.ets | arkts | getAdaptiveFontSize | 获取适配后的字体大小
@param baseSize 基础字体大小 | public getAdaptiveFontSize(baseSize: number): number {
if (this.isWatchOrWearable()) {
// 手环手表字体缩小30%
return Math.round(baseSize * 0.7);
} else if (this.isPhone()) {
return baseSize;
} else if (this.isTablet()) {
// 平板字体放大10%
return Math.round(baseSize * 1.1);
} else {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAdaptiveFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | public getAdaptiveFontSize(baseSize: number): number {
if (this.isWatchOrWearable()) {
// 手环手表字体缩小30%
return Math.round(baseSize * 0.7);
} else if (this.isPhone()) {
return baseSize;
} else if (this.isTablet()) {
// 平板字体放大10%
return Math.round(baseSize * 1.1);
} else {
... | https://github.com/LJ666-ui/harmony-health-care | 73f30e09c1e06191c0637cd55581b6f871fd71e5 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | findById | 根据主键查询单个实体
如果实体启用了软删除,默认只查询未删除的数据
查询成功后执行 afterLoad 钩子
支持查询缓存(启用缓存时优先从缓存读取)
@param id 主键值
@param includeDeleted 是否包含已删除的数据,默认 false
@param useCache 是否使用缓存,默认 true
@returns Promise<EntityData | null> | async findById(id: ValueType, includeDeleted: boolean = false, useCache: boolean = true): Promise<EntityData | null> {
const startTime = Date.now()
// 尝试从缓存获取(仅在不包含已删除数据时使用缓存)
if (useCache && !includeDeleted && this.queryCache.isEnabled()) {
const cached = this.queryCache.get(this.entityName, id)
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left findById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | async findById(id: ValueType, includeDeleted: boolean = false, useCache: boolean = true): Promise<EntityData | null> {
const startTime = Date.now()
// 尝试从缓存获取(仅在不包含已删除数据时使用缓存)
if (useCache && !includeDeleted && this.queryCache.isEnabled()) {
const cached = this.queryCache.get(this.entityName, id)
... | https://github.com/offlinecat-dev/OCNetORM | 064239df9e3aadde58785367f4a9d252cace4329 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | getLastSegment | Gets the decoded last path segment.
@returns { string } Returns the last decoded segment, or null if the path is empty. | getLastSegment(): string {
return this.uriEntry.getLastSegment();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLastSegment 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#stateme... | getLastSegment(): string {
return this.uriEntry.getLastSegment();
} | https://gitcode.com/iop123123/arkts-static-skills | c419e2a6a8aa7d654171e0d8ea796ab9e9079c40 | gitcode |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | dealWithOperatorCharInLast | Deal with Operator Char
@param { string } pValue | private dealWithOperatorCharInLast(pValue: string): void {
this.expression = this.handleExpressionWithOperator(pValue, this.expression);
this.setState(CalculatorState.INPUT);
this.setGlobalExpression(this.expression);
if (DisplayUtil.isNumber(this.expression)) {
this.result = '';
CommonUti... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dealWithOperatorCharInLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pValue AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private dealWithOperatorCharInLast(pValue: string): void {
this.expression = this.handleExpressionWithOperator(pValue, this.expression);
this.setState(CalculatorState.INPUT);
this.setGlobalExpression(this.expression);
if (DisplayUtil.isNumber(this.expression)) {
this.result = '';
CommonUti... | https://gitee.com/openharmony-sig/applications_calculator.git | 005a8a77446e433a6b50e7bda1ee16a189e96556 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | hasNetVPN | 判断当前网络是否是VPN网络。 | static hasNetVPN(): boolean {
return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_VPN);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasNetVPN 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#boo... | static hasNetVPN(): boolean {
return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_VPN);
} | https://github.com/tdcare/tdwebrtc | 00c2b193c03cb683aa6adef97a03e0b382955ae7 | github |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | convertStorage | DIGITAL STORAGE
Base unit: byte. Decimal prefixes (KB=1000), Binary prefixes (KiB=1024). | static convertStorage(value: number, from: StorageUnit, to: StorageUnit): number {
const toBytes: Record<StorageUnit, number> = {
[StorageUnit.BIT]: 0.125,
[StorageUnit.BYTE]: 1,
[StorageUnit.KILOBYTE]: 1e3,
[StorageUnit.MEGABYTE]: 1e6,
[StorageUnit.GIGABYTE]: 1e9,
[St... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertStorage 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 ... | static convertStorage(value: number, from: StorageUnit, to: StorageUnit): number {
const toBytes: Record<StorageUnit, number> = {
[StorageUnit.BIT]: 0.125,
[StorageUnit.BYTE]: 1,
[StorageUnit.KILOBYTE]: 1e3,
[StorageUnit.MEGABYTE]: 1e6,
[StorageUnit.GIGABYTE]: 1e9,
[St... | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | d004b2a0ac8eef486ce87527a6cbb63c13e95bd1 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/services/ImportService.ets | arkts | importUserData | 导入用户数据
@param filePath 备份文件路径
@param password 解密密码(如果文件已加密)
@param options 导入选项
@returns 导入结果 | static async importUserData(
filePath: string,
password?: string,
options?: ImportOptions
): Promise<ImportResult> {
const errors: Array<string> = [];
const statistics: ImportStatistics = {
users: 0,
accounts: 0,
categories: 0,
bills: 0,
budgets: 0,
tags: 0
... | 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 importUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left ... | static async importUserData(
filePath: string,
password?: string,
options?: ImportOptions
): Promise<ImportResult> {
const errors: Array<string> = [];
const statistics: ImportStatistics = {
users: 0,
accounts: 0,
categories: 0,
bills: 0,
budgets: 0,
tags: 0
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | b015832781433b20cb4ea6c79afae189115426fd | github |
FinalScave/SweetLine | platform/OHOS/sweetline/src/main/ets/Index.ets | arkts | removeDocument | Remove a managed document
@param uri Managed document URI | public removeDocument(uri: string): boolean {
if (this.nativeHandle == 0) {
return false;
}
return lib.HighlightEngine_RemoveDocument(this.nativeHandle, uri);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeDocument AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | public removeDocument(uri: string): boolean {
if (this.nativeHandle == 0) {
return false;
}
return lib.HighlightEngine_RemoveDocument(this.nativeHandle, uri);
} | https://github.com/FinalScave/SweetLine | 8df3a8249c8039faf31f0c21821609ef45838c7a | github |
daugf2527/harmonyos-libretro-emulator | entry/src/main/ets/pages/TestGambatte.ets | arkts | updateRomOptions | 更新 ROM 选项列表 | updateRomOptions() {
const availableRoms = this.getAvailableRoms();
this.romOptions = availableRoms.map((rom): SelectOption => {
return { value: rom.name };
});
this.selectedRomIndex = 0;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateRomOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | updateRomOptions() {
const availableRoms = this.getAvailableRoms();
this.romOptions = availableRoms.map((rom): SelectOption => {
return { value: rom.name };
});
this.selectedRomIndex = 0;
} | https://github.com/daugf2527/harmonyos-libretro-emulator | bd86c97cd7a49b5ea3c95b377fd67d86ceeb1440 | github |
arkui-x/samples | CodeLab/Cases/feature/databaseupgrade/src/main/ets/service/DataService.ets | arkts | migrate | 递归方式批次查询旧表数据
@param lastId 上一次查询的最后一个id
@param targetVersion 目标版本 | private async migrate(lastId: number, oldVersion: number, targetVersion: number, flag: boolean): Promise<void> {
if (flag) {
return;
}
let newDataArray: ValuesBucket[] = new Array();
await dbUtils.queryData(Constants.STUDENT_TABLE + oldVersion, Constants.MAX_BATCH_NUM, lastId, async (resultSet) ... | 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 migrate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lastId AST#identifier#Right AST#:#Left : AST#... | private async migrate(lastId: number, oldVersion: number, targetVersion: number, flag: boolean): Promise<void> {
if (flag) {
return;
}
let newDataArray: ValuesBucket[] = new Array();
await dbUtils.queryData(Constants.STUDENT_TABLE + oldVersion, Constants.MAX_BATCH_NUM, lastId, async (resultSet) ... | https://gitcode.com/arkui-x/samples | 6b97468d6e14611b1a32bb0f5ad4a996057fe7e9 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/NetworkBoostService.ets | arkts | setDataFlowDesc | HarmonyOS 26.0.0: 为关键串流 socket 标记实时游戏流。
只有在调用方能提供 native socket fd 或完整五元组时才调用;
当前 ArkTS 层没有可靠本地端口/fd,因此先作为可选入口保留。 | setDataFlowDesc(flow: NetworkBoostFiveTupleFlow | NetworkBoostSocketFlow): boolean {
if (!this.supported || !this.active) {
return false;
}
try {
netBoost.setSceneDesc({
scene: STREAMING_SERVICE_TYPE,
sceneEvent: netBoost.SceneEvent.SCENE_EVENT_ENTER
});
if (flow.ex... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDataFlowDesc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left flow AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left NetworkBoostF... | setDataFlowDesc(flow: NetworkBoostFiveTupleFlow | NetworkBoostSocketFlow): boolean {
if (!this.supported || !this.active) {
return false;
}
try {
netBoost.setSceneDesc({
scene: STREAMING_SERVICE_TYPE,
sceneEvent: netBoost.SceneEvent.SCENE_EVENT_ENTER
});
if (flow.ex... | https://github.com/AlkaidLab/moonlight-harmony | 8c77a34127088239c6df21678dcf6d3ac7b1657b | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets | arkts | updateReminderConfig | 更新单个提醒配置 | updateReminderConfig(config: ReminderConfig): void {
this.settings.updateReminderConfig(config);
console.log('提醒配置已更新:', config.type);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateReminderConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ReminderConfig AST#identifier#Rig... | updateReminderConfig(config: ReminderConfig): void {
this.settings.updateReminderConfig(config);
console.log('提醒配置已更新:', config.type);
} | https://gitcode.com/openharmony/codelabs | b186614c3c8d2f8d7429e65aaf218165aaff3d16 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets | arkts | constructor | Constructs a new Boolean with provided string value
@param { string } value value to construct class instance with
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(value: string) {
this.value = value != '';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | public constructor(value: string) {
this.value = value != '';
} | https://gitcode.com/iop123123/arkts-static-skills | 6be38d061cfcaf666f6ad5b971d8d40f86a97f28 | gitcode |
openharmony/arkui_ace_engine | examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets | arkts | getTotalBits | (Package-private) Calculates and returns the number of bits needed to encode the given segments at
the given version. The result is infinity if a segment has too many characters to fit its length field. | public static getTotalBits(segs: Readonly<Array<QrSegment>>, version: int): number {
let result: number = 0;
for (const seg of segs) {
const ccbits: int = seg.mode.numCharCountBits(version);
if (seg.numChars >= (1 << ccbits)) {
return Infinity; // The segment's length doesn't ... | 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 getTotalBits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left segs AST#identifier#Right AST#:#Left : AST... | public static getTotalBits(segs: Readonly<Array<QrSegment>>, version: int): number {
let result: number = 0;
for (const seg of segs) {
const ccbits: int = seg.mode.numCharCountBits(version);
if (seg.numChars >= (1 << ccbits)) {
return Infinity; // The segment's length doesn't ... | https://gitee.com/openharmony/arkui_ace_engine.git | 7f60511e3e6db7f3298fb2ab9f5d2113e5698a8e | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.