question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Promises for user variable functions

See original GitHub issue

Do you think its possible to replace all calls that sets and gets user variables asyncronously? Like with promises…

// example

self.master.getUservars(user).then((userVars) => {
    // use userVars in core ...
    return aVar
}).then((aVar){
    // use aVar in core ...
    return self.master.setUservar(user, "__initialmatch__", void 0);
}).catch((err) => {
    //...
});

I like how the Python version is now. It does all i want from Rivescript. I can only use it locally though.

All my production app’s are in NodeJs. I tried to modify the Rivescript core to in NodeJs to work with promises, but i kept hitting road-blocks. Maybe cause i don’t understand much what goes on there.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kirslecommented, Jan 12, 2017

@lynxionxs the Go version supports custom user session managers now if you wanna look into that.

1reaction
kirslecommented, Jul 26, 2016

@lynxionxs I’ll have to make a similar update to the Go version to support swapping out the session handler, it doesn’t support that at the moment.

@silentrob I know SuperScript has diverged quite a lot from RiveScript, but yours is async all throughout so I was curious if you found a way to make the reply phase less CPU-bound and provide more opportunities for async code to be run during that phase.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using promises - JavaScript - MDN Web Docs
Essentially, a promise is a returned object to which you attach callbacks, instead of passing callbacks into a function.
Read more >
How to Use promises in JavaScript - Tabnine Academy
To do so, use the following syntax: const waiting = await Promise. all([person1Arrival(), person2Arrival(), person3Arrival()]);
Read more >
How to create a Promise from a variable? - Stack Overflow
Something like: let promise = Promise(x); The question is not about when and how to use Promises. It is clear.
Read more >
How to wait for a promise to finish before returning the ...
Use of setTimeout() function: In order to wait for a promise to finish before returning the variable, the function can be set with...
Read more >
How to Write a JavaScript Promise - freeCodeCamp
Using a promise is also called consuming a promise. In our example above, our function returns a promise object. This allows us to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found