Keeping state and behavior private to a class lets library authors present a clear, stable interface, while changing their code over time behind the scenes. The class fields proposal provides private fields for classes and instances, and this proposal builds on that by adding private methods and accessors (getter/setters) to JavaScript. With this proposal, any class element can be private.

Motivation

https://v8.dev/features/class-fields https://github.com/tc39/proposal-private-methods/blob/master/README.md

Documentation

Specification

Working draft or equivalent

Status in Chromium

Blink>JavaScript>Parser


Enabled by default (tracking bug) in:

  • Chrome for desktop release 84
  • Chrome for Android release 84

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Owner

Intent to Prototype url

Intent to Prototype thread

Last updated on 2020-11-09