- 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" }
推薦閱讀
- Learning LibGDX Game Development(Second Edition)
- Learning Cython Programming(Second Edition)
- PyTorch自動駕駛視覺感知算法實戰
- Visual C++實例精通
- 名師講壇:Java微服務架構實戰(SpringBoot+SpringCloud+Docker+RabbitMQ)
- Hands-On Microservices with Kotlin
- Python完全自學教程
- 信息技術應用基礎
- Python語言實用教程
- 軟件項目管理實用教程
- Mastering AWS Security
- 現代C:概念剖析和編程實踐
- ABAQUS6.14中文版有限元分析與實例詳解
- Laravel Design Patterns and Best Practices
- 前端架構設計