mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
player属性代理到art属性
This commit is contained in:
1 parent
95d5f64057
commit
5e03c9b191
4 files changed
+32
-6
No files matched your search
@@ -21,6 +21,7 @@ import playingMix from './playingMix';
|
||||
import autoSizeMix from './autoSizeMix';
|
||||
import rectMix from './rectMix';
|
||||
import flipMix from './flipMix';
|
||||
import { proxyPropertys } from '../utils';
|
||||
|
||||
export default class Player {
|
||||
constructor(art) {
|
||||
@@ -47,6 +48,6 @@ export default class Player {
|
||||
autoSizeMix(art, this);
|
||||
rectMix(art, this);
|
||||
flipMix(art, this);
|
||||
|
||||
proxyPropertys(art, this);
|
||||
}
|
||||
}
|
||||
@@ -177,3 +177,13 @@ export function downloadFile(url, name) {
|
||||
elink.click();
|
||||
document.body.removeChild(elink);
|
||||
}
|
||||
|
||||
export function proxyPropertys(target, ...sources) {
|
||||
sources.forEach(source => {
|
||||
Object.getOwnPropertyNames(source).forEach(key => {
|
||||
if (!hasOwnProperty(target, key)) {
|
||||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user