* Add syntax & type check for Node.js example on CI
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* Fix quotes
---------
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Co-authored-by: Florian Duros <florianduros@element.io>
* Fix node.js example
Relates to: element-hq/element-web#26922
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* Update examples/node/app.js
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update examples/node/package.json
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Move imports to the top of the file
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This example seems to have been broken by the switch to Typescript. We can't
just symlink in `../..` because that gives us the typescript version of the
source, which, obviously, doesn't work in node.
Instead, make sure we use a prebuilt version of the js-sdk.
It's actually even more broken as of js-sdk 33.0.0, thanks to the switch to ES
modules (#4187), but we'll get to that later.
* Introduce Membership TS type
* Adapt the Membership TS type to be an enum
* Add docstrings for KnownMembership and Membership
* Move Membership types into a separate file, exported from types.ts
---------
Co-authored-by: Stanislav Demydiuk <s.demydiuk@gmail.com>
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Though the dictionary format works fine, it's slow. Access times are around the 1ms range for rooms like HQ, which doesn't seem like much, but when compared to the Map's access time of 0.05ms it's slow.
Converting things to a map means we lose index access and have to instead use `.keys()` and `.values()`, both of which return iterables and not arrays. Even doing the `Array.from()` conversion we see times in the 0.05ms range. This is also what makes this a breaking change.
Memory-wise there does not appear to be any measurable impact for a large account.
We now rely on browserify for building browser-specific versions of the JS
SDK. This can be initiated by running 'npm run build-js'. Node versions are
unaffected.