UNPKG

hta

Version:

The tiny framework for building Hyper Text Application with ease

23 lines (22 loc) 413 B
export default function createInstance( parent, key, type, shouldRemove, mount, args ) { let content = parent[key]; if ( content && (content.type !== type || (shouldRemove && shouldRemove(content))) ) { content.unmount(); content = null; } if (!content) { parent[key] = content = args ? mount.apply(null, args) : mount(); content.type = type; } return content; }