rt-sim-training-client/src/jmap/shape/factory.js

17 lines
379 B
JavaScript
Raw Normal View History

2019-07-03 14:29:09 +08:00
import deviceType from '../config/deviceType';
import Link from './Link';
import Section from './Section';
const mapShape = {};
mapShape[deviceType.Link] = Link;
mapShape[deviceType.Section] = Section;
function shapefactory(device) {
let shape = mapShape[device.type];
if (shape instanceof Function) {
return shape(device);
}
}
export default shapefactory