3 ms·
Could someone please explain to me what this does. I've looked at the repo and the readme, and I dabble in nodejs. But to be honest I have no idea what this doe
by iambot 15y ago
Could someone please explain to me what this does. I've looked at the repo and the readme, and I dabble in nodejs. But to be honest I have no idea what this does or helps one do.
- indutny 15y agoIt does locks management and some autoreleasing black magic. Lets image you have a `callback` variable that you want to pass to some 3rd party code and you ain't sure whether it'll call it or not (or you're aware that unhandled exception may be thrown inside it). If you'll wrap `callback` with `deadbolt.wrap(callback)` and pass it to that function, `callback` will be called with a error if it will become not referenced (see http://en.wikipedia.org/wiki/Garbage_collection_(computer_science) http://en.wikipedia.org/wiki/Garbage_collection_(computer_sc... ) in that 3rd party code.
- iambot 15y agoah thanks very much, so its a way of being alerted as to whether my callback has been ignored/lost.
- indutny 15y agoyes. I did that because in one of my projects 3rd party code was rarely throwing exceptions that I could not caught and incoming request was hanging for a minutes (and after that overall app's state was inconsistent)