Allow widgets to be constructed from Javascript

Also fixes a bug in the comm manager.
Thanks for pointing this out.  It turns out neither the `open_comm` or `primary` flags were needed here. :smile: