pub trait CxDesktopVsWasmCommon {
    fn get_default_window_size(&self) -> Vec2;
fn file_write(&mut self, path: &str, data: &[u8]);
fn websocket_send(&mut self, url: &str, data: &[u8]);
fn http_send(
        &mut self,
        verb: &str,
        path: &str,
        _proto: &str,
        domain: &str,
        port: u16,
        content_type: &str,
        body: &[u8],
        signal: Signal
    );
fn return_to_js(&mut self, callback_id: u32, params: Vec<ZapParam>); }
Expand description

A bunch of traits that are common between the native platforms and the WebAssembly platform. This trait makes sure that there is consistency in the interface, and provides one place for documentation.

Required methods

Get a default window size for new windows. TODO(JP): This doesn’t make too much sense for Wasm; maybe just omit this method there?

Write data to path.

Send data over a Websocket.

Make an HTTP request. When done, you get a SignalEvent corresponding to the provided Signal with Cx::STATUS_HTTP_SEND_OK or Cx::STATUS_HTTP_SEND_FAIL as the status.

Mechanism to communicate back returns values from callRustAsync functions.

Implementors