2019-06-21 10:42:40 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { inject as service } from '@ember/service';
|
2020-06-17 09:25:54 +00:00
|
|
|
import chart from './chart.xstate';
|
2019-06-21 10:42:40 +00:00
|
|
|
|
2020-05-12 12:36:03 +00:00
|
|
|
export default Component.extend({
|
2019-06-21 10:42:40 +00:00
|
|
|
clipboard: service('clipboard/os'),
|
2020-05-12 12:36:03 +00:00
|
|
|
dom: service('dom'),
|
|
|
|
tagName: '',
|
|
|
|
init: function() {
|
|
|
|
this._super(...arguments);
|
2020-06-17 09:25:54 +00:00
|
|
|
this.chart = chart;
|
2020-05-12 12:36:03 +00:00
|
|
|
this.guid = this.dom.guid(this);
|
|
|
|
this._listeners = this.dom.listeners();
|
|
|
|
},
|
|
|
|
willDestroyElement: function() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this._listeners.remove();
|
|
|
|
},
|
2019-06-21 10:42:40 +00:00
|
|
|
didInsertElement: function() {
|
|
|
|
this._super(...arguments);
|
2020-06-17 09:25:54 +00:00
|
|
|
this._listeners.add(this.clipboard.execute(`#${this.guid} button`), {
|
|
|
|
success: () => this.dispatch('SUCCESS'),
|
|
|
|
error: () => this.dispatch('ERROR'),
|
2019-06-21 10:42:40 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|