我正在尝试使用一些异步功能2装饰异步功能1。
例如
function func2(param) {
return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
//make async operations and then return descriptor
}
@func2(param)
async function func1() {
await .... //some async operation
await .... //some async operation
}
Run Code Online (Sandbox Code Playgroud)
因此,主要思想是在装饰器中执行一些异步操作,然后在main函数中执行其他异步调用。
可以使用打字稿装饰器来制作吗?
先感谢您。