From 7534f59af290516da2fde96169d7c7b19d10d386 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 23 Jun 2015 12:04:43 +0100 Subject: [PATCH] Hook up the callback fn for scrollback. Update CHANGELOG. --- CHANGELOG.md | 2 ++ examples/node/app.js | 4 ++++ lib/client.js | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c25f3a3db..9751e25bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ New features: in which they were submitted. * Room state is automatcally synchronised when joining a room (including if another device joins a room). + * Scrollback. You can request earlier events in a room using + `MatrixClient.scrollback(room, limit, callback)`. Bug fixes: * Fixed a bug which prevented the event stream from polling. Some devices will diff --git a/examples/node/app.js b/examples/node/app.js index e58434e73..89f3c80ca 100644 --- a/examples/node/app.js +++ b/examples/node/app.js @@ -24,6 +24,10 @@ var rl = readline.createInterface({ }); rl.setPrompt("$ "); rl.on('line', function(line) { + if (line.trim().length === 0) { + rl.prompt(); + return; + } if (line.indexOf("/join ") === 0 && !viewingRoom) { var roomIndex = line.split(" ")[1]; viewingRoom = roomList[roomIndex]; diff --git a/lib/client.js b/lib/client.js index 2d77418d9..3af7e8a72 100644 --- a/lib/client.js +++ b/lib/client.js @@ -816,9 +816,9 @@ MatrixClient.prototype.scrollback = function(room, limit, callback) { utils.map(res.chunk, _PojoToMatrixEventMapper), true ); room.oldState.paginationToken = res.end; - defer.resolve(room); + _resolve(callback, defer, room); }, function(err) { - defer.reject(err); + _reject(callback, defer, err); }); return defer.promise; };