1.1.0 • Published 7 years ago
@decorators/co v1.1.0
Project implements decorators for modern tools for NodeJS like:
Installation
npm install @decorators/co --save
API
Decorators
Method
- @Async
import { Async } from 'node-decorators/co';
let testAsyncFunc = () => {
return new Promise(resolve => {
setTimeout(() => {
console.log('testAsyncFunc');
resolve()
}, 3000);
});
};
class TestController {
@Async()
*getData() {
console.log('code before async function');
yield testAsyncFunc();
console.log('code after async function');
}
}
License
MIT