fix(core): update
This commit is contained in:
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartntml',
|
||||
version: '1.0.2',
|
||||
description: 'lit-html for the backend'
|
||||
}
|
32
ts/index.ts
Normal file
32
ts/index.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import * as plugins from './smartntml.plugins.js';
|
||||
|
||||
import type * as litTypes from 'lit';
|
||||
|
||||
export class Smartntml {
|
||||
// STATIC
|
||||
public static async createAndInit() {
|
||||
const smartntml = new Smartntml();
|
||||
await smartntml.init();
|
||||
return smartntml;
|
||||
}
|
||||
|
||||
// INSTANCE
|
||||
render: typeof litTypes.render;
|
||||
html: typeof litTypes.html;
|
||||
|
||||
constructor() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
public async init() {
|
||||
const lit = await import('lit');
|
||||
this.render = lit.render;
|
||||
this.html = lit.html;
|
||||
}
|
||||
|
||||
public async renderTemplateResult(templateResult: litTypes.TemplateResult) {
|
||||
const element = document.createElement('div');
|
||||
this.render(templateResult, element);
|
||||
return element.innerHTML;
|
||||
}
|
||||
}
|
2
ts/smartntml.plugins.ts
Normal file
2
ts/smartntml.plugins.ts
Normal file
@ -0,0 +1,2 @@
|
||||
import { GlobalRegistrator } from '@happy-dom/global-registrator';
|
||||
GlobalRegistrator.register();
|
Reference in New Issue
Block a user