Jump to content


Photo
Question

Expecting a object from getOffers() but getting undefined

node.js node-steam-tradeoffer-manager

  • Please log in to reply
2 replies to this topic

#1 Plumperkins

Plumperkins

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 05 June 2019 - 10:00 PM

I would like to create a function that returns the getOffers object.
when ever I console.log my loadTrades function i get undefined. I am new to coding especially aysnc. how could i write this better?
 
 
 
 
const loadTrades = function(callback){
  manager.getOffers('ActiveOnly',(err,received)=>{
 
    if(err){
      console.log(err)
    } else {
      callback(received);
    }
 
  });
}
 
 
manager.on('newOffer',()=>{
  // expecting to console log the getOffers object   
 console.log(loadTrades((received)=>{return received}));
 
});

 



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,162 posts

Posted 05 June 2019 - 10:02 PM

The first argument needs to be an enum value, not a string.


  • Plumperkins likes this

#3 Plumperkins

Plumperkins

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 06 June 2019 - 05:19 PM

The first argument needs to be an enum value, not a string.

Thank you for the quick response.







Also tagged with one or more of these keywords: Question, node.js, node-steam-tradeoffer-manager

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users