From 224e592701003eb3ba4800bbb9e136e3cb317a0c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Thu, 8 Dec 2022 10:43:20 +0000 Subject: [PATCH] Fix `examples/browser/browserTest.js` (#2952) This seems to have been broken for ages --- examples/browser/README.md | 4 ++-- examples/browser/browserTest.js | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/browser/README.md b/examples/browser/README.md index 1253d8000..45c1d2021 100644 --- a/examples/browser/README.md +++ b/examples/browser/README.md @@ -1,9 +1,9 @@ To try it out, **you must build the SDK first** and then host this folder: ``` - $ npm run build + $ yarn build $ cd examples/browser - $ python -m SimpleHTTPServer 8003 + $ python -m http.server 8003 ``` Then visit ``http://localhost:8003``. diff --git a/examples/browser/browserTest.js b/examples/browser/browserTest.js index e6623b382..891dd176b 100644 --- a/examples/browser/browserTest.js +++ b/examples/browser/browserTest.js @@ -1,11 +1,7 @@ console.log("Loading browser sdk"); -var client = matrixcs.createClient("https://matrix.org"); -client.publicRooms(function (err, data) { - if (err) { - console.error("err %s", JSON.stringify(err)); - return; - } +var client = matrixcs.createClient({baseUrl: "https://matrix.org"}); +client.publicRooms().then(function (data) { console.log("data %s [...]", JSON.stringify(data).substring(0, 100)); console.log("Congratulations! The SDK is working on the browser!"); var result = document.getElementById("result");