Recommended Posts

Posted (edited)

Hey, @veers!

Take a look at the single source files I uploaded recently: https://github.com/eisengrind/v-rpc/releases/tag/js-v1.0.1

If you are not using npm at all then you also can use these single source files provided there like this:

var v = require('vrpc-client.min.js');

v.vrpc.callServerAsync('ping', true);

Otherwise you would had to copy the npm package files.

Edited by TheMysteriousVincent

Share this post


Link to post
Share on other sites

I got it to work. Thanks. :)

Is there any way to force the script to wait for the promise to get the value?

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

No. And that is for a good reason: Since JavaScript is a programming language that runs in only one thread - something like waiting for a result and thus blocking other code executions would be fatal. That is when the Promise comes in handy, because a Promise does not block nor "wait" in the main thread for a result to return, so that other code executions can be continued.

Its a bit more complicated than the short summary above. If you are interested, here is a good explanation on that: https://developers.google.com/web/fundamentals/primers/promises

Edited by TheMysteriousVincent

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.