SlideShare ist ein Scribd-Unternehmen logo
1 von 26
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
“Everything that can be written in JavaScript
will eventually be written in JavaScript”.
(Atwood’s law)
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
Google JavaScript engine
A high performance, cross-platform evented I/O library
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
(source: Future-proofing Your Apps: Cloud Foundry and Node.js)
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com(source: Future-proofing Your Apps: Cloud Foundry and Node.js)
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com(source: Future-proofing Your Apps: Cloud Foundry and Node.js)
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
Objects:
 global
 process
 Console
 module
 exports
functions:
 Buffer
 require()
 setTimeout(cb,ms) , clearTimeout(t)
 setInterval(cb,ms) , clearInterval(t)
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
var circle = require('./circle.js');
console.log('The area of radius 4: '+ circle.area(4));
foo.js
var PI = Math.PI;
exports.area = function (r) {return PI * r * r;};
exports.circumference = function (r) {return 2 * PI * r;};
circle.js
The variable PI is
private to circle.js
exports === module.exports
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
console.log('a starting');
exports.done = false;
var b = require('./b.js');
console.log('in a,b.done= %j', b.done);
exports.done = true;
console.log('a done');
console.log('b starting');
exports.done = false;
var a = require('./a.js');
console.log('in b,a.done= %j', a.done);
exports.done = true;
console.log('b done');
console.log('main starting');
var a = require('./a.js');
var b = require('./b.js');
console.log('in main, a.done=%j, b.done=%j', a.done, b.done);
b.jsa.js
main.js
b.js tries to load a.js. In order to prevent
an infinite loop an unfinished copy of
the a.js exports object is returned to
the b.js module.
main starting
a starting
b starting
in b, a.done = false
b done
in a, b.done = true
a done
in main, a.done=true, b.done=true
Output
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
 https
 Net
 Os
 Path
 Punycode
 Querystring
 Readline
 Repl
 string_decoder
 Tls
 Tty
 url
 Util
 Vm
 zlib
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com

Weitere ähnliche Inhalte

Was ist angesagt?

Build RESTful API Using Express JS
Build RESTful API Using Express JSBuild RESTful API Using Express JS
Build RESTful API Using Express JSCakra Danu Sedayu
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBhargav Anadkat
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsRob O'Doherty
 
Neat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionNeat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionMikhail Egorov
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...Edureka!
 
Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash CourseHaim Michael
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsAkshay Mathur
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Visual Engineering
 
Node.js File system & Streams
Node.js File system & StreamsNode.js File system & Streams
Node.js File system & StreamsEyal Vardi
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 

Was ist angesagt? (20)

Node.js Basics
Node.js Basics Node.js Basics
Node.js Basics
 
Build RESTful API Using Express JS
Build RESTful API Using Express JSBuild RESTful API Using Express JS
Build RESTful API Using Express JS
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
Node js
Node jsNode js
Node js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Spring boot
Spring bootSpring boot
Spring boot
 
Express node js
Express node jsExpress node js
Express node js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Neat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protectionNeat tricks to bypass CSRF-protection
Neat tricks to bypass CSRF-protection
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
 
Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash Course
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Node.js File system & Streams
Node.js File system & StreamsNode.js File system & Streams
Node.js File system & Streams
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 

Andere mochten auch

Node.js Socket.IO
Node.js  Socket.IONode.js  Socket.IO
Node.js Socket.IOEyal Vardi
 
Node.js Event Emitter
Node.js Event EmitterNode.js Event Emitter
Node.js Event EmitterEyal Vardi
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 formsEyal Vardi
 
Modules and injector
Modules and injectorModules and injector
Modules and injectorEyal Vardi
 
Async & Parallel in JavaScript
Async & Parallel in JavaScriptAsync & Parallel in JavaScript
Async & Parallel in JavaScriptEyal Vardi
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 ViewsEyal Vardi
 
Angular 2.0 Pipes
Angular 2.0 PipesAngular 2.0 Pipes
Angular 2.0 PipesEyal Vardi
 
Http Communication in Angular 2.0
Http Communication in Angular 2.0Http Communication in Angular 2.0
Http Communication in Angular 2.0Eyal Vardi
 
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationAngular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationEyal Vardi
 
Node.js Spplication Scaling
Node.js Spplication ScalingNode.js Spplication Scaling
Node.js Spplication ScalingEyal Vardi
 
Routing And Navigation
Routing And NavigationRouting And Navigation
Routing And NavigationEyal Vardi
 
Angular 2 NgModule
Angular 2 NgModuleAngular 2 NgModule
Angular 2 NgModuleEyal Vardi
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0Eyal Vardi
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xEyal Vardi
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Eyal Vardi
 
Angular 2.0 Dependency injection
Angular 2.0 Dependency injectionAngular 2.0 Dependency injection
Angular 2.0 Dependency injectionEyal Vardi
 
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationAngular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationEyal Vardi
 
Performance Optimization In Angular 2
Performance Optimization In Angular 2Performance Optimization In Angular 2
Performance Optimization In Angular 2Eyal Vardi
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xEyal Vardi
 
Modules in ECMAScript 6.0
Modules in ECMAScript 6.0Modules in ECMAScript 6.0
Modules in ECMAScript 6.0Eyal Vardi
 

Andere mochten auch (20)

Node.js Socket.IO
Node.js  Socket.IONode.js  Socket.IO
Node.js Socket.IO
 
Node.js Event Emitter
Node.js Event EmitterNode.js Event Emitter
Node.js Event Emitter
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
 
Modules and injector
Modules and injectorModules and injector
Modules and injector
 
Async & Parallel in JavaScript
Async & Parallel in JavaScriptAsync & Parallel in JavaScript
Async & Parallel in JavaScript
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 Views
 
Angular 2.0 Pipes
Angular 2.0 PipesAngular 2.0 Pipes
Angular 2.0 Pipes
 
Http Communication in Angular 2.0
Http Communication in Angular 2.0Http Communication in Angular 2.0
Http Communication in Angular 2.0
 
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationAngular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
 
Node.js Spplication Scaling
Node.js Spplication ScalingNode.js Spplication Scaling
Node.js Spplication Scaling
 
Routing And Navigation
Routing And NavigationRouting And Navigation
Routing And Navigation
 
Angular 2 NgModule
Angular 2 NgModuleAngular 2 NgModule
Angular 2 NgModule
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
Angular 2.0 Dependency injection
Angular 2.0 Dependency injectionAngular 2.0 Dependency injection
Angular 2.0 Dependency injection
 
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationAngular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
 
Performance Optimization In Angular 2
Performance Optimization In Angular 2Performance Optimization In Angular 2
Performance Optimization In Angular 2
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
 
Modules in ECMAScript 6.0
Modules in ECMAScript 6.0Modules in ECMAScript 6.0
Modules in ECMAScript 6.0
 

Mehr von Eyal Vardi

Smart Contract
Smart ContractSmart Contract
Smart ContractEyal Vardi
 
Rachel's grandmother's recipes
Rachel's grandmother's recipesRachel's grandmother's recipes
Rachel's grandmother's recipesEyal Vardi
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Eyal Vardi
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 ArchitectureEyal Vardi
 
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0Eyal Vardi
 
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0Eyal Vardi
 
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0Eyal Vardi
 
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0Eyal Vardi
 
Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0Eyal Vardi
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS InternalEyal Vardi
 

Mehr von Eyal Vardi (11)

Why magic
Why magicWhy magic
Why magic
 
Smart Contract
Smart ContractSmart Contract
Smart Contract
 
Rachel's grandmother's recipes
Rachel's grandmother's recipesRachel's grandmother's recipes
Rachel's grandmother's recipes
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 Architecture
 
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
 
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
 
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0
 
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
 
Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS Internal
 

JavaScript Everything

  • 1. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 2. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com “Everything that can be written in JavaScript will eventually be written in JavaScript”. (Atwood’s law)
  • 3. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 4. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 5. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 6. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 7. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 8. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 9. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 10. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 11. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com Google JavaScript engine A high performance, cross-platform evented I/O library
  • 12. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 13. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com (source: Future-proofing Your Apps: Cloud Foundry and Node.js)
  • 14. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com(source: Future-proofing Your Apps: Cloud Foundry and Node.js)
  • 15. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com(source: Future-proofing Your Apps: Cloud Foundry and Node.js)
  • 16. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 17. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com Objects:  global  process  Console  module  exports functions:  Buffer  require()  setTimeout(cb,ms) , clearTimeout(t)  setInterval(cb,ms) , clearInterval(t)
  • 18. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 19. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var circle = require('./circle.js'); console.log('The area of radius 4: '+ circle.area(4)); foo.js var PI = Math.PI; exports.area = function (r) {return PI * r * r;}; exports.circumference = function (r) {return 2 * PI * r;}; circle.js The variable PI is private to circle.js exports === module.exports
  • 20. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 21. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com console.log('a starting'); exports.done = false; var b = require('./b.js'); console.log('in a,b.done= %j', b.done); exports.done = true; console.log('a done'); console.log('b starting'); exports.done = false; var a = require('./a.js'); console.log('in b,a.done= %j', a.done); exports.done = true; console.log('b done'); console.log('main starting'); var a = require('./a.js'); var b = require('./b.js'); console.log('in main, a.done=%j, b.done=%j', a.done, b.done); b.jsa.js main.js b.js tries to load a.js. In order to prevent an infinite loop an unfinished copy of the a.js exports object is returned to the b.js module. main starting a starting b starting in b, a.done = false b done in a, b.done = true a done in main, a.done=true, b.done=true Output
  • 22. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com  https  Net  Os  Path  Punycode  Querystring  Readline  Repl  string_decoder  Tls  Tty  url  Util  Vm  zlib
  • 23. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 24. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 25. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com© 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
  • 26. © 2014 All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com