| class Viewer { | class Viewer { | ||||
| constructor(id, options = {}) { | constructor(id, options = {}) { | ||||
| if (!id || !document.getElementById(id)) { | |||||
| if (!id || (typeof id === 'string' && !document.getElementById(id))) { | |||||
| throw new Error('Viewer:the id is empty') | throw new Error('Viewer:the id is empty') | ||||
| } | } | ||||
| this._dcContainer = DomUtil.create( | this._dcContainer = DomUtil.create( | ||||
| 'div', | 'div', | ||||
| 'dc-container', | 'dc-container', | ||||
| document.getElementById(id) | |||||
| typeof id === 'string' ? document.getElementById(id) : id | |||||
| ) //Register the custom container | ) //Register the custom container | ||||
| this._baseLayerPicker = new Cesium.BaseLayerPickerViewModel({ | this._baseLayerPicker = new Cesium.BaseLayerPickerViewModel({ |