pull/381/head
Lucas Nogueira 2 years ago
parent 907569c3ba
commit 08c3faae9b
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1

@ -60,7 +60,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { getVersion, hide } from '@tauri-apps/plugin-app'; import { getVersion, hide } from "@tauri-apps/plugin-app";
const appVersion = await getVersion(); const appVersion = await getVersion();
await hide(); await hide();
``` ```

@ -60,16 +60,16 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { getMatches } from '@tauri-apps/plugin-cli'; import { getMatches } from "@tauri-apps/plugin-cli";
const matches = await getMatches(); const matches = await getMatches();
if (matches.subcommand?.name === 'run') { if (matches.subcommand?.name === "run") {
// `./your-app run $ARGS` was executed // `./your-app run $ARGS` was executed
const args = matches.subcommand?.matches.args const args = matches.subcommand?.matches.args;
if ('debug' in args) { if ("debug" in args) {
// `./your-app run --debug` was executed // `./your-app run --debug` was executed
} }
} else { } else {
const args = matches.args const args = matches.args;
// `./your-app $ARGS` was executed // `./your-app $ARGS` was executed
} }
``` ```

@ -60,9 +60,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { writeText, readText } from '@tauri-apps/plugin-clipboard'; import { writeText, readText } from "@tauri-apps/plugin-clipboard";
await writeText('Tauri is awesome!'); await writeText("Tauri is awesome!");
assert(await readText(), 'Tauri is awesome!'); assert(await readText(), "Tauri is awesome!");
``` ```
## Contributing ## Contributing

@ -60,9 +60,9 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { fetch } from '@tauri-apps/plugin-http'; import { fetch } from "@tauri-apps/plugin-http";
const response = await fetch('http://localhost:3003/users/2', { const response = await fetch("http://localhost:3003/users/2", {
method: 'GET', method: "GET",
timeout: 30, timeout: 30,
}); });
``` ```

@ -45,7 +45,7 @@ fn main() {
RemoteDomainAccessScope::new(format!("localhost:{}", port)) RemoteDomainAccessScope::new(format!("localhost:{}", port))
.add_window("main") .add_window("main")
); );
let url = format!("http://localhost:{}", port).parse().unwrap(); let url = format!("http://localhost:{}", port).parse().unwrap();
WindowBuilder::new(app, "main".to_string(), WindowUrl::External(url)) WindowBuilder::new(app, "main".to_string(), WindowUrl::External(url))
.title("Localhost Example") .title("Localhost Example")

@ -60,7 +60,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { version } from '@tauri-apps/plugin-os'; import { version } from "@tauri-apps/plugin-os";
const osVersion = await version(); const osVersion = await version();
``` ```

@ -60,7 +60,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { exit, relaunch } from '@tauri-apps/plugin-process'; import { exit, relaunch } from "@tauri-apps/plugin-process";
// exit the app with the given status code // exit the app with the given status code
await exit(0); await exit(0);
// restart the app // restart the app

@ -60,8 +60,8 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import { Command } from '@tauri-apps/plugin-shell' import { Command } from "@tauri-apps/plugin-shell";
Command.create('git', ['commit', '-m', 'the commit message']) Command.create("git", ["commit", "-m", "the commit message"]);
``` ```
## Contributing ## Contributing

@ -64,8 +64,8 @@ import { check } from "@tauri-apps/plugin-updater";
import { relaunch } from "@tauri-apps/plugin-process"; import { relaunch } from "@tauri-apps/plugin-process";
const update = await check(); const update = await check();
if (update.response.available) { if (update.response.available) {
await update.downloadAndInstall(); await update.downloadAndInstall();
await relaunch(); await relaunch();
} }
``` ```

@ -67,12 +67,12 @@ await appWindow.setResizable(false);
// Creating new windows: // Creating new windows:
// loading embedded asset: // loading embedded asset:
const webview = new WebviewWindow('theUniqueLabel', { const webview = new WebviewWindow("theUniqueLabel", {
url: 'path/to/page.html' url: "path/to/page.html",
}); });
// alternatively, load a remote URL: // alternatively, load a remote URL:
const webview = new WebviewWindow('theUniqueLabel', { const webview = new WebviewWindow("theUniqueLabel", {
url: 'https://github.com/tauri-apps/tauri' url: "https://github.com/tauri-apps/tauri",
}); });
``` ```

@ -972,12 +972,12 @@ class WindowManager extends WebviewWindowHandle {
label: this.label, label: this.label,
value: size value: size
? { ? {
type: size.type, type: size.type,
data: { data: {
width: size.width, width: size.width,
height: size.height, height: size.height,
}, },
} }
: null, : null,
}); });
} }
@ -1006,12 +1006,12 @@ class WindowManager extends WebviewWindowHandle {
label: this.label, label: this.label,
value: size value: size
? { ? {
type: size.type, type: size.type,
data: { data: {
width: size.width, width: size.width,
height: size.height, height: size.height,
}, },
} }
: null, : null,
}); });
} }
@ -1786,11 +1786,11 @@ function mapMonitor(m: Monitor | null): Monitor | null {
return m === null return m === null
? null ? null
: { : {
name: m.name, name: m.name,
scaleFactor: m.scaleFactor, scaleFactor: m.scaleFactor,
position: mapPhysicalPosition(m.position), position: mapPhysicalPosition(m.position),
size: mapPhysicalSize(m.size), size: mapPhysicalSize(m.size),
}; };
} }
function mapPhysicalPosition(m: PhysicalPosition): PhysicalPosition { function mapPhysicalPosition(m: PhysicalPosition): PhysicalPosition {

Loading…
Cancel
Save