Allow widgets to be constructed from Javascript

Also fixes a bug in the comm manager.
Comms already have a primary bool that indicates whether they are the one that opens or is opened. Perhaps that should be relied upon here:

```python
widget = widget_class(comm=comm)
```