0

While I find node.js quite entertaining to use, I am still a beginner and need a lot of help from the documentation. However, lately, the problems I tried to solve are getting more complex, and so are the answers. Often, I find the explanations I need on this site, but the problem is that I cannot verify then on the documentation side.

A clear example: I wanted to set the process.stdin to read the keytrokes of the process. The question

nodejs how to read keystrokes from stdin

was very helpful and did what I needed, but something buggs me: in the node.js documentation, there is no mention that a stdin stream emits 'keypress' events. Am I missing a huge body of knowledge about node.js? If this site did not exist, how would one learn the stream emits 'keypress' events? Is the documentation just that bad?

Community
  • 1
  • 1
5xum
  • 5,250
  • 8
  • 36
  • 56
  • i find your question a bit academical if you ask me. for once, this might be an implementation detail not being specific to node.js. if you're missing something from the node.js documentation, i'd suggest you tell them https://github.com/joyent/node/blob/master/CONTRIBUTING.md#readme – Jakob Hohlfeld Apr 01 '14 at 09:24
  • I don't agree the question is academical. It is a completely concrete question: "Where can I learn that `process.stdin` emits a `'keypress'` event if this is not covered in the documentation?" – 5xum Apr 01 '14 at 09:28
  • I disagree that anything can be "academical". It's not even a word. – mc0e Dec 19 '15 at 04:31

1 Answers1

1

No documentation is perfect. The node community has done a reasonably solid job with making the standard Node documentation cover the primary use-cases though.

Your specific example about keypress isn't great though. keypress is/was not documented because that event was not meant for public usage, and it was removed in more recent versions of node, which is why it is not in the documentation today. The answer you linked to is nearly three years old.

For the current stable version of Node, the keypress module provides that functionality, and it documents how to use it.

loganfsmyth
  • 156,129
  • 30
  • 331
  • 251
  • Thank you for your comment. I didn't know that was the case with the keypress event, so I still think the documentation is a bit lacking, but I like your answer anyway. – 5xum Apr 01 '14 at 17:04