From edac52757aeaa8fbcafbe7d3f0ad66e1871b5bb8 Mon Sep 17 00:00:00 2001 From: Sebastien Jourdain Date: Mon, 23 Aug 2021 16:42:08 -0600 Subject: [PATCH] fix(wslink): Update to 1.0.6 api change --- package-lock.json | 19 ++++--------------- package.json | 2 +- src/Common/Misc/SizeHelper/index.js | 8 ++++++-- src/IO/WebSocket/WslinkImageStream/index.js | 6 ++++-- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 37aa8b98ad..9e045db10c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30155,23 +30155,12 @@ "dev": true }, "wslink": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/wslink/-/wslink-0.1.15.tgz", - "integrity": "sha512-2IIC8Bd7qkMPk7LEqvrqkV4wzeQdET+LhbaX3tkd/NTxcWh2zzUpdwtvouZkwTsbmfXSRbyB0TTBU3cRHKL3FA==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/wslink/-/wslink-1.0.6.tgz", + "integrity": "sha512-fpfvM8xdoVu+ccNaHYswvjP3EigtQY+Jtp0/4ivFkDnUbtMuCqoZ8sVLC/eWFe7hl1ktUQgV7OyaT3Lyk+ZKGQ==", "dev": true, "requires": { - "json5": "2.1.0" - }, - "dependencies": { - "json5": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", - "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - } + "json5": "2.2.0" } }, "xmlbuilder2": { diff --git a/package.json b/package.json index 4d5bfcf03f..f5cf909e81 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "tape-catch": "1.0.6", "tonic-arctic-sample-data": "http://www.paraview.org/files/dependencies/tonic-arctic-sample-data-1.2.2.tgz", "vtk.js": "19.2.2", - "wslink": "0.1.15" + "wslink": "1.0.6" }, "scripts": { "install": "./config/prebuild.sh", diff --git a/src/Common/Misc/SizeHelper/index.js b/src/Common/Misc/SizeHelper/index.js index 8f0f177220..72be7caa48 100644 --- a/src/Common/Misc/SizeHelper/index.js +++ b/src/Common/Misc/SizeHelper/index.js @@ -44,13 +44,17 @@ function getSize(domElement, clearCache = false) { class Subscriber { constructor(domElement, callback) { - observer.observe(domElement); + if (domElement) { + observer.observe(domElement); + } this.fn = observableInstance.on(TOPIC, callback); this.domElement = domElement; } unsubscribe() { - observer.unobserve(this.domElement); + if (this.domElement) { + observer.unobserve(this.domElement); + } this.fn.unsubscribe(); } } diff --git a/src/IO/WebSocket/WslinkImageStream/index.js b/src/IO/WebSocket/WslinkImageStream/index.js index 0f6239205c..a63d782111 100644 --- a/src/IO/WebSocket/WslinkImageStream/index.js +++ b/src/IO/WebSocket/WslinkImageStream/index.js @@ -58,7 +58,7 @@ function wslinkImageStream(publicAPI, model) { publicAPI.unsubscribeRenderTopic = () => { model.client.VtkImageDelivery.offRenderChange( model.renderTopicSubscription - ).then( + ).promise.then( (unsubSuccess) => { console.log('Unsubscribe resolved ', unsubSuccess); }, @@ -153,7 +153,9 @@ function wslinkImageStream(publicAPI, model) { model.width = size[0]; model.height = size[1]; - model.client.VtkImageDelivery.onRenderChange(publicAPI.viewChanged).then( + model.client.VtkImageDelivery.onRenderChange( + publicAPI.viewChanged + ).promise.then( (subscription) => { model.renderTopicSubscription = subscription; model.client.VtkImageDelivery.addRenderObserver(view_id).then(