Merge branch 'matthew/js-fixes' into 'master'
Fix JS demos, which had bitrotted See merge request matrix-org/olm!12
This commit is contained in:
commit
ad173bc798
4 changed files with 16 additions and 5 deletions
2
Makefile
2
Makefile
|
@ -33,7 +33,7 @@ JS_ASMJS_TARGET := javascript/olm_legacy.js
|
||||||
WASM_TARGET := $(BUILD_DIR)/wasm/libolm.a
|
WASM_TARGET := $(BUILD_DIR)/wasm/libolm.a
|
||||||
|
|
||||||
JS_EXPORTED_FUNCTIONS := javascript/exported_functions.json
|
JS_EXPORTED_FUNCTIONS := javascript/exported_functions.json
|
||||||
JS_EXTRA_EXPORTED_RUNTIME_METHODS := ALLOC_STACK
|
JS_EXTRA_EXPORTED_RUNTIME_METHODS := [ALLOC_STACK]
|
||||||
JS_EXTERNS := javascript/externs.js
|
JS_EXTERNS := javascript/externs.js
|
||||||
|
|
||||||
PUBLIC_HEADERS := include/olm/olm.h include/olm/outbound_group_session.h include/olm/inbound_group_session.h include/olm/pk.h include/olm/sas.h
|
PUBLIC_HEADERS := include/olm/olm.h include/olm/outbound_group_session.h include/olm/inbound_group_session.h include/olm/pk.h include/olm/sas.h
|
||||||
|
|
|
@ -2,7 +2,8 @@ Olm
|
||||||
===
|
===
|
||||||
|
|
||||||
Note: before using any of the olm functions, you must call `Olm.init()`, and
|
Note: before using any of the olm functions, you must call `Olm.init()`, and
|
||||||
wait for the promise to resolve.
|
wait for the promise to resolve, otherwise you will get errors like:
|
||||||
|
`Uncaught TypeError: Olm.Account is not a constructor`
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
|
|
@ -489,4 +489,8 @@ function startDemo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", startDemo, false);
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
Olm.init().then(function() {
|
||||||
|
startDemo();
|
||||||
|
});
|
||||||
|
}, false);
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
<head>
|
<head>
|
||||||
<script src="../olm.js"></script>
|
<script src="../olm.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function (event) {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
Olm.init().then(function() {
|
||||||
|
demo();
|
||||||
|
});
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
function demo() {
|
||||||
function progress(who, message) {
|
function progress(who, message) {
|
||||||
var message_element = document.createElement("pre");
|
var message_element = document.createElement("pre");
|
||||||
var progress = document.getElementById(who + "_progress");
|
var progress = document.getElementById(who + "_progress");
|
||||||
|
@ -109,7 +115,7 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
glue_encrypt("bob", "alice", b_session);
|
glue_encrypt("bob", "alice", b_session);
|
||||||
glue_decrypt("alice", a_session);
|
glue_decrypt("alice", a_session);
|
||||||
});
|
});
|
||||||
}, false);
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in a new issue