Skip to content

Multiple close/open support - #85

Open
gogoprog wants to merge 2 commits into
rlamana:masterfrom
firefalcom:fix/multipleCloseOpen
Open

Multiple close/open support#85
gogoprog wants to merge 2 commits into
rlamana:masterfrom
firefalcom:fix/multipleCloseOpen

Conversation

@gogoprog

@gogoprog gogoprog commented Jul 18, 2018

Copy link
Copy Markdown

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

Comment thread dist/ventus.js
},
onAnimationEnd: function (callback, scope) {
this.one(animationEventNames, function () {
this.on(animationEventNames, function () {

Copy link
Copy Markdown
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
Copy Markdown
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

rlamana commented Jan 20, 2019

Copy link
Copy Markdown
Owner

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