import { createVnode, createElement } from "./createElement";
import { DOMUpdater } from "./DOMUpdater";

function AnuPortal(props){
    return props.children;
}

export function createPortal(children, node) {
    var vnode,
        events = node.__events;
    if (events) {
        vnode = node.__events.vnode;
        console.log("更新");
    } else {
        events = node.__events = {};
        vnode = createVnode(node);
        events.vnode = vnode;
        new DOMUpdater(vnode);
    }

    var child = createElement(AnuPortal, { children: children });
    events.child = child;
    child.superReturn = vnode;
    console.log(vnode,"----");
    return child;
}
