Ghost/ghost/admin/app/components/gh-loading-spinner.js
Kevin Ansfield 1ad2c05d37 Bumped eslint-plugin-ghost and fixed linter errors
no issue

- new linting rules that needed fixing:
   - calling `super` in lifecycle hooks
   - no usage of String prototype extensions
2021-07-15 15:27:29 +01:00

22 lines
533 B
JavaScript

import Component from '@ember/component';
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,
didInsertElement() {
this._super(...arguments);
this.startSpinnerTimeout.perform();
},
startSpinnerTimeout: task(function* () {
yield timeout(this.slowLoadTimeout);
this.set('showSpinner', true);
})
});