Mercurial > hg > orthanc-stone
comparison Platforms/Wasm/WasmWebService.js @ 315:aad37d0b6407 am-2
Added LayerWidget::RemoveLayer + DELETE commands in WebService
author | am@osimis.io |
---|---|
date | Fri, 05 Oct 2018 10:38:16 +0200 |
parents | 14ef1227120f |
children | aee3d7941c9b |
comparison
equal
deleted
inserted
replaced
314:97f16214dc5e | 315:aad37d0b6407 |
---|---|
55 } | 55 } |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 xhr.send(new Uint8ClampedArray(HEAPU8.buffer, body, bodySize)); | 59 xhr.send(new Uint8ClampedArray(HEAPU8.buffer, body, bodySize)); |
60 }, | |
61 | |
62 WasmWebService_DeleteAsync: function(callableSuccess, callableFailure, url, headersInJsonString, payload, timeoutInSeconds) { | |
63 var xhr = new XMLHttpRequest(); | |
64 var url_ = UTF8ToString(url); | |
65 var headersInJsonString_ = UTF8ToString(headersInJsonString); | |
66 xhr.open('DELETE', url_, true); | |
67 xhr.timeout = timeoutInSeconds * 1000; | |
68 xhr.responseType = 'arraybuffer'; | |
69 xhr.setRequestHeader('Content-type', 'application/octet-stream'); | |
70 | |
71 var headers = JSON.parse(headersInJsonString_); | |
72 for (var key in headers) { | |
73 xhr.setRequestHeader(key, headers[key]); | |
74 } | |
75 | |
76 xhr.onreadystatechange = function() { | |
77 if (this.readyState == XMLHttpRequest.DONE) { | |
78 if (xhr.status === 200) { | |
79 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), | |
80 this.response.byteLength, payload); | |
81 } else { | |
82 WasmWebService_NotifyError(callableFailure, url_, payload); | |
83 } | |
84 } | |
85 } | |
86 | |
87 xhr.send(); | |
60 } | 88 } |
89 | |
61 }); | 90 }); |