mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
chore: Run formatter
This commit is contained in:
@@ -13,6 +13,7 @@ There are three general methods of installation that we can recommend.
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
@@ -23,6 +24,7 @@ tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-wo
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
|
||||
```rust
|
||||
use tauri::{Manager};
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Tauri Plugin single-instance
|
||||
|
||||
## Emit Event Example
|
||||
|
||||
To build and test in development mode run the following:
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,33 +3,38 @@
|
||||
<div>Plugin example</div>
|
||||
<pre id="args"></pre>
|
||||
<script type="module">
|
||||
var argsEl = document.getElementById('args')
|
||||
var argsEl = document.getElementById("args");
|
||||
|
||||
function cliProtocolVal({ args: { color: { value }}}) {
|
||||
argsEl.innerHTML = value
|
||||
document.body.style.backgroundColor = value
|
||||
function cliProtocolVal({
|
||||
args: {
|
||||
color: { value },
|
||||
},
|
||||
}) {
|
||||
argsEl.innerHTML = value;
|
||||
document.body.style.backgroundColor = value;
|
||||
}
|
||||
function cliProtocolErr (err) {
|
||||
argsEl.innerHTML = JSON.stringify(err)
|
||||
function cliProtocolErr(err) {
|
||||
argsEl.innerHTML = JSON.stringify(err);
|
||||
}
|
||||
|
||||
window.__TAURI__.cli.getMatches()
|
||||
window.__TAURI__.cli
|
||||
.getMatches()
|
||||
.then(cliProtocolVal)
|
||||
.catch(cliProtocolErr);
|
||||
|
||||
await window.__TAURI__.event.listen(
|
||||
'single-instance',
|
||||
({event, ...eventObj}) => {
|
||||
console.log(event, eventObj)
|
||||
let args = eventObj.payload?.args
|
||||
"single-instance",
|
||||
({ event, ...eventObj }) => {
|
||||
console.log(event, eventObj);
|
||||
let args = eventObj.payload?.args;
|
||||
|
||||
if (args?.length > 1) {
|
||||
let color = args[1]
|
||||
argsEl.innerHTML = color
|
||||
document.body.style.backgroundColor = color
|
||||
let color = args[1];
|
||||
argsEl.innerHTML = color;
|
||||
document.body.style.backgroundColor = color;
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -72,4 +72,4 @@
|
||||
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user