UNPKG

riot

Version:

Simple and elegant component-based UI library

16 lines (12 loc) 546 B
/* Riot v10.1.2, @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); register(tagName, window[GLOBAL_REGISTRY][tagName]); } export { inject };