Git Product home page Git Product logo

utils-decorators's People

Contributors

dependabot[bot] avatar gongpeione avatar maormoshe avatar notanengineercom avatar tripodsgames avatar tsachis avatar tyllo avatar vlio20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

utils-decorators's Issues

throttleAsync decorator

This decorator will allow only certin amount of calls to the async decorated method simultaneously. If the allowed amount of calls will be acceded the calls will be throttled.

Uncatchable timeout

Is it possible to catch the timeout exception somehow? I'm always crashing with "Unhandled promise rejection"

UnhandledPromiseRejectionWarning: Error: timeout occurred after 2000
    at new TimeoutError (node_modules/utils-decorators/src/timeout/timeout.ts:6:5)
    at Timeout._onTimeout (node_modules/utils-decorators/src/timeout/timeout.ts:28:20)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)

onError method decorator

Will invoke the provided method if the decorated method will throw an exception.

API:

function onError(method: Function): void

After decorator

Will invoke the provided after before the decorated method.

API:
function before(method: Function, delayMs: number): void

Changelog

Please post a Github release when updating the NPM package or create a CHANGELOG.md - this allows Dependabot to display the changelog when proposing an upgrade to a newer util-decorators

measure decorator

A decorator which will measure the execution time of the decorated method

Retry decorator

A decorator which will run x amount of retries of the method

afterSet

Will trigger a method after setting the property

timeout

this decorator will throw a timeout exception after waiting given time if the decorated method won't response during it

before (method)

Will invoke the provided method before the decorated method.

API:

function before(method: Function): void

callableTimes

Will limit the amount of calls to the decorated method. If a call will be made after the specific amount an exception will be thrown

Cache burst for memoize/memoizeAsync

First, thanks for your work and this library.

Please is it possible to provide a sample how to "burst"/invalidate the cache when we use memoize/memoizeAsync function/decorator ?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.