Untitled - Posted on May Fri 1st 8:10 PM (Never Expires) - Format: text - This is a modified post 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 player_key='key'
  14.     let results = {};
  15.     let pr = getAllPlayersInARoom(player_key);
  16.     pr.then(function (value) {
  17.         console.log("sub" ,value);
  18.         results = value;
  19.     })
  20.  
  21.     console.log("main",results);
  22. }
  23.  
  24. //Output
  25. //main {}
  26. //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