优化ready事件

This commit is contained in:
Harvey committed 2020-05-15 12:01:43 +08:00
1 parent 7b3913e318
commit 4cbefa172d
11 files changed
+21 -37

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ export default class Contextmenu extends Component {
this.$parent = $contextmenu;
art.on('ready', () => {
art.once('ready', () => {
this.add(
playbackRate({
disable: !option.playbackRate,
+1 -1
View File
@@ -35,7 +35,7 @@ export default class Control extends Component {
this.cancelDelayHide = this.delayHide.clearTimeout;
art.on('ready', () => {
art.once('ready', () => {
this.add(
progress({
name: 'progress',
+1 -1
View File
@@ -11,7 +11,7 @@ export default class Events {
this.loadImg = this.loadImg.bind(this);
if (art.whitelist.state) {
art.on('ready', () => {
art.once('ready', () => {
clickInit(art, this);
hoverInit(art, this);
mousemoveInit(art, this);
+1 -1
View File
@@ -9,7 +9,7 @@ export default class Hotkey {
} = art;
if (option.hotkey) {
art.on('ready', () => {
art.once('ready', () => {
this.add(27, () => {
if (player.fullscreenWeb) {
player.fullscreenWeb = false;
+1 -1
View File
@@ -5,7 +5,7 @@ export default class Layer extends Component {
super(art);
this.name = 'layer';
this.$parent = art.template.$layer;
art.on('ready', () => {
art.once('ready', () => {
art.option.layers.forEach(item => {
this.add(item);
});
+2 -9
View File
@@ -10,7 +10,6 @@ export default function eventInit(art, player) {
notice,
} = art;
let isReady = false;
let reconnectTime = 0;
const maxReconnectTime = 5;
@@ -37,10 +36,7 @@ export default function eventInit(art, player) {
art.loading.show = false;
art.controls.show = true;
art.mask.show = true;
if (!isReady) {
art.emit('ready');
isReady = true;
}
art.emit('ready');
});
// art.on('video:canplaythrough', () => {
@@ -97,10 +93,7 @@ export default function eventInit(art, player) {
art.loading.show = false;
art.controls.show = true;
art.mask.show = true;
if (!isReady) {
art.emit('ready');
isReady = true;
}
art.emit('ready');
}
});
@@ -38,7 +38,7 @@ export default function localSubtitle(art) {
});
}
art.on('ready', () => {
art.once('ready', () => {
setting.add({
title: 'Local Subtitle',
name: 'localSubtitle',
+1 -1
View File
@@ -51,7 +51,7 @@ export default function localVideo(art) {
});
}
art.on('ready', () => {
art.once('ready', () => {
setting.add({
title: 'Local Video',
name: 'localVideo',
+1 -1
View File
@@ -18,7 +18,7 @@ export default class Setting extends Component {
this.$parent = $settingBody;
if (option.setting) {
art.on('ready', () => {
art.once('ready', () => {
proxy($setting, 'click', e => {
if (e.target === $setting) {
this.show = false;