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
1 changed files with 3 additions and 0 deletions

View File

@ -18,6 +18,9 @@ func fetch(url: String, cbObj: Object, cbFn: String):
cbObj.call(cbFn, HTTPRequest.RESULT_SUCCESS, 200, [], buf)
return
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)
req.connect("request_completed", self, "_request_completed", [url, cbObj, cbFn])
req.request(url)