better code

This commit is contained in:
jykim
2016-08-05 15:04:31 +09:00
parent 2af446daa6
commit fa3408cfb7
3 changed files with 13 additions and 32 deletions

21
dist/clipboard.js vendored
View File

@@ -504,21 +504,12 @@ module.exports = E;
}; };
ClipboardAction.prototype.handleResult = function handleResult(succeeded) { ClipboardAction.prototype.handleResult = function handleResult(succeeded) {
if (succeeded) { this.emitter.emit(succeeded ? 'success' : 'error', {
this.emitter.emit('success', { action: this.action,
action: this.action, text: this.selectedText,
text: this.selectedText, trigger: this.trigger,
trigger: this.trigger, clearSelection: this.clearSelection.bind(this)
clearSelection: this.clearSelection.bind(this) });
});
} else {
this.emitter.emit('error', {
action: this.action,
text: this.selectedText,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
});
}
}; };
ClipboardAction.prototype.clearSelection = function clearSelection() { ClipboardAction.prototype.clearSelection = function clearSelection() {

File diff suppressed because one or more lines are too long

View File

@@ -119,22 +119,12 @@ class ClipboardAction {
* @param {Boolean} succeeded * @param {Boolean} succeeded
*/ */
handleResult(succeeded) { handleResult(succeeded) {
if (succeeded) { this.emitter.emit(succeeded ? 'success' : 'error', {
this.emitter.emit('success', { action: this.action,
action: this.action, text: this.selectedText,
text: this.selectedText, trigger: this.trigger,
trigger: this.trigger, clearSelection: this.clearSelection.bind(this)
clearSelection: this.clearSelection.bind(this) });
});
}
else {
this.emitter.emit('error', {
action: this.action,
text: this.selectedText,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
});
}
} }
/** /**