Soumettre la recherche
Mettre en ligne
Node.js Event Emitter
•
Télécharger en tant que PPTX, PDF
•
4 j'aime
•
2,521 vues
Eyal Vardi
Suivre
Node.js Event Emitter
Lire moins
Lire la suite
Logiciels
Affichage du diaporama
Signaler
Partager
Affichage du diaporama
Signaler
Partager
1 sur 15
Télécharger maintenant
Recommandé
Node.js File system & Streams
Node.js File system & Streams
Eyal Vardi
File system node js
File system node js
monikadeshmane
Introduction to VueJS & Vuex
Introduction to VueJS & Vuex
Bernd Alter
Nodejs presentation
Nodejs presentation
Arvind Devaraj
Spring boot Introduction
Spring boot Introduction
Jeevesh Pandey
Introduction to Node.js
Introduction to Node.js
Vikash Singh
Express JS
Express JS
Alok Guha
Inside Flutter: Widgets, Elements, and RenderObjects
Inside Flutter: Widgets, Elements, and RenderObjects
Hansol Lee
Recommandé
Node.js File system & Streams
Node.js File system & Streams
Eyal Vardi
File system node js
File system node js
monikadeshmane
Introduction to VueJS & Vuex
Introduction to VueJS & Vuex
Bernd Alter
Nodejs presentation
Nodejs presentation
Arvind Devaraj
Spring boot Introduction
Spring boot Introduction
Jeevesh Pandey
Introduction to Node.js
Introduction to Node.js
Vikash Singh
Express JS
Express JS
Alok Guha
Inside Flutter: Widgets, Elements, and RenderObjects
Inside Flutter: Widgets, Elements, and RenderObjects
Hansol Lee
ASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
Express js
Express js
Manav Prasad
JavaScript
JavaScript
Sunil OS
JavaScript Inheritance
JavaScript Inheritance
Jussi Pohjolainen
NestJS
NestJS
Wilson Su
.Net Core
.Net Core
Bertrand Le Roy
C# Async Await
C# Async Await
Simplilearn
ASP.NET Web API
ASP.NET Web API
habib_786
Why rust?
Why rust?
Mats Kindahl
Hibernate
Hibernate
Sunil OS
Node.js Express
Node.js Express
Eyal Vardi
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
Proxy pattern
Proxy pattern
Shakil Ahmed
Spring Boot
Spring Boot
HongSeong Jeon
An Introduction To REST API
An Introduction To REST API
Aniruddh Bhilvare
Node js overview
Node js overview
Eyal Vardi
Retrofit library for android
Retrofit library for android
InnovationM
Deep dive into SoapUI
Deep dive into SoapUI
Andrey Oleynik
Rxjs ppt
Rxjs ppt
Christoffer Noring
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Edureka!
API Design and WebSocket
API Design and WebSocket
Frank Greco
Node.js Spplication Scaling
Node.js Spplication Scaling
Eyal Vardi
Contenu connexe
Tendances
ASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
Express js
Express js
Manav Prasad
JavaScript
JavaScript
Sunil OS
JavaScript Inheritance
JavaScript Inheritance
Jussi Pohjolainen
NestJS
NestJS
Wilson Su
.Net Core
.Net Core
Bertrand Le Roy
C# Async Await
C# Async Await
Simplilearn
ASP.NET Web API
ASP.NET Web API
habib_786
Why rust?
Why rust?
Mats Kindahl
Hibernate
Hibernate
Sunil OS
Node.js Express
Node.js Express
Eyal Vardi
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
Proxy pattern
Proxy pattern
Shakil Ahmed
Spring Boot
Spring Boot
HongSeong Jeon
An Introduction To REST API
An Introduction To REST API
Aniruddh Bhilvare
Node js overview
Node js overview
Eyal Vardi
Retrofit library for android
Retrofit library for android
InnovationM
Deep dive into SoapUI
Deep dive into SoapUI
Andrey Oleynik
Rxjs ppt
Rxjs ppt
Christoffer Noring
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Edureka!
Tendances
(20)
ASP.NET MVC Presentation
ASP.NET MVC Presentation
Express js
Express js
JavaScript
JavaScript
JavaScript Inheritance
JavaScript Inheritance
NestJS
NestJS
.Net Core
.Net Core
C# Async Await
C# Async Await
ASP.NET Web API
ASP.NET Web API
Why rust?
Why rust?
Hibernate
Hibernate
Node.js Express
Node.js Express
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
Proxy pattern
Proxy pattern
Spring Boot
Spring Boot
An Introduction To REST API
An Introduction To REST API
Node js overview
Node js overview
Retrofit library for android
Retrofit library for android
Deep dive into SoapUI
Deep dive into SoapUI
Rxjs ppt
Rxjs ppt
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
En vedette
API Design and WebSocket
API Design and WebSocket
Frank Greco
Node.js Spplication Scaling
Node.js Spplication Scaling
Eyal Vardi
Node.js Socket.IO
Node.js Socket.IO
Eyal Vardi
Modules and injector
Modules and injector
Eyal Vardi
Angular 2.0 Views
Angular 2.0 Views
Eyal Vardi
Angular 2.0 forms
Angular 2.0 forms
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Angular 2.0 Pipes
Angular 2.0 Pipes
Eyal Vardi
Http Communication in Angular 2.0
Http Communication in Angular 2.0
Eyal Vardi
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Eyal Vardi
Routing And Navigation
Routing And Navigation
Eyal Vardi
Angular 2 NgModule
Angular 2 NgModule
Eyal Vardi
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
Template syntax in Angular 2.0
Template syntax in Angular 2.0
Eyal Vardi
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Eyal Vardi
Angular 2.0 Dependency injection
Angular 2.0 Dependency injection
Eyal Vardi
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Eyal Vardi
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Eyal Vardi
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Eyal Vardi
Modules in ECMAScript 6.0
Modules in ECMAScript 6.0
Eyal Vardi
En vedette
(20)
API Design and WebSocket
API Design and WebSocket
Node.js Spplication Scaling
Node.js Spplication Scaling
Node.js Socket.IO
Node.js Socket.IO
Modules and injector
Modules and injector
Angular 2.0 Views
Angular 2.0 Views
Angular 2.0 forms
Angular 2.0 forms
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Angular 2.0 Pipes
Angular 2.0 Pipes
Http Communication in Angular 2.0
Http Communication in Angular 2.0
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Routing And Navigation
Routing And Navigation
Angular 2 NgModule
Angular 2 NgModule
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Template syntax in Angular 2.0
Template syntax in Angular 2.0
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Angular 2.0 Dependency injection
Angular 2.0 Dependency injection
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Modules in ECMAScript 6.0
Modules in ECMAScript 6.0
Similaire à Node.js Event Emitter
What’s new in ECMAScript 6.0
What’s new in ECMAScript 6.0
Eyal Vardi
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Eyal Vardi
OOP in JavaScript
OOP in JavaScript
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
Eyal Vardi
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
Eyal Vardi
Forms in AngularJS
Forms in AngularJS
Eyal Vardi
Pim Elshoff "Final Class Aggregate"
Pim Elshoff "Final Class Aggregate"
Fwdays
Gérer vos objets
Gérer vos objets
Thomas Gasc
Silex meets SOAP & REST
Silex meets SOAP & REST
Hugo Hamon
Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0
Eyal Vardi
JSDay Italy - Backbone.js
JSDay Italy - Backbone.js
Pierre Spring
Virtual Madness @ Etsy
Virtual Madness @ Etsy
Nishan Subedi
JSGeneve - Backbone.js
JSGeneve - Backbone.js
Pierre Spring
Intro to Advanced JavaScript
Intro to Advanced JavaScript
ryanstout
#include -iostream- #include -fstream- #include -cctype- #include -cst.docx
#include -iostream- #include -fstream- #include -cctype- #include -cst.docx
NathanyXJSharpu
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くために
Yuya Takeyama
How to test complex SaaS applications - The family july 2014
How to test complex SaaS applications - The family july 2014
Guillaume POTIER
Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)
Nordic APIs
Guard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful Security
Ryan Weaver
Similaire à Node.js Event Emitter
(20)
What’s new in ECMAScript 6.0
What’s new in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
OOP in JavaScript
OOP in JavaScript
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
Forms in AngularJS
Forms in AngularJS
Pim Elshoff "Final Class Aggregate"
Pim Elshoff "Final Class Aggregate"
Gérer vos objets
Gérer vos objets
Silex meets SOAP & REST
Silex meets SOAP & REST
Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0
JSDay Italy - Backbone.js
JSDay Italy - Backbone.js
Virtual Madness @ Etsy
Virtual Madness @ Etsy
JSGeneve - Backbone.js
JSGeneve - Backbone.js
Intro to Advanced JavaScript
Intro to Advanced JavaScript
#include -iostream- #include -fstream- #include -cctype- #include -cst.docx
#include -iostream- #include -fstream- #include -cctype- #include -cst.docx
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くために
How to test complex SaaS applications - The family july 2014
How to test complex SaaS applications - The family july 2014
Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)
Guard Authentication: Powerful, Beautiful Security
Guard Authentication: Powerful, Beautiful Security
Plus de Eyal Vardi
Why magic
Why magic
Eyal Vardi
Smart Contract
Smart Contract
Eyal Vardi
Rachel's grandmother's recipes
Rachel's grandmother's recipes
Eyal Vardi
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
Eyal Vardi
Angular 2 Architecture
Angular 2 Architecture
Eyal Vardi
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0
Eyal Vardi
AngularJS Internal
AngularJS Internal
Eyal Vardi
Plus de Eyal Vardi
(7)
Why magic
Why magic
Smart Contract
Smart Contract
Rachel'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
Angular 2 Architecture
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0
AngularJS Internal
AngularJS Internal
Dernier
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
WSO2
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
WSO2
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
masabamasaba
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
AmarnathKambale
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
masabamasaba
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
masabamasaba
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
Presentation.STUDIO
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
masabamasaba
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
masabamasaba
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
masabamasaba
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
masabamasaba
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Jim McKeeth
Dernier
(20)
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Node.js Event Emitter
1.
2.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var events = require("events"), emitter = new events.EventEmitter(), username = "Eyal", password = "Vardi"; // an event listener emitter.on("userAdded", function (username, password) { console.log("Added user " + username); }); // Emit an event emitter.emit("userAdded", username, password);
3.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var events = require("events"); var emitter = new events.EventEmitter(); emitter.once("foo", function () { console.log("In foo handler"); }); emitter.emit("foo"); emitter.emit("foo");
4.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var events = require("events"); var EventEmitter = events.EventEmitter; var emitter = new EventEmitter(); emitter.on("foo", function () { }); emitter.on("foo", function () { }); console.log( EventEmitter.listenerCount(emitter, "foo") );
5.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var events = require("events"); var EventEmitter = events.EventEmitter; var emitter = new EventEmitter(); emitter.on("foo", function (){ console.log("In foo handler"); }); emitter.listeners("foo").forEach(function (handler) { handler(); });
6.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var events = require("events"); var emitter = new events.EventEmitter(); emitter.on( "newListener" , function (eventName, listener) { console.log("Added listener for " + eventName + " events"); }); emitter.on("foo", function () { });
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 var EventEmitter = require("events").EventEmitter; var util = require("util"); function UserEventEmitter() { EventEmitter.call(this); this.addUser = function (username, password) { // add the user // then emit an event this.emit("userAdded", username, password); }; }; util.inherits(UserEventEmitter, EventEmitter);
9.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com function SuperType(name){ this.name = name; this.colors = ['red', 'blue', 'green']; } SuperType.prototype.sayName = function(){ alert(this.name); }; function SubType(name, age){ SuperType.call(this, name); this.age = age; } SubType.prototype = Object.create(SuperType.prototype); SubType.prototype.sayAge = function(){ alert(this.age); };
10.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com val getSuperValue [prototype] subVal __proto__ val __proto__ [prototype] subVal
11.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com function SuperType(name){ this.name = name; this.colors = ['red', 'blue', 'green']; } SuperType.prototype.sayName = function(){ return this.name; }; function SubType(name, age){ SuperType.call(this, name); this.age = age; } SubType.prototype = Object.create(SuperType.prototype); SubType.prototype.constructor = SubType; SubType.prototype.sayAge = function(){ alert(this.age); }; SubType.prototype.sayName = function(){ return SuperType.prototype.sayName.call(this) + "!!"; }; override fix constructor
12.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var user = new UserEventEmitter(); var username = "colin"; var password = "password"; user.on("userAdded", function (username, password) { console.log("Added user " + username); }); user.addUser(username, password) console.log(user instanceof EventEmitter);
13.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var fs = require("fs"); var fileName = "foo.txt"; fs.exists(fileName, function (exists) { if (exists) { fs.stat(fileName, function (error, stats) { if (error) { throw error; } if (stats.isFile()) { fs.readFile(fileName, "utf8", function (error, data) { if (error) { throw error; } console.log(data); }); } }); } });
14.
© 2014 All
rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var EventEmitter = require("events").EventEmitter; var util = require("util"); var fs = require("fs"); function FileReader(fileName) { var _self = this; EventEmitter.call(_self); _self.on("stats", function() { fs.stat(fileName, function(error, stats) { if (!error && stats.isFile()) { _self.emit("read"); } }); }); _self.on("read", function() { fs.readFile(fileName, "utf8", function(error, data) { if (!error && data) { console.log(data); } }); }); fs.exists(fileName, function(exists) { if (exists) { _self.emit("stats"); } }); } util.inherits(FileReader, EventEmitter); var reader = new FileReader("foo.txt");
Télécharger maintenant