Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import { action } from '@ember-decorators/object';
  2.  
  3. export default class AutoBind {
  4. end = false;
  5.  
  6. constructor() {
  7. window.addEventListener('beforeunload', this.onDestroy);
  8. }
  9.  
  10. @action
  11. onDestroy(event) {
  12. this.end = true;
  13. console.log(this.end);
  14. event.preventDefault();
  15. event.returnValue = false;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement