forEach => for

This commit is contained in:
zhw2590582 committed 2022-01-07 22:11:48 +08:00
1 parent 99f5694100
commit 455e2189a7
18 files changed
+159 -103

No files matched your search

+3 -3
View File
@@ -21,11 +21,11 @@ export default function eventInit(art) {
art.fullscreen = !art.fullscreen;
});
config.events.forEach((eventName) => {
proxy($video, eventName, (event) => {
for (let index = 0; index < config.events.length; index++) {
proxy($video, config.events[index], (event) => {
art.emit(`video:${event.type}`, event);
});
});
}
// art.on('video:abort', () => {
@@ -4,7 +4,8 @@ export default function exclusiveMix(art) {
const sizeProps = ['mini', 'pip', 'fullscreen', 'fullscreenWeb'];
function exclusive(props) {
props.forEach((name) => {
for (let index = 0; index < props.length; index++) {
const name = props[index];
art.on(name, () => {
if (art[name]) {
props
@@ -16,7 +17,7 @@ export default function exclusiveMix(art) {
});
}
});
});
}
}
exclusive(sizeProps);
+6 -1
View File
@@ -21,7 +21,12 @@ export default function playMix(art) {
}
if (option.mutex) {
instances.filter((item) => item !== art).forEach((item) => item.pause());
for (let index = 0; index < instances.length; index++) {
const instance = instances[index];
if (instance !== art) {
instance.pause();
}
}
}
notice.show = i18n.get('Play');
+4 -2
View File
@@ -7,13 +7,15 @@ export default function rectMix(art) {
},
});
['bottom', 'height', 'left', 'right', 'top', 'width'].forEach((key) => {
const keys = ['bottom', 'height', 'left', 'right', 'top', 'width'];
for (let index = 0; index < keys.length; index++) {
const key = keys[index];
def(art, key, {
get: () => {
return art.rect[key];
},
});
});
}
def(art, 'x', {
get: () => {