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

dismiss(), opacity didn't stop at 0 #18

Closed
ghost opened this issue Jul 14, 2015 · 3 comments
Closed

dismiss(), opacity didn't stop at 0 #18

ghost opened this issue Jul 14, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 14, 2015

I don't know what happened, but I noticed after dismissal that the notification never showed back when calling set() again. So I went the developer tools and saw the opacity value rapidly decreasing in value. Of course, the CPU went up like crazy.

See attached image.
untitled

EDIT:
It seems to happen whenever I set() and dismiss() very fast.

@ghost
Copy link
Author

ghost commented Jul 14, 2015

For anyone that might need it, here's what I did. Works perfectly now.

  1. Add helper flags.
    var notifyShown = false;
    var notifyDismissing = false;

notifyScope.dismiss = function () {
notifyDismissing = true;

fadeOut(FADE_OUT_DURATION, function() {
notifyReset();
notifyShown = false;
notifyDismissing = false;
});

};

return {
set: function(message, userOpt) {
...
if (angular.isDefined(notifyTimeout)) {
$timeout.cancel(notifyTimeout);
notifyTimeout = undefined;
}

    if (angular.isDefined(notifyInterval)) {
            $interval.cancel(notifyInterval);
            notifyInterval = undefined;
    }

    ...
    fadeIn(FADE_IN_DURATION, function() {
        notifyShown = true;
        if (isSticky) {
            ...
        }
    }
}
  1. dismiss: function () {
    if (notifyShown && !notifyDismissing) {
    notifyScope.dismiss();
    }
    },

@nzamosenchuk
Copy link

Hi Droritos!
Looks similar to the problem I also discovered. When notifications where constantly shown or constantly hidden with opacity going to +inf or -inf.

#17

Waiting for Mat ...

@matowens
Copy link
Owner

Gonna close this one out since we're addressing it over on #17.

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

No branches or pull requests

2 participants