Fix style and race condition for history mode

This commit is contained in:
yflory
2017-09-21 18:00:11 +02:00
parent 95302366d1
commit dfdeb7b113
4 changed files with 23 additions and 11 deletions

View File

@@ -164,10 +164,14 @@ define([
};
funcs.getFullHistory = function (realtime, cb) {
ctx.sframeChan.on('EV_RT_HIST_MESSAGE', function (content) {
realtime.message(content);
ctx.sframeChan.query('Q_GET_FULL_HISTORY', null, function (err, messages) {
if (err) { return void console.error(err); }
if (!Array.isArray(messages)) { return; }
messages.forEach(function (m) {
realtime.message(m);
});
cb();
});
ctx.sframeChan.query('Q_GET_FULL_HISTORY', null, cb);
};
funcs.getPadAttribute = function (key, cb) {