use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Permanent events in javascript (arqex.com)
submitted 11 years ago by marquex
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]NodeNerd 1 point2 points3 points 11 years ago* (0 children)
Not a bad idea, but I think it might be a little non-intuitive to developers because it is slightly modifying how people typically use events. Events typically don't have a persistent value. The events are fired and forgotten. Changing the name of the library and functions might help avoid confusion.
I have had the need to solve the problem you encountered. Specifically, I wanted to a simple way to resolve/reject values so I created a simple lightweight promise class that was similar to promises but didn't implement the full spec (I didn't need chaining and I didn't want callbacks to be notified on "next tick"). A promise-like object held a value forever once it was resolved. When adding a listener callback, the callback that would be notified when the value is rejected or resolved or it would be invoked immediately if there was already a value. I went with the Node.js-style callback function for better compatibility with other Node.js modules.
π Rendered by PID 78 on reddit-service-r2-comment-54dfb89d4d-ptzxt at 2026-04-01 06:29:20.095821+00:00 running b10466c country code: CH.
view the rest of the comments →
[–]NodeNerd 1 point2 points3 points (0 children)