Node.js (RichClient)

  • View
    2.659

  • Download
    4

Embed Size (px)

DESCRIPTION

 

Text of Node.js (RichClient)

  • 1. Node.js I/O
  • 2. Node.js 1) V8 - JavaScript Google 2) Event-loop c / 3) CommonJS
  • 3. Node.js - . Node , callback, . .
  • 4. / RAM: ~80 HDD: ~130 000 : ~500 000
  • 5. / (nonblocking I/O) 1) : $result = $db->query(' ... '); // , JS: var result = db.query(' ... '); // - ? -
  • 6. / (nonblocking I/O) 2) : db.query(' ... ', function(result) { // // }); - ? -
  • 7. , ? Apache Nginx
  • 8. Apache , , , .
  • 9. - . . Node.js Nginx event-loop c . , , , , . Event-loop
  • 10. Event-loop , !
  • 11. JavaScript? Node.js - , Python Twisted Tornado, Ruby EventMachine / , . Javascript - - , .
  • 12. JavaScript? , JavaScript , (fab)
  • 13. callback , , error data. , .
  • 14. - Promises: var file = fs. open ( 'file' ) ; file. addCallback ( function ( data ){ // }) ; file. addErrback ( 'error' , function ( error ){ // , }) ; node_promise
  • 15. 1) CommonJS ( CommonJS Node) 2) ( ) 3) ( /++ - JS )
  • 16. : varmodule_name= require('module_name'); : /home/user/.node_libraries/ /home/user/.node_libraries/module_name /usr/local/lib/node/libraries/ /usr/local/lib/node/libraries/module_name
  • 17. : varmodule_name= require('./module_name'); // : ./ ./module_name
  • 18. ++ .node, . ++ API V8 JavaScript ++ JavaScript, a ++.
  • 19. Node.JS Plurk: 200 000 1 8 Node 32
  • 20. : , 150 (: http://wiki.github.com/ry/node/modules ) , , : - kiwi - seed - npm - mode
  • 21. two languages will never go away, C and JavaScript. - Ryan Dahl ( nodeJS) !