Skip to content

Commit 61b489c

Browse files
committed
doc: document capabilities
1 parent b39af16 commit 61b489c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tauri-wasm/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
## About
1414

1515
Interact with a Tauri backend using the pure Rust library.
16-
You don't need NPM or any other JavaScript ecosystem tools to build the frontend, use Cargo instead.
16+
You don't need NPM or any other JavaScript tools to build a frontend, use Cargo instead.
1717

1818
This crate is designed for Tauri version 2.0 and above.
1919

tauri-wasm/src/event.rs

+18
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ pub(crate) mod api {
6868
///
6969
/// To trigger an event to a listener registered by a specific target
7070
/// you can use the [`to`](Emit::to) function.
71+
///
72+
/// # Capabilities
73+
///
74+
/// Note that in order to emit events, the Tauri framework
75+
/// requires the corresponding capabilities to be enabled.
76+
/// For example, let's say our application and its window
77+
/// are named "app". Then your `Tauri.toml` config should
78+
/// include something like:
79+
///
80+
/// ```toml
81+
/// [app]
82+
/// # app configs..
83+
///
84+
/// [[app.security.capabilities]]
85+
/// identifier = "default"
86+
/// windows = ["app"]
87+
/// permissions = ["core:event:default"]
88+
/// ```
7189
#[inline]
7290
pub fn emit<E, P>(event: E, payload: &P) -> Result<Emit<E::Js>, Error>
7391
where

0 commit comments

Comments
 (0)