govuk-frontend
govuk-frontend copied to clipboard
Research JavaScript APIs in other projects
What
Research into how other projects structure their JavaScript and deal with things like public vs private methods.
We should:
- consider previous investigations we've done into this
- find different libraries that have a JavaScript public API and that set methods and variables as 'public' or 'private'
Why
To get some ideas for things to try when prototyping our own approach for JavaScript in GOV.UK Frontend. Some of the specific problems we're trying to solve as part of this work and that may guide this research are:
- https://github.com/alphagov/govuk-frontend/issues/1677
- https://github.com/alphagov/govuk-frontend/issues/1530
For example: do we need a function within the character count to allow people to programatically update the component or tigger an update?
See the epic card for more detail on the problem(s).
Who needs to know about this
Developers
Done when
- [x] Considered previous investigations
- [x] https://github.com/alphagov/govuk-frontend/issues/1530#issuecomment-565063234
- [x] https://github.com/alphagov/govuk-frontend/pull/1238
- [x] Considered JavaScript Design Patterns for creating public/private definitions
- [x] Identified projects that expose methods and variables to users as public API and set methods and/or variables as public and private
- What browsers do they support?
- Have they thought about performance?
- How does it work?
- What naming conventions do they use?
- Can methods/variables be accessed via attributes and properties?
- How do they document things?
- How do they test for public/private methods/variables?
- Are they using any libraries?
- How do they handle user trying to access private methods/variables?
- [ ] We have some approaches we know we want to use or try out within GOV.UK Frontend
I've made some notes here: https://docs.google.com/document/d/14g5JAmyvOhphJ1XDEOUEVb1FCaUb4cf3HLye49o_ovw/edit
The doc needs expanding, but our focus is elsewhere right now, so I'm leaving it here so we can get back to it later.
@domoscargin Ok for this to go back into the backlog?
Closing as we're not planning on doing this (at least not as a piece of work in its own right – we often look at what other frameworks are doing for examples of best practise)