Skip to content

Commit

Permalink
Merge pull request #5 from steffenmllr/master
Browse files Browse the repository at this point in the history
added destroy method
  • Loading branch information
andrepolischuk authored Jul 6, 2017
2 parents 396bf22 + bcfdebc commit 989d963
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ Forced show lens.

Forced hide lens.

### .destroy()

Unbinds the event handlers and removes the lense

## License

MIT
Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class Magnifier {
this.handleLoad = this.handleLoad.bind(this);
this.handleTouchMove = this.handleTouchMove.bind(this);
this.handleTouchEnd = this.handleTouchEnd.bind(this);
this.destroy = this.destroy.bind(this);
Object.keys(this.props).forEach(prop => this.setStyle(prop, this.props[prop]));
insertAfter(this.lens, this.el);
this.show();
Expand Down Expand Up @@ -155,4 +156,9 @@ export default class Magnifier {
this.lens.style.display = 'none';
return this;
}

destroy() {
this.unbind();
this.lens.remove();
}
}

0 comments on commit 989d963

Please sign in to comment.