0.0.1 • Published 7 years ago
decorator-synchronize v0.0.1
synchronize
Synchronize is a little module, that allows you to run an async method once a time. I needed it for a server, where I could request a resource only once a time. So I wrote this little helper, that could use for this.
usage
import {Synchronize} from 'synchronize';
class TestClass {
/**
* This method should only run once a time
*/
@Synchronize()
async method1(value: string, ... args) {
//
// do async stuff
//
}
/**
* Each method with this token should only run once a time
*/
@Synchronize('token')
async method1(value: string, ... args) {
//
// do async stuff
//
}
}
0.0.1
7 years ago