vlio20 / utils-decorators Goto Github PK
View Code? Open in Web Editor NEWDecorators for web and node applications
Home Page: https://vlio20.github.io/utils-decorators/
License: MIT License
Decorators for web and node applications
Home Page: https://vlio20.github.io/utils-decorators/
License: MIT License
deco-utils
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.
Thanks @notanengineercom for taking care.
Fix made in #75 and will be available in 1.4.1
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)
Decorator that validates that each of the inputs is defined
Will invoke the provided method if the decorated method will throw an exception.
API:
function onError(method: Function): void
The traspiler should target es5 instead of es6
Will trigger a method before setting the property
Create a decorator over methods that returns a promise, which will cancel the resolving of a previous promise once a newer call was made.
Will make a property to be read only.
Will invoke the provided after before the decorated method.
API:
function before(method: Function, delayMs: number): void
Provide a way to cancel refreshable
Make it optional for Memoize & MemoizeAsync to never delete items from caches
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
please add code samples
A decorator which will measure the execution time of the decorated method
will invoke a method call when get is triggered
A decorator which will run x amount of retries of the method
Features:
Params resolver
Custom cache counter
in lines
utils-decorators/src/after/afterify.ts
Line 19 in cb2ebde
utils-decorators/src/after/afterify.ts
Line 25 in cb2ebde
Will trigger a method after setting the property
All decorators should expect objects (interfaces) instead of parameters, this will allow not to break APIs in the future.
Currently only 1 @delegate
can be used per class at a time, if i use something like Promise.all and call multiple methods the application crash.
Execute only one request
I'm trying to use the delegate with Function and the following error occurs:
"utils-decorators" has no exported member 'delegatify'.
this decorator will throw a timeout exception after waiting given time if the decorated method won't response during it
Will invoke the provided method before the decorated method.
API:
function before(method: Function): void
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
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
After the first batch, all other calls are running in sequence.
Fix will be available in version 2.0.1
The above will improve the tree shaking capability
for ever invocation of the decorator the method will be dispatched multiple time (twice by default and or more by a configuration), the fastest successful response will be returned.
https://en.wikipedia.org/wiki/Double_dispatch
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.