Sign in to follow this  
Remmi_Jefferson

Browser Recall

Recommended Posts

Hi, the browser is called only once, the second time nothing happens

 

if(notifications)
{
    notifications.destroy();
}
else{
    var notifications = mp.browsers.new("package://notifications/index.html");
    setTimeout(() => {
        notifications.destroy();
    }, 5000)
}

 

Share this post


Link to post
Share on other sites

in this instance you'd have to do notifications = null; after the destroy, even if you destroy it, it doesn't turn the variable to nothing, so therefore each time you run it, it's always running 'notifications.destroy() because if(notifications) is true.

Share this post


Link to post
Share on other sites
if(notifications)
{
    notifications = null;
}
else{
    var notifications = mp.browsers.new("package://notifications/index.html");
    setTimeout(() => {
        notifications.destroy();
        notifications = null;
    }, 5000)
}

So?

Edited by Remmi_Jefferson

Share this post


Link to post
Share on other sites
6 minutes ago, Remmi_Jefferson said:
if(notifications)
{
    notifications = null;
}
else{
    var notifications = mp.browsers.new("package://notifications/index.html");
    setTimeout(() => {
        notifications.destroy();
    }, 5000)
}

So?

The null should be assigned AFTER the destroy() line, don't just replace it.

That's what @MrPancakers told you to do and how it's supposed to work.

Edited by Xabi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.