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 |
|---|---|---|---|---|---|---|---|---|---|---|
YANGZX22/Voot | entry/src/main/ets/services/SherpaWhisperMicService.ets | arkts | init | Initialize ASR model from rawfile using the app's resourceManager.
Must be called once before start().
@param modelType 模型类型,默认为 Moonshine EN | async init(ctx: common.UIAbilityContext, modelType: AsrModelType = AsrModelType.MOONSHINE_EN): Promise<void> {
this.ctx = ctx;
this.currentModelType = modelType;
const cfg = new OfflineRecognizerConfig();
// Feature config
cfg.featConfig.sampleRate = this.sampleRate;
cfg.featConfig.featureDi... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST... | async init(ctx: common.UIAbilityContext, modelType: AsrModelType = AsrModelType.MOONSHINE_EN): Promise<void> {
this.ctx = ctx;
this.currentModelType = modelType;
const cfg = new OfflineRecognizerConfig();
// Feature config
cfg.featConfig.sampleRate = this.sampleRate;
cfg.featConfig.featureDi... | https://github.com/YANGZX22/Voot | 25a202bd8f5ad13bfc30cbcfc7fe8ae0809f8028 | github |
openharmony-sig/flutter_packages | packages/pigeon/example/app/ohos/entry/src/main/ets/plugins/Messages.ets | arkts | getCodec | The codec used by ExampleHostApi. | static getCodec(): MessageCodec<Object>{
return ExampleHostApiCodec.INSTANCE;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCodec 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_st... | static getCodec(): MessageCodec<Object>{
return ExampleHostApiCodec.INSTANCE;
} | https://gitee.com/openharmony-sig/flutter_packages.git | 02c129754bbc064f1c1007468bbda1567fa1697b | gitee |
codelably/HCompass | core/module/src/main/ets/ModuleRegistry.ets | arkts | register | 注册模块
@param module 功能模块 | register(module: FeatureModule): void {
if (this.modules.has(module.moduleId)) {
this.log(`Module already registered: ${module.moduleId}`);
return;
}
this.modules.set(module.moduleId, {
module,
state: ModuleState.REGISTERED
});
this.log(`Module registered: ${module.module... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left module AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FeatureModule AST#identifier#Right AST#)#Left... | register(module: FeatureModule): void {
if (this.modules.has(module.moduleId)) {
this.log(`Module already registered: ${module.moduleId}`);
return;
}
this.modules.set(module.moduleId, {
module,
state: ModuleState.REGISTERED
});
this.log(`Module registered: ${module.module... | https://github.com/codelably/HCompass | 63b3a481f2f5926356bea3b2f3144647d50db118 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | addSessionMetaColumnsIfNeeded | 添加会话元信息字段(用于会话列表增强) | private async addSessionMetaColumnsIfNeeded(): Promise<void> {
if (this.rdbStore === null) {
return
}
try {
await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.SESSIONS} ADD COLUMN is_favorite INTEGER DEFAULT 0`)
} catch (error) {
console.info('DatabaseService', 'is_favorite col... | 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 addSessionMetaColumnsIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expr... | private async addSessionMetaColumnsIfNeeded(): Promise<void> {
if (this.rdbStore === null) {
return
}
try {
await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.SESSIONS} ADD COLUMN is_favorite INTEGER DEFAULT 0`)
} catch (error) {
console.info('DatabaseService', 'is_favorite col... | https://github.com/LongLiveY96/chatcube | 6c31b541ddea6f41026c2b250bffd94542cde1b7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | getThemedColor | 获取主题相关的颜色资源 | public static getThemedColor(
lightColorKey: string,
darkColorKey: string,
theme: ThemeType
): Resource {
return theme === ThemeType.LIGHT
? $r(`app.color.${lightColorKey}`)
: $r(`app.color.${darkColorKey}`);
} | 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 getThemedColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lightColorKey AST#identifier#Right AST#ERROR#Left AST#:... | public static getThemedColor(
lightColorKey: string,
darkColorKey: string,
theme: ThemeType
): Resource {
return theme === ThemeType.LIGHT
? $r(`app.color.${lightColorKey}`)
: $r(`app.color.${darkColorKey}`);
} | https://github.com/DaLongZhuaZi/manxia | 96b75c3c8daba614f78a5c2686fb0b5bffdbfc9a | github |
bluedeer000/HarmonyCalendar | entry/src/main/ets/services/CalendarSourceAdapterRegistry.ets | arkts | listWritableAdapters | 列出支持写入的适配器 | listWritableAdapters(): AdapterRegistration[] {
return this.listAdapters().filter((reg: AdapterRegistration) => reg.capability.supportsWrite);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left listWritableAdapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments... | listWritableAdapters(): AdapterRegistration[] {
return this.listAdapters().filter((reg: AdapterRegistration) => reg.capability.supportsWrite);
} | https://github.com/bluedeer000/HarmonyCalendar | 6fb3a6dffd7db88d9267d7d03d93b44cbe15dad1 | github |
darcycui/DarcyHarmonyNext | entry/src/main/ets/pages/background_task/ShortTaskPage.ets | arkts | stopTask | 取消短时任务
@param id 短时任务ID | function stopTask() {
backgroundTaskManager.cancelSuspendDelay(taskID);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left stopTask 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#expression_stateme... | function stopTask() {
backgroundTaskManager.cancelSuspendDelay(taskID);
} | https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/background_task/ShortTaskPage.ets#L61-L63 | da3e0ef24f92861e8eff666a96e1c6e8fa776d74 | github |
harmonyos/codelabs | HarmonyOS_NEXT/Preferences/entry/src/main/ets/common/utils/Logger.ets | arkts | warn | Outputs warning-level logs.
@param args Indicates the log parameters. | warn(...args: string[]) {
hilog.warn(this.domain, this.prefix, this.format, args);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left warn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right A... | warn(...args: string[]) {
hilog.warn(this.domain, this.prefix, this.format, args);
} | https://gitee.com/harmonyos/codelabs.git | cb743e6e4646bb0baf33a0adfab6a3861b3fc34f | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnImageUploadViewModel.ets | arkts | addFiles | 批量添加文件到列表
@param files 待添加的文件数组 | addFiles(files: TnUploadFile[]): void {
this.fileList = [...this.fileList, ...files];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left files AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left TnUploadFile AST... | addFiles(files: TnUploadFile[]): void {
this.fileList = [...this.fileList, ...files];
} | https://github.com/codelably/tuniao-ui | a29739e8c85c1fc61b4044f55c64fa6025c57a09 | github |
Lycorius03/studyos | apps/harmonyos/entry/src/main/ets/bridge/StudyOsBridge.ets | arkts | importFile | ---- File import ---- | importFile(
topicId: string,
filePath: string
): Question[] {
this.ensureInit();
// Note: progress callback is passed as null for now — ArkTS strict
// mode requires typed NAPI callbacks which are set up at the native layer.
const json: string = nativeModule.studyosImportFile(
this.han... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left importFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left topicId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#... | importFile(
topicId: string,
filePath: string
): Question[] {
this.ensureInit();
// Note: progress callback is passed as null for now — ArkTS strict
// mode requires typed NAPI callbacks which are set up at the native layer.
const json: string = nativeModule.studyosImportFile(
this.han... | https://github.com/Lycorius03/studyos | c6fb57cb34bc887334ec304ce79b37862b2737f0 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/InputInterceptorService.ets | arkts | isInjectApiAvailable | 查询按键注入 API 是否可用(API 13+ 设备)
返回 false 时不应启用反劫持功能(音量键会被吃掉且无法回注) | isInjectApiAvailable(): boolean {
if (this.native) {
return this.native.isInjectApiAvailable();
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isInjectApiAvailable 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 AS... | isInjectApiAvailable(): boolean {
if (this.native) {
return this.native.isInjectApiAvailable();
}
return false;
} | https://github.com/AlkaidLab/moonlight-harmony | 66dcebc6aec6612a17117d2acfec7c135f9f006a | github |
robotzzh/AgricultureApp | entry/src/main/ets/DB/relationDB.ets | arkts | getDatas | 根据谓词指定的查询条件查找数据 | async getDatas(tableName: string, atomArr: Array<string>, key: string, val: string | number) {
let predicates = new relationalStore.RdbPredicates(tableName);
predicates.equalTo(key, val);
if (store != undefined) {
return new Promise((resolve, reject) => {
(store as relationalStore.RdbStore).... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getDatas AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AST#type_annotation#Left AST#:... | async getDatas(tableName: string, atomArr: Array<string>, key: string, val: string | number) {
let predicates = new relationalStore.RdbPredicates(tableName);
predicates.equalTo(key, val);
if (store != undefined) {
return new Promise((resolve, reject) => {
(store as relationalStore.RdbStore).... | https://github.com/robotzzh/AgricultureApp | a22537afa7eab9129ea658b9e02b3b92ab287673 | github |
arkui-x/samples | CodeLab/Cases/feature/barchart/src/main/ets/view/BarChart.ets | arkts | aboutToAppear | 图表数据初始化 | aboutToAppear() {
// TODO 知识点:必须初始化图表配置构建类
this.model = new BarChartModel();
// TODO 知识点:配置图表指定样式,为图表添加数据选择的监听器。
this.model.setOnChartValueSelectedListener(this.valueSelectedListener);
// 为图表添加手势识别监听器
this.model.setOnChartGestureListener(this.chartGestureListener);
// 获取图表描述部件,设置图表描述部件不可用,... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// TODO 知识点:必须初始化图表配置构建类
this.model = new BarChartModel();
// TODO 知识点:配置图表指定样式,为图表添加数据选择的监听器。
this.model.setOnChartValueSelectedListener(this.valueSelectedListener);
// 为图表添加手势识别监听器
this.model.setOnChartGestureListener(this.chartGestureListener);
// 获取图表描述部件,设置图表描述部件不可用,... | https://gitcode.com/arkui-x/samples | 9d08dfcd8b4de9aaeb720e908492c1e17232c910 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | doWrite | Implemented by subclass inheritance. The implementation logic of flushing chunks in the buffer must not be
directly called. The call is controlled by Writable.write.
@param { string | Uint8Array } [chunk] - Data to be written.
@param { string } [encoding] - Encoding type.
@param { Function } [callback] - Callback after... | doWrite(chunk: string | Uint8Array, encoding: string, callback: Function): void {
this._writable.noWriteOpes(chunk, encoding, callback);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left doWrite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunk AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left string AST#identifie... | doWrite(chunk: string | Uint8Array, encoding: string, callback: Function): void {
this._writable.noWriteOpes(chunk, encoding, callback);
} | https://gitcode.com/iop123123/arkts-static-skills | 73e8f8eb5bdbe3429b21f2e0087a3be6458bb840 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/ModelManager.ets | arkts | isModelLoaded | 检查模型是否已加载
@param imagingType 影像类型
@returns 是否已加载 | isModelLoaded(imagingType: ImagingType): boolean {
return this.getModelStatus(imagingType) === ModelStatus.LOADED;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isModelLoaded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imagingType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImagingType AST#identifier#Right AS... | isModelLoaded(imagingType: ImagingType): boolean {
return this.getModelStatus(imagingType) === ModelStatus.LOADED;
} | https://github.com/LJ666-ui/harmony-health-care | 55ffb5b7472b2e5b5fa19c3197f960a701c61a7d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | toggleDictRule | 切换字典规则启用状态 | async toggleDictRule(name: string, enabled: boolean): Promise<void> {
const rule = this.dictRules.find(r => r.name === name);
if (rule) {
rule.enabled = enabled;
await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.DICT_RULES, this.dictRules);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left toggleDictRule AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async toggleDictRule(name: string, enabled: boolean): Promise<void> {
const rule = this.dictRules.find(r => r.name === name);
if (rule) {
rule.enabled = enabled;
await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.DICT_RULES, this.dictRules);
}
} | https://github.com/DaLongZhuaZi/manxia | 9af8eb21e2648874032327d1baab55e5af0fcb3e | github |
RoooyHe/toona-ohos | toona/src/main/ets/network/MatrixHttpClient.ets | arkts | deleteDevices | 3. 补充上批量删除的透传方法(如果您需要用到的话) | deleteDevices(deviceIds: string[], authData?: DeviceAuthData): Promise<void> {
return this.deviceClient.deleteDevices(deviceIds, authData);
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left deleteDevices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceIds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A... | deleteDevices(deviceIds: string[], authData?: DeviceAuthData): Promise<void> {
return this.deviceClient.deleteDevices(deviceIds, authData);
} | https://github.com/RoooyHe/toona-ohos | 9952b70d23917a3af134760c0a575ec662d6e152 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnDateTimePickerViewModel.ets | arkts | setDateValue | 设置选中的日期值
@param value 日期字符串 | setDateValue(value: string): void {
this.dateValue = value;
this.selectedDate = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDateValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | setDateValue(value: string): void {
this.dateValue = value;
this.selectedDate = value;
} | https://github.com/codelably/tuniao-ui | 4f04312c79ca06bad9cf146640c13517748921fa | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/CloudSyncService.ets | arkts | sync | 60秒超时
执行同步 | static async sync(options: SyncOptions): Promise<SyncResult> {
const startTime: number = Date.now();
let syncRecord: CloudSyncRecord | null = null;
try {
// 检查是否有正在进行的同步
const inProgressSync: CloudSyncRecord | null = await CloudSyncRecordDAO.getInProgressSync(options.userId);
if (inProg... | 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 sync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Rig... | static async sync(options: SyncOptions): Promise<SyncResult> {
const startTime: number = Date.now();
let syncRecord: CloudSyncRecord | null = null;
try {
// 检查是否有正在进行的同步
const inProgressSync: CloudSyncRecord | null = await CloudSyncRecordDAO.getInProgressSync(options.userId);
if (inProg... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 48e2b822f1da4b96bd5f851d7bd01b4d4279d69a | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test60_original_index.ets | arkts | topK | --- Top-K with partial sort --- | function topK(arr: number[], k: number): number[] {
let sorted: number[] = arr.slice(0);
for (let i: number = 0; i < k; i++) {
let maxIdx: number = i;
for (let j: number = i + 1; j < sorted.length; j++) {
if (sorted[j] > sorted[maxIdx]) {
maxIdx = j;
}
}
let temp: number = sorted... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left topK AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ar... | function topK(arr: number[], k: number): number[] {
let sorted: number[] = arr.slice(0);
for (let i: number = 0; i < k; i++) {
let maxIdx: number = i;
for (let j: number = i + 1; j < sorted.length; j++) {
if (sorted[j] > sorted[maxIdx]) {
maxIdx = j;
}
}
let temp: number = sorted... | https://github.com/miaochiahao/ark-ghidra | ced227a3e2745fe07236eb077b4118ff36193915 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test4_original_index.ets | arkts | testLogicalNot | === Logical NOT === | function testLogicalNot(flag: boolean): boolean {
return !flag;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testLogicalNot AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left flag AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function testLogicalNot(flag: boolean): boolean {
return !flag;
} | https://github.com/miaochiahao/ark-ghidra | 014fead2185da6edadddd1a047be472d7e3a3fa5 | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordBookRepository.ets | arkts | getUserWordBookWordCountsBatch | Batch fetch word counts for multiple books to avoid N+1 query problem | private async getUserWordBookWordCountsBatch(bookIds: string[]): Promise<Record<string, number>> {
if (bookIds.length === 0) {
return {};
}
console.info(`[WordBookRepository] Batch fetching word counts for ${bookIds.length} books`);
const counts: Record<string, number> = {};
// Initialize ... | 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 getUserWordBookWordCountsBatch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookIds AST#identifier... | private async getUserWordBookWordCountsBatch(bookIds: string[]): Promise<Record<string, number>> {
if (bookIds.length === 0) {
return {};
}
console.info(`[WordBookRepository] Batch fetching word counts for ${bookIds.length} books`);
const counts: Record<string, number> = {};
// Initialize ... | https://github.com/CLMC2025/Vignette | 62e8ae29d1ddcd5163ccfad280513de46448ca41 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/AudioFocusManager.ets | arkts | requestFocus | Request audio focus for RDP audio playback | static async requestFocus(): Promise<boolean> {
if (!audioManager) {
console.error(`${TAG}: Audio manager not initialized`);
return false;
}
if (isAudioFocusHeld) {
console.info(`${TAG}: Audio focus already held`);
return true;
}
console.info(`${TAG}: Requesting a... | 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 requestFocus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static async requestFocus(): Promise<boolean> {
if (!audioManager) {
console.error(`${TAG}: Audio manager not initialized`);
return false;
}
if (isAudioFocusHeld) {
console.info(`${TAG}: Audio focus already held`);
return true;
}
console.info(`${TAG}: Requesting a... | https://github.com/tangwengang-del/freerdp-harmonyos | 490ad3dd036b1ca603c10c61da77c3fd3c488539 | github |
Joker-x-dev/CoolMallArkTS | feature/launch/src/main/ets/viewmodel/GuideViewModel.ets | arkts | onActionClick | 处理继续/开始体验按钮点击
@returns {void} 无返回值 | onActionClick(): void {
if (this.isLastPage()) {
this.onStartExperienceClick();
return;
}
this.currentPageIndex = Math.min(this.currentPageIndex + 1, this.guidePages.length - 1);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onActionClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | onActionClick(): void {
if (this.isLastPage()) {
this.onStartExperienceClick();
return;
}
this.currentPageIndex = Math.min(this.currentPageIndex + 1, this.guidePages.length - 1);
} | https://github.com/Joker-x-dev/CoolMallArkTS | fd61f4e2b8bc9441eb3c6cce5f00e783f74c56f8 | github |
openharmony/applications_contacts | common/src/main/ets/util/SharedPreferencesUtils.ets | arkts | getFromPreferences | getFromPreferences
@return the value get from Preferences | public async getFromPreferences(key: string, defValue: data_preferences.ValueType) {
let preferences: data_preferences.Preferences = await this.getPreferences();
return await preferences.get(key, defValue);
} | 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 getFromPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left :... | public async getFromPreferences(key: string, defValue: data_preferences.ValueType) {
let preferences: data_preferences.Preferences = await this.getPreferences();
return await preferences.get(key, defValue);
} | https://gitee.com/openharmony/applications_contacts.git | 557963a12b535164e365faa4426a343b766543d4 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | getPendingSyncRecords | 获取待同步的记录 | public async getPendingSyncRecords(): Promise<TrackRecord[]> {
try {
const sql = 'SELECT * FROM track_record WHERE syncStatus = ?';
const results = await this.dbManager.querySql(sql, [SyncStatus.PENDING]);
return this.parseTrackRecords(results);
} catch (error) {
logger.error(TAG, `❌ 获... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getPendingSyncRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public async getPendingSyncRecords(): Promise<TrackRecord[]> {
try {
const sql = 'SELECT * FROM track_record WHERE syncStatus = ?';
const results = await this.dbManager.querySql(sql, [SyncStatus.PENDING]);
return this.parseTrackRecords(results);
} catch (error) {
logger.error(TAG, `❌ 获... | https://github.com/DaLongZhuaZi/manxia | e485f70a3e4c5deb84901c442818637bcc0db943 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | findLast | Finds the last element in the Uint8Array that satisfies the condition
@param { function } fn - condition
@returns { number } - the last element that satisfies fn
@throws { Error } - If the element cannot be found, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: number, index: int, array: Uint8Array) => boolean): number {
for (let i = this.lengthInt - 1; i >= 0; i--) {
let val = this.getUnsafe(i).toDouble()
if (fn(val, i, this)) {
return val
}
}
throw new Error("Uint8Array... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | public findLast(fn: (val: number, index: int, array: Uint8Array) => boolean): number {
for (let i = this.lengthInt - 1; i >= 0; i--) {
let val = this.getUnsafe(i).toDouble()
if (fn(val, i, this)) {
return val
}
}
throw new Error("Uint8Array... | https://gitcode.com/iop123123/arkts-static-skills | 9f83b3247cb1bd6d7541ba09b32707d3169592a7 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getStringWithSplitRules | 使用分割规则获取字符串 | private getStringWithSplitRules(rules: string[], splitType: string): string {
const results: string[] = [];
for (const rule of rules) {
const result = this.getStringSingle(rule);
if (result) {
results.push(result);
// || 操作:第一个有结果就返回
if (splitType === '||') {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringWithSplitRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rules AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs... | private getStringWithSplitRules(rules: string[], splitType: string): string {
const results: string[] = [];
for (const rule of rules) {
const result = this.getStringSingle(rule);
if (result) {
results.push(result);
// || 操作:第一个有结果就返回
if (splitType === '||') {
... | https://github.com/DaLongZhuaZi/manxia | dd98f6c1b3ed5a68a97a234d4b8a18acb6ea68bf | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitEnum | ========== 枚举字段 ==========
访问 enum 字段
Wire type: 0 (varint)
枚举值以 int32 形式编码 | visitEnum(value: number, fieldNumber: number): void {
this.writer.tag(fieldNumber, 0).int32(value)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitEnum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#... | visitEnum(value: number, fieldNumber: number): void {
this.writer.tag(fieldNumber, 0).int32(value)
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | c41b244316381747ab27393eb9eadca408a12519 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | set | Copies all elements of arr to the current Uint8ClampedArray starting from insertPos.
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
@param { FixedArray<int> } arr - array to copy data from
@param { int } insertPos - start index where data from arr will be inserte... | public set(arr: FixedArray<int>, insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.lengthInt) {
throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint8ClampedArray.length")
}
for (let i = 0; i < arr.length; i++) ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: FixedArray<int>, insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.lengthInt) {
throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint8ClampedArray.length")
}
for (let i = 0; i < arr.length; i++) ... | https://gitcode.com/iop123123/arkts-static-skills | 8d7403abf13aebd7b87036ba467b81599f0c902a | gitcode |
IoTAccessControl/ArkTSAnalysis | TestApps/AccountKit-QuickLogin/entry/src/main/ets/pages/PersonalInfoPage.ets | arkts | logOut | Sign out. | logOut() {
this.pageInfos?.pushPathByName('PrepareLoginPage', null, true);
hilog.info(this.domainId, this.logTag, 'Succeeded in logging out.');
} | 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#expression_statement#Left AST#... | logOut() {
this.pageInfos?.pushPathByName('PrepareLoginPage', null, true);
hilog.info(this.domainId, this.logTag, 'Succeeded in logging out.');
} | https://github.com/IoTAccessControl/ArkTSAnalysis | 3b87457586a240d675f72b023e4054bc9ba41b5c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/components/ShortcutManager.ets | arkts | getAvailableKeys | 获取所有可用的键选项(从统一的 VK_DISPLAY_NAMES 自动生成 + 补充小键盘/媒体键) | getAvailableKeys(): KeyOption[] {
// 从 VK_DISPLAY_NAMES 自动生成(已包含字母/数字/功能键/修饰键/符号/方向键/小键盘/媒体键)
const keys: KeyOption[] = [];
const entries = Object.entries(VK_DISPLAY_NAMES);
for (const entry of entries) {
const code = Number(entry[0]);
const shortName = entry[1] as string;
const opti... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAvailableKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left KeyOption AST#i... | getAvailableKeys(): KeyOption[] {
// 从 VK_DISPLAY_NAMES 自动生成(已包含字母/数字/功能键/修饰键/符号/方向键/小键盘/媒体键)
const keys: KeyOption[] = [];
const entries = Object.entries(VK_DISPLAY_NAMES);
for (const entry of entries) {
const code = Number(entry[0]);
const shortName = entry[1] as string;
const opti... | https://github.com/AlkaidLab/moonlight-harmony | 4014e0c89f327e85f7a102df1a49d281410b41d4 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/Task.ets | arkts | getId | ==================== Getters ==================== | public getId(): string {
return this.id;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getId AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public getId(): string {
return this.id;
} | https://github.com/jjjjjjava/ffmpeg_tools | c22107ae8bff67faf2a5fb9857944c0ee16fad8a | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/common/FocusDemo.ets | arkts | build | tabIndex() - 通过 tab 键走焦
组件的 tabIndex 的默认值为 0
如果页面内每个组件的 tabIndex 均为 0 则按照布局顺序走焦
如果页面内有 tabIndex 大于 0 的组件,则按照 tabIndex 从小到大的顺序走焦,且 tabIndex 为 0 的组件无法通过 tab 键走焦
如果不希望组件通过 tab 键走焦,则将 tabIndex 设置为 -1 即可
groupDefaultFocus() - 当父容器获取到 tab 键焦点时,当前组件是否是默认焦点
仅当父容器的 tabIndex 大于 1 时有效
如需在父容器的内部的组件之间走焦,则可以通过方向键 | build() {
Column({space:10}) {
TextInput().width('90%').height(40)
.tabIndex(4)
TextInput().width('90%').height(40)
.tabIndex(2)
TextInput().width('90%').height(40)
.tabIndex(1)
TextInput().width('90%').height(40)
.tabIndex(3)
// 此 Column 获取到焦点后,默... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Column({space:10}) {
TextInput().width('90%').height(40)
.tabIndex(4)
TextInput().width('90%').height(40)
.tabIndex(2)
TextInput().width('90%').height(40)
.tabIndex(1)
TextInput().width('90%').height(40)
.tabIndex(3)
// 此 Column 获取到焦点后,默... | https://github.com/webabcd/HarmonyDemo | 17cc33b52d7d86e1089a1ad05f477e639045c78f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an array-like object.
@param { ArrayLike<number> } arr - An array-like object to convert to an array.
@returns { Uint32Array } - A new Uint32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: ArrayLike<number>): Uint32Array {
return Uint32Array.from<number>(
arr,
(x: number, _k: number): number => x
);
} | 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 arr AST#identifier#Righ... | public static from(arr: ArrayLike<number>): Uint32Array {
return Uint32Array.from<number>(
arr,
(x: number, _k: number): number => x
);
} | https://gitcode.com/iop123123/arkts-static-skills | 493d76e074caaef54a6f9751df595913a2a35d7a | gitcode |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets | arkts | handleBackAfterPayment | 处理支付后的返回逻辑
@param {boolean} isPaySuccess - 是否支付成功
@returns {void} 无返回值 | private handleBackAfterPayment(isPaySuccess: boolean): void {
if (this.from === "confirm") {
navigateBack();
OrderNavigator.toDetail(this.orderId);
return;
}
if (isPaySuccess) {
const result: RefreshResult = { refresh: true };
navigateBackWithResult(result);
return;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBackAfterPayment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isPaySuccess AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left b... | private handleBackAfterPayment(isPaySuccess: boolean): void {
if (this.from === "confirm") {
navigateBack();
OrderNavigator.toDetail(this.orderId);
return;
}
if (isPaySuccess) {
const result: RefreshResult = { refresh: true };
navigateBackWithResult(result);
return;
... | https://github.com/Joker-x-dev/CoolMallArkTS | 27d9d9d94d9134f21bf18051b775247700b9251d | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Creates a Uint16Array with the same underlying ArrayBuffer
@param begin start index, inclusive
@param end last index, exclusive
@returns new Uint16Array with the same underlying ArrayBuffer
public | /* public */ internal subarray(begin: int, end: int): Uint16Array {
return new Uint16Array(this.buffer, begin * Uint16Array.BYTES_PER_ELEMENT, end - begin)
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Lef... | /* public */ internal subarray(begin: int, end: int): Uint16Array {
return new Uint16Array(this.buffer, begin * Uint16Array.BYTES_PER_ELEMENT, end - begin)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 48fb288f3dfa79336aaf5263c0d895713b29e44e | gitee |
openharmony-sig/FastBle | entry/src/main/ets/pages/CharacteristicListPage.ets | arkts | <arrow> | (service: /*bluetooth.BLECharacteristic*/any, index) | (item: CharacteristicListMapClass) => {
ListItem() {
Row() {
Column() {
Text(this.characteristic_name_text + '(' + item.index + ')').fontSize(14).fontWeight(FontWeight.Bold)
Text(item.characteristic.characteristicUuid).margin({ top:... | AST#program#Left AST#expression_statement#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left CharacteristicListMapClass AST#type_identifier#R... | (item: CharacteristicListMapClass) => {
ListItem() {
Row() {
Column() {
Text(this.characteristic_name_text + '(' + item.index + ')').fontSize(14).fontWeight(FontWeight.Bold)
Text(item.characteristic.characteristicUuid).margin({ top:... | https://gitee.com/openharmony-sig/FastBle.git | 929d68258cd86db5fec823bbff10805f46aa6f67 | gitee |
HarmonyOS_Samples/BestPracticeSnippets | LoadPerformanceInWeb/entry/src/main/ets/pages/UseArrayBufferInterceptReplace.ets | arkts | initArrayBufferData | size - 1:10k, 2:1M, 3:10M | initArrayBufferData(size:Number): void {
this.initStringData(size);
hilog.error(DOMAIN, TAG, 'target string: ' + this.data);
this.buffer = new ArrayBuffer(this.data.length);
const uint8Array: Uint8Array = new Uint8Array(this.buffer);
for (let i = 0; i < this.data.length; i++) {
uint8Array[i]... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initArrayBufferData 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 AST#)#Le... | initArrayBufferData(size:Number): void {
this.initStringData(size);
hilog.error(DOMAIN, TAG, 'target string: ' + this.data);
this.buffer = new ArrayBuffer(this.data.length);
const uint8Array: Uint8Array = new Uint8Array(this.buffer);
for (let i = 0; i < this.data.length; i++) {
uint8Array[i]... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 4f3ae43eb86728b63b65b6646a17bc4c559f1208 | gitcode |
guyu0327/HarmonyGomoku | entry/src/main/ets/pages/Second.ets | arkts | checkLink | 判断是否五子连珠 | checkLink() {
if (!this.chess_coord || this.chess_coord.length === 0) {
return;
}
const lastCoord = this.chess_coord[this.chess_coord.length - 1];
const directions: [number, number][] = [
[1, 0], // 垂直方向
[0, 1], // 水平方向
[1, 1], // 右对角线
[-1, 1]// 左对角线
];
for (con... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkLink AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | checkLink() {
if (!this.chess_coord || this.chess_coord.length === 0) {
return;
}
const lastCoord = this.chess_coord[this.chess_coord.length - 1];
const directions: [number, number][] = [
[1, 0], // 垂直方向
[0, 1], // 水平方向
[1, 1], // 右对角线
[-1, 1]// 左对角线
];
for (con... | https://github.com/guyu0327/HarmonyGomoku | a1cb1a2de798e9ae811d7cfbb952db5212e78376 | github |
Joker-x-dev/HarmonyKit | feature/main/src/main/ets/view/ExpandPage.ets | arkts | build | 构建扩展页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.expand"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.ExpandContent();
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.expand"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.ExpandContent();
... | https://github.com/Joker-x-dev/HarmonyKit | d90b68a9310d31dfdb312ca934b6d3bb9e2982be | github |
erosTeam/NextE | shared/src/main/ets/network/EhCookieStore.ets | arkts | serializeForPersist | Every stored cookie as a "name=value; …" string for PERSISTENCE — the COMPLETE jar, not just the
known auth bundle. EH gates some galleries (ExHentai-only content shown as "removed or unavailable"
on the e-hentai.org URL) on donor/permission cookies whose NAMES we don't enumerate; dropping the
unknown cookies made a lo... | serializeForPersist(): string {
const parts: string[] = []
this.cookies.forEach((value: string, name: string) => {
if (name !== EhConstants.COOKIE_NW && value.length > 0) {
parts.push(`${name}=${value}`)
}
})
return parts.join('; ')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left serializeForPersist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#st... | serializeForPersist(): string {
const parts: string[] = []
this.cookies.forEach((value: string, name: string) => {
if (name !== EhConstants.COOKIE_NW && value.length > 0) {
parts.push(`${name}=${value}`)
}
})
return parts.join('; ')
} | https://github.com/erosTeam/NextE | e080c88e9c7ff632f9b57e2cd5575c9e32c2b9d9 | github |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnBadgePage.ets | arkts | build | 构建徽标展示页面 | build() {
AppNavDestination({
title: "徽标",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.BadgeContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "徽标",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.BadgeContent();
}
} | https://github.com/codelably/tuniao-ui | 193496a1311fe30accd9d80398c858c3c5614b23 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | postUpdatedMovies | @summary Reports that new movies have been added by an external source.
@param {LibraryApiPostUpdatedMoviesRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof LibraryApi | public postUpdatedMovies(requestParameters: LibraryApiPostUpdatedMoviesRequest = {}): Promise<void> {
return this.apiClient.post({path: `/Library/Movies/Updated`, parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left postUpdatedMovies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#a... | public postUpdatedMovies(requestParameters: LibraryApiPostUpdatedMoviesRequest = {}): Promise<void> {
return this.apiClient.post({path: `/Library/Movies/Updated`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | 4eb4ba3d073d4c2e6faa5b812c3234fac97dbc28 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets | arkts | if | otherwise the result will be exactly the same as it is | if (this.actualLength > 1) {
Array.reverseImpl(this.buffer, this.actualLength)
} | AST#program#Left AST#if_statement#Left AST#if#Left if AST#if#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#this#Left this AST#this#Right AST#.#Left . AST#.#Right AST#property_identifier#Left actualLength AST#property_identifier#Right AST#membe... | if (this.actualLength > 1) {
Array.reverseImpl(this.buffer, this.actualLength)
} | https://gitcode.com/iop123123/arkts-static-skills | 3717da33444c1db6263f7824a0b01be47c4b2ddb | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Console.ets | arkts | println | Prints a char to the console and puts newline
@param i value to print | public println(i: char): void {
this.print(i);
this.println();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left char AST#id... | public println(i: char): void {
this.print(i);
this.println();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c189fe35ae619e0dbf39d1bbb34191f11a62d90e | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setMinWidth | 弹窗最小宽度,仅限于wrap=true | setMinWidth(minWidth: Length): Builder {
this.popupConfig.minWidth = minWidth
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMinWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Length AST#identifier#Right AST#ERROR#Right AST#)#Left )... | setMinWidth(minWidth: Length): Builder {
this.popupConfig.minWidth = minWidth
return this
} | https://github.com/wuba/omni-ui | e4a46f55e53b51ba23d8177c9ccd8fb3c2678a48 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/CryptoService.ets | arkts | decrypt | ── 统一接口 ──
解密:自动识别 v1/v2 格式
v1 → HUKS 解密(旧格式,可能因密钥丢失而失败)
v2 → PBKDF2 解密(新格式,跨安装可用) | static async decrypt(data: Uint8Array, password?: string): Promise<string> {
const version = CryptoService.getVersion(data);
if (version === 2) {
return CryptoService.decryptV2(data, password);
} else if (version === 1) {
return CryptoService.decryptV1(data);
}
throw new Error('不支持的加密格... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left decrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Rig... | static async decrypt(data: Uint8Array, password?: string): Promise<string> {
const version = CryptoService.getVersion(data);
if (version === 2) {
return CryptoService.decryptV2(data, password);
} else if (version === 1) {
return CryptoService.decryptV1(data);
}
throw new Error('不支持的加密格... | https://github.com/AlkaidLab/moonlight-harmony | 856a9e883197c8fe54287d99ea097ba6e318d411 | github |
aimilin6688/KeePassHO | entry/src/main/ets/entryability/EntryAbility.ets | arkts | createStorage | 创建本地存储
@param createUrl
@returns | private createStorage(createUrl: string): void {
AppStorage.setOrCreate(Constants.APP_STORAGE_LOCATION_INFO, {
filePath: createUrl,
fileName: FilenameUtils.getFileName(createUrl),
storageType: StorageType.LOCAL,
storageConfig: new LocalFileStorageConfig()
});
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left createUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | private createStorage(createUrl: string): void {
AppStorage.setOrCreate(Constants.APP_STORAGE_LOCATION_INFO, {
filePath: createUrl,
fileName: FilenameUtils.getFileName(createUrl),
storageType: StorageType.LOCAL,
storageConfig: new LocalFileStorageConfig()
});
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/entryability/EntryAbility.ets#L213-L220 | edf6e5cdb9620a486b2f8fb97f6cf8e1a6d9ec80 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/PresenterManager.ets | arkts | onRequest | Go to a specified page. | onRequest(parameters: Record<string, Object> | undefined, isOnCreate: boolean) {
HiLog.i(TAG, 'show pageRouteHandler routeMessage ');
let url = 'pages/index';
let params: paramsInterface = {};
let pageIndex = 1;
if (parameters?.pageFlag) {
HiLog.i(TAG, 'pageRouteHandler case is ' + parameter... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#instantiation_expression#Left AST#identifier#Left parameters AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ... | onRequest(parameters: Record<string, Object> | undefined, isOnCreate: boolean) {
HiLog.i(TAG, 'show pageRouteHandler routeMessage ');
let url = 'pages/index';
let params: paramsInterface = {};
let pageIndex = 1;
if (parameters?.pageFlag) {
HiLog.i(TAG, 'pageRouteHandler case is ' + parameter... | https://gitee.com/openharmony/applications_contacts.git | 451168e58b7d0e6744aae19ce1d0b3230f187003 | gitee |
openharmony/codelabs | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | deleteFormData | Delete form data.
@param {string} formId Form ID
@param {relationalStore.RdbStore} rdbStore RDB database | deleteFormData(formId: string, rdbStore: relationalStore.RdbStore) {
if (this.isEmpty(rdbStore)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'rdbStore is null');
return;
}
let predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.TABLE_NAME);
pr... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Ri... | deleteFormData(formId: string, rdbStore: relationalStore.RdbStore) {
if (this.isEmpty(rdbStore)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'rdbStore is null');
return;
}
let predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.TABLE_NAME);
pr... | https://gitee.com/openharmony/codelabs.git | 677c26c3a6c448e9f30ca0ecacadfa919cb15634 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/mapping/TypedEntityData.ets | arkts | getBoolean | 获取布尔类型的属性值
@param key 属性名
@returns 属性值,如果不存在返回 null | getBoolean(key: string): boolean | null {
const value = this.data.get(key)
if (value === undefined || value === null) {
return null
}
if (typeof value === 'boolean') {
return value
}
return null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getBoolean AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | getBoolean(key: string): boolean | null {
const value = this.data.get(key)
if (value === undefined || value === null) {
return null
}
if (typeof value === 'boolean') {
return value
}
return null
} | https://github.com/offlinecat-dev/OCNetORM | 4be1c49f86f5d2beefbc745df7c1efbe85353325 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets | arkts | getRemainingLeave | 获取剩余假期天数 | async getRemainingLeave(): Promise<ApiResponse<{ type: LeaveType; total: number; used: number; remaining: number }[]>> {
return this.client.get<{ type: LeaveType; total: number; used: number; remaining: number }[]>('/api/v1/attendance/leave/balance')
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRemainingLeave AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async getRemainingLeave(): Promise<ApiResponse<{ type: LeaveType; total: number; used: number; remaining: number }[]>> {
return this.client.get<{ type: LeaveType; total: number; used: number; remaining: number }[]>('/api/v1/attendance/leave/balance')
} | https://github.com/David8Idira/AI-OA | 67c5a1e450dac9bd4f17d55b66dbb29badbe9392 | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | wordToValuesBucket | Convert WordItem to ValuesBucket | private wordToValuesBucket(word: WordItem): relationalStore.ValuesBucket {
return {
'word': word.word,
'status': word.status,
'fsrs_state': word.fsrsState.toJSON(),
'history': word.history.toJSON(),
'definition': word.definition.toJSON(),
'due_date': word.dueDate,
'create... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left wordToValuesBucket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private wordToValuesBucket(word: WordItem): relationalStore.ValuesBucket {
return {
'word': word.word,
'status': word.status,
'fsrs_state': word.fsrsState.toJSON(),
'history': word.history.toJSON(),
'definition': word.definition.toJSON(),
'due_date': word.dueDate,
'create... | https://github.com/CLMC2025/Vignette | 21991c503865a03da1537b618f5772bb1b93d764 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/app/AppNav.ets | arkts | pushOverlayByName | 向导航栈压入覆盖页。
用于搜索页、测试页等叠加式目的页,不改变当前主页面选中状态。 | pushOverlayByName(routeName: string, param: Object | undefined = undefined, animated: boolean = true): void {
this.pushOverlayRoute(routeName, param, animated);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushOverlayByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left routeName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , ... | pushOverlayByName(routeName: string, param: Object | undefined = undefined, animated: boolean = true): void {
this.pushOverlayRoute(routeName, param, animated);
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L59-L61 | 13f153eaa342c344ae77404fdbf40e4219e224e1 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SmartCategoryService.ets | arkts | createCustomRule | ==================== 规则管理 ====================
创建自定义规则 | static async createCustomRule(
userId: number,
ruleName: string,
categoryId: number,
categoryName: string,
ruleType: 'keyword' | 'regex' | 'amount' | 'merchant' | 'composite',
pattern: string,
keywords: string,
amountMin?: number,
amountMax?: number,
priority: number = 5
): P... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left createCustomRule AST#identifier#Right AST#arguments#Left... | static async createCustomRule(
userId: number,
ruleName: string,
categoryId: number,
categoryName: string,
ruleType: 'keyword' | 'regex' | 'amount' | 'merchant' | 'composite',
pattern: string,
keywords: string,
amountMin?: number,
amountMax?: number,
priority: number = 5
): P... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 858a5268aa195a416ef92e561e004cd340917d91 | github |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | roundTo | Round to with decimals digit count | static roundTo(value: number, decimals: number): number {
const factor = Math.pow(10, decimals);
return Math.round(value * factor) / factor;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left roundTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | static roundTo(value: number, decimals: number): number {
const factor = Math.pow(10, decimals);
return Math.round(value * factor) / factor;
} | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | c56aef0e81f7b11713515f6c179040543b5a6d16 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | subarray | Creates a Uint32Array with the same underlying Buffer
@param { int } [begin] - start index, inclusive
@param { int } [end] - last index, exclusive
@returns { Uint32Array } - a new Uint32Array with the same underlying Buffer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public subarray(begin?: int, end?: int): Uint32Array {
const len: int = this.lengthInt
const relStart = normalizeIndex(begin ?? 0, len)
const relEnd = normalizeIndex(end ?? this.lengthInt, len)
let count = relEnd - relStart
if (count < 0) {
count = 0
}
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le... | public subarray(begin?: int, end?: int): Uint32Array {
const len: int = this.lengthInt
const relStart = normalizeIndex(begin ?? 0, len)
const relEnd = normalizeIndex(end ?? this.lengthInt, len)
let count = relEnd - relStart
if (count < 0) {
count = 0
}
... | https://gitcode.com/iop123123/arkts-static-skills | 5245f4946c04ccf4dca412692871ea7e71e6ec7c | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets | arkts | getAttendanceSummary | 获取考勤月统计
@param year 年份
@param month 月份 | async getAttendanceSummary(year: number, month: number): Promise<ApiResponse<AttendanceSummary>> {
return this.client.get<AttendanceSummary>('/api/v1/attendance/summary', { year, month })
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAttendanceSummary AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#L... | async getAttendanceSummary(year: number, month: number): Promise<ApiResponse<AttendanceSummary>> {
return this.client.get<AttendanceSummary>('/api/v1/attendance/summary', { year, month })
} | https://github.com/David8Idira/AI-OA | 22f1bc447b6595808ed33fc8edc16141d90d84d3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | pushUniqueCandidate | 添加唯一候选ID | private pushUniqueCandidate(candidates: string[], candidate: string): void {
if (candidate.length === 0) {
return;
}
if (!candidates.includes(candidate)) {
candidates.push(candidate);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left pushUniqueCandidate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left candidates AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ... | private pushUniqueCandidate(candidates: string[], candidate: string): void {
if (candidate.length === 0) {
return;
}
if (!candidates.includes(candidate)) {
candidates.push(candidate);
}
} | https://github.com/DaLongZhuaZi/manxia | 23dfb9f1fdfadf83f5580ded9ffeaca9c1293b60 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | copyArray | Helper function preparing copy of `this` instance of `Array` class' data array.
@returns Copy of an `Array`'s primitive array data. | private copyArray(): T[] {
let len: int = this.data.length;
let res = new T[len];
for (let i = 0; i < len; i++) {
res[i] = this.data[i];
}
return res;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left copyArray 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#expressio... | private copyArray(): T[] {
let len: int = this.data.length;
let res = new T[len];
for (let i = 0; i < len; i++) {
res[i] = this.data[i];
}
return res;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 62da6d29760bf513b61ba61d2ebae9d704af5ad5 | gitee |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/NoteUtil.ets | arkts | removeNoteData | Remove NoteData
@param allNoteDataArray
@param noteUuid | removeNoteData(allNoteDataArray: NoteData[], noteUuid: string) {
let index = allNoteDataArray.findIndex((note) => {
return note.uuid == noteUuid
})
LogUtil.info(TAG, "index " + index.toString() + " uuid " + noteUuid)
index == -1 ? null : allNoteDataArray.splice(index, 1)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeNoteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left allNoteDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NoteData AST#identifier#Right ... | removeNoteData(allNoteDataArray: NoteData[], noteUuid: string) {
let index = allNoteDataArray.findIndex((note) => {
return note.uuid == noteUuid
})
LogUtil.info(TAG, "index " + index.toString() + " uuid " + noteUuid)
index == -1 ? null : allNoteDataArray.splice(index, 1)
} | https://gitee.com/openharmony/applications_notes.git | 7cbfb00f5b2b6e19ad4c89c0962b676cae266acd | gitee |
xiebyapps/ClipLink | entry/src/main/ets/services/SyncClipboardService.ets | arkts | updateConfig | Update HTTP client config | updateConfig(baseUrl: string, username?: string, password?: string): void {
this.httpClient.setBaseUrl(baseUrl);
if (username && password) {
this.httpClient.setCredentials(username, password);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#R... | updateConfig(baseUrl: string, username?: string, password?: string): void {
this.httpClient.setBaseUrl(baseUrl);
if (username && password) {
this.httpClient.setCredentials(username, password);
}
} | https://github.com/xiebyapps/ClipLink | 16f5f50a9cad456fe911ea75aab66507084e310e | github |
AuspiciousSign/HarmonyOS | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | loadPreferences | 加载preferences | async loadPreferences(context, password: string){
try {
let pref = await preferences.getPreferences(context, password)
this.preferencesMap.set(password, pref)
console.log(this.LOG_TAG, `加载preferences成功:${password}`)
}catch (e){
console.log(this.LOG_TAG, `加载preferences失败:${password}`, J... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadPreferences 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#required_parameter#Right AST#,... | async loadPreferences(context, password: string){
try {
let pref = await preferences.getPreferences(context, password)
this.preferencesMap.set(password, pref)
console.log(this.LOG_TAG, `加载preferences成功:${password}`)
}catch (e){
console.log(this.LOG_TAG, `加载preferences失败:${password}`, J... | https://github.com/AuspiciousSign/HarmonyOS | 9b14e7677dd6d02364330a5440ebc42bff3bb5a2 | github |
CLMC2025/Vignette | entry/src/main/ets/context/ContextValidator.ets | arkts | getMaxWordLength | 获取最大词长(根据用户级别) | private getMaxWordLength(userLevel: DifficultyLevel): number {
switch (userLevel) {
case DifficultyLevel.CET4:
return 5;
case DifficultyLevel.CET6:
return 6;
case DifficultyLevel.IELTS:
return 7;
case DifficultyLevel.TOEFL:
return 8;
case DifficultyLev... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getMaxWordLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userLevel AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private getMaxWordLength(userLevel: DifficultyLevel): number {
switch (userLevel) {
case DifficultyLevel.CET4:
return 5;
case DifficultyLevel.CET6:
return 6;
case DifficultyLevel.IELTS:
return 7;
case DifficultyLevel.TOEFL:
return 8;
case DifficultyLev... | https://github.com/CLMC2025/Vignette | 5c1725699191879b6f6031d8cfee59404e415b01 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | initializeStatistics | 初始化统计信息 | private initializeStatistics(): LoadingStatistics {
return {
totalLoadingTime: 0,
successfulPhases: 0,
failedPhases: 0,
skippedPhases: 0,
totalRetries: 0,
averagePhaseTime: 0,
errorStatistics: {
totalErrors: 0,
errorsByPhase: new Map(),
errorsBySev... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializeStatistics 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#Lef... | private initializeStatistics(): LoadingStatistics {
return {
totalLoadingTime: 0,
successfulPhases: 0,
failedPhases: 0,
skippedPhases: 0,
totalRetries: 0,
averagePhaseTime: 0,
errorStatistics: {
totalErrors: 0,
errorsByPhase: new Map(),
errorsBySev... | https://github.com/DaLongZhuaZi/manxia | ea8577f4293eab5a58fd7ad2226c927400c4cb53 | github |
arkui-x/xts | arkxtest/crossplatform/uitest_test/entry/src/ohosTest/ets/test/setDisplayRotation.test.ets | arkts | skipError | helper to mark a soft-skipped error at runtime | function skipError(message?: string): void {
// log skip reason; test frameworks may not support explicit skip at runtime,
// so we log and return to treat the branch as a pass.
console.warn(`[${TAG}] SKIP: ${message || 'skipped by skipError'}`);
return;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left skipError AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left message AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_annotation#Le... | function skipError(message?: string): void {
// log skip reason; test frameworks may not support explicit skip at runtime,
// so we log and return to treat the branch as a pass.
console.warn(`[${TAG}] SKIP: ${message || 'skipped by skipError'}`);
return;
} | https://gitcode.com/arkui-x/xts | 0f8eef0a506277f019df1806cde417eb08aec935 | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/util/MediaTools.ets | arkts | msToCountdownTime | Formats milliseconds as D:H:M:S style countdown string (omits zero high units).
@param ms Duration in milliseconds; falsy yields "00:00". | public static msToCountdownTime(ms: number): string {
if (!ms) {
return '00:00';
}
const days = Math.floor(ms / (1000 * 60 * 60 * 24));
const hours = Math.floor((ms % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((ms % (1000 * 60 * 60)) / (1000 * 60));
const seco... | 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 msToCountdownTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : ... | public static msToCountdownTime(ms: number): string {
if (!ms) {
return '00:00';
}
const days = Math.floor(ms / (1000 * 60 * 60 * 24));
const hours = Math.floor((ms % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((ms % (1000 * 60 * 60)) / (1000 * 60));
const seco... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 30b734d5b4463c2182f515988777f526c143371f | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/GameConfigSettings.ets | arkts | getMicSourceOptions | 对齐 Android string-array: game_runtime_mic_source_options | function getMicSourceOptions(): SelectOption[] {
return [
{ value: RuntimeMicSource.DEFAULT, label: I18n.t('opt_default') },
{ value: RuntimeMicSource.NONE, label: I18n.t('opt_none') },
{ value: RuntimeMicSource.BLOW, label: I18n.t('opt_blow_short') },
{ value: RuntimeMicSource.DEVICE, label: I18n.t('... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getMicSourceOptions 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#array_t... | function getMicSourceOptions(): SelectOption[] {
return [
{ value: RuntimeMicSource.DEFAULT, label: I18n.t('opt_default') },
{ value: RuntimeMicSource.NONE, label: I18n.t('opt_none') },
{ value: RuntimeMicSource.BLOW, label: I18n.t('opt_blow_short') },
{ value: RuntimeMicSource.DEVICE, label: I18n.t('... | https://github.com/richshaw2015/nds | 761558bc532107306b1023ff7471013bebddb950 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | checkPosition | Checks the position of the XML serializer and throws an error if the position is illegal. | private checkPosition(): void {
throw createBusinessError(IllegalPositionErrorCodeId, 'Illegal position for xml');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expre... | private checkPosition(): void {
throw createBusinessError(IllegalPositionErrorCodeId, 'Illegal position for xml');
} | https://gitcode.com/iop123123/arkts-static-skills | 23205502d2a825dc5e35cd53b6aa57dc52841b85 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/utils/FileHelper.ets | arkts | readFromFile | ... (readFromFile and generateFileName remain unchanged) ...
从文件读取内容
@param filePath 文件路径
@returns 文件内容 | static async readFromFile(filePath: string): Promise<string> {
try {
FileHelper.logInfo(`开始读取文件: ${filePath}`);
// 检查文件是否存在
const exists = fs.accessSync(filePath);
if (!exists) {
throw new ExportError(
ExportErrorCode.FILE_SYSTEM_ERROR,
`文件不存在: ${filePath}`
... | 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 readFromFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async readFromFile(filePath: string): Promise<string> {
try {
FileHelper.logInfo(`开始读取文件: ${filePath}`);
// 检查文件是否存在
const exists = fs.accessSync(filePath);
if (!exists) {
throw new ExportError(
ExportErrorCode.FILE_SYSTEM_ERROR,
`文件不存在: ${filePath}`
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 2bde945db3bdc11c77334c0b5999f35189792c6a | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveStorage.ets | arkts | refreshAccessToken | 刷新访问令牌
@returns Promise<void>
@throws StorageError | private async refreshAccessToken(): Promise<void> {
if (!this.client || !this.config) {
throw new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, 'OneDrive not initialized');
}
try {
const token = await this.client.refreshToken(this.config.getRefreshTokenText());
this.config.setAccessT... | 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 refreshAccessToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async refreshAccessToken(): Promise<void> {
if (!this.client || !this.config) {
throw new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, 'OneDrive not initialized');
}
try {
const token = await this.client.refreshToken(this.config.getRefreshTokenText());
this.config.setAccessT... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveStorage.ets#L109-L133 | a97c17438e9e487a190694edf3f6fc256b62c6e4 | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets | arkts | alipayAppPay | 发起支付宝 App 支付
@param {Record<string, number>} params - 支付参数
@returns {Promise<NetworkResponse<string>>} 支付签名结果 | async alipayAppPay(params: Record<string, number>): Promise<NetworkResponse<string>> {
const resp: AxiosResponse<NetworkResponse<string>> =
await NetworkClient.http.post("order/pay/alipayAppPay", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left alipayAppPay AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async alipayAppPay(params: Record<string, number>): Promise<NetworkResponse<string>> {
const resp: AxiosResponse<NetworkResponse<string>> =
await NetworkClient.http.post("order/pay/alipayAppPay", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | d0f565ace84d1205d794b8d010810925667c82a6 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/BinaryFileHandler.ets | arkts | generateBinaryDiffSummary | 生成二进制对比的摘要文本 | static generateBinaryDiffSummary(entry: BinaryDiffEntry): string {
if (entry.isIdentical) {
return `二进制文件内容与元数据一致 (${FileContentService.formatFileSize(entry.sizeA)})`;
}
if (entry.side !== 'both') {
return `二进制文件仅存在于 ${entry.side === 'a' ? '左侧' : '右侧'} (${FileContentService.formatFileSize(entr... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateBinaryDiffSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | static generateBinaryDiffSummary(entry: BinaryDiffEntry): string {
if (entry.isIdentical) {
return `二进制文件内容与元数据一致 (${FileContentService.formatFileSize(entry.sizeA)})`;
}
if (entry.side !== 'both') {
return `二进制文件仅存在于 ${entry.side === 'a' ? '左侧' : '右侧'} (${FileContentService.formatFileSize(entr... | https://github.com/XJTUWYD/ArkDiff | 736130d31cf2a1f18bd5d2d1b63d3ef5db42916c | github |
openharmony-sig/FastBle | library/src/main/ets/BleManager.ets | arkts | setReConnectCount | Set connect retry count and interval
@param count
@return BleManager | public setReConnectCount(count: number, interval: number = BleManager.DEFAULT_CONNECT_RETRY_INTERVAL): BleManager {
if (count > 10)
count = 10;
if (interval < 0)
interval = 0;
this.reConnectCount = count;
this.reConnectInterval = interval;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setReConnectCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setReConnectCount(count: number, interval: number = BleManager.DEFAULT_CONNECT_RETRY_INTERVAL): BleManager {
if (count > 10)
count = 10;
if (interval < 0)
interval = 0;
this.reConnectCount = count;
this.reConnectInterval = interval;
return this;
} | https://gitee.com/openharmony-sig/FastBle.git | 61e34be96d4cd6e15e3205522764a288f26ff877 | gitee |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/pages/Index.ets | arkts | onBillSortTypeChanged | 排序方式变化后同步刷新列表和标题动作文案。 | onBillSortTypeChanged(): void {
this.updateWeeklyDisplayData();
this.updateHeaderState();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBillSortTypeChanged 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#statem... | onBillSortTypeChanged(): void {
this.updateWeeklyDisplayData();
this.updateHeaderState();
} | https://github.com/ZestBox-18/kitebook-frontend | 61ed2a2da88e332873440b749637eb8d163e1f5c | github |
DaLongZhuaZi/manxia | tmp/ohpm_research/wolfx_minizip/package/src/main/ets/Zip.ets | arkts | startStreamingDecompress | 开始流式解压
@param zipFilePath ZIP文件路径
@param targetPath 目标解压路径
@returns Promise<boolean> 解压是否成功 | async startStreamingDecompress(zipFilePath: string, targetPath: string): Promise<boolean> {
try {
let minizipEntry = new MinizipNative(zipFilePath);
// 先打开ZIP文件
if (minizipEntry.Open() == 0) {
// 自动检测字符编码
const detectedEncoding: number = minizipEntry.DetectCharEncoding();
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startStreamingDecompress AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left zipFilePath AST#identifier#Right AST#type_ann... | async startStreamingDecompress(zipFilePath: string, targetPath: string): Promise<boolean> {
try {
let minizipEntry = new MinizipNative(zipFilePath);
// 先打开ZIP文件
if (minizipEntry.Open() == 0) {
// 自动检测字符编码
const detectedEncoding: number = minizipEntry.DetectCharEncoding();
... | https://github.com/DaLongZhuaZi/manxia | 0eabbc98c7ea12208a566507ad586c790d32f63e | github |
egavrin/arkts_agent_kit | examples/http-lite/test_server/server.ets | arkts | parseHttp | ---- HTTP parsing ---- | function parseHttp(raw: string): ParsedRequest {
let req = new ParsedRequest()
let lineEnd = raw.indexOf("\r\n")
if (lineEnd < 0) { return req }
let requestLine = raw.substring(0, lineEnd)
let pos = lineEnd + 2
let sp1 = requestLine.indexOf(" ")
if (sp1 < 0) { return req }
let sp2 = re... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseHttp AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left raw AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A... | function parseHttp(raw: string): ParsedRequest {
let req = new ParsedRequest()
let lineEnd = raw.indexOf("\r\n")
if (lineEnd < 0) { return req }
let requestLine = raw.substring(0, lineEnd)
let pos = lineEnd + 2
let sp1 = requestLine.indexOf(" ")
if (sp1 < 0) { return req }
let sp2 = re... | https://gitcode.com/egavrin/arkts_agent_kit | 2b7c9e911b9d2e6730bbe0346f2c0a0635380e84 | gitcode |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosEngineHost.ets | arkts | updateVisibility | Recompute the engine's render-loop visibility from the combined app +
page state and relay the transition through the app lifecycle. onHide
stops the engine's main-loop timer (OpenHarmonyPlatform::onHideNative),
which is the only call that actually halts rendering — the JSPAGE
onPageHide relay alone does NOT, and an in... | private updateVisibility(): void {
const want: boolean = this.booted && this.appForeground
&& this.pageActive && this.surfaceAlive;
if (want === this.visible) {
return;
}
this.visible = want;
if (want) {
this.appLifecycle?.onShow();
} else {
this.appLifecycle?.onHide();... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateVisibility 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... | private updateVisibility(): void {
const want: boolean = this.booted && this.appForeground
&& this.pageActive && this.surfaceAlive;
if (want === this.visible) {
return;
}
this.visible = want;
if (want) {
this.appLifecycle?.onShow();
} else {
this.appLifecycle?.onHide();... | https://github.com/terryma2024/happyword | ea601485fbcfafa3d3acbee619b6ceb63fe5366d | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/view/MePage.ets | arkts | build | 构建我的页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.me"),
viewModel: this.vm,
hideTitleBar: true,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset
}
}) {
this... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.me"),
viewModel: this.vm,
hideTitleBar: true,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset
}
}) {
this... | https://github.com/Joker-x-dev/CoolMallArkTS | 91d6225ad2e39a8b86cba7fc5e638d9168ae07df | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/FontNameParser.ets | arkts | parseNameTable | 解析name表 | function parseNameTable(dataView: DataView, offset: number): FontNameInfo {
const format = dataView.getUint16(offset, false);
const count = dataView.getUint16(offset + 2, false);
const stringOffset = dataView.getUint16(offset + 4, false);
// 存储不同语言版本的名称
const names: Map<string, string> = new Map();
fo... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseNameTable AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left dataView AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function parseNameTable(dataView: DataView, offset: number): FontNameInfo {
const format = dataView.getUint16(offset, false);
const count = dataView.getUint16(offset + 2, false);
const stringOffset = dataView.getUint16(offset + 4, false);
// 存储不同语言版本的名称
const names: Map<string, string> = new Map();
fo... | https://github.com/DaLongZhuaZi/manxia | d423008debac7d1a512b9524daaf738634f139d2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets | arkts | allSettled | Create a promise that will be resolved after all promises are completed
@param promises array of promise-like objects
@returns { Promise } promise that will be resolved after all promises are completed with an array of results | static allSettled<U>(promises: FixedArray<PromiseLike<U>|U|undefined>): Promise<PromiseSettledResult<Awaited<U>>[]> {
return new Promise<PromiseSettledResult<Awaited<U>>[]>(
(resolve: (value: PromiseSettledResult<Awaited<U>>[]) => void, _reject: (error: Error) => void): void => {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left allSettled AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri... | static allSettled<U>(promises: FixedArray<PromiseLike<U>|U|undefined>): Promise<PromiseSettledResult<Awaited<U>>[]> {
return new Promise<PromiseSettledResult<Awaited<U>>[]>(
(resolve: (value: PromiseSettledResult<Awaited<U>>[]) => void, _reject: (error: Error) => void): void => {
... | https://gitcode.com/iop123123/arkts-static-skills | 2585e344a6465e3639570d2b96ba5ce2cc63585d | gitcode |
Delsin-Yu/JustPDF | entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets | arkts | resetImportedPolylinePrepareState | 新文档加载或离开 PDFView 时调用,避免沿用上一次的「已准备」状态。 | resetImportedPolylinePrepareState(): void {
this.importedPolylinePrepared = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetImportedPolylinePrepareState 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#Righ... | resetImportedPolylinePrepareState(): void {
this.importedPolylinePrepared = false;
} | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets#L242-L244 | dcc8c6716e1f1ae534c6164175b243bef9b548e2 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | context | 获取应用上下文
@returns | public static get context(): Context {
return this._context ?? getContext()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left context AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#ca... | public static get context(): Context {
return this._context ?? getContext()
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L82-L84 | d510c9f8244279ea98ea2f7c0d0aa0bddaef1445 | github |
openharmony/applications_mms | entry/src/main/ets/utils/DateUtil.ets | arkts | convertDateFormatForItem | Converts the timestamp of an item to a time (for the SMS message list).
@param messageItem
@param is24HourTime
@return | convertDateFormatForItem(messageItem, is24HourTime) {
let now = new Date();
let currentDate = {
timeOfNow: now.getTime(),
yearOfNow: now.getFullYear(),
monthOfNow: now.getMonth() + 1,
dayOfNow: now.getDate()
};
let timeMillisecond = messageItem.timeMillisecond;
messageItem.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left convertDateFormatForItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left messageItem AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left is24HourTime AST#identifier#Right AST#)#... | convertDateFormatForItem(messageItem, is24HourTime) {
let now = new Date();
let currentDate = {
timeOfNow: now.getTime(),
yearOfNow: now.getFullYear(),
monthOfNow: now.getMonth() + 1,
dayOfNow: now.getDate()
};
let timeMillisecond = messageItem.timeMillisecond;
messageItem.... | https://gitee.com/openharmony/applications_mms.git | 81274f559f0385fbf62eeb7f153592005c5eb56b | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | reduceRight | Calls the specified callback function for all the elements in an array, in descending order.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduceR... | public reduceRight<U = number>(
callbackfn: (previousValue: U, currentValue: number, currentIndex: int, array: Int8Array) => U,
initialValue: U): U {
let accumulatedValue = initialValue
for (let i = this.lengthInt - 1; i >= 0; --i) {
accumulatedValue = cal... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Righ... | public reduceRight<U = number>(
callbackfn: (previousValue: U, currentValue: number, currentIndex: int, array: Int8Array) => U,
initialValue: U): U {
let accumulatedValue = initialValue
for (let i = this.lengthInt - 1; i >= 0; --i) {
accumulatedValue = cal... | https://gitcode.com/iop123123/arkts-static-skills | 4cbffbaf88819a7489c450dd25190ed78025e667 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | isUint8Array | Check whether the entered value is the uint8array array type.
@param { Object } value - A Uint8Array value
@returns { boolean } Returns true if the value is a built-in Uint8Array instance. | isUint8Array(value: Object): boolean {
return value instanceof Uint8Array;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST#identifier#Right AST#)#Left ) A... | isUint8Array(value: Object): boolean {
return value instanceof Uint8Array;
} | https://gitcode.com/iop123123/arkts-static-skills | 1a5e0bf4516879266e7381a558e7ccaff54c6fdd | gitcode |
openharmony/arkui_ace_engine | examples/Info/entry/src/main/ets/pages/badge/BadgeExample002.ets | arkts | build | 设置数字控制标记显隐 | build() {
Column({ space: 40 }) {
Badge({
count: this.badgeCount,
style: {},
position: BadgePosition.RightTop,
}) {
Image($r('app.media.startIcon'))
.width(50)
.height(50)
}
.width(55)
Button('count 0').onClick(() => {
this... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Column({ space: 40 }) {
Badge({
count: this.badgeCount,
style: {},
position: BadgePosition.RightTop,
}) {
Image($r('app.media.startIcon'))
.width(50)
.height(50)
}
.width(55)
Button('count 0').onClick(() => {
this... | https://gitee.com/openharmony/arkui_ace_engine.git | 3b806eec80145fc2638a7ecf133334023a75f7c4 | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/Windows11CompatibilityTester.ets | arkts | checkKvmSupport | 检查设备是否支持 KVM(硬件层面)
注意:即使硬件支持,也需要华为的许可才能使用 | checkKvmSupport(): KvmSupportInfo {
const productModel = deviceInfo.productModel || '';
const brand = deviceInfo.brand || '';
console.info(`[W11Tester] 设备型号: ${productModel}, 品牌: ${brand}`);
// 检查是否是支持 KVM 的设备
const isKvmCapableDevice = this.isKvmCapableDevice(productModel);
if ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkKvmSupport 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 KvmSupportInfo AST#identifier#Right AST#ERROR#... | checkKvmSupport(): KvmSupportInfo {
const productModel = deviceInfo.productModel || '';
const brand = deviceInfo.brand || '';
console.info(`[W11Tester] 设备型号: ${productModel}, 品牌: ${brand}`);
// 检查是否是支持 KVM 的设备
const isKvmCapableDevice = this.isKvmCapableDevice(productModel);
if ... | https://github.com/AetheriumSimulator/qemu-hmos | 9ac56c6f4c1a8fcf5efe63c38ff196cf8446a8b9 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/DistributedKVService.ets | arkts | get | 调用get()方法从键值数据库中获取数据
@param key
@returns | public static get(key: string): Promise<boolean | string | number | Uint8Array> {
return new Promise((resolve, reject) => {
if (!DistributedKVService.kvStore) {
reject(new Error('KVStore is not initialized'));
return;
}
DistributedKVService.kvStore.get(key).then((value) => {
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Righ... | public static get(key: string): Promise<boolean | string | number | Uint8Array> {
return new Promise((resolve, reject) => {
if (!DistributedKVService.kvStore) {
reject(new Error('KVStore is not initialized'));
return;
}
DistributedKVService.kvStore.get(key).then((value) => {
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L287-L305 | 656a0112cd15144158203b8da370d704e029c280 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test6_original_index.ets | arkts | testRegExp | === RegExp Patterns === | function testRegExp(): boolean {
let pattern: RegExp = new RegExp('^\\d+$');
let testStr: string = '12345';
return pattern.test(testStr);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testRegExp 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_type#... | function testRegExp(): boolean {
let pattern: RegExp = new RegExp('^\\d+$');
let testStr: string = '12345';
return pattern.test(testStr);
} | https://github.com/miaochiahao/ark-ghidra | f170aa70fd4ee7a382ce4079808e44137195bdcd | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/AudioVibrationService.ets | arkts | setSettings | 音乐模式最短间隔 15ms (~66次/秒)
更新设置 | setSettings(enabled: boolean, strength: number, vibrationMode: string, sceneMode: string = '游戏/电影'): void {
this.enabled = enabled;
this.strength = strength;
this.vibrationMode = vibrationMode;
this.sceneMode = sceneMode;
if (!enabled) {
this.stopAll();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#,#Left ,... | setSettings(enabled: boolean, strength: number, vibrationMode: string, sceneMode: string = '游戏/电影'): void {
this.enabled = enabled;
this.strength = strength;
this.vibrationMode = vibrationMode;
this.sceneMode = sceneMode;
if (!enabled) {
this.stopAll();
}
} | https://github.com/AlkaidLab/moonlight-harmony | 991b10dceb0e281b4dc47c7920e505a7b78329e2 | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | delayAlarm | 延迟闹钟,并返回根据再响配置更新过下次响铃时间的闹钟对象
@param alarmInfo 闹钟对象
@param isAuto 是否为自动延迟响铃,不传视为否,自动延迟的场景,会更新闹钟延迟次数的计时器
@return 根据再响配置更新过下次响铃时间的闹钟对象 | async delayAlarm(alarmInfo: AlarmInfo, isAuto?: boolean): Promise<number> {
if (isAuto) {
await SnoozeManager.increaseSnoozedTimes(alarmInfo.id as string);
} else {
await SnoozeManager.clearSnoozeTimes(alarmInfo.id as string);
}
const nextAlertTime = new Date().getTime() + alarmInfo.snooze... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left delayAlarm AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AST... | async delayAlarm(alarmInfo: AlarmInfo, isAuto?: boolean): Promise<number> {
if (isAuto) {
await SnoozeManager.increaseSnoozedTimes(alarmInfo.id as string);
} else {
await SnoozeManager.clearSnoozeTimes(alarmInfo.id as string);
}
const nextAlertTime = new Date().getTime() + alarmInfo.snooze... | https://gitee.com/openharmony-sig/applications_clock.git | a6d53d3f5faea308c8a8862e4029bbfc52ce6ecb | gitee |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/AccountManager.ets | arkts | getAccountByName | 按账户名称查询单个账户,供账单记账时同步更新余额。 | static async getAccountByName(name: string): Promise<AccountBean | null> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('name', name);
return new Promise<AccountBean | null>((resolve, reject) => {
dbManager.dbStore?.query(predicates)
.then((result) =>... | 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 getAccountByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : ... | static async getAccountByName(name: string): Promise<AccountBean | null> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('name', name);
return new Promise<AccountBean | null>((resolve, reject) => {
dbManager.dbStore?.query(predicates)
.then((result) =>... | https://github.com/ZestBox-18/kitebook-frontend | 1e922ad55ded634e85554c285ef8d853db02e9eb | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | round | Return a new Decimal whose value is `n` rounded to an integer using rounding mode `rounding`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type | static round(n: Value): Decimal {
let x = new Decimal(n)
return Utils.finalise(x, x.e + 1, Decimal.rounding);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left round 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#... | static round(n: Value): Decimal {
let x = new Decimal(n)
return Utils.finalise(x, x.e + 1, Decimal.rounding);
} | https://gitcode.com/iop123123/arkts-static-skills | d5c08a248dc69ec808162f986d7419de166881a0 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/EventSourcingDAO.ets | arkts | getByAggregate | 获取聚合的所有事件 | static async getByAggregate(
aggregateType: string,
aggregateId: number,
fromVersion: number = 0
): Promise<DomainEvent[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates... | 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 getByAggregate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggregateType AST#identifier#Right AST#ERROR#Left AST#:#... | static async getByAggregate(
aggregateType: string,
aggregateId: number,
fromVersion: number = 0
): Promise<DomainEvent[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 65d7cf1a23ac19be2d265ec5c7abe64509b69502 | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | setErrorCallback | 设置错误回调
@param callback 错误回调函数
@returns 设置是否成功 | static setErrorCallback(callback: ErrorCallback): boolean {
return MelonDSNative.native.setErrorCallback(callback);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setErrorCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | static setErrorCallback(callback: ErrorCallback): boolean {
return MelonDSNative.native.setErrorCallback(callback);
} | https://github.com/richshaw2015/nds | b7e77851e4d16bf56bfe8d9006a7d59d41b5ced8 | github |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/manager/AudioManager.ets | arkts | playAudio | Start playing audio | async playAudio(ringFilePath?: string): Promise<void> {
try {
this.audioStartTime = new Date().getTime();
await this.repeatPlay(ringFilePath);
} catch {
LogUtil.error(TAG, 'Failed to playAudio');
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left playAudio AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left ringFilePath AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_a... | async playAudio(ringFilePath?: string): Promise<void> {
try {
this.audioStartTime = new Date().getTime();
await this.repeatPlay(ringFilePath);
} catch {
LogUtil.error(TAG, 'Failed to playAudio');
}
} | https://gitee.com/openharmony-sig/applications_clock.git | f226cdd0af9682d322ddf873250e7d3c737c9416 | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/CommentManager.ets | arkts | toggleDislike | Toggle dislike on a comment | static async toggleDislike(commentId: string, username: string): Promise<boolean> {
try {
if (!CommentManager.preferencesInstance) {
console.error('Preferences not initialized');
return false;
}
const comments = await CommentManager.getAllComments();
// 先在顶级评论中查找
... | 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 toggleDislike AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commentId AST#identifier#Right AST#ERROR#Left AST#:#Left ... | static async toggleDislike(commentId: string, username: string): Promise<boolean> {
try {
if (!CommentManager.preferencesInstance) {
console.error('Preferences not initialized');
return false;
}
const comments = await CommentManager.getAllComments();
// 先在顶级评论中查找
... | https://github.com/Harrisonls2004/WaterFlow | 307baaef96e706271e92e270e4e7f0907bcee0b3 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Int16Array from Array<int>
@param { Array<int> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: Array<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i].toShort())
}
} | 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#instantiation_expression#Left AST#identifier#Left numbers AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST... | public constructor(numbers: Array<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i].toShort())
}
} | https://gitcode.com/iop123123/arkts-static-skills | 881fc883fd2f828a1cb06e550cfdb1bbaa3d2e9c | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.