Suche senden
Hochladen
Node.js Event Emitter
•
Als PPTX, PDF herunterladen
•
4 gefällt mir
•
2,521 views
Eyal Vardi
Folgen
Node.js Event Emitter
Weniger lesen
Mehr lesen
Software
Melden
Teilen
Melden
Teilen
1 von 15
Jetzt herunterladen
Empfohlen
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
Empfohlen
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
Weitere ähnliche Inhalte
Was ist angesagt?
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!
Was ist angesagt?
(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...
Andere mochten auch
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
Andere mochten auch
(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
Ähnlich wie 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
Ähnlich wie 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
Mehr von 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
Mehr von 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
Kürzlich hochgeladen
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
Jittipong Loespradit
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Jim McKeeth
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
AnnaArtyushina1
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2
%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
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
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
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
WSO2
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
%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
%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
tonesoftg
tonesoftg
lanshi9
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
Papp Krisztián
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
masabamasaba
Kürzlich hochgeladen
(20)
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
%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
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
tonesoftg
tonesoftg
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
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");
Jetzt herunterladen