Skip to content

Commit 8c1e715

Browse files
authored
feat(docs) add init_script fn to the plugin recipe (tauri-apps#100)
1 parent 3571ef2 commit 8c1e715

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/usage/recipes/plugin.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ impl MyAwesomePlugin {
3333
}
3434

3535
impl Plugin for MyAwesomePlugin {
36+
/// The JS script to evaluate on init.
37+
/// Useful when your plugin is accessible through `window`
38+
/// or needs to perform a JS task on app initialization
39+
/// e.g. "window.localStorage = { ... the plugin interface }"
40+
fn init_script(&self) -> Option<String> {
41+
None
42+
}
43+
3644
/// Callback invoked when the webview is created.
3745
fn created(&self, webview: &mut Webview) {}
3846

0 commit comments

Comments
 (0)