angular / angular-hint

run-time hinting for AngularJS applications
362 stars 45 forks source link

fix(hint): properly clean up when location is changed before DOM content has been loaded #120

Open gkalpak opened 8 years ago

gkalpak commented 8 years ago

The beforeunload event was never fired is the location was changed before the DOM content had been loaded (e.g. directly inside a <script> tag. The unload event is fired more consistently.

Fixes https://github.com/angular/batarang/issues/290

gkalpak commented 7 years ago

This mostly affects batarang (which runs on Chrome only), but I don't see any reason not to play it safe(r), by hooking into both events. At least, this way it will be at least as good as it was before this PR.

@Narretz, PTAL.