Skip to content

Commit

Permalink
fix bug when src becomes null
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Makhov committed May 20, 2016
1 parent 8a99982 commit 3c752d7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pdf-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,18 @@
},

attributeChanged: function(name, type) {
if (typeof this.instance == 'undefined') this._initializeReader();
else {
this.instance.changePDFSource(this.getAttribute(name));
this.currentPage = 1;
this.totalPages = this.instance.totalPages;
this.fileName = this.src.split('/').pop();
if (name === 'src') {
if (typeof this.instance == 'undefined') this._initializeReader();
else {
if (!this.getAttribute(name)) return;
this.instance.changePDFSource(this.getAttribute(name));
this.currentPage = 1;
this.totalPages = this.instance.totalPages;
this.fileName = this.src.split('/').pop();
}
}
},

_initializeReader: function() {
this.instance = new Polymer.Reader(this);
if (this.src != null) this.fileName = this.src.split('/').pop();
Expand Down

0 comments on commit 3c752d7

Please sign in to comment.