diff options
Diffstat (limited to 'notes.txt')
-rw-r--r-- | notes.txt | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -9,6 +9,14 @@ $ express id is 'listdb', then a db would get preloaded by the time we stepped into the route logic - doing next(new Error('foo')) will stall and end middleware chain +[node] +- process.nextTick() + when you defined a function that return something, and takes in a callback, + make sure you callback on the next event loop-around, so at that point you + would return valid object, that callback might likely want to access/modify + + use this to be nice, similar to yield()? delay executation of callback until next loop-around + [code analysis] # npm install -g jslint $ jslint --sloppy --white <file.js> @@ -24,6 +32,9 @@ var bar = foo.slice(0); who responds/listens to those, so we will see statements such eventer.on('foo', somehandler) +[modules] +- now.js and dnode--socket.io namespace (function/var sharing) + [mongodb] $ mongo; show dbs; use nodejs1; show collections; db.getCollectionNames(), db.users.find(), db.users.remove(), db.users.drop() @@ -32,6 +43,8 @@ $ node --debug-brk app.js $ node-inspector & http://0.0.0.0:8080/debug?port=5858 +- __proto__ in node-inspector imples functions/methods of the 'this' object + [module.exports vs exports] - if you want your module to be of a specific object type (boolean, string, etc), use module.exports; if you want your module to be a typical module instance, use exports |