Jump to content

Recommended Posts

Posted

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)
}

 

Posted

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.

Posted (edited)
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
Posted (edited)
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
Posted
2 минуты назад, Xabi сказал:

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.

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

 

Does not work

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...