Allow widget views to be loaded from require modules

As discussed previously, this is a significant improvement for building widgets outside of IPython, because from the Python side, you can install the Javascript, load it and display the widget all in one go - previously you had to leave an arbitrary gap between loading the nbextension and displaying the widget, to allow time for the extension to load asynchronously and register the widget view class. I have already adapted [mobilechelonian](https://github.com/takluyver/mobilechelonian/tree/require-widgets) to use this.

This required refactoring things that create widget views to use callbacks instead of return values, because require loads modules asynchronously.

I plan to do the same for comm targets, which have a similar global registry, and the same problem with async loading. But I wanted to get this up for review first.
I'm not actually changing this code - it just shows up in the diff because I've moved it inside a callback, changing the indentation.