Promises for user variable functions
See original GitHub issueDo 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:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lynxionxs the Go version supports custom user session managers now if you wanna look into that.
@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.