mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 10:31:20 -08:00
forEach => for
This commit is contained in:
1 parent
99f5694100
commit
455e2189a7
18 files changed
+159
-103
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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: () => {
|
||||
|
||||
Reference in new issue
Block a user