Implement the template
This commit is contained in:
24
src/lib/tools/appendLinkInHead.ts
Normal file
24
src/lib/tools/appendLinkInHead.ts
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
export function appendLinkInHead(
|
||||
props: {
|
||||
href: string;
|
||||
}
|
||||
) {
|
||||
|
||||
const { href } = props;
|
||||
|
||||
var link = document.createElement("link");
|
||||
|
||||
Object.assign(
|
||||
link,
|
||||
{
|
||||
href,
|
||||
"type": "text/css",
|
||||
"rel": "stylesheet",
|
||||
"media": "screen,print"
|
||||
}
|
||||
);
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(link);
|
||||
|
||||
}
|
22
src/lib/tools/appendScriptInHead.ts
Normal file
22
src/lib/tools/appendScriptInHead.ts
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
export function appendScriptInHead(
|
||||
props: {
|
||||
src: string;
|
||||
}
|
||||
) {
|
||||
|
||||
const { src } = props;
|
||||
|
||||
var script = document.createElement("script");
|
||||
|
||||
Object.assign(
|
||||
script,
|
||||
{
|
||||
src,
|
||||
"type": "text/javascript",
|
||||
}
|
||||
);
|
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(script);
|
||||
|
||||
}
|
Reference in New Issue
Block a user