Search code examples
node.jsobjectsteam

How to include what's being defined in the defining variable?


Good day, I have a question. I have here a function that doesn't give me Client with a valid manager. Here's the function:

function SetupClient(user) {
    let Client = {
        client: new SteamUser(),
        community: new SteamCommunity(),
        manager: new TradeOfferManager({
            steam: this.client,
            community: this.community,
            language: 'en'
        }),
        details: user       
    }
    SteamClients[user.username] = Client;
    Debug.emit('message', `Client setup: ${SteamClients[user.username]}`);
}

I am trying to get the client that is being created as it's being created... I guess? Hope my intentions are shown in the code accurately.


Solution

  • I messed up, this works, I just called community, instead of calling it as a property of Client. Oops...