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