nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Creates a slice of current Uint8Array using range [begin, this.length).
@param begin start index to be taken into slice
@returns a new Uint8Array with elements of current Uint8Array[begin, this.length)
public | /* public */ internal slice(begin: int): Uint8Array {
return this.slice(begin, this.length)
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Ri... | /* public */ internal slice(begin: int): Uint8Array {
return this.slice(begin, this.length)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b0b4132c50bb64379c94cbece4a1bfaad5b812bf | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/ExportManager.ets | arkts | deleteExportedFile | 删除导出文件 | async deleteExportedFile(context: Context, fileName: string): Promise<boolean> {
try {
const filePath = `${context.cacheDir}/${fileName}`;
fileIo.unlinkSync(filePath);
return true;
} catch (error) {
console.error('删除文件失败:', JSON.stringify(error));
return false;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteExportedFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#... | async deleteExportedFile(context: Context, fileName: string): Promise<boolean> {
try {
const filePath = `${context.cacheDir}/${fileName}`;
fileIo.unlinkSync(filePath);
return true;
} catch (error) {
console.error('删除文件失败:', JSON.stringify(error));
return false;
}
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 9f45d622269e26326698b76f4e7c51a934fa2f9c | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/SubtitleUtil.ets | arkts | selectExternalSubtitles | 获取外挂字幕 | static async selectExternalSubtitles(sandbox_subtitle: string, date: string) {
const documentSelectOptions = new picker.DocumentSelectOptions()
documentSelectOptions.fileSuffixFilters = SUPPORT_SUBTITLE_FORMAT
documentSelectOptions.maxSelectNumber = 1
const documentViewPicker = new picker.DocumentView... | 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 selectExternalSubtitles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sandbox_subtitle AST#identifier#Right AST#ERROR... | static async selectExternalSubtitles(sandbox_subtitle: string, date: string) {
const documentSelectOptions = new picker.DocumentSelectOptions()
documentSelectOptions.fileSuffixFilters = SUPPORT_SUBTITLE_FORMAT
documentSelectOptions.maxSelectNumber = 1
const documentViewPicker = new picker.DocumentView... | https://github.com/Yebingiscn/SweetVideo | 65b469e7e0c7d6071607d1a2bf7f9ead2e8c0265 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | constructor | The Intl.Locale() constructor creates Intl.Locale objects.
@param tag BCP47LanguageTag or other Locale
@param options options | public constructor(tag: BCP47LanguageTag | Locale, options?: LocaleOptions) {
// Step 1: Initialize locale
this.initLocale()
// Use local variable for default language to avoid multiple calls within same constructor
let defaultLanguage: string | undefined = undef... | 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 tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Lef... | public constructor(tag: BCP47LanguageTag | Locale, options?: LocaleOptions) {
// Step 1: Initialize locale
this.initLocale()
// Use local variable for default language to avoid multiple calls within same constructor
let defaultLanguage: string | undefined = undef... | https://gitcode.com/iop123123/arkts-static-skills | a1ca3bbe60ab83b7de025003952f214475adb307 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | isUsePercentValuesEnabled | Returns true if using percentage values is enabled for the chart.
@return | public isUsePercentValuesEnabled(): boolean {
return this.mUsePercentValues;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isUsePercentValuesEnabled 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... | public isUsePercentValuesEnabled(): boolean {
return this.mUsePercentValues;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f8f0d6801b9f87e8f8a18509fe90208a137d7405 | gitee |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets | arkts | setAxisLineWidth | Sets the width of the border surrounding the chart in dp.
@param width | public setAxisLineWidth(width: number): void {
this.mAxisLineWidth = Utils.convertDpToPixel(width);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAxisLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public setAxisLineWidth(width: number): void {
this.mAxisLineWidth = Utils.convertDpToPixel(width);
} | https://gitee.com/openharmony/developtools_profiler.git | d56a6c723f9251288bbf24a6c669a4685cf0f236 | gitee |
din0sauria/audio-deepfake-detection | entry/src/main/ets/Audio/AudioDB.ets | arkts | add | 向表中插入一条数据 * | add(newItem: IInterviewAudioItem): IInterviewAudioItem[] {
const res = this.store?.insertSync(this.tableName, newItem)
if (!res) {
AlertDialog.show({ message: '数据新增失败' })
}
return this.getAllData()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newItem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IInterviewAudioItem AST#identifier... | add(newItem: IInterviewAudioItem): IInterviewAudioItem[] {
const res = this.store?.insertSync(this.tableName, newItem)
if (!res) {
AlertDialog.show({ message: '数据新增失败' })
}
return this.getAllData()
} | https://github.com/din0sauria/audio-deepfake-detection | 49421a0017ee1a4493e412ab9829853e17d910f3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportDownloadTasks | 导出下载任务 | private async exportDownloadTasks(): Promise<DownloadTaskBackup[]> {
try {
const sql = `
SELECT
id, comicId, chapterId, taskType, status, progress, downloadedSize, totalSize,
downloadSpeed, errorMessage, priority, createTime, startTime, completeTime
FROM download_task
... | 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 exportDownloadTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async exportDownloadTasks(): Promise<DownloadTaskBackup[]> {
try {
const sql = `
SELECT
id, comicId, chapterId, taskType, status, progress, downloadedSize, totalSize,
downloadSpeed, errorMessage, priority, createTime, startTime, completeTime
FROM download_task
... | https://github.com/DaLongZhuaZi/manxia | 30957cf89618ecbe4f218f55002c21cd4fadbcff | github |
egavrin/arkts_agent_kit | examples/fslib/src/tests/fslib.test.ets | arkts | testSymlinkReadlink | --- symlink / readlink --- | function testSymlinkReadlink(): void {
ensureSetup()
let fs = new FileSystem()
let target: string = TMPDIR + "/sym_tgt.txt"
let link: string = TMPDIR + "/sym_lnk.txt"
safeRemove(fs, link)
fs.writeText(target, "symlinked")
fs.symlink(target, link)
arktest.assertTrue(fs.exists(link))
a... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSymlinkReadlink AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefi... | function testSymlinkReadlink(): void {
ensureSetup()
let fs = new FileSystem()
let target: string = TMPDIR + "/sym_tgt.txt"
let link: string = TMPDIR + "/sym_lnk.txt"
safeRemove(fs, link)
fs.writeText(target, "symlinked")
fs.symlink(target, link)
arktest.assertTrue(fs.exists(link))
a... | https://gitcode.com/egavrin/arkts_agent_kit | 98b1acd00606c72e13c5f8a474deca83a7d92b2d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Workflow/WorkflowCapabilities.ets | arkts | applyUrlResolver | 应用URL解析能力 | applyUrlResolver(
template: string,
context: WorkflowContext
): string {
const capability = context.capabilities.get('urlResolver');
if (!capability) {
return template;
}
const config = capability as UrlResolverConfig;
config.variables = context.variables;
return this.url... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyUrlResolver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left template AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AS... | applyUrlResolver(
template: string,
context: WorkflowContext
): string {
const capability = context.capabilities.get('urlResolver');
if (!capability) {
return template;
}
const config = capability as UrlResolverConfig;
config.variables = context.variables;
return this.url... | https://github.com/DaLongZhuaZi/manxia | 7db4ecbb14e1c8246c921552a3b582d74371967f | github |
openharmony-sig/jtar | library/src/main/ets/ohos_tar.ets | arkts | tar | tar打包 | public tar(): number {
let isExists: boolean = true;
if (this.tarPaths.length != 0) {
// 将所有需要tar的文件或目录传递下去
for (let i = 0; i < this.tarPaths.length; i++) {
if(!fs.accessSync(this.rootPath + "/" + this.tarPaths[i])){
isExists = false;
console.error("目标文件或文件夹 [" + this.t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left tar AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right... | public tar(): number {
let isExists: boolean = true;
if (this.tarPaths.length != 0) {
// 将所有需要tar的文件或目录传递下去
for (let i = 0; i < this.tarPaths.length; i++) {
if(!fs.accessSync(this.rootPath + "/" + this.tarPaths[i])){
isExists = false;
console.error("目标文件或文件夹 [" + this.t... | https://gitee.com/openharmony-sig/jtar.git | 1b52cc8686e158fa24c2c7ddd2a40bb6b900d3d1 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setUTCDay | Changes the day of the month of a given Date instance, based on UTC time.
@param { int } value new day.
@returns { long } set UTCDay
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setUTCDay(value: int): long {
this.setUTCDate(value);
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Ri... | public setUTCDay(value: int): long {
this.setUTCDate(value);
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | 9af8cf1b1a27ab43113f82ecb6dd5dd0ca257b2c | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/CrashRecorderService.ets | arkts | checkPreviousCrashLogs | 检查上次崩溃记录
在启动时调用,如果存在崩溃记录则通过 AppStorage 标记 | private checkPreviousCrashLogs(): void {
try {
this.ensureCrashLogsDir();
const summaryPath = `${this.crashLogsDir}/last_crash_summary.json`;
try {
const exists = SafeFileUtils.accessSync(summaryPath);
if (!exists) {
console.log(`[NGF] ${TAG}: 未检测到上次崩溃记录`);
re... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkPreviousCrashLogs 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 ... | private checkPreviousCrashLogs(): void {
try {
this.ensureCrashLogsDir();
const summaryPath = `${this.crashLogsDir}/last_crash_summary.json`;
try {
const exists = SafeFileUtils.accessSync(summaryPath);
if (!exists) {
console.log(`[NGF] ${TAG}: 未检测到上次崩溃记录`);
re... | https://github.com/DaLongZhuaZi/manxia | 29f538737a12cb33038b429eafe5c463cac8a3d6 | github |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/BreakpointSystem.ets | arkts | constructor | @param sm Value for XS/SM widths.
@param md Value for MD width.
@param lg Value for LG width.
@param xl Value for XL width.
@param heightSm Optional SM-height override; falls back to sm when omitted. | public constructor(sm: T, md: T, lg: T, xl: T, heightSm?: T) {
this.sm = sm;
this.md = md;
this.lg = lg;
this.xl = xl;
this.heightSm = heightSm;
} | 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#identifier#Left sm AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right... | public constructor(sm: T, md: T, lg: T, xl: T, heightSm?: T) {
this.sm = sm;
this.md = md;
this.lg = lg;
this.xl = xl;
this.heightSm = heightSm;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 84a338eefd0e1ae80b2ff186be6bd6cb27c11f2f | gitcode |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/model/repository/AchievementRepository.ets | arkts | queryByCondition | 根据条件标识查询(用于判断特定成就是否存在) | async queryByCondition(condition: string): Promise<Achievement | null> {
const store = RdbHelper.getRdbStore();
if (!store) {
return null;
}
const predicates = new relationalStore.RdbPredicates(CommonConstants.ACHIEVEMENT_TABLE_NAME);
predicates.equalTo('unlockCondition', condition);
c... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryByCondition AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left condition AST#identifier#Right AST#type_annotation#Left AST#:#... | async queryByCondition(condition: string): Promise<Achievement | null> {
const store = RdbHelper.getRdbStore();
if (!store) {
return null;
}
const predicates = new relationalStore.RdbPredicates(CommonConstants.ACHIEVEMENT_TABLE_NAME);
predicates.equalTo('unlockCondition', condition);
c... | https://gitcode.com/openharmony/codelabs | 2dcbed9e09986173a05fb8cbe4864d900f922d1d | gitcode |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/interceptors/LogInterceptor.ets | arkts | normalizeMethod | 规范化请求方法
@param {string | undefined} method - 请求方法
@returns {string} 规范化后的请求方法 | function normalizeMethod(method?: string): string {
return method ? method.toUpperCase() : "UNKNOWN";
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left normalizeMethod AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left method AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_annotati... | function normalizeMethod(method?: string): string {
return method ? method.toUpperCase() : "UNKNOWN";
} | https://github.com/Joker-x-dev/CoolMallArkTS | 1cb74f59e4b6ad69ca279751ead72cb2c94f5cc5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | filter | Creates a new Uint8Array from current Uint8Array based on a condition fn.
@param { function } fn - the condition to apply for each element
@returns { Uint8Array } - a new Uint8Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public filter(fn: (val: number, index: int, array: Uint8Array) => boolean): Uint8Array {
let markers : ValueArray<boolean> = new ValueArray<boolean>(this.lengthInt)
let resLen = 0
for (let i = 0; i < this.lengthInt; i++) {
markers[i] = fn(this.getUnsafe(i).toDouble(), i, this)
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: number, index: int, array: Uint8Array) => boolean): Uint8Array {
let markers : ValueArray<boolean> = new ValueArray<boolean>(this.lengthInt)
let resLen = 0
for (let i = 0; i < this.lengthInt; i++) {
markers[i] = fn(this.getUnsafe(i).toDouble(), i, this)
... | https://gitcode.com/iop123123/arkts-static-skills | 87d3a22440c880fe4e0fea45b3b0f0b2d0ece7a6 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from a set of type std.core.Set<int>.
@param { Set<int> } set - A set object to convert to an array.
@returns { Int8Array } - A new Int8Array
@throws { RangeError } - Input parameter error.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(set: Set<int>): Int8Array {
const length = set.size;
const result = new Int8Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('Wrong Leng... | 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#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Righ... | public static from(set: Set<int>): Int8Array {
const length = set.size;
const result = new Int8Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('Wrong Leng... | https://gitcode.com/iop123123/arkts-static-skills | 6d9fd4759a7d56f12750ba43e174557c4aec727f | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/BarLineChartTouchListener.ets | arkts | getXDist | calculates the distance on the x-axis between two pointers (fingers on
the display)
@param e
@return | private static getXDist(isTouchEvent: boolean, e: TouchEvent | GestureEvent): number {
let x: number = 0;
if (isTouchEvent) {
e = e as TouchEvent;
if (!e.touches || e.touches.length == 0 || !e.touches[0]) {
return 0;
}
x = Math.abs(e.touches[0].x - e.touches[1].x);
} else {... | 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 getXDist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Lef... | private static getXDist(isTouchEvent: boolean, e: TouchEvent | GestureEvent): number {
let x: number = 0;
if (isTouchEvent) {
e = e as TouchEvent;
if (!e.touches || e.touches.length == 0 || !e.touches[0]) {
return 0;
}
x = Math.abs(e.touches[0].x - e.touches[1].x);
} else {... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 9b6338f48be88d2b49de72cb8b4e39eda97dff19 | gitee |
dividez/harmonyos-games | features/number/src/main/ets/services/PreferencesUtil.ets | arkts | getPreference | 使用Preferences的get方法读取数据 | async getPreference(key: string) {
let result: dataPreferences.ValueType = '';
if (this.preferences === null) {
await this.getPreferencesFromStorage();
}
await this.preferences?.get(key, '').then((data) => {
result = data;
console.info(`Succeeded in getting value`);
}).catch((err... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPreference AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#... | async getPreference(key: string) {
let result: dataPreferences.ValueType = '';
if (this.preferences === null) {
await this.getPreferencesFromStorage();
}
await this.preferences?.get(key, '').then((data) => {
result = data;
console.info(`Succeeded in getting value`);
}).catch((err... | https://github.com/dividez/harmonyos-games | 0b4ccd456859bbbe33d0fb490c81b8d904701684 | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/AuthVM.ets | arkts | restoreFromStorage | 启动时调用:若本地有 cookie,且服务端依然认账,把 USER 写回 AppStorage;
否则返回 null,由调用方决定是否跳转 LoginPage。
失败不抛异常。 | static async restoreFromStorage(): Promise<User | null> {
const cred: SavedAccount | null = await AuthStore.getCredentials();
if (cred === null) {
return null;
}
try {
const user: User = await ZLibraryClient.instance.loginWithToken(cred.userId, cred.userKey);
AppStorage.setOrCreate<U... | 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 restoreFromStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | static async restoreFromStorage(): Promise<User | null> {
const cred: SavedAccount | null = await AuthStore.getCredentials();
if (cred === null) {
return null;
}
try {
const user: User = await ZLibraryClient.instance.loginWithToken(cred.userId, cred.userKey);
AppStorage.setOrCreate<U... | https://github.com/LZZLHY/hlib | 550132ba1c9e9cf295bf439e4943d7550dcc68c9 | github |
erosTeam/NextE | feature/gallery/src/main/ets/components/GalleryPreviewGrid.ets | arkts | columnsTemplate | Inline grid peek of the first preview page. Responsive column count via columnsTemplate (a true Grid,
not a wrapping Flex) so tiles align in columns with uniform gap and the last row left-aligns naturally. | private columnsTemplate(): string {
return `repeat(auto-fit, ${this.effectiveMinWidth()}vp)`
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left columnsTemplate 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 ... | private columnsTemplate(): string {
return `repeat(auto-fit, ${this.effectiveMinWidth()}vp)`
} | https://github.com/erosTeam/NextE | 11e49e6dfbce27297f9a305da673c7160c41c672 | github |
XXYoLoong/SchoolSmart | entry/src/main/ets/pages/Index.ets | arkts | Main | 定义一个函数 Main,当前未实现具体功能,抛出错误提示 | function Main() {
throw new Error('Function not implemented.')
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left Main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#throw_statement#Left A... | function Main() {
throw new Error('Function not implemented.')
} | https://github.com/XXYoLoong/SchoolSmart | e9bb9f5a550e40747a0353cee81d9553d43ae1bb | github |
IoTAccessControl/ArkTSAnalysis | TestApps1/1.AccountKit_Codelab_QuickLogin_Clientdemo_ArkTS/entry/src/main/ets/pages/PermissionsPage.ets | arkts | startAudioRecording | 本地录音 - AudioRecorder | startAudioRecording() {
try {
// 如果已经在录音,先停止
if (this.isRecording && this.audioRecorder) {
this.stopAudioRecording();
return;
}
if (!this.context) {
this.showToast('无法获取上下文');
return;
}
// 创建录音文件路径
let cacheDir = this.context.cacheDir;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAudioRecording 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_bloc... | startAudioRecording() {
try {
// 如果已经在录音,先停止
if (this.isRecording && this.audioRecorder) {
this.stopAudioRecording();
return;
}
if (!this.context) {
this.showToast('无法获取上下文');
return;
}
// 创建录音文件路径
let cacheDir = this.context.cacheDir;
... | https://github.com/IoTAccessControl/ArkTSAnalysis | c86d6e6cf563d370b9a7a7fdb553621d5eb8bdeb | github |
ibestservices/ibest-ui | library/src/main/ets/components/cascader/index.ets | arkts | createAllOptionsInstance | 创建全部选项实例 | createAllOptionsInstance(array: IBestCascaderOptionInstance[][] = [], children: IBestCascaderOption[] = [], index: number){
let curValue = this.value[index]
let i = children.findIndex((item: IBestCascaderOption) => item.value === curValue)
i = i > -1 ? i : 0
array.push(
children.map((item: IBestCascaderOpti... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createAllOptionsInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#... | createAllOptionsInstance(array: IBestCascaderOptionInstance[][] = [], children: IBestCascaderOption[] = [], index: number){
let curValue = this.value[index]
let i = children.findIndex((item: IBestCascaderOption) => item.value === curValue)
i = i > -1 ? i : 0
array.push(
children.map((item: IBestCascaderOpti... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/cascader/index.ets#L103-L143 | 0a4b3c62e2556067f0facb4dac1a8bfcafa4ece5 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleRemoteConfig.ets | arkts | fireAutomaticDownload | Fire an automatic download, fire-and-forget. Triggers are best-effort
side effects (init, consent grant, device-id change), a failure here
shouldn't block the caller but must be logged. | private fireAutomaticDownload(reason: string): void {
this.config.logger.d(`[ModuleRemoteConfig] auto-trigger, downloading (reason=${reason})`);
this.downloadAllKeys(null).catch((err: Object) => {
this.config.logger.e(`[ModuleRemoteConfig] auto-trigger (${reason}) rejected: ${err}`);
});
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fireAutomaticDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private fireAutomaticDownload(reason: string): void {
this.config.logger.d(`[ModuleRemoteConfig] auto-trigger, downloading (reason=${reason})`);
this.downloadAllKeys(null).catch((err: Object) => {
this.config.logger.e(`[ModuleRemoteConfig] auto-trigger (${reason}) rejected: ${err}`);
});
} | https://github.com/Countly/countly-sdk-hos | 9cae4af5c0b59356c8245b37f02821b77185d774 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | getModelUsageRanking | 获取模型调用排行
仅统计 role='assistant' 且 model_name 有效的消息;按 model_name 分组(同名模型在不同 provider 视为同一项) | async getModelUsageRanking(rangeStartMs: number = 0, limit: number = 10): Promise<ModelUsageRankingItem[]> {
await this.waitForInitialization()
const items: ModelUsageRankingItem[] = []
if (this.rdbStore === null) {
return items
}
const safeLimit = limit > 0 ? limit : 10
try {
cons... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getModelUsageRanking AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rangeStartMs AST#identifier#Right AST#type_annotation#Left... | async getModelUsageRanking(rangeStartMs: number = 0, limit: number = 10): Promise<ModelUsageRankingItem[]> {
await this.waitForInitialization()
const items: ModelUsageRankingItem[] = []
if (this.rdbStore === null) {
return items
}
const safeLimit = limit > 0 ? limit : 10
try {
cons... | https://github.com/LongLiveY96/chatcube | d0dea5d8212c08669c27b82efa8e79b6e050ac90 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | IsUnlocked | Checks if the lock is in unlocked state.
@param { long } state Current lock state
@returns { boolean } True if the lock is unlocked, false otherwise
@syscap SystemCapability.Utils.Lang | public static IsUnlocked(state: long): boolean {
return state == State.UNLOCKED;
} | 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 IsUnlocked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public static IsUnlocked(state: long): boolean {
return state == State.UNLOCKED;
} | https://gitcode.com/iop123123/arkts-static-skills | fd3a9310ede4884849fc4665c8942f3e03f8430b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getPageInfoList | 获取页面信息列表(别名方法) | public async getPageInfoList(chapterId: string): Promise<PageInfo[]> {
return this.getChapterPages(chapterId);
} | 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 getPageInfoList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async getPageInfoList(chapterId: string): Promise<PageInfo[]> {
return this.getChapterPages(chapterId);
} | https://github.com/DaLongZhuaZi/manxia | fc4897b32d8e2b03a3126f47822ce5a1528f2773 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets | arkts | fastOutSlowIn | 快进快出插值器 | static fastOutSlowIn(): curves.ICurve {
return AnimationInterpolator.cubicBezier(0.4, 0, 0.2, 1);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fastOutSlowIn 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#member_expression#Left A... | static fastOutSlowIn(): curves.ICurve {
return AnimationInterpolator.cubicBezier(0.4, 0, 0.2, 1);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 5740c8fce48b9dd8e0b27c3ee1028163ea955f34 | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/bookmarks/classes/meowBookmarkStash.ets | arkts | requestSaveToDisk | Save HTML to disk. Has a 500 ms timeout by default.
@returns true if success, false if failed. | requestSaveToDisk(timeout: number = 500) {
clearTimeout(this.timeoutIdSaveToDisk);
this.timeoutIdSaveToDisk = setTimeout(async () => {
this.timeoutIdSaveToDisk = undefined;
await this.saveToDisk();
}, timeout);
meow(`Called requestSaveToDisk. It is expected to save HTML to disk in ${timeo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestSaveToDisk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timeout AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#ident... | requestSaveToDisk(timeout: number = 500) {
clearTimeout(this.timeoutIdSaveToDisk);
this.timeoutIdSaveToDisk = setTimeout(async () => {
this.timeoutIdSaveToDisk = undefined;
await this.saveToDisk();
}, timeout);
meow(`Called requestSaveToDisk. It is expected to save HTML to disk in ${timeo... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 99a02d450ded596b35681a3ac1c8898903bf301a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/BookTransitionOverlay.ets | arkts | startCloseTransitionWithCapture | 使用截图开始关闭过渡动画(在prepareCloseTransition之后调用)
@param readerContentPixelMap 阅读器截图
@param onComplete 完成回调
@param readerContentImagePath 截图文件路径 | public startCloseTransitionWithCapture(
readerContentPixelMap?: image.PixelMap,
onComplete?: () => void,
readerContentImagePath?: string
): void {
logger.info(TAG, `开始关闭过渡动画(带截图): imagePath=${readerContentImagePath ? '有' : '无'}`);
// 更新截图数据
this.currentState.readerContentPixelMap = read... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startCloseTransitionWithCapture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left readerContentPixelMap AST#identifier#Right AST#ERROR#Left A... | public startCloseTransitionWithCapture(
readerContentPixelMap?: image.PixelMap,
onComplete?: () => void,
readerContentImagePath?: string
): void {
logger.info(TAG, `开始关闭过渡动画(带截图): imagePath=${readerContentImagePath ? '有' : '无'}`);
// 更新截图数据
this.currentState.readerContentPixelMap = read... | https://github.com/DaLongZhuaZi/manxia | 90985a82dc1f46b96dd522bf7e2c94d32cab3495 | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | baseUrl | Resolve the request origin for the current site mode. | static baseUrl(isEx: boolean): string {
return isEx ? EhConstants.EX_BASE_URL : EhConstants.EH_BASE_URL
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left baseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isEx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean ... | static baseUrl(isEx: boolean): string {
return isEx ? EhConstants.EX_BASE_URL : EhConstants.EH_BASE_URL
} | https://github.com/erosTeam/NextE | 0cb52da0c64eb758e85a20677cda24e37f401111 | github |
openharmony/applications_settings | product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets | arkts | loadDescription | Load description of AccessibilityService | async loadDescription(bundleInfo: bundleManager.BundleInfo, serviceName: string): Promise<ResourceStr> {
let description: ResourceStr = $r('app.string.no_description_provided');
let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context;
let moduleInfo: Ar... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadDescription AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bundleInfo AST#identifier#Right AST#type_annotation#Le... | async loadDescription(bundleInfo: bundleManager.BundleInfo, serviceName: string): Promise<ResourceStr> {
let description: ResourceStr = $r('app.string.no_description_provided');
let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context;
let moduleInfo: Ar... | https://gitee.com/openharmony/applications_settings.git | 7401614821f572d43acd6ff362a0ac8680d84cd8 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/FamilyService.ets | arkts | submitHealthInfo | 提交家属健康信息 | async submitHealthInfo(infoData: string): Promise<boolean> {
return await this.medicalService.submitFamilyHealthInfo(infoData);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitHealthInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left infoData AST#identifier#Right AST#type_annotation#Left AST#:#L... | async submitHealthInfo(infoData: string): Promise<boolean> {
return await this.medicalService.submitFamilyHealthInfo(infoData);
} | https://github.com/LJ666-ui/harmony-health-care | 8649deeb3f3104fc94d79bd220bc8f94ea4c5091 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/UnifiedContentAdapter.ets | arkts | getOriginalChapter | 从统一章节获取原始电子书章节 | static getOriginalChapter(unifiedChapter: UnifiedChapter): EBookChapter | null {
if (unifiedChapter.originalType !== UnifiedContentType.EBOOK) {
logger.warn(TAG, '尝试从非电子书章节获取电子书数据');
return null;
}
return unifiedChapter.originalData as EBookChapter;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getOriginalChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left unifiedChapter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | static getOriginalChapter(unifiedChapter: UnifiedChapter): EBookChapter | null {
if (unifiedChapter.originalType !== UnifiedContentType.EBOOK) {
logger.warn(TAG, '尝试从非电子书章节获取电子书数据');
return null;
}
return unifiedChapter.originalData as EBookChapter;
} | https://github.com/DaLongZhuaZi/manxia | f27eafeb6df9b85939e007cad57b3b4fe280ad52 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | updateModifierFlags | 根据 Windows VK 码更新修饰键状态位掩码
参照 Android 版 Game.java handleSpecialKeys() 的实现
@param vkCode Windows 虚拟键码
@param isDown 是否按下 | private updateModifierFlags(vkCode: number, isDown: boolean): void {
let mask = 0;
switch (vkCode) {
case 0xA0: // VK_LSHIFT
case 0xA1: // VK_RSHIFT
mask = MODIFIER_SHIFT;
break;
case 0xA2: // VK_LCONTROL
case 0xA3: // VK_RCONTROL
mask = MODIFIER_CTRL;
b... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateModifierFlags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vkCode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private updateModifierFlags(vkCode: number, isDown: boolean): void {
let mask = 0;
switch (vkCode) {
case 0xA0: // VK_LSHIFT
case 0xA1: // VK_RSHIFT
mask = MODIFIER_SHIFT;
break;
case 0xA2: // VK_LCONTROL
case 0xA3: // VK_RCONTROL
mask = MODIFIER_CTRL;
b... | https://github.com/AlkaidLab/moonlight-harmony | 57b270e45a05084c3bd0c592e8d3cf96f67a3bec | github |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/CominLog/PlayerManager.ets | arkts | seek | 设置进度
@param ms 进度 | seek(ms) {
this.currentTimeMs = ms;
if (this.isPlaying) {
CommonLog.info('MusicPlayer[PlayerModel] player.seek ' + ms);
this.player.seek(ms);
} else {
CommonLog.info('MusicPlayer[PlayerModel] stash seekTo=' + ms);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left seek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ms AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#... | seek(ms) {
this.currentTimeMs = ms;
if (this.isPlaying) {
CommonLog.info('MusicPlayer[PlayerModel] player.seek ' + ms);
this.player.seek(ms);
} else {
CommonLog.info('MusicPlayer[PlayerModel] stash seekTo=' + ms);
}
} | https://gitee.com/openharmony-sig/online_event.git | 23c56347104066fc499621a5e6f399400032d24b | gitee |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | setRemoteDescription | 设置远端 SDP
v24: 从 SDP 中提取协商后的视频编解码器
- 收到 answer: 对端从 offer 中选择了它支持的编解码器
- 收到 offer: 对端的编解码器偏好
第一个视频 payload type 就是协商后的首选编解码器
v29: H264 profile-level-id 统一替换(对齐 Android v26)
- 根因:OHOS 注册 H264 profile-level-id=42e01f,Android 硬件编码器可能返回 42001f/42c01f 等
- rtc-patched 的 fmtp 匹配要求前 2 字节完全相同,否则降级为 VP8
- 需在 SDP 协商前统一为 OHOS 自己的值,... | public setRemoteDescription(sdp: string, type: 'offer' | 'answer'): boolean {
if (!this.client) return false;
// v29: H264 profile-level-id 统一替换(类似 Android v26)
let processedSdp = sdp;
if (type === 'answer' || type === 'offer') {
// 提取 OHOS Rust 端注册的 H264 profile-level-id(从本地 Offer/Answer 中... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setRemoteDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sdp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public setRemoteDescription(sdp: string, type: 'offer' | 'answer'): boolean {
if (!this.client) return false;
// v29: H264 profile-level-id 统一替换(类似 Android v26)
let processedSdp = sdp;
if (type === 'answer' || type === 'offer') {
// 提取 OHOS Rust 端注册的 H264 profile-level-id(从本地 Offer/Answer 中... | https://github.com/tdcare/tdwebrtc | 5c381f5491bb4386bd0086913aaf72e9a1f82ded | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/CheatManager.ets | arkts | hasLocalCheatsXml | 检查本地 cheats.xml 是否存在 | hasLocalCheatsXml(): boolean {
try {
return fileIo.accessSync(this.getLocalCheatsXmlPath());
} catch (_e) {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasLocalCheatsXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#s... | hasLocalCheatsXml(): boolean {
try {
return fileIo.accessSync(this.getLocalCheatsXmlPath());
} catch (_e) {
return false;
}
} | https://github.com/richshaw2015/nds | b96d4b6dfe8c892d91ff0cfb7e06494ed86e96d9 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/ExternalFileOpener.ets | arkts | shareFile | 分享文件路径 | private static async shareFile(filePath: string): Promise<OpenResult> {
const fileName = filePath.split('/').pop() || 'unknown';
const shareText = `${fileName}\n路径: ${filePath}`;
try {
const shareUrl = this.toFileUri(filePath);
const want: Want = {
action: 'ohos.want.action.sendData',... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left shareFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identif... | private static async shareFile(filePath: string): Promise<OpenResult> {
const fileName = filePath.split('/').pop() || 'unknown';
const shareText = `${fileName}\n路径: ${filePath}`;
try {
const shareUrl = this.toFileUri(filePath);
const want: Want = {
action: 'ohos.want.action.sendData',... | https://github.com/XJTUWYD/ArkDiff | 39ebe87672dd5146118091dd9a23f839e1465777 | github |
openharmony/arkui_advanced_ui_component | customappbar/source/custom_app_bar.ets | arkts | onColorConfigurationUpdate | 颜色变化设置
@param isDark 是否是深色模式 | onColorConfigurationUpdate(isDark: boolean): void {
this.isDark = isDark;
this.menuFillColor = this.getResourceColor(ICON_FILL_COLOR_DEFAULT);
this.closeFillColor = this.getResourceColor(ICON_FILL_COLOR_DEFAULT);
this.menubarBorderColor = this.getResourceColor(BORDER_COLOR_DEFAULT);
this.dividerBa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onColorConfigurationUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isDark AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Righ... | onColorConfigurationUpdate(isDark: boolean): void {
this.isDark = isDark;
this.menuFillColor = this.getResourceColor(ICON_FILL_COLOR_DEFAULT);
this.closeFillColor = this.getResourceColor(ICON_FILL_COLOR_DEFAULT);
this.menubarBorderColor = this.getResourceColor(BORDER_COLOR_DEFAULT);
this.dividerBa... | https://gitee.com/openharmony/arkui_advanced_ui_component.git | ee12280ea36f70988e7751a34cd826dfb88add45 | gitee |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/DateUtil.ets | arkts | formateDateForNoteContent | 获取笔记内容的格式化时间
@param date note modified time | formateDateForNoteContent(date: Date): string {
// formatted time
let noteContentTime = ""
// note modified time
let year = date.getFullYear()
let month = date.getMonth()
let day = date.getDate()
let hours = date.getHours()
let mins = date.getMinutes()
// now date
let nowDate =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formateDateForNoteContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Date AST#identifier#Right AST#... | formateDateForNoteContent(date: Date): string {
// formatted time
let noteContentTime = ""
// note modified time
let year = date.getFullYear()
let month = date.getMonth()
let day = date.getDate()
let hours = date.getHours()
let mins = date.getMinutes()
// now date
let nowDate =... | https://gitee.com/openharmony/applications_notes.git | 448b7d8def476d81b38a5654730dee1313604f2d | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/NativeHidController.ets | arkts | getLastActivityTime | 获取最后活动时间
用于检测静默断开 | getLastActivityTime(): number {
return this.lastActivityTime;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLastActivityTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#st... | getLastActivityTime(): number {
return this.lastActivityTime;
} | https://github.com/AlkaidLab/moonlight-harmony | f41d1a09f92d6aade95478d4129ab50df20b3885 | github |
arkui-x/samples | CodeLab/Cases/common/routermodule/src/main/ets/interceptor/Interceptor.ets | arkts | registerInterceptorPage | 注册拦截页面
@param interceptorFnc 子模块传过来的自定义拦截函数 | public static registerInterceptorPage(interceptorFnc: InterceptorExecute): void {
Interceptor.list.push(interceptorFnc);
} | 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 registerInterceptorPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left interceptorFnc AST#identifier#R... | public static registerInterceptorPage(interceptorFnc: InterceptorExecute): void {
Interceptor.list.push(interceptorFnc);
} | https://gitcode.com/arkui-x/samples | 4318f326f4b949bff885589cb4baa95ee10671cc | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | add | Return a new Decimal whose value is the value of this Decimal plus `n`, rounded to `precision`
significant digits using rounding mode `rounding`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type | public add(n: Value): Decimal {
let y = new Decimal(n);
if (!this.d || !y.d) {
if (!this.s || !y.s) {
y = new Decimal(NaN);
} else if (!this.d) {
y = new Decimal(y.d || this.s === y.s ? this : NaN);
}
return y;
}... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | public add(n: Value): Decimal {
let y = new Decimal(n);
if (!this.d || !y.d) {
if (!this.s || !y.s) {
y = new Decimal(NaN);
} else if (!this.d) {
y = new Decimal(y.d || this.s === y.s ? this : NaN);
}
return y;
}... | https://gitcode.com/iop123123/arkts-static-skills | 95a9ca3aeefca40c05909289620a47984ad8f8f9 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets | arkts | getChapterList | ==================== 章节列表缓存 ====================
获取章节列表缓存 | getChapterList(sourceId: number, mangaId: string): ChapterInfo[] | null {
const key = this.generateKey(sourceId, mangaId);
const item = this.chapterListCache.get(key);
if (!item) {
logger.debug(TAG, `章节列表缓存未命中: ${key}`);
return null;
}
if (this.isExpired(item)) {
this.c... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getChapterList 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#numb... | getChapterList(sourceId: number, mangaId: string): ChapterInfo[] | null {
const key = this.generateKey(sourceId, mangaId);
const item = this.chapterListCache.get(key);
if (!item) {
logger.debug(TAG, `章节列表缓存未命中: ${key}`);
return null;
}
if (this.isExpired(item)) {
this.c... | https://github.com/DaLongZhuaZi/manxia | cff1abb51e79796dcb17e72e619c481c79427d49 | github |
openharmony/security_privacy_center | entry/src/main/ets/common/utils/AutoMenuManager.ets | arkts | isSupportMenu | To judge this menu is support or not
@param context The context
@param item The menu id
@returns True is support | async isSupportMenu(context: Context, item: MenuConfig): Promise<number> {
let isSupport: number = 0;
const uri = item.showControlAbilityUri;
if (uri === undefined) {
isSupport = 1;
} else {
let value: string = await this._verificationUri(context, item.showControlAbilityUri);
if (val... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left isSupportMenu 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 AS... | async isSupportMenu(context: Context, item: MenuConfig): Promise<number> {
let isSupport: number = 0;
const uri = item.showControlAbilityUri;
if (uri === undefined) {
isSupport = 1;
} else {
let value: string = await this._verificationUri(context, item.showControlAbilityUri);
if (val... | https://gitee.com/openharmony/security_privacy_center.git | 6bab0bbcd16f8ccce076918dd85cb2216165ee70 | gitee |
openharmony/codelabs | ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/common/utils/ImageCache.ets | arkts | setMaxSize | 设置最大缓存数量(可被外部调整) | setMaxSize(size: number) {
if (size > 0) {
this.maxSize = size;
this.shrinkIfNeeded();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setMaxSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS... | setMaxSize(size: number) {
if (size > 0) {
this.maxSize = size;
this.shrinkIfNeeded();
}
} | https://gitcode.com/openharmony/codelabs | aa91d6672b2eae7156c66787fba920284f11bf44 | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/util/SongItemBuilder.ets | arkts | build | Resolves raw FD for songItem.src and stores it for getRealUrl(). | public async build(songItem: SongItem): Promise<SongItem> {
this.songItem = songItem;
if (!this.abilityContext) {
return this.songItem;
}
let rawfileFd = await this.abilityContext.resourceManager.getRawFd(songItem.src)
.catch((error: BusinessError) => {
Logger.error(`resourceManage... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left build AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left songItem AST#identifier#Right AST... | public async build(songItem: SongItem): Promise<SongItem> {
this.songItem = songItem;
if (!this.abilityContext) {
return this.songItem;
}
let rawfileFd = await this.abilityContext.resourceManager.getRawFd(songItem.src)
.catch((error: BusinessError) => {
Logger.error(`resourceManage... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 44e4e1610c3ae6506ccc70d44c111534626f4c25 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/pages/UserProfilePage.ets | arkts | getIncomeLevelLabel | ==================== 标签映射 ==================== | getIncomeLevelLabel(level: string): string {
if (level === INCOME_LOW) return '低收入';
if (level === INCOME_MEDIUM) return '中等收入';
if (level === INCOME_HIGH) return '高收入';
return '未知';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIncomeLevelLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#L... | getIncomeLevelLabel(level: string): string {
if (level === INCOME_LOW) return '低收入';
if (level === INCOME_MEDIUM) return '中等收入';
if (level === INCOME_HIGH) return '高收入';
return '未知';
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 1dbe1f392c91cf3ebcf8ae0a6eb486db97a1cf77 | github |
XHXYT/Pixark | entry/src/main/ets/common/utils/JumpUtils.ets | arkts | init | 初始化工具类,注入 UIAbilityContext
@param context UIAbilityContext | static init(context: common.UIAbilityContext): void {
JumpUtil.context = context;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#E... | static init(context: common.UIAbilityContext): void {
JumpUtil.context = context;
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/JumpUtils.ets#L15-L17 | af4c90cb7422a475f7a62c2e64da9e862799e1af | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/RadarChartModel.ets | arkts | getWebAlpha | Returns the alpha value for all web lines.
@return | public getWebAlpha(): number {
return this.mWebAlpha;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWebAlpha 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#num... | public getWebAlpha(): number {
return this.mWebAlpha;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 1c4b3ab5c537dee04ee0b9bc1f890b80ba41d5d1 | gitee |
openharmony-sig/applications_clock | feature/timer/src/main/ets/controller/TimerController.ets | arkts | flush | Persist preferences | private flush() {
if (!this.preferences) {
return;
}
this.preferences.flush(function (err) {
if (err) {
console.warn('Failed flush. Cause: ' + err);
return;
}
console.warn('Succeeded flush.');
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left flush AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#... | private flush() {
if (!this.preferences) {
return;
}
this.preferences.flush(function (err) {
if (err) {
console.warn('Failed flush. Cause: ' + err);
return;
}
console.warn('Succeeded flush.');
})
} | https://gitee.com/openharmony-sig/applications_clock.git | 4690546d5ce77655e45e50a8508da5f01a27d889 | gitee |
fbinba3955/Flymby | common/src/main/ets/utils/BrightnessUtil.ets | arkts | enterVideoPage | 进入视频页面,恢复视频页面亮度 | public static async enterVideoPage(): Promise<void> {
const videoBrightness = BrightnessUtil.getPageBrightness(BrightnessUtil.NAV_DESTINATION_VIDEO);
await BrightnessUtil.setBrightness(videoBrightness, BrightnessUtil.SET_BRIGHTNESS_CLICK);
LogUtil.info(`BrightnessUtil 进入视频页面,恢复亮度: ${videoBrightness}`);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left enterVideoPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments... | public static async enterVideoPage(): Promise<void> {
const videoBrightness = BrightnessUtil.getPageBrightness(BrightnessUtil.NAV_DESTINATION_VIDEO);
await BrightnessUtil.setBrightness(videoBrightness, BrightnessUtil.SET_BRIGHTNESS_CLICK);
LogUtil.info(`BrightnessUtil 进入视频页面,恢复亮度: ${videoBrightness}`);
... | https://github.com/fbinba3955/Flymby | ee011466072982a8356ace02b851a4558f281348 | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/entry/src/main/ets/scan/ScanPage.ets | arkts | startCustomScan | 开启自定义扫码 | startCustomScan() {
this.viewControl = { width: this.cameraWidth, height: this.cameraHeight, surfaceId: this.surfaceId };
customScan.start(this.viewControl).then((scanResult: Array<scanBarcode.ScanResult>) => {
this.handlerScanResult(scanResult)
this.onLightingFlash()
}).catch((error: Business... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startCustomScan 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#Le... | startCustomScan() {
this.viewControl = { width: this.cameraWidth, height: this.cameraHeight, surfaceId: this.surfaceId };
customScan.start(this.viewControl).then((scanResult: Array<scanBarcode.ScanResult>) => {
this.handlerScanResult(scanResult)
this.onLightingFlash()
}).catch((error: Business... | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 93b2ae83ea9f7bf8728cf19e1d201dff8de4bd1d | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateService.ets | arkts | findGroupByName | 根据名称查找分组 | private findGroupByName(group: KdbxGroup, name: string): KdbxGroup | null {
if (group.name === name) {
return group;
}
for (let i = 0; i < group.groups.length; i++) {
const found = this.findGroupByName(group.groups[i], name);
if (found) {
return found;
}
}
return nu... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findGroupByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private findGroupByName(group: KdbxGroup, name: string): KdbxGroup | null {
if (group.name === name) {
return group;
}
for (let i = 0; i < group.groups.length; i++) {
const found = this.findGroupByName(group.groups[i], name);
if (found) {
return found;
}
}
return nu... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L381-L392 | 2893a148c3442bd80a66c79f602391b033610f19 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/Sm4Utils.ets | arkts | encryptWithPrefix | SM4加密,返回有前缀的字符串
@param data 明文字符串
@returns 返回16进制的字符串, SM4:1234567890123 | public static encryptWithPrefix(data: string): string {
if (!data) {
return '';
}
if (data && data.startsWith(Sm4Utils.SM4_ENCRYPT_PREFIX)) {
return data;
}
return Sm4Utils.SM4_ENCRYPT_PREFIX + aegis.sm4EncTextHexSync(aegis.SM4Alg.SM4_CBC_PKCS5Padding, data, Sm4Utils.initKey());
} | 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 encryptWithPrefix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left ... | public static encryptWithPrefix(data: string): string {
if (!data) {
return '';
}
if (data && data.startsWith(Sm4Utils.SM4_ENCRYPT_PREFIX)) {
return data;
}
return Sm4Utils.SM4_ENCRYPT_PREFIX + aegis.sm4EncTextHexSync(aegis.SM4Alg.SM4_CBC_PKCS5Padding, data, Sm4Utils.initKey());
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/Sm4Utils.ets#L90-L98 | 95d874c1253bc70c4a62584a48293c405e44bb56 | github |
openharmony/arkui_ace_engine | examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets | arkts | constructor | -- Constructor and fields -- | private constructor(
// The mode indicator bits, which is a uint4 value (range 0 to 15).
public readonly modeBits: int,
// Number of character count bits for three different version ranges.
private readonly numBitsCharCount: [int, int, int]) { } | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#comment#Left // The mode indicator bits, which is a uint4 value (range 0 ... | private constructor(
// The mode indicator bits, which is a uint4 value (range 0 to 15).
public readonly modeBits: int,
// Number of character count bits for three different version ranges.
private readonly numBitsCharCount: [int, int, int]) { } | https://gitee.com/openharmony/arkui_ace_engine.git | 3f579ab8804f4c18590d44dac4d847d422e09e9e | gitee |
arkui-x/samples | CodeLab/Cases/feature/clickanimation/src/main/ets/model/BasicDataSource.ets | arkts | notifyDataChange | 通知控制器数据变化
@param index 数组索引 | notifyDataChange(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataChange(index);
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left... | notifyDataChange(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataChange(index);
})
} | https://gitcode.com/arkui-x/samples | 078fcb338bd79817fc7bb1103e1a6071371977c8 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | setNotifyOnComplete | 设置“完成时通知”开关 | async setNotifyOnComplete(enabled: boolean): Promise<void> {
await this.setBoolean(PreferenceKeys.NOTIFY_ON_COMPLETE, enabled)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setNotifyOnComplete AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left enabled AST#identifier#Right AST#type_annotation#Left AST#:... | async setNotifyOnComplete(enabled: boolean): Promise<void> {
await this.setBoolean(PreferenceKeys.NOTIFY_ON_COMPLETE, enabled)
} | https://github.com/LongLiveY96/chatcube | 31b37853333876feb3f671a548df8e4b1e5a5ea4 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateBuilder.ets | arkts | withExpiryTime | 设置过期时间 | withExpiryTime(expiryTime: Date): TemplateBuilder {
this.entry.times.expiryTime = expiryTime;
this.entry.times.expires = true;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left withExpiryTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left expiryTime AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Date AST#identifier#Right AST#ERROR#Right AST#)#Lef... | withExpiryTime(expiryTime: Date): TemplateBuilder {
this.entry.times.expiryTime = expiryTime;
this.entry.times.expires = true;
return this;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L176-L180 | b72bbeb8eaf93fde4cbbcd1e688320b0d706a009 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartMessenger.ets | arkts | getPendingChannelResponseCount | Returns the number of pending channel callback replies.
<p>When sending messages to the Flutter application using {@link BinaryMessenger#send(String,
ByteBuffer, io.flutter.plugin.common.BinaryMessenger.BinaryReply)}, developers can optionally
specify a reply callback if they expect a reply from the Flutter application... | getPendingChannelResponseCount(): number {
return this.pendingReplies.size;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPendingChannelResponseCount 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#R... | getPendingChannelResponseCount(): number {
return this.pendingReplies.size;
} | https://gitee.com/openharmony-sig/flutter_engine.git | f3e591802aecce79945f20f8daf515f9e4703a79 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ContentPanel.ets | arkts | getMode | Getters | getMode(): PanelMode { return this.mode; } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMode 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 PanelMode AST#identifier#Right AST#ERROR#Right AST#sta... | getMode(): PanelMode { return this.mode; } | https://github.com/DaLongZhuaZi/manxia | f513e22f799dc6a2f32ccd63c6f0eca944a50535 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test15_original_index.ets | arkts | testNestedData | --- Nested data structures (3-level) --- | function testNestedData(): string {
let data: Record<string, Record<string, number>> = {};
let math: Record<string, number> = {};
math['pi'] = 3;
math['e'] = 2;
data['math'] = math;
let physics: Record<string, number> = {};
physics['c'] = 299792;
physics['g'] = 9;
data['physics'] = physics;
let math... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t... | function testNestedData(): string {
let data: Record<string, Record<string, number>> = {};
let math: Record<string, number> = {};
math['pi'] = 3;
math['e'] = 2;
data['math'] = math;
let physics: Record<string, number> = {};
physics['c'] = 299792;
physics['g'] = 9;
data['physics'] = physics;
let math... | https://github.com/miaochiahao/ark-ghidra | b17690580c5a1adfca9bd4a3a3c561fb2d009d97 | github |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/feature/CallingBellFeature.ets | arkts | startRinging | Skipped in mute mode; deferred to foreground when app is currently background. | startRinging(): void {
if (GlobalState().enableMuteMode) {
Logger.info('CallingBellFeature: mute mode enabled, skip ringing');
return;
}
if (AppStateObserver().isBackground()) {
Logger.info('CallingBellFeature: app is background, defer ringing');
this.pendingRing = true;
this... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startRinging AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#method... | startRinging(): void {
if (GlobalState().enableMuteMode) {
Logger.info('CallingBellFeature: mute mode enabled, skip ringing');
return;
}
if (AppStateObserver().isBackground()) {
Logger.info('CallingBellFeature: app is background, defer ringing');
this.pendingRing = true;
this... | https://github.com/Tencent-RTC/TUIKit_Harmony | 0f7e83c8e5ee81ca068fc49b93024a9bdcefe9c2 | github |
openharmony/applications_settings | product/phone/src/main/ets/pages/passwordInput.ets | arkts | clearViewData | --------------------------- updateView -----------------------
Update view data | clearViewData() {
AppStorage.SetOrCreate("checkMessage", '');
this.password = '';
this.passwordCircle = ["", "", "", "", "", ""];
this.mController.bindComponent(this).initData();
this.updateView();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearViewData 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... | clearViewData() {
AppStorage.SetOrCreate("checkMessage", '');
this.password = '';
this.passwordCircle = ["", "", "", "", "", ""];
this.mController.bindComponent(this).initData();
this.updateView();
} | https://gitee.com/openharmony/applications_settings.git | 63c1c8f9603d2df658758961021e1e933e5f04aa | gitee |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/utils/HomeIndexCalculator.ets | arkts | getBillSortModeText | 生成列表头部使用的排序说明文本。 | private static getBillSortModeText(billSortType: BillSortTypeEnum): string {
if (billSortType === BillSortTypeEnum.DATE_DESC) {
return '按时间倒序';
}
if (billSortType === BillSortTypeEnum.DAY_TOTAL_DESC) {
return '按日总额从高到低';
}
return '按金额从高到低';
} | 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 getBillSortModeText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billSortType AST#identifier#Righ... | private static getBillSortModeText(billSortType: BillSortTypeEnum): string {
if (billSortType === BillSortTypeEnum.DATE_DESC) {
return '按时间倒序';
}
if (billSortType === BillSortTypeEnum.DAY_TOTAL_DESC) {
return '按日总额从高到低';
}
return '按金额从高到低';
} | https://github.com/ZestBox-18/kitebook-frontend | ede3e885873b782d3db98b92d06102e3646c0d5c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | ApplyLockState | Applies the appropriate lock state (READ_LOCKED, WRITE_LOCKED, or UNLOCKED)
based on the presence of waiting readers or writers.
@param { long } state Current lock state with counters updated
@returns { long } State with lock bits updated according to readers and writers
@syscap SystemCapability.Utils.Lang | public static ApplyLockState(state: long): long {
return state | (State.HasReaders(state) ? State.READ_LOCKED :
State.HasWriters(state) ? State.WRITE_LOCKED : State.UNLOCKED);
} | 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 ApplyLockState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public static ApplyLockState(state: long): long {
return state | (State.HasReaders(state) ? State.READ_LOCKED :
State.HasWriters(state) ? State.WRITE_LOCKED : State.UNLOCKED);
} | https://gitcode.com/iop123123/arkts-static-skills | 999ca2840c8b29861868492205366b26e563c9c3 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/ShareService.ets | arkts | captureScrollableAsImage | 滚动截图并拼接成完整长图。复用预览态 Scroll 内已渲染的 ShareMessageCard,
利用每段 viewport 的 componentSnapshot.get 截取已绘制像素,再按偏移拼接,
绕开 Sheet 父链 clip 与 createFromBuilder 离屏 Markdown 异步未完成的问题。 | async captureScrollableAsImage(opts: CaptureScrollableOptions): Promise<string> {
if (opts.totalContentVp <= 0 || opts.viewportVp <= 0) {
throw new Error(`截图失败: 无效尺寸 (content=${opts.totalContentVp}, viewport=${opts.viewportVp})`)
}
let stitchContext: StitchContext | null = null
try {
con... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left captureScrollableAsImage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left opts AST#identifier#... | async captureScrollableAsImage(opts: CaptureScrollableOptions): Promise<string> {
if (opts.totalContentVp <= 0 || opts.viewportVp <= 0) {
throw new Error(`截图失败: 无效尺寸 (content=${opts.totalContentVp}, viewport=${opts.viewportVp})`)
}
let stitchContext: StitchContext | null = null
try {
con... | https://github.com/LongLiveY96/chatcube | 13b88258a60d6ce96514721e96c3558561125d1b | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | executeWithConfig | 执行FFmpeg任务(完整版本) | public executeWithConfig(
commands: string[],
duration: number,
config: TaskConfig,
callback: TaskCallback
): string {
const taskId = util.generateRandomUUID(true);
const task = new Task(taskId, commands, duration, config, callback);
// 记录活动任务
this.activeTasks.set(taskId, tas... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left executeWithConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commands AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public executeWithConfig(
commands: string[],
duration: number,
config: TaskConfig,
callback: TaskCallback
): string {
const taskId = util.generateRandomUUID(true);
const task = new Task(taskId, commands, duration, config, callback);
// 记录活动任务
this.activeTasks.set(taskId, tas... | https://github.com/jjjjjjava/ffmpeg_tools | 2c9473dbcc614a3681b10240aa16fe9eb7d45b47 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | precision | Return the number of significant digits of the value of this Decimal, whether to count
integer-part trailing zeros.
@param { boolean | int } includeZeros Whether to count integer-part trailing zeros: true, false,
1 or 0.
@returns { double } the number type
@throws { BusinessError } 10200001 - The value of `includeZeros... | public precision(includeZeros: boolean | int): double {
let result: double;
if (includeZeros != undefined && includeZeros !== !!includeZeros && includeZeros !== 1 && includeZeros !== 0) {
throw Utils.createBusinessError(RANGE_ERROR_CODE,
`The value of includeZeros is out ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left precision AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left includeZeros AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boo... | public precision(includeZeros: boolean | int): double {
let result: double;
if (includeZeros != undefined && includeZeros !== !!includeZeros && includeZeros !== 1 && includeZeros !== 0) {
throw Utils.createBusinessError(RANGE_ERROR_CODE,
`The value of includeZeros is out ... | https://gitcode.com/iop123123/arkts-static-skills | b27c8bc10ac9c8030c0d819f46c7ecf2a4fc8778 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AnomalyDetection.ets | arkts | detectBillsAnomaly | 批量检测账单异常
@param bills 账单列表
@param baseline 用户消费基线
@param algorithm 检测算法 | static detectBillsAnomaly(
bills: Bill[],
baseline: UserSpendingBaseline,
algorithm: string = ALGORITHM_ENSEMBLE
): AnomalyRecord[] {
const anomalies: AnomalyRecord[] = [];
const now = new Date().toISOString();
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectBillsAnomaly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex... | static detectBillsAnomaly(
bills: Bill[],
baseline: UserSpendingBaseline,
algorithm: string = ALGORITHM_ENSEMBLE
): AnomalyRecord[] {
const anomalies: AnomalyRecord[] = [];
const now = new Date().toISOString();
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 90d219d3b7babced4a9c8d35a0acc466fc05d75c | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets | arkts | stopProgressTimer | 停止进度计时器 | private stopProgressTimer(): void {
if (this.progressTimer !== -1) {
clearInterval(this.progressTimer)
this.progressTimer = -1
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopProgressTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#e... | private stopProgressTimer(): void {
if (this.progressTimer !== -1) {
clearInterval(this.progressTimer)
this.progressTimer = -1
}
} | https://gitcode.com/openharmony/codelabs | 107b583a4657e1abb16c9a217ee7db9cee10a89a | gitcode |
HarmonyCandies/extended_text | extended_text/src/main/ets/Utils.ets | arkts | constructor | Accumulator may be initialized with a specified value; otherwise, it will initialize to zero. | constructor(value: number = 0) {
this._value = value;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Le... | constructor(value: number = 0) {
this._value = value;
} | https://github.com/HarmonyCandies/extended_text | 09fa32d5a00e940a0bc8083a7594d18318163711 | github |
openharmony/codelabs | ETSUI/SimpleApp/entry/src/main/ets/pages/Index.ets | arkts | getPressedColor | 获取按下状态的颜色 | getPressedColor(color: string): string {
// 简单的颜色映射
const colorMap: Record<string, string> = {
'#FF6B6B': '#D45A5A',
'#4ECDC4': '#42A9A1',
'#45B7D1': '#3A9AB4',
'#FF9500': '#D67E00',
'#34C759': '#2CA74B',
'#5856D6': '#4A49B4'
};
return colorMap[color] || color;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPressedColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ... | getPressedColor(color: string): string {
// 简单的颜色映射
const colorMap: Record<string, string> = {
'#FF6B6B': '#D45A5A',
'#4ECDC4': '#42A9A1',
'#45B7D1': '#3A9AB4',
'#FF9500': '#D67E00',
'#34C759': '#2CA74B',
'#5856D6': '#4A49B4'
};
return colorMap[color] || color;
} | https://gitcode.com/openharmony/codelabs | ec2800a189ba0b80fc8b0360979bb442fc57a1ba | gitcode |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/HomePage.ets | arkts | logout | 方法名称: logout
功能描述: 执行退出登录操作。
逻辑:
1. router.clear(): 这是一个关键操作。它会清空当前的页面路由栈。
这样做的目的是防止用户退出后,还能通过物理返回键或手势滑回主页,确保安全性。
2. router.pushUrl(...): 导航回 'pages/Index' (通常是登录/启动页)。
退出登录 | logout() {
// 清空路由历史栈,防止回退
router.clear();
// 跳转回登录入口
router.pushUrl({
url: 'pages/Index'
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logout 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#comment#Left // 清空路由历史栈,防止回退 A... | logout() {
// 清空路由历史栈,防止回退
router.clear();
// 跳转回登录入口
router.pushUrl({
url: 'pages/Index'
});
} | https://gitcode.com/openharmony/codelabs | 2bb55b2e17ab3cf33fd831715e1d91f29084cf31 | gitcode |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/defaultError.ets | arkts | array2 | array is not readonly | function array2(arg: readonly string[][]) {} // array element is not readonly | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left array2 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function array2(arg: readonly string[][]) {} // array element is not readonly | https://github.com/SMAT-Lab/Homecheck-Sec2026 | d1838a46759f914553e628f2a81916c0e82fd3c5 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/BackgroundMusicManager.ets | arkts | setEnabled | 更新启用状态 | public async setEnabled(enabled: boolean): Promise<void> {
if (!this.initialized || !this.avPlayer) return;
if (enabled) {
await this.play();
} else {
await this.pause();
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left setEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST... | public async setEnabled(enabled: boolean): Promise<void> {
if (!this.initialized || !this.avPlayer) return;
if (enabled) {
await this.play();
} else {
await this.pause();
}
} | https://github.com/richshaw2015/nds | c1c6470943d4cdfab1543ea0b45f56962693a171 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/AutoPageTurnController.ets | arkts | setCallbacks | 设置回调函数 | public setCallbacks(
onPageTurn: () => void,
getCurrentPageIndex: () => number,
getTotalPages: () => number
): void {
this.onPageTurn = onPageTurn;
this.getCurrentPageIndex = getCurrentPageIndex;
this.getTotalPages = getTotalPages;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left o... | public setCallbacks(
onPageTurn: () => void,
getCurrentPageIndex: () => number,
getTotalPages: () => number
): void {
this.onPageTurn = onPageTurn;
this.getCurrentPageIndex = getCurrentPageIndex;
this.getTotalPages = getTotalPages;
} | https://github.com/DaLongZhuaZi/manxia | e8619011d79ab89ad0f7836abe9082f85c2a892c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | at | Returns an instance of primitive type at passed index.
@param index index to look at
@returns a primitive at index | public at(index: number): number {
return this.at(index as int) as double as number
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left at AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | public at(index: number): number {
return this.at(index as int) as double as number
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ceed7b3e2977717d0c1d42fee13ffbcd3f23abd7 | gitee |
Joker-x-dev/CoolMallArkTS | core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets | arkts | toModel | 将数据库实体转换为领域模型
@param {CartEntity} entity 数据库实体
@returns {Cart} 领域模型 | private toModel(entity: CartEntity): Cart {
const cart: Cart = new Cart();
cart.goodsId = entity.goodsId ?? 0;
cart.goodsName = entity.goodsName ?? "";
cart.goodsMainPic = entity.goodsMainPic ?? "";
cart.spec = this.parseSpecs(entity.specJson);
return cart;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left toModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entity AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Car... | private toModel(entity: CartEntity): Cart {
const cart: Cart = new Cart();
cart.goodsId = entity.goodsId ?? 0;
cart.goodsName = entity.goodsName ?? "";
cart.goodsMainPic = entity.goodsMainPic ?? "";
cart.spec = this.parseSpecs(entity.specJson);
return cart;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 23975560f9182bff577762f5b38c6ac0be37a33e | github |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/bean/OmniFilterItemBean.ets | arkts | hasCheckBoxBrother | 检查自己的兄弟节点是否存在 checkbox 类型。 | hasCheckBoxBrother(): boolean {
const count = this.parent?.children?.filter(
(f) => f.type === OmniFilterType.checkbox
).length;
return count !== undefined && count > 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasCheckBoxBrother AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#... | hasCheckBoxBrother(): boolean {
const count = this.parent?.children?.filter(
(f) => f.type === OmniFilterType.checkbox
).length;
return count !== undefined && count > 0;
} | https://github.com/wuba/omni-ui | 9e748f8646bae39e52b2ea05d45077e8584e14e3 | github |
CLMC2025/Vignette | entry/src/main/ets/ui/Animations.ets | arkts | scaleIn | 创建缩放动画 | static scaleIn(duration: number = 300): AnimationConfig {
return new AnimationConfig(
AnimationType.SCALE_IN,
AnimationDirection.CENTER,
duration,
0,
Curve.EaseOut
);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left scaleIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left duration AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressio... | static scaleIn(duration: number = 300): AnimationConfig {
return new AnimationConfig(
AnimationType.SCALE_IN,
AnimationDirection.CENTER,
duration,
0,
Curve.EaseOut
);
} | https://github.com/CLMC2025/Vignette | 85a327a3a9d7b7b0ed54dd821875c5400137ab9c | github |
honjow/Next2V | shared/src/main/ets/backup/BackupPreferencesAdapter.ets | arkts | dumpSettingsStore | Read every key in the unified store and keep the JSON-safe scalars that are not denylisted. | private static async dumpSettingsStore(context: common.UIAbilityContext): Promise<SettingsMap> {
const result: SettingsMap = JSON.parse('{}') as SettingsMap
const store = await preferences.getPreferences(context, STORE_NAME_SETTINGS)
const all = store.getAllSync() as Record<string, preferences.ValueType>
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left dumpSettingsStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le... | private static async dumpSettingsStore(context: common.UIAbilityContext): Promise<SettingsMap> {
const result: SettingsMap = JSON.parse('{}') as SettingsMap
const store = await preferences.getPreferences(context, STORE_NAME_SETTINGS)
const all = store.getAllSync() as Record<string, preferences.ValueType>
... | https://github.com/honjow/Next2V | 3fb029ec813d99b4e67dc65fec4f2efc12cbd8f3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets | arkts | getBookOpenDuration | 获取书籍打开动画时长 | public getBookOpenDuration(): number {
return this.currentSettings.bookOpenDuration;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBookOpenDuration 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... | public getBookOpenDuration(): number {
return this.currentSettings.bookOpenDuration;
} | https://github.com/DaLongZhuaZi/manxia | 454619c46402958c7ebdd49ad5b5c9d63ba27442 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Float64Array from FixedArray<number>
@param { FixedArray<number> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: FixedArray<number>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i])
}
} | 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 numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public constructor(numbers: FixedArray<number>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i])
}
} | https://gitcode.com/iop123123/arkts-static-skills | 9c1889eb602006306e174bdc662ca14be1e5b5aa | gitcode |
anhao0226/harmony-music-player | entry/src/main/ets/common/utils/AudioService.ets | arkts | setPlaylist | @param data | public setPlaylist(data: Song[]) {
this._shareData.playlist = data;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression... | public setPlaylist(data: Song[]) {
this._shareData.playlist = data;
} | https://github.com/anhao0226/harmony-music-player | de4761691afa71cb58bf7df689f705739492a4fd | github |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/goods/OrderGoodsCard.ets | arkts | build | 构建订单商品卡片
@returns {void} 无返回值 | build(): void {
Card() {
// 商品标题
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
}) {
IBestCell({
title: this.data.goodsName,
isLink: true,
hasBorder: true,
leftContentWidth: P80,
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
Card() {
// 商品标题
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
}) {
IBestCell({
title: this.data.goodsName,
isLink: true,
hasBorder: true,
leftContentWidth: P80,
... | https://github.com/Joker-x-dev/CoolMallArkTS | 1a49a33375a9db26dcc57a4202016ec1cf562058 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | valueOf | The `valueOf()` method returns the primitive value of a `Date` object.
@see ECMA-262, 21.4.4.44
@returns The number of milliseconds between 1 January 1970 00:00:00 UTC and the given date.
@throws InvalidDate - Throws if Date object is invalid (@link{isDateValid} is `false`). | public valueOf(): long throws {
if (!this.isDateValid()) {
throw new InvalidDate();
}
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left long AST#ident... | public valueOf(): long throws {
if (!this.isDateValid()) {
throw new InvalidDate();
}
return this.ms;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 11cf05331f075eb40e8f2e3d07a5b01761e8c278 | gitee |
OHPG/FinSdk | jellyfin/src/main/ets/api/SessionApi.ets | arkts | sendGeneralCommand | sendGeneralCommand
@summary Issues a general command to a client.
@param {SessionApiSendGeneralCommandRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof SessionApi | public async sendGeneralCommand(requestParameters: SessionApiSendGeneralCommandRequest): Promise<void> {
this.assertParam(requestParameters.sessionId)
this.assertParam(requestParameters.command)
return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/Command/${requestParameters.command... | 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 sendGeneralCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Righ... | public async sendGeneralCommand(requestParameters: SessionApiSendGeneralCommandRequest): Promise<void> {
this.assertParam(requestParameters.sessionId)
this.assertParam(requestParameters.command)
return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/Command/${requestParameters.command... | https://github.com/OHPG/FinSdk | c5d55a3cc51f4dd168460cfa499b459f89ef33e2 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SoundEffectManager.ets | arkts | initialize | 初始化 SoundPool 并预加载所有音效
需要在 context 可用后调用(如 aboutToAppear) | public async initialize(context: Context): Promise<void> {
if (this.initialized || this.initializing) return;
this.initializing = true;
try {
const audioRendererInfo: audio.AudioRendererInfo = {
usage: audio.StreamUsage.STREAM_USAGE_GAME,
rendererFlags: 0
};
this.soundP... | 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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST... | public async initialize(context: Context): Promise<void> {
if (this.initialized || this.initializing) return;
this.initializing = true;
try {
const audioRendererInfo: audio.AudioRendererInfo = {
usage: audio.StreamUsage.STREAM_USAGE_GAME,
rendererFlags: 0
};
this.soundP... | https://github.com/richshaw2015/nds | fc5b220d284476874b503b8a0fbb22c0c9b7de52 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | registerUsbDevice | 注册 USB 设备 | private registerUsbDevice(
controllerId: number,
deviceKey: string,
name: string,
vendorId: number,
productId: number
): void {
this.connectedDevices.set(controllerId, name);
this.deviceStates.set(controllerId, this.createEmptyState());
this.usbDeviceKeyToId.set(deviceKey, contro... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerUsbDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | private registerUsbDevice(
controllerId: number,
deviceKey: string,
name: string,
vendorId: number,
productId: number
): void {
this.connectedDevices.set(controllerId, name);
this.deviceStates.set(controllerId, this.createEmptyState());
this.usbDeviceKeyToId.set(deviceKey, contro... | https://github.com/AlkaidLab/moonlight-harmony | ddc0bf59495c16223e9dafc545a706fbde05f454 | github |
aimilin6688/KeePassHO | entry/src/main/ets/components/loading/LoadingDialogUtils.ets | arkts | hideLoading | 隐藏 hud | async hideLoading(): Promise<void> {
if (this.loadingList.length > 0) {
this.loadingList = [];
}
this.hide(LoadingState.LOADING).catch(() => {
this.hideDialogDelay(LoadingState.LOADING, { hideDelay: 100 });
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left hideLoading AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST... | async hideLoading(): Promise<void> {
if (this.loadingList.length > 0) {
this.loadingList = [];
}
this.hide(LoadingState.LOADING).catch(() => {
this.hideDialogDelay(LoadingState.LOADING, { hideDelay: 100 });
})
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/loading/LoadingDialogUtils.ets#L42-L49 | d5e96cf86dfb30210b332a9f0093d55cfbdfd34f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDataManager.ets | arkts | initialize | 初始化数据库(使用现有数据库连接) | async initialize(context: common.UIAbilityContext): Promise<void> {
if (this.isInitialized) {
return;
}
try {
logger.info(TAG, '开始初始化小说数据库表');
const config: relationalStore.StoreConfig = {
name: 'manxia_comic.db',
securityLevel: relationalStore.SecurityLevel.S1,
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#t... | async initialize(context: common.UIAbilityContext): Promise<void> {
if (this.isInitialized) {
return;
}
try {
logger.info(TAG, '开始初始化小说数据库表');
const config: relationalStore.StoreConfig = {
name: 'manxia_comic.db',
securityLevel: relationalStore.SecurityLevel.S1,
... | https://github.com/DaLongZhuaZi/manxia | 960608953e7c7286daa58d02e7aa92e6cb0299f8 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/pages/Index.ets | arkts | connectToBookmark | Connect to a bookmark | connectToBookmark(bookmark: BookmarkBase): void {
// Check native library first
if (!LibFreeRDP.isNativeLoaded()) {
this.showNativeError = true;
return;
}
console.info(`${TAG}: Connecting to ${bookmark.hostname}:${bookmark.port}`);
router.pushUrl({
url: 'pages/SessionPa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left connectToBookmark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookmark AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BookmarkBase AST#identifier#Right ... | connectToBookmark(bookmark: BookmarkBase): void {
// Check native library first
if (!LibFreeRDP.isNativeLoaded()) {
this.showNativeError = true;
return;
}
console.info(`${TAG}: Connecting to ${bookmark.hostname}:${bookmark.port}`);
router.pushUrl({
url: 'pages/SessionPa... | https://github.com/tangwengang-del/freerdp-harmonyos | e0533d0db881aa8ce95f635454ee3bb53df23c09 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CategoryDAO.ets | arkts | updateSortOrders | 批量更新分类排序
@param categories 已重新排序的分类列表 | static async updateSortOrders(categories: Category[]): Promise<void> {
if (categories.length === 0) return;
// 假设 categories 已经是排好序的,我们更新它们的 sort_order
const userId = categories[0].userId;
await DAOHelper.transaction(async () => {
const store = DatabaseManager.getDatabase();
con... | 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 updateSortOrders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categories AST#identifier#Right AST#ERROR#Left AST#:#L... | static async updateSortOrders(categories: Category[]): Promise<void> {
if (categories.length === 0) return;
// 假设 categories 已经是排好序的,我们更新它们的 sort_order
const userId = categories[0].userId;
await DAOHelper.transaction(async () => {
const store = DatabaseManager.getDatabase();
con... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | faec2944da07124bb709313541a39397fe35b83b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets | arkts | addListener | 添加策略更新监听器 | public addListener(listener: (strategy: PreloadStrategy) => void): void {
this.listeners.push(listener);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left addListener 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#(#Left ( AST#(#R... | public addListener(listener: (strategy: PreloadStrategy) => void): void {
this.listeners.push(listener);
} | https://github.com/DaLongZhuaZi/manxia | a58227b739b44fc4fd0a0dbb0baaf6f450c0195a | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/pages/Index.ets | arkts | quickConnect | Quick connect | quickConnect(): void {
// Check native library first
if (!LibFreeRDP.isNativeLoaded()) {
this.showQuickConnect = false;
this.showNativeError = true;
return;
}
if (!this.quickConnectHost) {
promptAction.showToast({ message: '请输入主机地址' });
return;
}
const b... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left quickConnect 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... | quickConnect(): void {
// Check native library first
if (!LibFreeRDP.isNativeLoaded()) {
this.showQuickConnect = false;
this.showNativeError = true;
return;
}
if (!this.quickConnectHost) {
promptAction.showToast({ message: '请输入主机地址' });
return;
}
const b... | https://github.com/tangwengang-del/freerdp-harmonyos | 6ceab72d72aa7097e3c086dff8dc1a0a24a1a8c8 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test23_original_index.ets | arkts | testMapForOf | --- for-of with Map entries --- | function testMapForOf(): string {
let m: Map<string, number> = new Map<string, number>();
m.set('x', 10);
m.set('y', 20);
let result: string = '';
let entries: IterableIterator<[string, number]> = m.entries();
let entry: IteratorResult<[string, number]> = entries.next();
while (!entry.done) {
let pair... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapForOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_typ... | function testMapForOf(): string {
let m: Map<string, number> = new Map<string, number>();
m.set('x', 10);
m.set('y', 20);
let result: string = '';
let entries: IterableIterator<[string, number]> = m.entries();
let entry: IteratorResult<[string, number]> = entries.next();
while (!entry.done) {
let pair... | https://github.com/miaochiahao/ark-ghidra | 9409a74a851955d8b95946e979dbea1379b2d5f4 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.