FjordWarden
FjordWarden
Explore posts from servers
SSolidJS
Created by FjordWarden on 5/7/2024 in #support
Return non DOM element as component with hyper dom expressions
Ok, very cool. I've been studying your implementation and it has been a great help. It is one of those things I wonder how you could figure this out without an example. The name jsx-tokenizer is probably not the most descriptive either. I don't actually want to make a canvas api this was just the easiest way to describe the problem by analogy. At any rate thx for your help.
5 replies
SSolidJS
Created by FjordWarden on 4/13/2024 in #support
No Context when using hyper dom expressions
Ooh ffs, I look at this for two days, thx for ur help atleast
4 replies
SSolidJS
Created by FjordWarden on 10/26/2023 in #support
Use non breaking space with hyper dom expressions
Muchas gracias!
3 replies
DDeno
Created by FjordWarden on 10/25/2023 in #help
Can't upgrade request to websocket
Oh, ok sorry I get it know, that error is normal if you don't connect with a websocket...
11 replies
DDeno
Created by FjordWarden on 10/25/2023 in #help
Can't upgrade request to websocket
Look, for some reason I keep having issues just running the example code. if I run the example from the blog, I just added an explicit version number, it still doesn't work:
import { Application, Router } from "https://deno.land/x/[email protected]/mod.ts";
const app = new Application({ logErrors: false });
const router = new Router();
router.get("/wss", (ctx) => {
if (!ctx.isUpgradable) {
ctx.throw(501);
}
const ws = ctx.upgrade();
ws.onopen = () => {
console.log("Connected to client");
ws.send("Hello from server!");
};
ws.onmessage = (m) => {
console.log("Got message from client: ", m.data);
ws.send(m.data);
ws.close();
};
ws.onclose = () => console.log("Disconncted from client");
});
app.use(router.routes());
app.use(router.allowedMethods());
app.listen({ port: 8000 });
import { Application, Router } from "https://deno.land/x/[email protected]/mod.ts";
const app = new Application({ logErrors: false });
const router = new Router();
router.get("/wss", (ctx) => {
if (!ctx.isUpgradable) {
ctx.throw(501);
}
const ws = ctx.upgrade();
ws.onopen = () => {
console.log("Connected to client");
ws.send("Hello from server!");
};
ws.onmessage = (m) => {
console.log("Got message from client: ", m.data);
ws.send(m.data);
ws.close();
};
ws.onclose = () => console.log("Disconncted from client");
});
app.use(router.routes());
app.use(router.allowedMethods());
app.listen({ port: 8000 });
The code does not run past if (!ctx.isUpgradable) ...
11 replies
DDeno
Created by FjordWarden on 10/25/2023 in #help
Can't upgrade request to websocket
I want to use oak
11 replies
DDeno
Created by FjordWarden on 10/25/2023 in #help
Can't upgrade request to websocket
Yes, that works but I'm trying to migrate to oak . I can't imagine what I am doing wrong as I am just following the documentation.
11 replies
DDeno
Created by FjordWarden on 9/29/2023 in #help
BDD with async tests
Sorry but this AI is stupid, I am asking about the funciton in the deno std
3 replies
DDeno
Created by FjordWarden on 9/6/2023 in #help
Read CSV files inside zip file using the web streams API
I've managed to make the example self containing and can run without a zip file. But I still haven't found a way I can read the unzipped file as a csv. Somehow I should be able to wrap it in some way, but the streaming api is very confusing.
import {Uint8ArrayWriter,Uint8ArrayReader,TextReader,ZipReader,ZipWriter} from 'https://deno.land/x/zipjs/index.js'
import {readCSV,CSVReader} from 'https://deno.land/x/csv/mod.ts'
import {CsvParseStream} from 'https://deno.land/[email protected]/csv/mod.ts'


async function streamToString(stream) {
const {done,value} = await stream.getReader().read()
return done ? '' : new TextDecoder().decode(value,{stream:true})
}

const zipWriter = new ZipWriter(new Uint8ArrayWriter());
await Promise.all([
zipWriter.add("a.csv", new TextReader("a,b,c\nd,e,f")),
zipWriter.add("b.csv", new TextReader("g,h,i\nj,k,l"))])
const zipFile = await zipWriter.close()
const zipReader = new ZipReader(new Uint8ArrayReader(zipFile))
for (const entry of await zipReader.getEntries()) {
console.log('file ', entry.filename)
const transformStream = new TransformStream()
const promiseText = streamToString(transformStream.readable)
await entry.getData(transformStream.writable)
const text = await promiseText
console.log(text)
}
await zipReader.close()
import {Uint8ArrayWriter,Uint8ArrayReader,TextReader,ZipReader,ZipWriter} from 'https://deno.land/x/zipjs/index.js'
import {readCSV,CSVReader} from 'https://deno.land/x/csv/mod.ts'
import {CsvParseStream} from 'https://deno.land/[email protected]/csv/mod.ts'


async function streamToString(stream) {
const {done,value} = await stream.getReader().read()
return done ? '' : new TextDecoder().decode(value,{stream:true})
}

const zipWriter = new ZipWriter(new Uint8ArrayWriter());
await Promise.all([
zipWriter.add("a.csv", new TextReader("a,b,c\nd,e,f")),
zipWriter.add("b.csv", new TextReader("g,h,i\nj,k,l"))])
const zipFile = await zipWriter.close()
const zipReader = new ZipReader(new Uint8ArrayReader(zipFile))
for (const entry of await zipReader.getEntries()) {
console.log('file ', entry.filename)
const transformStream = new TransformStream()
const promiseText = streamToString(transformStream.readable)
await entry.getData(transformStream.writable)
const text = await promiseText
console.log(text)
}
await zipReader.close()
Also this example hangs after executing.
2 replies
SSolidJS
Created by FjordWarden on 8/23/2023 in #support
Remove element from store not working
Oh ok, thx for your help!
4 replies
DDeno
Created by FjordWarden on 7/9/2023 in #help
Sanitize multiple test steps
No you are actually right I think, I've added the awaits and now ny sample is working
5 replies
DDeno
Created by FjordWarden on 7/9/2023 in #help
Sanitize multiple test steps
5 replies
SSolidJS
Created by FjordWarden on 5/16/2023 in #support
How to iterate over Object.entries()?
thx, that did the trick
4 replies
SSolidJS
Created by FjordWarden on 4/25/2023 in #support
Abort resource
Ok, my bad looks like I can just use: import {makeAbortable} from "@solid-primitives/resource";
2 replies
SSolidJS
Created by FjordWarden on 4/19/2023 in #support
Context undefined
Ok, I found the problem, just put the TokenProvider in useContext instead of TokenContext
6 replies
SSolidJS
Created by FjordWarden on 4/19/2023 in #support
Context undefined
Then I also have the TokenProvider in the root of my app:
render(() => (
<CounterProvider count={1}>
<TokenProvider>
<Router>
<div class="h-screen bg-neutral-900">
<Routes>
// ...
</Routes>
</div>
</Router>
</TokenProvider>
</CounterProvider>
), document.body);
render(() => (
<CounterProvider count={1}>
<TokenProvider>
<Router>
<div class="h-screen bg-neutral-900">
<Routes>
// ...
</Routes>
</div>
</Router>
</TokenProvider>
</CounterProvider>
), document.body);
6 replies
SSolidJS
Created by FjordWarden on 4/19/2023 in #support
Context undefined
I use it in a function like this:
function Login(props) {
const [searchParams, setSearchParams] = useSearchParams();
const [token, {login}] = useToken();
createEffect(()=>{if (searchParams.token) login(searchParams.token)})
function Login(props) {
const [searchParams, setSearchParams] = useSearchParams();
const [token, {login}] = useToken();
createEffect(()=>{if (searchParams.token) login(searchParams.token)})
6 replies