ES-Next & ES7 @decorator
ES-Next & ES7 @decorator
@decorator
https://tc39.github.io/proposal-decorators/#sec-syntax
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/
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
Java & decorator design pattern
@Override
@ decorator
Spring Framework 5
https://www.baeldung.com/java-decorator-pattern
Spring 5 & Spring Boot 2
ES7 Decorator
https://www.sitepoint.com/javascript-decorators-what-they-are/
https://github.com/tc39/proposal-decorators
https://babeljs.io/docs/en/babel-plugin-proposal-decorators
https://es6.ruanyifeng.com/#docs/decorator
demo
这个@connect 的注解,是把下面的 class 与 上面的方法一起生成 container 组件
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/10971637.html
未经授权禁止转载,违者必究!