riot
Version:
Simple and elegant component-based UI library
16 lines (13 loc) • 583 B
JavaScript
/* Riot v9.4.9, @license MIT */
import { GLOBAL_REGISTRY } from './global-registry.js';
import { defineWindowRiotGlobalRegistry } from './define-window-riot-global-registry.js';
import { evaluate } from './evaluate.js';
import { transpile } from './transpile.js';
import { register } from '../api/register.js';
function inject(code, tagName, url) {
defineWindowRiotGlobalRegistry();
evaluate(`window.${GLOBAL_REGISTRY}['${tagName}'] = ${transpile(code)}`, url);
// eslint-disable-next-line no-undef
register(tagName, window[GLOBAL_REGISTRY][tagName]);
}
export { inject };