Skip to content

Commit

Permalink
refactor: Avoid running unnecessary History API code for Drawer when …
Browse files Browse the repository at this point in the history
…on Electron
  • Loading branch information
rstoenescu committed Dec 28, 2016
1 parent a99ed9b commit 2f241a6
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/vue-components/drawer/Drawer.vue
Expand Up @@ -87,7 +87,7 @@ export default {
if (this.opened) {
backdrop.classList.add('active')
if (!Platform.within.iframe) {
if (Platform.has.popstate) {
if (!window.history.state) {
window.history.replaceState({__quasar_drawer: true}, '')
}
Expand All @@ -103,7 +103,7 @@ export default {
}
else {
window.removeEventListener('resize', this.close)
if (!Platform.within.iframe) {
if (Platform.has.popstate) {
window.removeEventListener('popstate', this.__popState)
if (window.history.state && !window.history.state.__quasar_drawer) {
window.history.go(-1)
Expand Down Expand Up @@ -139,7 +139,7 @@ export default {
if (this.opened) {
backdrop.classList.add('active')
document.body.classList.add('drawer-opened')
if (!Platform.within.iframe) {
if (Platform.has.popstate) {
if (!window.history.state) {
window.history.replaceState({__quasar_drawer: true}, '')
}
Expand All @@ -152,7 +152,7 @@ export default {
}
else {
window.removeEventListener('resize', this.close)
if (!Platform.within.iframe) {
if (Platform.has.popstate) {
window.removeEventListener('popstate', this.__popState)
if (window.history.state && !window.history.state.__quasar_drawer) {
window.history.go(-1)
Expand Down Expand Up @@ -300,10 +300,8 @@ export default {
fn(this.opened ? 0.01 : 1, done)
},
__popState () {
if (!Platform.within.iframe) {
if (window.history.state && window.history.state.__quasar_drawer) {
this.setState(false)
}
if (Platform.has.popstate && window.history.state && window.history.state.__quasar_drawer) {
this.setState(false)
}
},
open (done) {
Expand Down

0 comments on commit 2f241a6

Please sign in to comment.