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() {
|
|
|
|
this.get('startSpinnerTimeout').perform();
|
|
|
|
},
|
|
|
|
|
2017-01-18 02:44:08 +03:00
|
|
|
startSpinnerTimeout: task(function* () {
|
|
|
|
yield timeout(this.get('slowLoadTimeout'));
|
|
|
|
this.set('showSpinner', true);
|
2018-01-11 20:43:23 +03:00
|
|
|
})
|
2017-01-18 02:44:08 +03:00
|
|
|
});
|