- Expert Angular
- Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
- 103字
- 2021-07-15 17:05:34
Decorators
Decorators enable us to extend a class or object by adding behaviors without modifying code. Decorators wrap the class with extra functionality. Decorators can be attached to a class, property, method, parameter, and accessor. In ECMAScript 2016, decorators are proposed to modify the behavior of a class. Decorators are prefixed with the @ symbol and a decorator name that resolves to a function called at runtime.
The following code snippet shows the authorize function, and it can be used as the @authorize decorator on any other class:
function authorize(target) { // check the authorization of the use to access the "target" }
推薦閱讀
- Vue.js 3.x快速入門
- Oracle從入門到精通(第3版)
- 從零開始:數字圖像處理的編程基礎與應用
- SoapUI Cookbook
- Game Programming Using Qt Beginner's Guide
- Android開發精要
- Full-Stack Vue.js 2 and Laravel 5
- 3D少兒游戲編程(原書第2版)
- Unity 2018 Shaders and Effects Cookbook
- Python從入門到精通
- SQL Server 2016 從入門到實戰(視頻教學版)
- Solutions Architect's Handbook
- Learning VMware vSphere
- MongoDB Cookbook(Second Edition)
- 現代CPU性能分析與優化