From a5f0ec7c7da0398d03a7ebd2af6bedbac5e573db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Sat, 12 Nov 2016 17:39:48 +0100 Subject: [PATCH] Fix examples. --- examples/browser/lib/matrix.js | 2 +- examples/node/app.js | 14 +++++++++----- examples/voip/browserTest.js | 12 ++++++++++-- examples/voip/lib/matrix.js | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/examples/browser/lib/matrix.js b/examples/browser/lib/matrix.js index e4b1b6ecb..518d47ddb 120000 --- a/examples/browser/lib/matrix.js +++ b/examples/browser/lib/matrix.js @@ -1 +1 @@ -../../../dist/browser-matrix-dev.js \ No newline at end of file +../../../dist/browser-matrix.js \ No newline at end of file diff --git a/examples/node/app.js b/examples/node/app.js index 65bed3ba2..dcff22aac 100644 --- a/examples/node/app.js +++ b/examples/node/app.js @@ -135,11 +135,15 @@ rl.on('line', function(line) { // ==== END User input // show the room list after syncing. -matrixClient.on("syncComplete", function() { - setRoomList(); - printRoomList(); - printHelp(); - rl.prompt(); +matrixClient.on("sync", function(state, prevState, data) { + switch (state) { + case "PREPARED": + setRoomList(); + printRoomList(); + printHelp(); + rl.prompt(); + break; + } }); matrixClient.on("Room", function() { diff --git a/examples/voip/browserTest.js b/examples/voip/browserTest.js index 53b19920c..29ede49a8 100644 --- a/examples/voip/browserTest.js +++ b/examples/voip/browserTest.js @@ -44,7 +44,15 @@ window.onload = function() { disableButtons(true, true, true); }; -client.on("syncComplete", function () { +matrixClient.on("sync", function(state, prevState, data) { + switch (state) { + case "PREPARED": + syncComplete(); + break; + } +}); + +function syncComplete() { document.getElementById("result").innerHTML = "

Ready for calls.

"; disableButtons(false, true, true); @@ -85,5 +93,5 @@ client.on("syncComplete", function () { call = c; addListeners(call); }); -}); +} client.startClient(); diff --git a/examples/voip/lib/matrix.js b/examples/voip/lib/matrix.js index e4b1b6ecb..518d47ddb 120000 --- a/examples/voip/lib/matrix.js +++ b/examples/voip/lib/matrix.js @@ -1 +1 @@ -../../../dist/browser-matrix-dev.js \ No newline at end of file +../../../dist/browser-matrix.js \ No newline at end of file