mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-11 13:30:01 -04:00
Revert "improve download speeds by listening directly for ws messages"
This reverts commit 4004409650
.
This commit is contained in:
parent
04aa226b2d
commit
0897769f70
3 changed files with 2 additions and 13 deletions
|
@ -1,5 +0,0 @@
|
|||
/* INSERT
|
||||
Module\[['"]websocket['"]\]\.emit\(['"]message['"], ?sock\.stream\.fd\)
|
||||
*/
|
||||
; ws_events.dispatchEvent(new Event("message"));
|
||||
|
|
@ -30,8 +30,6 @@ var wasm_ready = false;
|
|||
var version_dict = null;
|
||||
var api = null;
|
||||
var main_session = null;
|
||||
const ws_events = new EventTarget();
|
||||
|
||||
const libcurl_version = "__library_version__";
|
||||
const wisp_version = "__wisp_version__";
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@ class CurlSession {
|
|||
}, "viii");
|
||||
this.request_callbacks = {};
|
||||
this.last_request_id = 0;
|
||||
|
||||
this.ws_event_listener = () => {this.event_loop_func()};
|
||||
ws_events.addEventListener("message", this.ws_event_listener);
|
||||
}
|
||||
|
||||
assert_ready() {
|
||||
|
@ -100,7 +97,7 @@ class CurlSession {
|
|||
if (this.event_loop) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.event_loop = setInterval(() => {
|
||||
this.event_loop_func();
|
||||
}, 0);
|
||||
|
@ -111,7 +108,7 @@ class CurlSession {
|
|||
if (libcurl_active || this.active_requests) {
|
||||
_session_perform(this.session_ptr);
|
||||
}
|
||||
else if (this.event_loop) {
|
||||
else {
|
||||
clearInterval(this.event_loop);
|
||||
this.event_loop = null;
|
||||
}
|
||||
|
@ -123,7 +120,6 @@ class CurlSession {
|
|||
}
|
||||
_session_cleanup(this.session_ptr);
|
||||
this.session_ptr = null;
|
||||
ws_events.removeEventListener("message", this.ws_event_listener);
|
||||
Module.removeFunction(this.end_callback_ptr);
|
||||
Module.removeFunction(this.headers_callback_ptr);
|
||||
Module.removeFunction(this.data_callback_ptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue