chore: Run formatter

pull/72/head
Beanow 2 years ago
parent d9301f2ad1
commit b88ec8e9c1
No known key found for this signature in database
GPG Key ID: 67C49F1108FCE5A4

@ -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: Install the Core plugin by adding the following to your `Cargo.toml` file:
`src-tauri/Cargo.toml` `src-tauri/Cargo.toml`
```toml ```toml
[dependencies] [dependencies]
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } 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: First you need to register the core plugin with Tauri:
`src-tauri/src/main.rs` `src-tauri/src/main.rs`
```rust ```rust
use tauri::{Manager}; use tauri::{Manager};

@ -1,4 +1,5 @@
# Tauri Plugin single-instance # Tauri Plugin single-instance
## Emit Event Example ## Emit Event Example
To build and test in development mode run the following: To build and test in development mode run the following:

@ -11,4 +11,4 @@
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^1.0.0" "@tauri-apps/cli": "^1.0.0"
} }
} }

@ -3,33 +3,38 @@
<div>Plugin example</div> <div>Plugin example</div>
<pre id="args"></pre> <pre id="args"></pre>
<script type="module"> <script type="module">
var argsEl = document.getElementById('args') var argsEl = document.getElementById("args");
function cliProtocolVal({ args: { color: { value }}}) { function cliProtocolVal({
argsEl.innerHTML = value args: {
document.body.style.backgroundColor = value color: { value },
},
}) {
argsEl.innerHTML = value;
document.body.style.backgroundColor = value;
} }
function cliProtocolErr (err) { function cliProtocolErr(err) {
argsEl.innerHTML = JSON.stringify(err) argsEl.innerHTML = JSON.stringify(err);
} }
window.__TAURI__.cli.getMatches() window.__TAURI__.cli
.getMatches()
.then(cliProtocolVal) .then(cliProtocolVal)
.catch(cliProtocolErr); .catch(cliProtocolErr);
await window.__TAURI__.event.listen( await window.__TAURI__.event.listen(
'single-instance', "single-instance",
({event, ...eventObj}) => { ({ event, ...eventObj }) => {
console.log(event, eventObj) console.log(event, eventObj);
let args = eventObj.payload?.args let args = eventObj.payload?.args;
if (args?.length > 1) { if (args?.length > 1) {
let color = args[1] let color = args[1];
argsEl.innerHTML = color argsEl.innerHTML = color;
document.body.style.backgroundColor = color document.body.style.backgroundColor = color;
} }
} }
) );
</script> </script>
</body> </body>
</html> </html>

@ -72,4 +72,4 @@
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'" "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
} }
} }
} }

Loading…
Cancel
Save