tauri-plugin-pinia 0.8.1

Persistent Pinia stores for Tauri
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::pinia::Pinia;
use tauri::{AppHandle, Manager, Runtime, WebviewWindow, Window};

pub trait ManagerExt<R: Runtime>: Manager<R> {
  fn pinia(&self) -> tauri::State<Pinia<R>> {
    self.state::<Pinia<R>>()
  }
}

impl<R: Runtime> ManagerExt<R> for AppHandle<R> {}
impl<R: Runtime> ManagerExt<R> for WebviewWindow<R> {}
impl<R: Runtime> ManagerExt<R> for Window<R> {}