@inter-digital/wasm-client-sdk 3.8.3-patch.14 → 3.8.3-patch.14-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.es.js +20 -0
- package/lib/index.js +20 -0
- package/lib/index.umd.js +20 -0
- package/package.json +1 -1
package/lib/index.es.js
CHANGED
|
@@ -943,6 +943,18 @@ let initialized = false;
|
|
|
943
943
|
let go;
|
|
944
944
|
let goExitPromise;
|
|
945
945
|
const CACHE_KEY = 'openim-wasm-cache';
|
|
946
|
+
if (typeof window !== 'undefined') {
|
|
947
|
+
const cleanup = () => {
|
|
948
|
+
reset();
|
|
949
|
+
};
|
|
950
|
+
window.addEventListener('beforeunload', cleanup);
|
|
951
|
+
window.addEventListener('unload', cleanup);
|
|
952
|
+
if ('__TAURI__' in window) {
|
|
953
|
+
window.addEventListener('tauri://close-requested', cleanup);
|
|
954
|
+
window.addEventListener('tauri://destroyed', cleanup);
|
|
955
|
+
window.addEventListener('tauri://window-close-requested', cleanup);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
946
958
|
async function initializeWasm(url) {
|
|
947
959
|
if (initialized) {
|
|
948
960
|
return null;
|
|
@@ -970,6 +982,12 @@ async function initializeWasm(url) {
|
|
|
970
982
|
initialized = true;
|
|
971
983
|
return go;
|
|
972
984
|
}
|
|
985
|
+
function reset() {
|
|
986
|
+
initialized = false;
|
|
987
|
+
if (go) {
|
|
988
|
+
go = undefined;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
973
991
|
function getGO() {
|
|
974
992
|
return go;
|
|
975
993
|
}
|
|
@@ -2076,6 +2094,8 @@ class SDK extends Emitter {
|
|
|
2076
2094
|
]);
|
|
2077
2095
|
};
|
|
2078
2096
|
this.fileMapSet = (uuid, file) => window.fileMapSet(uuid, file);
|
|
2097
|
+
// Reset any previous state before initializing
|
|
2098
|
+
reset();
|
|
2079
2099
|
initDatabaseAPI(debug);
|
|
2080
2100
|
this.isLogStandardOutput = debug;
|
|
2081
2101
|
this.wasmInitializedPromise = initializeWasm(url);
|
package/lib/index.js
CHANGED
|
@@ -947,6 +947,18 @@ let initialized = false;
|
|
|
947
947
|
let go;
|
|
948
948
|
let goExitPromise;
|
|
949
949
|
const CACHE_KEY = 'openim-wasm-cache';
|
|
950
|
+
if (typeof window !== 'undefined') {
|
|
951
|
+
const cleanup = () => {
|
|
952
|
+
reset();
|
|
953
|
+
};
|
|
954
|
+
window.addEventListener('beforeunload', cleanup);
|
|
955
|
+
window.addEventListener('unload', cleanup);
|
|
956
|
+
if ('__TAURI__' in window) {
|
|
957
|
+
window.addEventListener('tauri://close-requested', cleanup);
|
|
958
|
+
window.addEventListener('tauri://destroyed', cleanup);
|
|
959
|
+
window.addEventListener('tauri://window-close-requested', cleanup);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
950
962
|
async function initializeWasm(url) {
|
|
951
963
|
if (initialized) {
|
|
952
964
|
return null;
|
|
@@ -974,6 +986,12 @@ async function initializeWasm(url) {
|
|
|
974
986
|
initialized = true;
|
|
975
987
|
return go;
|
|
976
988
|
}
|
|
989
|
+
function reset() {
|
|
990
|
+
initialized = false;
|
|
991
|
+
if (go) {
|
|
992
|
+
go = undefined;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
977
995
|
function getGO() {
|
|
978
996
|
return go;
|
|
979
997
|
}
|
|
@@ -2080,6 +2098,8 @@ class SDK extends Emitter {
|
|
|
2080
2098
|
]);
|
|
2081
2099
|
};
|
|
2082
2100
|
this.fileMapSet = (uuid, file) => window.fileMapSet(uuid, file);
|
|
2101
|
+
// Reset any previous state before initializing
|
|
2102
|
+
reset();
|
|
2083
2103
|
initDatabaseAPI(debug);
|
|
2084
2104
|
this.isLogStandardOutput = debug;
|
|
2085
2105
|
this.wasmInitializedPromise = initializeWasm(url);
|
package/lib/index.umd.js
CHANGED
|
@@ -949,6 +949,18 @@
|
|
|
949
949
|
let go;
|
|
950
950
|
let goExitPromise;
|
|
951
951
|
const CACHE_KEY = 'openim-wasm-cache';
|
|
952
|
+
if (typeof window !== 'undefined') {
|
|
953
|
+
const cleanup = () => {
|
|
954
|
+
reset();
|
|
955
|
+
};
|
|
956
|
+
window.addEventListener('beforeunload', cleanup);
|
|
957
|
+
window.addEventListener('unload', cleanup);
|
|
958
|
+
if ('__TAURI__' in window) {
|
|
959
|
+
window.addEventListener('tauri://close-requested', cleanup);
|
|
960
|
+
window.addEventListener('tauri://destroyed', cleanup);
|
|
961
|
+
window.addEventListener('tauri://window-close-requested', cleanup);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
952
964
|
async function initializeWasm(url) {
|
|
953
965
|
if (initialized) {
|
|
954
966
|
return null;
|
|
@@ -976,6 +988,12 @@
|
|
|
976
988
|
initialized = true;
|
|
977
989
|
return go;
|
|
978
990
|
}
|
|
991
|
+
function reset() {
|
|
992
|
+
initialized = false;
|
|
993
|
+
if (go) {
|
|
994
|
+
go = undefined;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
979
997
|
function getGO() {
|
|
980
998
|
return go;
|
|
981
999
|
}
|
|
@@ -2082,6 +2100,8 @@
|
|
|
2082
2100
|
]);
|
|
2083
2101
|
};
|
|
2084
2102
|
this.fileMapSet = (uuid, file) => window.fileMapSet(uuid, file);
|
|
2103
|
+
// Reset any previous state before initializing
|
|
2104
|
+
reset();
|
|
2085
2105
|
initDatabaseAPI(debug);
|
|
2086
2106
|
this.isLogStandardOutput = debug;
|
|
2087
2107
|
this.wasmInitializedPromise = initializeWasm(url);
|