官术网_书友最值得收藏!

  • 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" 
} 
主站蜘蛛池模板: 永春县| 中超| 文水县| 阳谷县| 蕲春县| 庆城县| 桐柏县| 松原市| 迭部县| 三江| 慈利县| 阜宁县| 河北省| 芦山县| 手机| 东港市| 田林县| 湾仔区| 来安县| 望谟县| 洪洞县| 东海县| 铜鼓县| 郧西县| 合作市| 英吉沙县| 平遥县| 新河县| 湘潭市| 金溪县| 大同市| 额尔古纳市| 中牟县| 苏尼特右旗| 托克托县| 宝山区| 永新县| 平顺县| 宜兰市| 阜南县| 板桥市|