Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/mini-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,29 @@ const render = createRenderer({
}
})

const normalizeContainer = (container) => {
if (typeof container === 'string') {
return document.querySelector(selector)
}

return container
}

const createApp = (...args) => {
//TODO
const app = render.createApp(...args)
const { mount } = app

app.mount = (containerOrSelector) => {
const container = normalizeContainer(containerOrSelector)
container.innerHTML = ''
const proxy = mount(container)

return proxy
}
console.log(app);

return app
}

export {
Expand Down