优化事件互斥关系

This commit is contained in:
Harvey committed 2020-05-15 17:30:50 +08:00
1 parent cf22fb0535
commit 634e776d49
8 files changed
+41 -27

No files matched your search

@@ -0,0 +1,17 @@
export default function exclusiveInit(art, player) {
const props = ['pip', 'fullscreen', 'fullscreenWeb', 'fullscreenRotate'];
props.forEach((name) => {
const event = `${name}Change`;
art.on(event, (state) => {
if (state) {
props
.filter((item) => item !== name)
.forEach((item) => {
if (player[item]) {
player[item] = false;
}
});
}
});
});
}