Giter Club home page Giter Club logo

Comments (2)

ClearScriptLib avatar ClearScriptLib commented on June 9, 2024 1

Hi @flat-eric147,

Since I am porting a large amount of C# code to use the async/await paradigm, I cannot use await in the property setter. In some cases the setter might trigger loading an image from a web resource.

Unfortunately, in both C# and JavaScript, the expression foo.bar = baz always evaluates to baz. There's no way for a property setter to return a task or promise that tracks the operation of the setter itself, nor is there a way to override the assignment operator in a way that would allow it.

Therefore, as far as we can tell, there's no way to add nonblocking behavior to settable properties without affecting their callers – in either language – so the first step is to decide how exactly you want your settable properties to behave in your new async-aware, nonblocking codebase.

And how would I await a c# async method in CleacScript/V8?

The easiest way would be to enable automatic task-promise conversion via V8ScriptEngineFlags.EnableTaskPromiseConversion. That way you could simply await tasks in script code. Let us know if you need an example.

Good luck!

from clearscript.

flat-eric147 avatar flat-eric147 commented on June 9, 2024 1

Thank you!

from clearscript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.