#10 Event handlers can return values to emiters

Đã đóng
%! (template.HTML=6 năm trước cách đây)đang mở bởi msieron · 5 ý kiến

New interface, similar to EventListener, to handle responses from event handlers.

Synchronous model should look like:

  • Method #handleEvent should return generic value.
  • value should be intercepted by EventListener and passed to EventRouter
  • EventRouter#signalEvent should return this value

That model is obviously incompatible with whole concept of event model, so we have to think about something different, like "callback events". Callback event could be possibly implemented without changing current implementation. It would be enough to introduce new type of event with correlation id: correlation id could be used to process responses.

On top of asynchronous model we could write two kind of simple utility classes:

  • for synchronous model: class will wait for correlated events using event locks
  • for callback model: class will put handle inside internal queue. It will be processed later on event receive.

We need synchronous model if we want to implement event model with rejection: e.g. veto property change.

New interface, similar to EventListener, to handle responses from event handlers. Synchronous model should look like: - Method #handleEvent should return generic value. - value should be intercepted by EventListener and passed to EventRouter - EventRouter#signalEvent should return this value That model is obviously incompatible with whole concept of event model, so we have to think about something different, like "callback events". Callback event could be possibly implemented without changing current implementation. It would be enough to introduce new type of event with correlation id: correlation id could be used to process responses. On top of asynchronous model we could write two kind of simple utility classes: - for synchronous model: class will wait for correlated events using event locks - for callback model: class will put handle inside internal queue. It will be processed later on event receive. We need synchronous model if we want to implement event model with rejection: e.g. veto property change.
msieron referenced this issue from a commit 6 năm trước cách đây
Đăng nhập để tham gia bình luận.
Không có Milestone
Không có người được phân công
1 tham gia
Đang tải...
Hủy bỏ
Lưu
Ở đây vẫn chưa có nội dung nào.