2019-07-15 17:14:32 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { task, timeout } from 'ember-concurrency';
|
2020-06-10 13:49:16 +00:00
|
|
|
import { classNames } from '@ember-decorators/component';
|
|
|
|
import classic from 'ember-classic-decorator';
|
2019-07-15 17:14:32 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@classic
|
|
|
|
@classNames('copy-button')
|
|
|
|
export default class CopyButton extends Component {
|
|
|
|
clipboardText = null;
|
|
|
|
state = null;
|
2019-07-15 17:14:32 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@(task(function*() {
|
2019-07-15 17:14:32 +00:00
|
|
|
this.set('state', 'success');
|
|
|
|
|
|
|
|
yield timeout(2000);
|
|
|
|
this.set('state', null);
|
2020-06-10 13:49:16 +00:00
|
|
|
}).restartable())
|
|
|
|
indicateSuccess;
|
|
|
|
}
|