| export interface StylesheetAttributes { |
| export function injectStylesheet( |
| attributes: StylesheetAttributes = {}, |
| const link = document.createElement('link'); |
| link.setAttribute('rel', 'stylesheet'); |
| link.setAttribute('href', stylesheetName); |
| if ('media' in attributes) { |
| link.setAttribute('media', attributes['media']); |
| document.head.appendChild(link); |
| export function injectStyles(css: string) { |
| injectStylesheet('data:text/css;charset=UTF-8,' + encodeURIComponent(css)); |
| export function injectScript(scriptName: string, prepend = false) { |
| const script = document.createElement('script'); |
| const root = document.head || document.documentElement; |