Emscripten
The Emscripten namespace provides functions for interacting with JavaScript and the browser in an Emscripten environment. It includes utilities for running scripts, displaying alert dialogs, saving and loading user files, and performing asynchronous fetch operations. These features enable seamless integration of native code with web-based functionalities.
#include <system/TellusimEmscripten.h>
Functions
Run script.
void run(const char *src)
int32_t runi32(const char *src)
const char *runs(const char *src)
Alert dialog.
void alert(const char *message)
void alert(const String &message)
void alertf(const char *format)
Save user file.
void save(const Blob &blob, const char *mime = nullptr)
void load(const LoadedCallback &func, const char *type = nullptr)
void fetch(const char *name, const FetchedCallback &fetched_func, const ProgressCallback &progress_func, bool cache = false)
void fetch(const String &name, const FetchedCallback &fetched_func, const ProgressCallback &progress_func, bool cache = false)
Types
using LoadedCallback = Function<void(Blob blob)>
using ProgressCallback = Function<void(uint32_t progress, uint32_t total)>
using FetchedCallback = Function<void(const uint8_t *data, size_t size, uint32_t status)>