0.0.1 • Published 5 years ago
@back2wild/js-synchronized v0.0.1
@back2wild/js-synchronized
class SomeClass {
@synchronized()
public async f1(wait: number) {
await new Promise((resolove: any) => {
setTimeout(resolve, wait);
});
return wait;
}
}
The @synchronized
will make the f1()
execute sequentially, just like synchronized in multithread envronment.
It is actually make every call on f1
wait until the previous finish, by Promise.
0.0.1
5 years ago