Jump to content
McKay Development

Recommended Posts

Posted (edited)

Hello, sorry for stupid post but I have question why after use this code second time console.log print the same information twice?

3 turns on 3 times when I use in other place 'loggedOn' I see again console.log(this.informations) in other function. Someone can tell me why and what I can to do with that? 

Sorry for my rip English and code. 

{
        let p = new Promise((resolve,reject)=>{
            this.steam.logOn(this.account_details);
            this.steam.on('loggedOn', () => {
                this.steam.setPersona(SteamUser.Steam.EPersonaState.Online);
                this.informations.steamID=this.steam.client.steamID;
                this.informations.accountid=this.steam.steamID.accountid;
                console.log(this.informations);
                this.steam.logOff();
                setTimeout(()=>{
                    resolve(true);
                },1000);
         });
        });
        return p.then((resolve)=>{
            console.log(`...`);
        });
    }

Console:

post-2851-0-26411800-1546597962_thumb.png 

Edited by Skyper
Posted

It's possible work on same lisener without multiple? Without promise I have normal console log without any double lines but I need promise... Thanks for respond @Dr. McKay!

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...