2017-08-22 10:53:26 +03:00
|
|
|
import Component from '@ember/component';
|
2017-01-18 02:44:08 +03:00
|
|
|
import {task, timeout} from 'ember-concurrency';
|
|
|
|
|
|
|
|
export default Component.extend({
|
|
|
|
tagName: '',
|
|
|
|
|
|
|
|
showSpinner: false,
|
|
|
|
// ms until the loader is displayed,
|
|
|
|
// prevents unnecessary flash of spinner
|
|
|
|
slowLoadTimeout: 200,
|
|
|
|
|
2018-01-11 20:43:23 +03:00
|
|
|
didInsertElement() {
|
2021-07-15 17:27:29 +03:00
|
|
|
this._super(...arguments);
|
2019-03-06 16:53:54 +03:00
|
|
|
this.startSpinnerTimeout.perform();
|
2018-01-11 20:43:23 +03:00
|
|
|
},
|
|
|
|
|
2017-01-18 02:44:08 +03:00
|
|
|
startSpinnerTimeout: task(function* () {
|
2019-03-06 16:53:54 +03:00
|
|
|
yield timeout(this.slowLoadTimeout);
|
2017-01-18 02:44:08 +03:00
|
|
|
this.set('showSpinner', true);
|
2018-01-11 20:43:23 +03:00
|
|
|
})
|
2017-01-18 02:44:08 +03:00
|
|
|
});
|