| 1 |
import ReactDOM from 'react-dom'; |
| 2 |
import MeetingControlController from './MeetingControlController'; |
| 3 |
import MeetingWidgetController from './MeetingWidgetController'; |
| 4 |
|
| 5 |
export interface IMeetingAttributes { |
| 6 |
url: string; |
| 7 |
} |
| 8 |
|
| 9 |
export default class registerMeetingsWidget { |
| 10 |
widgetContainer: Element; |
| 11 |
controlContainer: Element; |
| 12 |
setValue: Function; |
| 13 |
attributes: IMeetingAttributes; |
| 14 |
|
| 15 |
constructor(controlContainer: any, widgetContainer: any, setValue: Function) { |
| 16 |
const attributes = widgetContainer.dataset.attributes |
| 17 |
? JSON.parse(widgetContainer.dataset.attributes) |
| 18 |
: {}; |
| 19 |
|
| 20 |
this.widgetContainer = widgetContainer; |
| 21 |
this.controlContainer = controlContainer; |
| 22 |
this.setValue = setValue; |
| 23 |
this.attributes = attributes; |
| 24 |
} |
| 25 |
|
| 26 |
render() { |
| 27 |
ReactDOM.render( |
| 28 |
MeetingWidgetController(this.attributes, this.setValue)(), |
| 29 |
this.widgetContainer |
| 30 |
); |
| 31 |
|
| 32 |
ReactDOM.render( |
| 33 |
MeetingControlController(this.attributes, this.setValue)(), |
| 34 |
this.controlContainer |
| 35 |
); |
| 36 |
} |
| 37 |
|
| 38 |
done() { |
| 39 |
ReactDOM.unmountComponentAtNode(this.widgetContainer); |
| 40 |
ReactDOM.unmountComponentAtNode(this.controlContainer); |
| 41 |
} |
| 42 |
} |
| 43 |
|