eventify
컨텍스트 기반 이벤트 기반 프로그래밍을 지원하는 취소 가능한 이벤트 발신기입니다.
dart용 EventEmitter. 이는 어떤 응용 프로그램에서 이벤트를 등록하고 발생했을 때 알림을 받는 데 사용할 수 있습니다.
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
EventEmitter for dart. This can be used in any application to register for events and get notified once it is fired.
This library provide mechanism to register for event notifications with emitter or publisher and get notified in the event of an event.
One main advantage of the mehanism is that, it support context from where the subscriber is listening. The context could be any additional data the subscriber is interested in.
Another feature this has is the ability to receive sender information, which could be handy if the subscriber wish to know about the publisher.
void performAddition(){
}
EventCallback cb = (ev, cont) {
if (null != ev) {
switch (ev.eventName) {
case "add":
performAddition();
break;
}
}
};
EventEmitter emitter = new EventEmitter();
Listener listener = emitter.on("add", this , cb);
emitter.emit("add","keyboard",10);
As shown in the above example, it is easy to register for events and get notified once it is triggered.