UNPKG

@uswds/uswds

Version:

Open source UI components and visual style guide for U.S. government websites

25 lines (18 loc) 610 B
window.uswdsPresent = true; // GLOBAL variable to indicate that the uswds.js has loaded in the DOM. const uswds = require("./config"); const components = require("./index"); uswds.components = components; const initComponents = () => { const target = document.body; Object.keys(components).forEach((key) => { const behavior = components[key]; behavior.on(target); }); }; if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", initComponents, { once: true }); } else { initComponents(); } exports.default = uswds; exports.initComponents = initComponents;