You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decide and document our JavaScript conventions for GOV.UK Frontend components. At the moment, our JavaScript has some undocumented conventions (e.g: init methods) which we should document. We should also think about conventions that we don't have in place yet, for example:
public vs private methods
conventions for triggering and/or listening to events
managing state
We need to keep in mind that these conventions should work for future components we build, especially more complex ones like modals. Modals have more unique functionality, e.g: how do you initialise/manage more than one per page; how do users hook into the open/close?
Why
In our component JavaScript at the moment, we don't have a concept of private vs public methods. Doing this will:
make it easier for users to understand which JS methods/variables it is recommended they access in their application script.
make it easier for us to understand which changes to our JavaScript will affect users and which changes should be considered breaking ones
Having any 'accidental'/unintentional conventions documented will mean we're more likely to follow them in future when building new components or making changes to existing component JavaScript.
vanitabarrett
changed the title
Have a JavaScript public API for components
Decide and document our JavaScript API conventions for components
Feb 28, 2022
vanitabarrett
changed the title
Decide and document our JavaScript API conventions for components
Decide and document our JavaScript conventions for components
Feb 28, 2022
What
Decide and document our JavaScript conventions for GOV.UK Frontend components. At the moment, our JavaScript has some undocumented conventions (e.g:
init
methods) which we should document. We should also think about conventions that we don't have in place yet, for example:We need to keep in mind that these conventions should work for future components we build, especially more complex ones like modals. Modals have more unique functionality, e.g: how do you initialise/manage more than one per page; how do users hook into the open/close?
Why
In our component JavaScript at the moment, we don't have a concept of private vs public methods. Doing this will:
Having any 'accidental'/unintentional conventions documented will mean we're more likely to follow them in future when building new components or making changes to existing component JavaScript.
Related issues
Who needs to know about this
Developers; Tech Writer
Done when
The text was updated successfully, but these errors were encountered: