D
Deno

help

Async OP that returns value instead of promise

EExidex6/11/2023
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?
AAapoAlas6/11/2023
That would be a blocking / sync op then
EExidex6/11/2023
I think It depends, if deno has support for something like this it could be async op that deno itself would block on and resolve OR it will be sync op which I would block on inside the op. The problem is I don't know how to get a tokio's runtime into the op with all the ownership rules, or if it is even possible given that the whole deno execution is inside a block_on
AAapoAlas6/11/2023
From JavaScript's perspective it is necessarily a blocking operation since it returns a value. Unfortunately I don't really know about the tokio event loop binding for deno_runtime though.
ABTAndreu Botella (they/them)6/11/2023
I implemented something like that for testing classic workers on WPT I don't remember how I did it though
ABTAndreu Botella (they/them)6/11/2023
GitHub
deno/sync_fetch.rs at main · denoland/deno
A modern runtime for JavaScript and TypeScript. Contribute to denoland/deno development by creating an account on GitHub.
EExidex6/11/2023
creating new thread and a runtime seems excessive to be done on each op call

Looking for more? Join the community!

Recommended Posts
Fresh Logging MiddlewareHow would you go about writing a duration logger? Using 2 middlewares, I assumed they would behave VS-Code auto import local modulesHey is there a way to enable some sort of auto import for local modules/files in VS-Code? Currently In memory Deno KvHi there, I am exploring with [Deno Kv](https://deno.com/deploy/docs/kv) and it looks great! But myDeno Language Server Issue - Attempting to Use KV in Existing ProjectHi! I'm attempting to create a branch of an existing project (utilizing Fresh) and add KV as an expeTwitter APIIs there a easy way to fetch Tweets using Twitter API or something else? (since they put their API cIn browser video chat client & serverHello! How might people go about architecting an in-browser video chat client & server, specificallynpm:pusher working but http://esm.sh/pusher notAny ideas? deno run -A test.js //test.js import Pusher from "pusher" // const Pusher = require('pFile Permissions on Deno.FileInfoHello. As a programming exercise I'm trying to convert a Decimal number into Octal and that Octal reDeno Fresh - Different POST handlers for different <form>s ?what's the idiomatic way of handling different POST requests on the same page?Deno.open() questionDoes, when the process terminate, deno close the files if they were opened with `Deno.open()`?Can't figure out complicated type incompatibilityAnyone know what's going on here? `T` should have resolved to `[number, number, number]` https://wwManually edit existing KV tableHello! another day, another question. Is there a way to manually edit KV database to modify an entrLooking to deploy Deno Fresh on VPS using port 443Hello! I have two questions, I used saaskit as a base. However fresh's start function is using `serTrying to use Deno.serve() for an https static hostingI was trying to setup an simple hello world response in https on my custom domain."https://esm.sh/mercadopago@1.5.15" Is not workin on deploy"https://esm.sh/mercadopago@1.5.15" Is not workin on deno deploy, any clues? it works on local but Simulating physics collisions across isolatesA bit tangential to Deno, but since Deploy uses v8 isolates, it seems that a multiplayer online game