synchronize-calls
Decorator that synchronizes asynchronous methods :-)
Method Decorator Example
; { thisstart = ; } @ async { await lock; await this; } async { await ; this; } { console; } const e = ; e; // outputs after 1se; // outputs after 1se; // outputs after 1s e; // outputs after 3se; // outputs after 5se; // outputs after 6s
Function Decorator Example
; let item; { await ; item = newItem; console;} { return ;} const syncedIncrement = ; { item = price: 0; await* // Saved item with price: 1 // Saved item with price: 1 // Saved item with price: 1 ;} { item = price: 0; await* // Saved item with price: 1 // Saved item with price: 2 // Saved item with price: 3 ;} { await ; await ;} ;