@mongodb-js/mongodb-ui-components
Version:
A collection of frequently used functional UI components found on mongodb properties
30 lines (25 loc) • 675 B
JavaScript
;
import {h} from 'preact';
import {render} from 'preact';
import Nav from './index';
function renderMongoNav(rootNode, props, next) {
function onReady() {
render(h(Nav, props), document.querySelector(rootNode), function () {
return next && next();
});
}
function onload() {
document.removeEventListener('DOMContentLoaded', onload);
window.removeEventListener('load', onload);
onReady();
}
if (/^loaded|^i|^c/.test(document.readyState)) {
onReady();
} else {
document.addEventListener('DOMContentLoaded', onload);
window.addEventListener('load', onload);
}
}
window.MongoNav = {
render: renderMongoNav
};