mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-09 04:43:54 -05:00
Means our rollup bundling doesn't leave any artefact files lying around that we'd then have to deal with. Also includes: - removal of some JSHint config' marking the artefacts as scripts to ignore - use of streamqueue package to allow the same ordering of scripts as before
35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
// JS Module used to combine all the JS modules used in the application into a single entry point,
|
|
// a bit like `app/__init__` in the Flask app.
|
|
//
|
|
// When processed by a bundler, this is turned into a Immediately Invoked Function Expression (IIFE)
|
|
// The IIFE format allows it to run in browsers that don't support JS Modules.
|
|
//
|
|
// Exported items will be added to the window.GOVUK namespace.
|
|
// For example, `export { Frontend }` will assign `Frontend` to `window.Frontend`
|
|
import Header from 'govuk-frontend/components/header/header';
|
|
|
|
// Copy of the initAll function from https://github.com/alphagov/govuk-frontend/blob/v2.13.0/src/all.js
|
|
// except it only includes, and initialises, the components used by this application.
|
|
function initAll (options) {
|
|
// Set the options to an empty object by default if no options are passed.
|
|
options = typeof options !== 'undefined' ? options : {}
|
|
|
|
// Allow the user to initialise GOV.UK Frontend in only certain sections of the page
|
|
// Defaults to the entire document if nothing is set.
|
|
var scope = typeof options.scope !== 'undefined' ? options.scope : document
|
|
|
|
// Find first header module to enhance.
|
|
var $toggleButton = scope.querySelector('[data-module="header"]')
|
|
new Header($toggleButton).init()
|
|
}
|
|
|
|
// Create separate namespace for GOVUK Frontend.
|
|
var Frontend = {
|
|
"Header": Header,
|
|
"initAll": initAll
|
|
}
|
|
|
|
export {
|
|
Frontend
|
|
}
|