Jump to content
McKay Development

Any way to await a getInventoryContents()?


Recommended Posts

Hello,

I worked on projects where I could use async await to try to make my functions a bit cleaner instead of falling into callback hell.

So I wrote this below.

async _fetchInventory() {
         this.inventory = await this.tradeOfferBot.getInventoryContents(this.GAME_CODE, 2, true);
         console.log('Below is from the fetch inventory function.');
         console.log(this.inventory);
    }

I want to add the items into a variable inside of my class. Is this possible?

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...