Stéphane
Fresh - Error while running deno run on the built _fresh directory
Hi, I installed the latest version of Deno yesterday on Manjaro using the install.sh script. I then created a fresh (haha) fresh project. I noticed that the
cli
task was not happy because it uses the --unstable
flag which is not valid anymore.
Then I used the build
task that successfully created a _fresh
folder, but when I tried deno run -A _fresh/main.js
I got the following error :
Is it an expected behaviour ?6 replies
How to use a class name as a qualifier for an enum ?
Hi there, it's more of a generic typescript question but I'm using it in the Deno context and the linter throws some warnings at my code. I'm trying to do this little helper class for rich text logging in the terminal :
and I want to be able to just import
RichText
and use it like that : console.log(new RichText("coucou", RichText.COLOR.BLUE, RichText.STYLE.BRIGHT));
which actually works, but I wonder if there's an "official" clean way to do it. I don't want to import generic terms such as COLOR or STYLE so I'd like them to be qualified with the same name as the class for clarity's sake.4 replies
API architecture for generic callback
Hi there,
I have a general question about code architecture for an API I'm doing.
Basically, it listens to MIDI messages from a native library and I use an FFI binding to forward the messages to the user. A message is represented by an array of bytes, and from that you can describe its data and how to interpret it. I made a layer that converts the raw data to a typed object, but what I want to do is offer a choice to the user so he can retrieve either the raw data or the converted typed object.
What I have so far is like that :
And the method that the user can use to listen to messages :
And I wonder if there's a better way to do that and if it looks understandable as an API user. Any thoughts welcome 🙂
30 replies
Launch tests with unstable flag inside VS Code
Hi there,
I'm creating a module that uses FFI and Deno.dlopen and I wrote tests to validate some of the API calls, like this one :
I can run them in the command line typing
deno test --unstable --allow-ffi
but I can't call them directly from the interface in VS Code, it just says "Test failed" with no output and no explanation on why it fails.
Is it a known issue and is there a workaround ? Command line is fine of course but I like the VS Code integration, it would be nice if it could work there too 🙂
Thanks !1 replies
[Resolved][Fresh] How to load data asynchronously after rendering a page ?
Hi ! I was wondering if someone could help me understand the paradigm to load data asynchronously after a page is rendered. My use case is that I load data from the backend, reading some folders and retrieving git information. It takes a few seconds so I don't want to wait for the whole information before rendering the rest of the page. My code runs well if I do that synchronously but I don't understand how to do it after the page render. Should I use a component ? An island ?
I don't understand well which code is executed on the server and when so it's not easy to troubleshoot, and I couldn't really find any examples that do something similar.
I did a post here with more details but maybe it wasn't the right place for it : https://discord.com/channels/684898665143206084/991511118524715139/1072518216728977489
Any help would be appreciated, cheers !
3 replies