0.0.1 • Published 7 years ago

decorator-synchronize v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

synchronize

Greenkeeper badge Build Status Coverage Status Known Vulnerabilities

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 
            //
        }
    }