Got rid of ES7 notation and built library

This commit is contained in:
Kevin Malakoff
2015-09-30 01:59:41 -07:00
parent ff71c92b11
commit 5a09e390e3
3 changed files with 22 additions and 6 deletions

23
dist/clipboard.js vendored
View File

@@ -477,11 +477,21 @@ var Clipboard = (function (_Emitter) {
_classCallCheck(this, Clipboard);
_Emitter.call(this);
this.initialize = this.initialize.bind(this); // pre-bind for consistent reference on remove
this.resolveOptions(options);
this.delegateClick(selector);
}
/**
* @param {String} selector
* @param {Object} options
*/
Clipboard.prototype.destroy = function destroy() {
this.undelegateClick();
};
/**
* Defines if attributes would be resolved using internal setter functions
* or custom functions that were passed in the constructor.
@@ -502,11 +512,16 @@ var Clipboard = (function (_Emitter) {
*/
Clipboard.prototype.delegateClick = function delegateClick(selector) {
var _this = this;
_delegateEvents2['default'].bind(document.body, selector, 'click', this.initialize);
};
_delegateEvents2['default'].bind(document.body, selector, 'click', function (e) {
return _this.initialize(e);
});
/**
* Undelegates a click event on the passed selector.
* @param {String} selector
*/
Clipboard.prototype.undelegateClick = function undelegateClick() {
_delegateEvents2['default'].unbind(document.body, 'click', this.initialize);
};
/**

File diff suppressed because one or more lines are too long

View File

@@ -15,6 +15,7 @@ class Clipboard extends Emitter {
*/
constructor(selector, options) {
super();
this.initialize = this.initialize.bind(this); // pre-bind for consistent reference on remove
this.resolveOptions(options);
this.delegateClick(selector);
@@ -59,7 +60,7 @@ class Clipboard extends Emitter {
* Defines a new `ClipboardAction` on each click event.
* @param {Event} e
*/
initialize = (e) => {
initialize(e) {
if (this.clipboardAction) {
this.clipboardAction = null;
}