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

Multiple close/open support #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gogoprog
Copy link

@gogoprog gogoprog commented Jul 18, 2018

Hello,

The following:

myWindow.close();
myWindow.open();

during the same JavaScript frame breaks the behavior and the window can be lost forever.

This PR prevents such issue.

Let me know what do you think

@@ -1088,7 +1088,7 @@ define('ventus/core/view', ['$'], function ($) {
});
},
onAnimationEnd: function (callback, scope) {
this.one(animationEventNames, function () {
this.on(animationEventNames, function () {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will lead to memory leaks since the event listener is never unregistered.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for reviewing, I just made an update.

@rlamana
Copy link
Owner

rlamana commented Jan 20, 2019

I understand the issue here, but I'm not sure if this is the right solution. Generally, this only happens when programmatically you close and then open a window, which occurs so fast that the animationEnd event handler of the open operation is executed before the window is even closed. I don't clearly see the use case however, I would approach this by either:

  1. ignoring any operation if the previous animation has not ended.
  2. enqueuing the operation and execute it whenever the animation has ended by means of promises.

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

Successfully merging this pull request may close these issues.

2 participants