ES-Next & ES7 @ decorator

ES-Next & ES7 @ decorator

@ decorator

https://tc39.github.io/proposal-decorators/#sec-syntax

740516-20190604095446775-1489330870.png

https://github.com/wycats/javascript-decorators

https://github.com/tc39/proposal-decorators

https://www.npmjs.com/package/core-decorators#decorate

https://tc39.github.io/proposal-decorators/

ES7

https://googlechrome.github.io/samples/decorators-es7/read-write/

TS

https://www.typescriptlang.org/docs/handbook/decorators.html

JS

https://www.sitepoint.com/javascript-decorators-what-they-are/

740516-20190604101834615-643263236.png

https://repl.it/languages/javascript


function doSomething(name) {
  console.log('Hello, ' + name);
}

function loggingDecorator(wrapped) {
  return function() {
    console.log('Starting');
    const result = wrapped.apply(this, arguments);
    console.log('Finished');
    return result;
  }
}

const wrapped = loggingDecorator(doSomething);

wrapped(`xgqfrms`);

blogs

https://stackoverflow.com/questions/33635511/simple-es7-decorator-with-babel

https://babeljs.io/docs/en/babel-preset-stage-1/

http://exploringjs.com/es2016-es2017/ch_tc39-process.html

https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841

https://www.sitepoint.com/javascript-decorators-what-they-are/

zh-Hans

http://es6.ruanyifeng.com/#docs/decorator

http://taobaofed.org/blog/2015/11/16/es7-decorator/

https://juejin.im/post/5b4720c56fb9a04fb016c307


demo

https://lwc.dev/guide/html_templates#data-binding

https://lwc.dev/guide/reference#javascript-decorators

https://github.com/salesforce/lwc/issues/1338

740516-20190604093927118-929502481.png

740516-20190604094021312-653853781.png


Java & decorator design pattern

@Override

@ decorator

740516-20190604132956277-1439837866.png

Spring Framework 5

https://spring.io/

https://www.baeldung.com/java-decorator-pattern

Spring 5 & Spring Boot 2


转载于:https://www.cnblogs.com/xgqfrms/p/10971637.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值