Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): simplify scope definition for sidecars (#3574)
- Loading branch information
1 parent
91ec876
commit 9b3b163
Showing
9 changed files
with
137 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"tauri": patch | ||
--- | ||
|
||
The `cmd` field is no longer required on the shell scope for sidecars. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Sidecar</title> | ||
</head> | ||
|
||
<body> | ||
<div></div> | ||
<script> | ||
const div = document.querySelector('div') | ||
window.__TAURI__.event.listen('message', (event) => { | ||
const p = document.createElement('p') | ||
p.innerText = event.payload | ||
div.appendChild(p) | ||
}) | ||
</script> | ||
</body> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Sidecar</title> | ||
<style> | ||
.container { | ||
display: flex; | ||
} | ||
.container > div { | ||
flex: 1; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<div id="backend"></div> | ||
<div id="frontend"></div> | ||
</div> | ||
<script> | ||
function addMessage(div, message) { | ||
const p = document.createElement('p') | ||
p.innerText = message | ||
div.appendChild(p) | ||
} | ||
|
||
const backendDiv = document.getElementById('backend') | ||
window.__TAURI__.event.listen('message', (event) => { | ||
addMessage(backendDiv, event.payload) | ||
}) | ||
|
||
const frontendDiv = document.getElementById('frontend') | ||
const { Command } = window.__TAURI__.shell | ||
const command = Command.sidecar('binaries/app') | ||
command.on('close', data => { | ||
addMessage(frontendDiv, `command finished with code ${data.code} and signal ${data.signal}`) | ||
}) | ||
command.on('error', error => addMessage(frontendDiv, `command error: "${error}"`)) | ||
command.stdout.on('data', line => addMessage(frontendDiv, `command stdout: "${line}"`)) | ||
command.stderr.on('data', line => addMessage(frontendDiv, `command stderr: "${line}"`)) | ||
command.spawn() | ||
</script> | ||
</body> | ||
|
||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters