client/events: improve event dispatching

This commit introduces timer-less retry system:

1. Any change to URL is going to stop listening to any messages.
2. If a message is sent and there's no handler that could pick it up,
   the message gets enqueued.
3. The message is sent again to the first handler that attaches itself
   to given event type.

While in theory this is full of holes (no control over the first
handler), in practice, it works quite well.

Additionally, views.listenToMessages was attaching to completely wrong
DOM node; this commit fixes this as well.
This commit is contained in:
rr-
2016-05-11 21:29:57 +02:00
parent 09bc5f10f9
commit 2a4241641c
23 changed files with 133 additions and 100 deletions

View File

@ -16,7 +16,7 @@ class HomeView {
buildDate: config.meta.buildDate,
});
views.listenToMessages(target);
views.listenToMessages(source);
views.showView(target, source);
}
}