The Util Directory
The util directory in ScandiPWA contains various utility functions that don't belong in the other categories
Some Util directories, such as Address, Cart, Currency, Menu, Price, Product, facilitate working with certain kinds of data. Others define commonly-needed functionality:
| Purpose |
Auth | Responsible for user authentication |
BrowserDatabase | Convenience methods for accessing the browser's local storage with a simpler API |
CSS | CSS manipulation. E.g. an utility for setting a CSS variable. This is useful if you want to be able to dynamically edit theme colors from the admin panel. |
Extensions | Implements a part of the plugin mechanism |
FormPortalCollector | Works with form data |
History | Exports a history object using the |
Media | Utility for working with media URLs |
Mobile | Function that helps determine the browser device, and wether it is a mobile device. |
Polyfill | Defines polyfills. Currently includes the smoothscroll polyfill |
Promise | Implements a cancelable promise |
Query | Defines tools to work with GraphQL queries |
Request | Defines tools to work with Requests |
Url | Tools to work with URLs and parse them. |
Finally, there is the Braintree
directory, which can handle interaction with the Braintree payment method.
When overriding the theme or creating plugins, you are allowed to override Util files to add functionality, or to create your own Util files.
Last updated