3.11 Use sustainable JavaScript and APIs
Write efficient JavaScript and use APIs that minimize processing, data use, and energy consumption.
Success Criteria
- Sustainable JavaScript:
Write JavaScript that supports long-term application performance by reducing unnecessary calculations, limiting DOM updates, and minimizing network requests. - Energy-relevant APIs:
Leverage JavaScript APIs, such as Compression Streams, Page Visibility, or Vibration, when they help reduce energy use or improve efficiency. - API requests:
Only call client-side or server-side APIs when needed. Ensure only data required for the task is included in requests and responses.