mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
[HTML5] Implement JavaScript PWA update callbacks.
Allows detecting when a new version of the progressive web app service worker is waiting (i.e. an update is pending), along a function to force the update and reload all clients.
This commit is contained in:
parent
3cc72ac03f
commit
948e66c3d6
8 changed files with 119 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "api/javascript_singleton.h"
|
||||
#include "emscripten.h"
|
||||
#include "os_javascript.h"
|
||||
|
||||
extern "C" {
|
||||
extern void godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime);
|
||||
|
@ -355,3 +356,10 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
|
|||
void JavaScript::download_buffer(Vector<uint8_t> p_arr, const String &p_name, const String &p_mime) {
|
||||
godot_js_os_download_buffer(p_arr.ptr(), p_arr.size(), p_name.utf8().get_data(), p_mime.utf8().get_data());
|
||||
}
|
||||
|
||||
bool JavaScript::pwa_needs_update() const {
|
||||
return OS_JavaScript::get_singleton()->pwa_needs_update();
|
||||
}
|
||||
Error JavaScript::pwa_update() {
|
||||
return OS_JavaScript::get_singleton()->pwa_update();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue