mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Merge 5a09e390e3
into b3fcd15a8e
This commit is contained in:
commit
3ad11b45ae
23
dist/clipboard.js
vendored
23
dist/clipboard.js
vendored
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
2
dist/clipboard.min.js
vendored
2
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
@ -15,11 +15,20 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} selector
|
||||
* @param {Object} options
|
||||
*/
|
||||
destroy() {
|
||||
this.undelegateClick();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if attributes would be resolved using internal setter functions
|
||||
* or custom functions that were passed in the constructor.
|
||||
@ -36,7 +45,15 @@ class Clipboard extends Emitter {
|
||||
* @param {String} selector
|
||||
*/
|
||||
delegateClick(selector) {
|
||||
Delegate.bind(document.body, selector, 'click', (e) => this.initialize(e));
|
||||
Delegate.bind(document.body, selector, 'click', this.initialize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Undelegates a click event on the passed selector.
|
||||
* @param {String} selector
|
||||
*/
|
||||
undelegateClick() {
|
||||
Delegate.unbind(document.body, 'click', this.initialize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user