Untitled - Posted on May Fri 1st 8:08 PM (Never Expires) - Format: text - See newer version(s) of this paste titled "Untitled"
  1. async function getAllPlayersInARoom(player_key) {
  2.     let promise = await new Promise(function (resolve, reject) {
  3.         redisClient.hgetall(player_key, function (err, value) {
  4.             if (err) { reject(err); }
  5.             resolve(value);
  6.         });
  7.     });
  8.  
  9.     return promise;
  10. }
  11.  
  12. function main(){
  13.     let results = {};
  14.     let pr = getAllPlayersInARoom(player_key);
  15.     pr.then(function (value) {
  16.         console.log("sub" ,value);
  17.         results = value;
  18.     })
  19.  
  20. }
  21.  
  22. //Output
  23. //main {}
  24. //sub { ...}

New Paste

Paste Options

Recent Pastes

24 hours ago

dir

10 days ago

Untitled

13 days ago

Untitled

19 days ago

Untitled

68 days ago

Untitled

68 days ago

Untitled

68 days ago

Untitled

68 days ago

Untitled

74 days ago

radis node

74 days ago

node redis