Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout of 0 does not work #23

Closed
mikebm opened this issue May 25, 2016 · 3 comments
Closed

timeout of 0 does not work #23

mikebm opened this issue May 25, 2016 · 3 comments
Labels

Comments

@mikebm
Copy link

mikebm commented May 25, 2016

Hello, i have tried to override the timeout for errors to make them sticky and it does not work.

I have tried the below and no matter what, it goes away after 5 seconds.

    var toasterconfig : ToasterConfig = new ToasterConfig({timeout: {error:0 }});
    var toast : Toast = {
        type: "error",
        title: title,
        body: message,
        showCloseButton: true,
        toasterConfig: toasterconfig
    };

    this.toasterService.pop(toast);    


    var toast : Toast = {
        type: "error",
        title: title,
        body: message,
        showCloseButton: true,
        timeout: 0
    };
    this.toasterService.pop(toast);  
@mikebm
Copy link
Author

mikebm commented May 25, 2016

Apparently using -1 for timeout works, so maybe the documentation just needs to be updated?

@Stabzs
Copy link
Owner

Stabzs commented May 25, 2016

A toastconfig.timeout property of 0 should be perfectly fine. However, in this case you are assigning the toasterconfig directly to the toast instance, which is incorrect behavior. It should be bound to your toaster-container. Not doing so (and passing it to the toast directly) would cause issues and would probably explain the behavior in the first example.

That said, it looks like there also may be a bug in the check for the presence of the timeout property on the toast which is incorrectly causing it to fallback to looking at the timeout defined on the toasterconfig (which if not overridden, would be the default of 5000ms). This would cause an issue in your second example.

This explains why -1 is working whereas 0 is not.

@Stabzs Stabzs added the bug label May 25, 2016
Stabzs added a commit that referenced this issue May 25, 2016
If `toast.timeout` property is set to 0, the toast instance will
correctly be "sticky". If the `toast.timeout` is undefined, the timeout
property assignment will continue to correctly fallback to the
`toasterconfig.timeout` property.
Closes [#23](#23).
@Stabzs Stabzs closed this as completed May 25, 2016
@Stabzs
Copy link
Owner

Stabzs commented May 25, 2016

Fixed in 0.3.2-rc.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants