From fdf66a21f1a330595f7345f3b0024e0e7cafa28a Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Wed, 19 May 2021 15:53:04 +0200 Subject: [HTML5] Add easy to use download API. New `JavaScript.download_buffer` method to create a prompt that let the user download a file. --- platform/javascript/api/api.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'platform/javascript/api/api.cpp') diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp index 039ce815e4..5ad2bf56cf 100644 --- a/platform/javascript/api/api.cpp +++ b/platform/javascript/api/api.cpp @@ -70,6 +70,7 @@ void JavaScript::_bind_methods() { mi.arguments.push_back(PropertyInfo(Variant::STRING, "object")); ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "create_object", &JavaScript::_create_object_bind, mi); } + ClassDB::bind_method(D_METHOD("download_buffer", "buffer", "name", "mime"), &JavaScript::download_buffer, DEFVAL("application/octet-stream")); } #if !defined(JAVASCRIPT_ENABLED) || !defined(JAVASCRIPT_EVAL_ENABLED) @@ -100,3 +101,7 @@ Variant JavaScript::_create_object_bind(const Variant **p_args, int p_argcount, return Ref(); } #endif +#if !defined(JAVASCRIPT_ENABLED) +void JavaScript::download_buffer(Vector p_arr, const String &p_name, const String &p_mime) { +} +#endif -- cgit v1.2.3