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

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" 
} 
主站蜘蛛池模板: 东丽区| 吴旗县| 灌云县| 丹巴县| 彭阳县| 怀安县| 郓城县| 桐城市| 东乡县| 迁安市| 武义县| 吉首市| 柳江县| 兴安县| 贞丰县| 临邑县| 新干县| 新竹县| 巫山县| 沈丘县| 睢宁县| 昂仁县| 苍梧县| 陈巴尔虎旗| 枞阳县| 梨树县| 松滋市| 西华县| 南平市| 密云县| 布尔津县| 腾冲县| 罗山县| 高台县| 霍林郭勒市| 仙居县| 丹东市| 汤阴县| 鹤庆县| 周至县| 城口县|