Allow cancellation of HTTP requests

`NETWORK::HttpRequest()` now returns a HttpRequestFuture with a
`Cancel()` method.
This commit is contained in:
Martin Natano
2021-12-08 14:10:43 +01:00
parent 134fa9a3d9
commit bb826dc0b2
4 changed files with 74 additions and 7 deletions
+4
View File
@@ -2051,6 +2051,9 @@
<Function name='GetHeld'/>
<Function name='GetActive'/>
</Class>
<Class name='HttpRequestFuture'>
<Function name='Cancel'/>
</Class>
<Class base='ActorFrame' name='TextBanner'>
<Function name='Load'/>
<Function name='SetFromSong'/>
@@ -2498,6 +2501,7 @@
<EnumValue name='&apos;HttpErrorCode_TooManyRedirects&apos;' value='13'/>
<EnumValue name='&apos;HttpErrorCode_ChunkReadError&apos;' value='14'/>
<EnumValue name='&apos;HttpErrorCode_CannotReadBody&apos;' value='15'/>
<EnumValue name='&apos;HttpErrorCode_Cancelled&apos;' value='16'/>
</Enum>
<Enum name='ImageCacheMode'>
<EnumValue name='&apos;ImageCacheMode_Off&apos;' value='0'/>
+7 -1
View File
@@ -3560,7 +3560,7 @@ end
<Function name='IsUrlAllowed' return='bool' arguments='string url'>
Returns true if access to <code>url</code> is allowed.
</Function>
<Function name='HttpRequest' return='void' arguments='table params'>
<Function name='HttpRequest' return='HttpRequestFuture' arguments='table params'>
Performs an HTTP request.<br />
Usage example:
<pre><code>
@@ -6210,6 +6210,12 @@ local spr = Def.Sprite{
Returns true if the note was initiated.
</Function>
</Class>
<Class name='HttpRequestFuture'>
<Function name='Cancel' return='void' arguments=''>
Cancels the running HTTP request. Does nothing if the request
has already completed.
</Function>
</Class>
<Class name='TextBanner' grouping='Actor'>
<Function name='Load' return='void' arguments='string sMetricsGroup'>
Loads the TextBanner from the specified metrics group.