45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import * as plugins from './infohtml.plugins.js';
|
|
|
|
import { simpleInfo } from './template.js';
|
|
|
|
export interface IHtmlInfoOptions {
|
|
text: string;
|
|
heading?: string;
|
|
title?: string;
|
|
sentryMessage?: string;
|
|
sentryDsn?: string;
|
|
redirectTo?: string;
|
|
}
|
|
|
|
export class InfoHtml {
|
|
// STATIC
|
|
public static async fromSimpleText(textArg: string) {
|
|
const infohtmlInstance = new InfoHtml({
|
|
text: textArg,
|
|
heading: null,
|
|
});
|
|
await infohtmlInstance.init();
|
|
return infohtmlInstance;
|
|
}
|
|
|
|
public static async fromOptions(optionsArg: IHtmlInfoOptions) {
|
|
const infohtmlInstance = new InfoHtml(optionsArg);
|
|
await infohtmlInstance.init();
|
|
return infohtmlInstance;
|
|
}
|
|
|
|
// INSTANCE
|
|
public options: IHtmlInfoOptions;
|
|
public smartntmlInstance: plugins.smartntml.Smartntml;
|
|
public htmlString: string;
|
|
constructor(optionsArg: IHtmlInfoOptions) {
|
|
this.options = optionsArg;
|
|
}
|
|
|
|
public async init() {
|
|
this.smartntmlInstance = new plugins.smartntml.Smartntml();
|
|
this.htmlString = await simpleInfo(this.smartntmlInstance, this.options);
|
|
return this.htmlString;
|
|
}
|
|
}
|