Files
ArtPlayer/packages/artplayer/src/loading.js
T
2019-06-12 15:24:34 +08:00

27 lines
662 B
JavaScript

import { append } from './utils';
export default class Loading {
constructor(art) {
this.art = art;
const { $loading } = art.template;
append($loading, art.icons.loading);
}
set show(value) {
const { $player } = this.art.template;
if (value) {
this.state = true;
$player.classList.add('artplayer-loading-show');
this.art.emit('loading:show');
} else {
this.state = false;
$player.classList.remove('artplayer-loading-show');
this.art.emit('loading:hide');
}
}
toggle() {
this.show = !this.state;
}
}