mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
22 lines
504 B
JavaScript
22 lines
504 B
JavaScript
"use strict"
|
|
|
|
var Vnode = require("../render/vnode")
|
|
|
|
module.exports = function(redrawService) {
|
|
return function(root, component) {
|
|
if (component === null) {
|
|
redrawService.render(root, [])
|
|
redrawService.unsubscribe(root)
|
|
return
|
|
}
|
|
|
|
if (component.view == null) throw new Error("m.mount(element, component) expects a component, not a vnode")
|
|
|
|
var run = function() {
|
|
redrawService.render(root, Vnode(component))
|
|
}
|
|
redrawService.subscribe(root, run)
|
|
redrawService.redraw()
|
|
}
|
|
}
|