lib/bundle.js
/**
 * Attach a widget to a host DOM node.
 *
 * @param widget - The widget to attach to the DOM.
 *
 * @param host - The node to use as the widget's host.
 *
 * @throws Will throw an error if the widget is not a root widget,
 *   if the widget is already attached to the DOM, or if the host
 *   is not attached to the DOM.
 *
 * #### Notes
 * This function ensures that an `'after-attach'` message is dispatched
 * to the hierarchy. It should be used in lieu of manual DOM attachment.
 */
Attach a widget to a host DOM node.
@param widget - The widget to attach to the DOM.

@param host - The node to use as the widget's host.

@throws Will throw an error if the widget is not a root widget,
if the widget is already attached to the DOM, or if the host
is not attached to the DOM.

Notes
This function ensures that an `'after-attach'` message is dispatched
to the hierarchy. It should be used in lieu of manual DOM attachment.
Attach a widget to a host DOM node . @param widget - The widget to attach to the DOM . @param host - The node to use as the widget ' s host . @throws Will throw an error if the widget is not a root widget if the widget is already attached to the DOM or if the host is not attached to the DOM . Notes This function ensures that an ` ' after - attach ' ` message is dispatched to the hierarchy . It should be used in lieu of manual DOM attachment .
function attachWidget(widget, host) {
    if (widget.parent) {
        throw new Error('only a root widget can be attached to the DOM');
    }
    if (widget.isAttached || document.body.contains(widget.node)) {
        throw new Error('widget is already attached to the DOM');
    }
    if (!document.body.contains(host)) {
        throw new Error('host is not attached to the DOM');
    }
    host.appendChild(widget.node);
    phosphor_messaging_1.sendMessage(widget, exports.MSG_AFTER_ATTACH);
}
function attachWidget ( widget , host ) { if ( widget . parent ) { throw new Error ( 'only a root widget can be attached to the DOM' ) ; } if ( widget . isAttached || document . body . contains ( widget . node ) ) { throw new Error ( 'widget is already attached to the DOM' ) ; } if ( ! document . body . contains ( host ) ) { throw new Error ( 'host is not attached to the DOM' ) ; } host . appendChild ( widget . node ) ; phosphor_messaging_1 . sendMessage ( widget , exports . MSG_AFTER_ATTACH ) ; }
Attach a widget to a host DOM node.
Attach a widget to a host DOM node .