Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Prevent init race condition
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv committed Apr 17, 2019
commit 08cc89bed0faefb104ba86847d00e285d3365ab8
10 changes: 9 additions & 1 deletion src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export default {
fileList: [],

isMobile: window.outerWidth < 768,
isLoaded: false,

showSidebar: false,
sidebarWidth: 0,

Expand Down Expand Up @@ -160,7 +162,12 @@ export default {
watch: {
// make sure any late external app can register handlers
handlers: function() {
this.registerHandler(this.handlers[this.handlers.length - 1])
// make sure the viewer is done registering handlers
// so we only register handlers added AFTER the init
// of the viewer
if (this.isLoaded) {
this.registerHandler(this.handlers[this.handlers.length - 1])
}
}
},

Expand All @@ -171,6 +178,7 @@ export default {
this.registerHandler(handler)
})
})
this.isLoaded = true

window.addEventListener('resize', this.onResize)
},
Expand Down