Book Image

JavaScript at Scale

By : Adam Boduch
Book Image

JavaScript at Scale

By: Adam Boduch

Overview of this book

Table of Contents (17 chapters)
JavaScript at Scale
About the Author
About the Reviewers

Generic component configuration

As we saw in the preceding section on locale preferences, we need to load a preference value, which can then be used by each of our components. Or maybe just one component in the case of locales, but this preference value indirectly impacts all components. Looking beyond locales, there're a lot of other things we'll want to configure in our components. This section looks at the problem from a generic perspective. First we need to decide on which aspects of a given component are configurable, and then there are the mechanics of getting those preferences into the components at runtime.

Deciding on configuration values

The first step with component configuration is deciding on preferences—which aspects of the component need to be configurable, and which aspects can stay static? It's far from an exact science, as more often than not, we realize later on that something static should have been configurable. Trial and error is the best process for finding configurable...