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://spring.io/
https://www.baeldung.com/java-decorator-pattern
Spring 5 & Spring Boot 2