Exidex
Exidex
DDeno
Created by Exidex on 12/28/2023 in #help
Executing module multiple times
I have a script that can be imported using await import() statement. what goes inside brackets is resolved using ModuleLoader. But even if i call await import() multiple times console.logs seem to be executed only on first run. Is there a way to have the module executed multiple times? I want to avoid having to define functions inside a script file
3 replies
DDeno
Created by Exidex on 9/2/2023 in #help
Can extension state have fields that require passing lifetime?
It is possible to pass bounds and parameters to the extension! macro but as far as I see it doesn't support lifetimes?
4 replies
DDeno
Created by Exidex on 7/23/2023 in #help
Is it possible to import cjs module from es module, both in extension?
cjs is added using deno_core::extension's js. esm added using deno_core::extension's esm I can import esm from other esm using ext but it seems that ext protocol only works for esm and not cjs.
3 replies
DDeno
Created by Exidex on 7/21/2023 in #help
Reason for "Following modules were not evaluated"
What is the reason for "Following modules were not evaluated; make sure they are imported from other code". As far as I can tell it requires me to add esm_entry_point if my deno extension has esm files. Why cant I add esm and use it later in side module and not in entry point? or am I missing something?
7 replies
DDeno
Created by Exidex on 7/2/2023 in #help
How do I enqueue_microtask from other thread
so Isolate.enqueue_microtask is obviously not send/sync so I think the only option is to use std::sync::mpsc::channel and use Receiver.try_recv to get the values from Sender on other thread. The problem is that I am being a rust newbie don't know how to combine them on the single thread or if it actually possible. I somehow need to wake up the runtime when the Sender actually sends the value, I think I can wrap try_recv with poll_fn and use something like tokio's select! macro but that also doesn't seem to fit my problem because I need to be able to restart run_event_loop to process any new microtasks. Any pointers?
12 replies
DDeno
Created by Exidex on 6/25/2023 in #help
HandleScope in async op
Is there a way to get v8::HandleScope inside async op if I add it as
scope: &mut v8::HandleScope<'a>,
scope: &mut v8::HandleScope<'a>,
it errors with following error
195 | #[op]
| ^^^^^ the trait `Deserialize<'_>` is not implemented for `&mut HandleScope<'_>`
195 | #[op]
| ^^^^^ the trait `Deserialize<'_>` is not implemented for `&mut HandleScope<'_>`
2 replies
DDeno
Created by Exidex on 6/11/2023 in #help
Async OP that returns value instead of promise
In deno_runtime is possible to have async op that returns the resolved value instead of promise? Kinda like calling tokio's block_on in the op (is it possible)? For my use case i use crate in that uses async but in js I use library that will call this op but it doesn't support async. I there any way to work around this problem?
8 replies
DDeno
Created by Exidex on 5/26/2023 in #help
Deno event loop and gui application
Hi, I am trying to write custom gtk library in deno using gtk-rs and deno_runtime. I already have initial rendering of components but i am having trouble understanding how to setup event loop for gui application. Currently i am using tokio's new_current_thread and block_on on deno's execute_main_module but this way setTimeouts don't seem to be executed which I suspect is because there is no event loop. execute_main_module seems to already call run_event_loop but should i just call it in loop or is there a proper way to do it using tokio? and how does event_loop_middleware fit into all this?
The other slightly related question is how do i schedule updates from the button clicks if the click listener closure is setup in the #[op(v8)]? thanks for your help
1 replies