mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-25 05:07:12 +01:00
Expose API to force file system sync.
This commit is contained in:
parent
109e2f7385
commit
f2682927f0
@ -46,6 +46,13 @@
|
|||||||
If [code]use_global_execution_context[/code] is [code]true[/code], the code will be evaluated in the global execution context. Otherwise, it is evaluated in the execution context of a function within the engine's runtime environment.
|
If [code]use_global_execution_context[/code] is [code]true[/code], the code will be evaluated in the global execution context. Otherwise, it is evaluated in the execution context of a function within the engine's runtime environment.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="force_fs_sync">
|
||||||
|
<return type="void" />
|
||||||
|
<description>
|
||||||
|
Force synchronization of the persistent file system (when enabled).
|
||||||
|
[b]Note:[/b] This is only useful for modules or extensions that can't use [File] to write files.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="get_interface">
|
<method name="get_interface">
|
||||||
<return type="JavaScriptObject" />
|
<return type="JavaScriptObject" />
|
||||||
<argument index="0" name="interface" type="String" />
|
<argument index="0" name="interface" type="String" />
|
||||||
|
@ -73,6 +73,7 @@ void JavaScript::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("download_buffer", "buffer", "name", "mime"), &JavaScript::download_buffer, DEFVAL("application/octet-stream"));
|
ClassDB::bind_method(D_METHOD("download_buffer", "buffer", "name", "mime"), &JavaScript::download_buffer, DEFVAL("application/octet-stream"));
|
||||||
ClassDB::bind_method(D_METHOD("pwa_needs_update"), &JavaScript::pwa_needs_update);
|
ClassDB::bind_method(D_METHOD("pwa_needs_update"), &JavaScript::pwa_needs_update);
|
||||||
ClassDB::bind_method(D_METHOD("pwa_update"), &JavaScript::pwa_update);
|
ClassDB::bind_method(D_METHOD("pwa_update"), &JavaScript::pwa_update);
|
||||||
|
ClassDB::bind_method(D_METHOD("force_fs_sync"), &JavaScript::force_fs_sync);
|
||||||
ADD_SIGNAL(MethodInfo("pwa_update_available"));
|
ADD_SIGNAL(MethodInfo("pwa_update_available"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +112,8 @@ bool JavaScript::pwa_needs_update() const {
|
|||||||
Error JavaScript::pwa_update() {
|
Error JavaScript::pwa_update() {
|
||||||
return ERR_UNAVAILABLE;
|
return ERR_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
void JavaScript::force_fs_sync() {
|
||||||
|
}
|
||||||
void JavaScript::download_buffer(Vector<uint8_t> p_arr, const String &p_name, const String &p_mime) {
|
void JavaScript::download_buffer(Vector<uint8_t> p_arr, const String &p_name, const String &p_mime) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,6 +60,7 @@ public:
|
|||||||
void download_buffer(Vector<uint8_t> p_arr, const String &p_name, const String &p_mime = "application/octet-stream");
|
void download_buffer(Vector<uint8_t> p_arr, const String &p_name, const String &p_mime = "application/octet-stream");
|
||||||
bool pwa_needs_update() const;
|
bool pwa_needs_update() const;
|
||||||
Error pwa_update();
|
Error pwa_update();
|
||||||
|
void force_fs_sync();
|
||||||
|
|
||||||
static JavaScript *get_singleton();
|
static JavaScript *get_singleton();
|
||||||
JavaScript();
|
JavaScript();
|
||||||
|
@ -351,6 +351,11 @@ void JavaScript::download_buffer(Vector<uint8_t> p_arr, const String &p_name, co
|
|||||||
bool JavaScript::pwa_needs_update() const {
|
bool JavaScript::pwa_needs_update() const {
|
||||||
return OS_JavaScript::get_singleton()->pwa_needs_update();
|
return OS_JavaScript::get_singleton()->pwa_needs_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JavaScript::force_fs_sync() {
|
||||||
|
OS_JavaScript::get_singleton()->force_fs_sync();
|
||||||
|
}
|
||||||
|
|
||||||
Error JavaScript::pwa_update() {
|
Error JavaScript::pwa_update() {
|
||||||
return OS_JavaScript::get_singleton()->pwa_update();
|
return OS_JavaScript::get_singleton()->pwa_update();
|
||||||
}
|
}
|
||||||
|
@ -1040,6 +1040,12 @@ Error OS_JavaScript::pwa_update() {
|
|||||||
return pandemonium_js_pwa_update() ? FAILED : OK;
|
return pandemonium_js_pwa_update() ? FAILED : OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OS_JavaScript::force_fs_sync() {
|
||||||
|
if (is_userfs_persistent()) {
|
||||||
|
idb_needs_sync = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool OS_JavaScript::is_userfs_persistent() const {
|
bool OS_JavaScript::is_userfs_persistent() const {
|
||||||
return idb_available;
|
return idb_available;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,7 @@ public:
|
|||||||
bool check_size_force_redraw();
|
bool check_size_force_redraw();
|
||||||
bool pwa_needs_update() const { return pwa_is_waiting; }
|
bool pwa_needs_update() const { return pwa_is_waiting; }
|
||||||
Error pwa_update();
|
Error pwa_update();
|
||||||
|
void force_fs_sync();
|
||||||
|
|
||||||
// Override return type to make writing static callbacks less tedious.
|
// Override return type to make writing static callbacks less tedious.
|
||||||
static OS_JavaScript *get_singleton();
|
static OS_JavaScript *get_singleton();
|
||||||
|
Loading…
Reference in New Issue
Block a user