Exidex
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.log
s 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 file3 replies
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
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
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
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
Deno event loop and gui application
Hi, I am trying to write custom gtk library in deno using
The other slightly related question is how do i schedule updates from the button clicks if the click listener closure is setup in the
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 help1 replies