mirror of
https://github.com/nathonius/obsidian-github-link.git
synced 2026-07-22 09:20:25 +00:00
🔨 refactor: #102 Remove init logic from query constructor
This commit is contained in:
parent
c2cc1dea9c
commit
f670708c68
2 changed files with 11 additions and 7 deletions
|
|
@ -1,6 +1,11 @@
|
|||
import type { MarkdownPostProcessorContext } from "obsidian";
|
||||
import { GithubQuery } from "./query";
|
||||
|
||||
export function QueryProcessor(source: string, el: HTMLElement, _ctx: MarkdownPostProcessorContext): void {
|
||||
new GithubQuery(source, el);
|
||||
export async function QueryProcessor(
|
||||
source: string,
|
||||
el: HTMLElement,
|
||||
_ctx: MarkdownPostProcessorContext,
|
||||
): Promise<void> {
|
||||
const query = new GithubQuery(el);
|
||||
await query.init(source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,15 +142,14 @@ export class GithubQuery {
|
|||
private result: TableResult | null = null;
|
||||
private resultMeta: PaginationMeta | null = null;
|
||||
|
||||
constructor(
|
||||
source: string,
|
||||
private readonly hostElement: HTMLElement,
|
||||
) {
|
||||
constructor(private readonly hostElement: HTMLElement) {}
|
||||
|
||||
public async init(source: string): Promise<void> {
|
||||
const parsedParams = this.parseCodeblock(source);
|
||||
if (!parsedParams) {
|
||||
console.error(`Github Link: simplistic parsing failed`);
|
||||
} else {
|
||||
void this.setParams(parsedParams);
|
||||
await this.setParams(parsedParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue