pub struct BridgeConfig {
pub global_key: &'static str,
pub core_key: &'static str,
pub invoke_key: &'static str,
}Expand description
Configuration for bridge initialization.
Allows customization of bridge behavior.
Fields§
§global_key: &'static strThe global bridge object key on window.
core_key: &'static strThe core module key.
invoke_key: &'static strThe invoke function key.
Implementations§
Source§impl BridgeConfig
Implementation of bridge configuration and invocation.
impl BridgeConfig
Implementation of bridge configuration and invocation.
Sourcepub fn is_available(config: Option<&BridgeConfig>) -> bool
pub fn is_available(config: Option<&BridgeConfig>) -> bool
Checks whether the bridge native bridge is available on the current platform.
Looks up window.___.core via Reflect to determine if the
bridge runtime is present. Returns false if the property chain does not exist
or if any reflection error occurs.
§Arguments
Option<&BridgeConfig>: Optional custom bridge configuration.
§Returns
bool:trueif the bridge core module is available.
Sourcepub fn invoke(
command: &str,
args: Option<&JsValue>,
config: Option<&BridgeConfig>,
) -> Result<Promise, String>
pub fn invoke( command: &str, args: Option<&JsValue>, config: Option<&BridgeConfig>, ) -> Result<Promise, String>
Invokes a bridge core command by name via window.___.core.invoke.
Resolves the ___ → core → invoke property chain on the global
window object, then calls invoke with the given command name and
optional arguments object. Returns the resulting Promise, or an
error string if any step in the reflection chain fails.
§Arguments
&str: The bridge command name to invoke.Option<&JsValue>: Optional arguments object to pass to the command.Option<&BridgeConfig>: Optional custom bridge configuration.
§Returns
Result<Promise, String>: The promise returned by the invoke call, or an error message.
Source§impl BridgeConfig
impl BridgeConfig
pub fn get_global_key(&self) -> &'static str
pub fn get_mut_global_key(&mut self) -> &mut &'static str
pub fn set_global_key(&mut self, val: &'static str) -> &mut Self
pub fn get_core_key(&self) -> &'static str
pub fn get_mut_core_key(&mut self) -> &mut &'static str
pub fn set_core_key(&mut self, val: &'static str) -> &mut Self
pub fn get_invoke_key(&self) -> &'static str
pub fn get_mut_invoke_key(&mut self) -> &mut &'static str
pub fn set_invoke_key(&mut self, val: &'static str) -> &mut Self
Trait Implementations§
Source§impl Clone for BridgeConfig
impl Clone for BridgeConfig
Source§fn clone(&self) -> BridgeConfig
fn clone(&self) -> BridgeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more