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

Add cleanup code to web backend, mostly web-sys #1715

Merged
merged 7 commits into from
Sep 20, 2020

Conversation

alvinhochun
Copy link
Contributor

@alvinhochun alvinhochun commented Sep 20, 2020

  • Tested on all platforms changed
  • Compilation warnings were addressed
  • cargo fmt has been run on this branch
  • cargo doc builds successfully
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

(copied from changelog:)

  • On Web (web-sys only), the Event::LoopDestroyed event is correctly emitted when leaving the page.
  • On Web (web-sys only), the WindowEvent::Destroyed event now gets emitted when a Window is dropped.
  • On Web (web-sys only), the event listeners are now removed when a Window is dropped or when the event loop is destroyed.
  • On Web (web-sys only), the event handler closure passed to EventLoop::run now gets dropped after the event loop is destroyed.
  • Breaking: On Web, the canvas element associated to a Window is no longer removed from the DOM when the Window is dropped.

Closes #1688

@alvinhochun
Copy link
Contributor Author

cc @ryanisaacg

Copy link
Contributor

@ryanisaacg ryanisaacg left a comment

Choose a reason for hiding this comment

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

Looks good, though I think the compile errors mean you have to stub out some methods for stdweb.

- Drops the Runner, which causes the event handler closure to be
  dropped.
- (web-sys only:) Remove event listeners from DOM.
The canvas was inserted by the user, so it should be up to the user
whether the canvas should be removed.
@alvinhochun alvinhochun marked this pull request as ready for review September 20, 2020 19:58
@alvinhochun
Copy link
Contributor Author

I even got the changelog wrong somehow. Now fixed.

@ryanisaacg ryanisaacg merged commit 47e7aa4 into rust-windowing:master Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Web backend does not handle ControlFlow::Exit nicely
2 participants