eventEmitter설명

unow30·2021년 4월 17일
0

Much of the Node.js core API is built around an idiomatic asynchronous event-driven architecture in which certain kinds of objects (called "emitters") emit named events that cause Function objects ("listeners") to be called.

Node.js 핵심 API의 대부분은 "emitters"라고 부르는 객체가 "listener"라고 불리는 함수 객체를 호출하는 event라는 것을 방출(emit)하는 관용적 비동기 아키텍처를 중심으로 구축된다.

All objects that emit events are instances of the EventEmitter class. These objects expose an eventEmitter.on() function that allows one or more functions to be attached to named events emitted by the object. Typically, event names are camel-cased strings but any valid JavaScript property key can be used.
Typically, event names are camel-cased strings but any valid JavaScript property key can be used.

이벤트를 방출하는 모든 객체는 EventEmitter클래스의 인스턴스이다.
이런 객체는 객체에서 방출된 events가 첨부된 하나 이상의 함수를 허락하는 eventEmitter.on()함수를 노출한다.
일반적으로 이벤트 이름은 카멜 케이스 문자열이지만 유효한 JavaScript 속성 키를 사용할 수 있습니다.

0개의 댓글