Use remote threads on supported platforms

This commit is contained in:
Hamcha 2019-05-28 00:57:28 +02:00
parent d249fa29bb
commit 336ae08cd0
Signed by: hamcha
GPG key ID: A40413D21021EAEE

View file

@ -18,6 +18,9 @@ func fetch(url: String, cbObj: Object, cbFn: String):
cbObj.call(cbFn, HTTPRequest.RESULT_SUCCESS, 200, [], buf) cbObj.call(cbFn, HTTPRequest.RESULT_SUCCESS, 200, [], buf)
return return
var req := HTTPRequest.new() var req := HTTPRequest.new()
# On HTML5 we cannot use threaded requests
# On other platforms (such as Android), we *need* to!
req.use_threads = !OS.has_feature("HTML5")
add_child(req) add_child(req)
req.connect("request_completed", self, "_request_completed", [url, cbObj, cbFn]) req.connect("request_completed", self, "_request_completed", [url, cbObj, cbFn])
req.request(url) req.request(url)