#simulator #tauri-plugin #running #check

sys tauri-plugin-is-simulator

A simple Tauri plugin to check if the app is running in a simulator

1 stable release

new 1.0.0 Dec 16, 2024

#104 in Simulation

MIT license

48KB
284 lines

Tauri Plugin is-simulator

A simple Tauri plugin to check if the app is running in a simulator.

Supported Platforms

  • iOS
  • Android

Installation

Rust

Run the following command in the src-tauri folder to add the plugin to the project’s dependencies in Cargo.toml:

cargo add tauri-plugin-is-simulator

Modify lib.rs to initialize the plugin:

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .setup(|app| {
            #[cfg(mobile)]
            app.handle().plugin(tauri_plugin_is_simulator::init());
            Ok(())
        })
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

JavaScript Bindings

Install the JavaScript bindings:

npm install tauri-plugin-is-simulator

Usage

import { isSimulator } from 'tauri-plugin-is-simulator';

console.log(`Is simulator: ${await isSimulator()}`);

Dependencies

~18–62MB
~892K SLoC