netanelbasal / helpful-decorators Goto Github PK
View Code? Open in Web Editor NEWHelpful decorators for typescript projects
Home Page: https://netbasal.com/create-and-test-decorators-in-javascript-85e8d5cf879c
License: MIT License
Helpful decorators for typescript projects
Home Page: https://netbasal.com/create-and-test-decorators-in-javascript-85e8d5cf879c
License: MIT License
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
Method decorated with @measure
returns nothing. Haven't tested with other decorators.
Returned value does not change
[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
Application with helpful-decorators will not open on IE because browser does not support template literals which is used in measure function inside console.log().
Application will open correctly.
https://stackblitz.com/edit/angular-b7lgd7
helpful-decorators version: 2.0.5
Browser:
[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[x] Feature request
[ ] Documentation issue or request
Adding debounce to a function with parameters, no longer forwards the arguments when the function is called.
example: https://stackblitz.com/edit/angular-fggoh2
@debounce(300)
log(newVal){
this.name = newVal; //newVal is always undefined.
}
I think ln
helpful-decorators/src/debounce.ts
Line 13 in 59944dc
should be
debounced.apply(this, arguments);
@debounce(300)
log(newVal){
this.name = newVal;
}
newVal would be the value passed on the last call.
https://stackblitz.com/edit/angular-fggoh2
Browser:
[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
The version I got from npm (2.0.5) contains a template string in the dist-web/index.js
:
console.log(`Call to ${propertyKey} took ${(end - start).toFixed(2)} milliseconds.`);
I assume that is not correct, because the target in the tsconfig is "es5".
If I checkout the current master and build the package myself and the file dist-web/index.js
contains
console.log("Call to ".concat(propertyKey, " took ").concat((end - start).toFixed(2), " milliseconds."));
Did I miss something? Or is the npm version too old?
helpful-decorators version: 2.0.5
For Tooling issues:
- Node version: 10.16.0
- Platform: Linux
Hi @NetanelBasal ,
Thanks for sharing this repo and I found it is very cool and helpful.
Got one question: would you be open to new decorators contribution from pull requests?
Thanks.
These look great. Haven't tried them out yet.
But when I first read @timeout
, my initial intuition made me think of Promise.timeout()
used in some promise libraries like bluebird. Since setTimeout
has been around since the beginning of JavaScript, I'm not sure if it's appropriate to use @delay
or @future
. At least it would hint for something to execute in the future, or after a delay.
Just throwing this out there for consideration. Maybe I'm the odd one out.
Not intending to turn this "issue" into a feature request but it could be really cool to see some decorators that worked with async functions as well just like Bluebird's timeout/delay.
Like implemented here for example:
https://github.com/vlio20/utils-decorators#retry-method
I am using your module using webpack and i only want throttle.
But right now the way it is written , it will import all in my webpack build plus all lodash deps.
I think i can solve this by importing helpful-decorators/dist-src/throttle
but then i get no typings.
Could you make it so that we can import helpful-decorators/throttle
?
That would be awesome!
Thanks
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
@measure only works for synchronous functions at the moment. Will be a nice addition to make it work for async functions as well.
@measure should work for both sync and async functions.
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
Trying to use @bind
decorator without any arguments results in "Expected 3 arguments but got 0" TypeScript error.
@bind()
decorator should work without any arguments.
Try to use @bind()
decorator in Angular 9 project.
helpful-decorators version: 2.0.6
Browser:
- [x] Chrome (desktop) version XX
For Tooling issues:
- Node version: 12
- Platform: Windows
Others:
TypeScript: 3.8.3
Would it be possible to release version 2.2.0
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.