class LineHandler { handleData(data) { var type = data.type; if (type === 'image') { var imageHandler = new ImageHandler(); imageHandler.handleImage(data); } } }