Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated calls to create empty objects in our window.GOVUK object #3189

Open
andysellick opened this issue Jan 16, 2023 · 0 comments
Open

Repeated calls to create empty objects in our window.GOVUK object #3189

andysellick opened this issue Jan 16, 2023 · 0 comments
Assignees
Labels
acknowledged This issue has been triaged.

Comments

@andysellick
Copy link
Contributor

We call things like window.GOVUK = window.GOVUK || {} at various points throughout our code, as well as several variations (e.g. window.GOVUK.Modules = window.GOVUK.Modules || {}).

Recent changes have highlighted that this approach means that some of our code is somewhat brittle because we don't always check for everything we should check for. Adding new code is fine, but if old code is removed that takes away something that isn't being checked for, we get an error.

The reason for having some of these calls is because different applications include different components, so they can't always assume that window.GOVUK.Modules exists. However this means that lines of code are repeated.

We should investigate whether it would be possible to put all these calls and their variants together in one place, before any other code executes.

@andysellick andysellick self-assigned this Jan 16, 2023
@andysellick andysellick added the acknowledged This issue has been triaged. label Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged This issue has been triaged.
Projects
None yet
Development

No branches or pull requests

1 participant