the-world-engine
Version:
three.js based, unity like game engine for browser
32 lines (26 loc) • 450 B
JavaScript
;
class Component {
getProps() {
return this;
}
}
class DrivedComponent extends Component {
value1=1;
}
class DrivedComponent2 extends Component {
getProps() {
return this;
}
value1=1;
func1=n => n;
func2=n => n;
}
function withComponent(n, e) {
e(new n);
}
withComponent(DrivedComponent, (n => {
n.value1 = 2;
}));
withComponent(DrivedComponent2, (n => {
n.func1(1);
}));