JavaScript decorators
- Category
- JavaScript
- Type
- Chromium catches up
- Status
- No active development (Chrome No active development)
- Intent stage
- None
Summary
Adds support for decorating classes and class elements using functions preceded with the "@" symbol, these functions are called during definition to replace the value that is being decorated, provide access to it via accessor functions, or initialize it by running additional code after the value has been fully defined. Adds support for the "accessor" keyword, used in front of class fields to define auto-accessors which, unlike regular fields, define a getter and a setter on the class prototype.
Motivation
See https://github.com/tc39/proposal-decorators
Standards & signals
- Specification: https://arai-a.github.io/ecma262-compare/?pr=2417
- Firefox: No signal
- Safari: No signal
- Web developers: No signals
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=javascript-decorators
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+JavaScript%20decorators
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=JavaScript%20decorators
- Baseline status: https://webstatus.dev/?q=JavaScript%20decorators