8000 set pdfViewer to null when component gets distoryed by dpritos · Pull Request #33 · arkokoley/pdfvuer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

set pdfViewer to null when component gets distoryed #33

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

Merged
merged 1 commit into from
Oct 23, 2019

Conversation

dpritos
Copy link
Contributor
@dpritos dpritos commented Sep 24, 2019

Fixes issue #
When the component is destroyed it will call resizeScale method for the last time and calling the drawScaled method thus causing error below
image

Describe the changes you have made in this PR -

Since drawScaled method has a checking if pdfViewer data exists before doing anything, so setting pdfViewer data to null on before the component is destroyed should fix the issue.

Have you updated the readme?

No

@pendext
Copy link
pendext commented Oct 11, 2019

I am seeing this error locally, it would be nice to have this merged in to quiet down the console.

@dpritos
Copy link
Contributor Author
dpritos commented Oct 14, 2019

@pendext a work around using mixins while waiting for this to be merged.

import Vue from 'vue'
import pdfvuer from 'pdfvuer'

export default Vue.component('pdf-viewer', {
  mixins: [pdfvuer],
  beforeDestroy() {
    var self = this
    if (self.pdfViewer) {
      self.pdfViewer.destroy()
      self.pdfViewer = null
    }
  }
})

@arkokoley arkokoley merged commit 80d7964 into arkokoley:master Oct 23, 2019
@arkokoley
Copy link
Owner
arkokoley commented Oct 23, 2019

Looks good. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0