/|\  /|\
/|\ /|\
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
Ok thank you
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
May I ask when it'll become available in fresh?
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
Ok amazing thank you
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
Ok ty I'll check that
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
Is there a way to read the current head to check if it's already there?
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
Oh ok thank you, I was hopping to do it automatically
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
Is there any simple way to avoid this?
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
If you need more information, don't hesitate to ask
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
My component looks like that:
import { JSX } from "preact";
import { Head } from "$fresh/runtime.ts";

interface props extends EventTarget {
title: string;
content: string;
linkText: string;
};

export default function Card(props: JSX.HTMLAttributes<props>) {

return (
<>
<Head>
<link rel="stylesheet" href="/css/card.css" />
</Head>
<div></div>
</>
);
}
import { JSX } from "preact";
import { Head } from "$fresh/runtime.ts";

interface props extends EventTarget {
title: string;
content: string;
linkText: string;
};

export default function Card(props: JSX.HTMLAttributes<props>) {

return (
<>
<Head>
<link rel="stylesheet" href="/css/card.css" />
</Head>
<div></div>
</>
);
}
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
I have a repo but the code is really to complicate for this, I can try to make a simple reproducable example
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
When I inject css in the head of my html in a component, it works perfectly, but when I reuse the component somewhere in my html, it reinjects the css a second time @Deno AI Helper
24 replies
DDeno
Created by /|\ /|\ on 9/18/2023 in #help
[fresh] injecting css into head in a component
@Deno AI Helper
24 replies
DDeno
Created by ataractic on 8/29/2023 in #help
Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...
Looks perfect for your needs
26 replies
DDeno
Created by ataractic on 8/29/2023 in #help
Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...
Yeah you should probably better use a while statement
26 replies
DDeno
Created by ataractic on 8/29/2023 in #help
Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...
Ex:
let running = false;
function startTask() {
if (running) return;
running = true; task(window["example"].shift());
running = false;
if (window["example"].length) startTask();
}
let running = false;
function startTask() {
if (running) return;
running = true; task(window["example"].shift());
running = false;
if (window["example"].length) startTask();
}
26 replies
DDeno
Created by ataractic on 8/29/2023 in #help
Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...
Then create a function to execute the last queued task, and check it's running only once at a time. Each time you append something to the array, check if function is running
26 replies
DDeno
Created by ataractic on 8/29/2023 in #help
Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...
So just use window[my array]
26 replies
DDeno
Created by ataractic on 8/29/2023 in #help
Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...
No sorry it's just window
26 replies
DDeno
Created by ataractic on 8/29/2023 in #help
Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...
I think you have a globalThis object in deno
26 replies
DDeno
Created by ataractic on 8/29/2023 in #help
Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...
Depends on what you want to do with the result
26 replies