logo
pub trait ExternalSystem {
    fn is_supported(&self) -> bool;
    fn call(
        &self,
        name: String,
        params: Option<Vec<Dynamic, Global>>
    ) -> Option<Dynamic>; fn bind(&self, name: String, function: Dynamic); }
Expand description

Functions for interacting with external code. When running in a web browser, this means Javascript running on the page.

Required Methods

Whether the environment supports interaction with external code.

Call an external fn with the given parameters, and returns the result. Errors thrown by the called fn will propogate.

Bind a fn to be called by external code. @param name The name to bind to. The namespace may be shared with third party code, so it’s good practice to prefix names. In Javascript, the fn will be hooked onto the window object. @param fn The function, or None to unbind.

Implementors