diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-05-19 15:53:04 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-05-21 15:31:23 +0200 |
commit | fdf66a21f1a330595f7345f3b0024e0e7cafa28a (patch) | |
tree | 4d7e4cc526f209065baba845a0e3ab15d8e99f7c /doc/classes | |
parent | 8c2beeea907cb39baac20df198392ae4fdf64029 (diff) |
[HTML5] Add easy to use download API.
New `JavaScript.download_buffer` method to create a prompt that let the
user download a file.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/JavaScript.xml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/classes/JavaScript.xml b/doc/classes/JavaScript.xml index e6d74eeb21..c87e637ff5 100644 --- a/doc/classes/JavaScript.xml +++ b/doc/classes/JavaScript.xml @@ -29,6 +29,22 @@ Creates a new JavaScript object using the [code]new[/code] constructor. The [code]object[/code] must a valid property of the JavaScript [code]window[/code]. See [JavaScriptObject] for usage. </description> </method> + <method name="download_buffer"> + <return type="void"> + </return> + <argument index="0" name="buffer" type="PackedByteArray"> + </argument> + <argument index="1" name="name" type="String"> + </argument> + <argument index="2" name="mime" type="String" default=""application/octet-stream""> + </argument> + <description> + Prompts the user to download a file containing the specified [code]buffer[/code]. The file will have the given [code]name[/code] and [code]mime[/code] type. + [b]Note:[/b] The browser may override the [url=https://en.wikipedia.org/wiki/Media_type]MIME type[/url] provided based on the file [code]name[/code]'s extension. + [b]Note:[/b] Browsers might block the download if [method download_buffer] is not being called from a user interaction (e.g. button click). + [b]Note:[/b] Browsers might ask the user for permission or block the download if multiple download requests are made in a quick succession. + </description> + </method> <method name="eval"> <return type="Variant"> </return> |