player属性代理到art属性

This commit is contained in:
Harvey Zack committed 2019-08-01 15:53:01 +08:00
1 parent 95d5f64057
commit 5e03c9b191
4 files changed
+32 -6

No files matched your search

+2 -1
View File
@@ -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);
}
}
+10
View File
@@ -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));
}
});
});
}