-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request Cache implementation #17
Conversation
…um (defaults to 5). This eliminates network concurrency errors (such as ECONNRESET) on 1st Gen Hue bridges.
Thanks, Federico @fedhat I want to take a good look at your request, but that will have to wait until this weekend. On first impression your solution seems a bit more elaborate than I anticipated. Maybe I'm just intimidated by the use of |
@ebaauw I hope you find the PR useful. My goal was to write in your coding style, but no worries if it doesn't suit your needs. Also, feel free to ask me to make adjustments or answer questions regarding the code. Likewise, you can make changes yourself. The code changes might look more elaborate than they actually are. I essentially moved what you had in I first used promises in Angular JS, which uses the deferred style and loved them. When I switched over to ES6 / TypeScript development on a later project, I felt restricted with non-deferred promises. The great thing about deferred promises (in my opinion) is that you don't have to supply the code which handles calling either What var deferredPromise = new Promise(function(resolve, reject) {
this.resolver = resolve;
this.rejector = reject;
}); |
Hi Federico @fedhat, Indeed, I find this PR very useful; it teaches me a lot.
I started homebridge-hue (and my other, yet to be published, homebridge plug-ins) in the Node.js
I'm not particularly interested in disputes on patterns/anti-patterns, but I am a big fan of consistency. So I would want to use |
Hi Federico @fedhat Thanks for your remark on the semi columns! I'm relatively new to JavaScript and still learning the subtleties of the language. I grew up programming in the 1980s in C (even before C++ was created) and, until recently, still used I recently switched to Atom (which I found through GitHub Desktop), but still lack a proper IDE for JavaScript. What IDE and/or linter would you recommend? I'd like to run all my code through this linter. |
Hi Erik @ebaauw This kind of collaboration is the main thing I truly enjoy about working on open source software. :-D I was laughing at myself when you asked about I'm in total agreement with not wanting to get into disputes about the "right" way to do something -- consistency is much more useful. |
@ebaauw Regarding JS linting, you're quite welcome. While I've been writing Javascript since the early days (circa 1997), I've never been a big fan of it, though I've had to accept that it has become the lingua franca of the internet. My first programming experiences were with BASIC in the 80's, then early Javascript, and then Java, Objective-C. Javascript's lack of types and runtime-only error checking is what got me interested in TypeScript. TS still transpiles to Javascript, but gives you a lot of what traditional programmers look for in a language (typing, abstraction, class definitions, private/public/protected properties and functions, interfaces, compile-time error checking). Also agree on your assessment of Node.js. I spent more than a decade using emacs as my text editor of choice, but eventually switched over to IDEs. Currently my IDE of choice for Javascript development is WebStorm. It's a commercial editor with a lot of useful tools and functionality that I haven't found in open source editors. That said, Atom has lots and lots of great plugins. The JS linter I use is JSHint. There's an Atom package for it: https://atom.io/packages/atom-jshint |
deferred
node module needed to create deferred promises for the request cache.