mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-26 21:41:48 +02:00
Revert "set readme banners to absolute url"
This reverts commit c46b464c69.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
This plugin provides APIs to read application metadata and macOS app visibility functions.
|
This plugin provides APIs to read application metadata and macOS app visibility functions.
|
||||||
|
|
||||||
@@ -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();
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Use hardware security-keys in your Tauri App.
|
Use hardware security-keys in your Tauri App.
|
||||||
|
|
||||||
@@ -70,7 +70,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 { Authenticator } from '@tauri-apps/plugin-authenticator';
|
import { Authenticator } from "@tauri-apps/plugin-authenticator";
|
||||||
|
|
||||||
const auth = new Authenticator();
|
const auth = new Authenticator();
|
||||||
auth.init(); // initialize transports
|
auth.init(); // initialize transports
|
||||||
@@ -80,9 +80,9 @@ const arr = new Uint32Array(32);
|
|||||||
window.crypto.getRandomValues(arr);
|
window.crypto.getRandomValues(arr);
|
||||||
const b64 = btoa(String.fromCharCode.apply(null, arr));
|
const b64 = btoa(String.fromCharCode.apply(null, arr));
|
||||||
// web-safe base64
|
// web-safe base64
|
||||||
const challenge = b64.replace(/\+/g, '-').replace(/\//g, '_');
|
const challenge = b64.replace(/\+/g, "-").replace(/\//g, "_");
|
||||||
|
|
||||||
const domain = 'https://tauri.app';
|
const domain = "https://tauri.app";
|
||||||
|
|
||||||
// attempt to register with the security key
|
// attempt to register with the security key
|
||||||
const json = await auth.register(challenge, domain);
|
const json = await auth.register(challenge, domain);
|
||||||
@@ -93,7 +93,7 @@ const r2 = await auth.verifyRegistration(
|
|||||||
challenge,
|
challenge,
|
||||||
app,
|
app,
|
||||||
registerResult.registerData,
|
registerResult.registerData,
|
||||||
registerResult.clientData
|
registerResult.clientData,
|
||||||
);
|
);
|
||||||
const j2 = JSON.parse(r2);
|
const j2 = JSON.parse(r2);
|
||||||
|
|
||||||
@@ -108,11 +108,11 @@ const counter = await auth.verifySignature(
|
|||||||
signData.signData,
|
signData.signData,
|
||||||
clientData,
|
clientData,
|
||||||
keyHandle,
|
keyHandle,
|
||||||
pubkey
|
pubkey,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (counter && counter > 0) {
|
if (counter && counter > 0) {
|
||||||
console.log('SUCCESS!');
|
console.log("SUCCESS!");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Automatically launch your application at startup. Supports Windows, Mac (via AppleScript or Launch Agent), and Linux.
|
Automatically launch your application at startup. Supports Windows, Mac (via AppleScript or Launch Agent), and Linux.
|
||||||
|
|
||||||
@@ -62,7 +62,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 { enable, isEnabled, disable } from '@tauri-apps/plugin-autostart';
|
import { enable, isEnabled, disable } from "@tauri-apps/plugin-autostart";
|
||||||
|
|
||||||
await enable();
|
await enable();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Parse arguments from your Command Line Interface.
|
Parse arguments from your Command Line Interface.
|
||||||
|
|
||||||
@@ -67,12 +67,12 @@ 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 {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Read and write to the system clipboard.
|
Read and write to the system clipboard.
|
||||||
|
|
||||||
@@ -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-manager';
|
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
await writeText('Tauri is awesome!');
|
await writeText("Tauri is awesome!");
|
||||||
assert(await readText(), 'Tauri is awesome!');
|
assert(await readText(), "Tauri is awesome!");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Native system dialogs for opening and saving files along with message dialogs.
|
Native system dialogs for opening and saving files along with message dialogs.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Access the file system.
|
Access the file system.
|
||||||
|
|
||||||
@@ -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 { metadata } from '@tauri-apps/plugin-fs';
|
import { metadata } from "@tauri-apps/plugin-fs";
|
||||||
|
|
||||||
await metadata('/path/to/file');
|
await metadata("/path/to/file");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Register global shortcuts.
|
Register global shortcuts.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Access the HTTP client written in Rust.
|
Access the HTTP client written in Rust.
|
||||||
|
|
||||||
@@ -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,
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Expose your apps assets through a localhost server instead of the default custom protocol.
|
Expose your apps assets through a localhost server instead of the default custom protocol.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Configurable logging for your Tauri app.
|
Configurable logging for your Tauri app.
|
||||||
|
|
||||||
@@ -66,14 +66,14 @@ 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 { trace, info, error, attachConsole } from '@tauri-apps/plugin-log';
|
import { trace, info, error, attachConsole } from "@tauri-apps/plugin-log";
|
||||||
|
|
||||||
// with LogTarget::Webview enabled this function will print logs to the browser console
|
// with LogTarget::Webview enabled this function will print logs to the browser console
|
||||||
const detach = await attachConsole();
|
const detach = await attachConsole();
|
||||||
|
|
||||||
trace('Trace');
|
trace("Trace");
|
||||||
info('Info');
|
info("Info");
|
||||||
error('Error');
|
error("Error");
|
||||||
|
|
||||||
// detach the browser console from the log stream
|
// detach the browser console from the log stream
|
||||||
detach();
|
detach();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API.
|
Send message notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Read information about the operating system.
|
Read information about the operating system.
|
||||||
|
|
||||||
@@ -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();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Save filesystem and asset scopes and restore them when the app is reopened.
|
Save filesystem and asset scopes and restore them when the app is reopened.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Position your windows at well-known locations.
|
Position your windows at well-known locations.
|
||||||
|
|
||||||
@@ -66,7 +66,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 { move_window, Position } from '@tauri-apps/plugin-positioner';
|
import { move_window, Position } from "@tauri-apps/plugin-positioner";
|
||||||
|
|
||||||
move_window(Position.TopRight);
|
move_window(Position.TopRight);
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin.
|
This plugin provides APIs to access the current process. To spawn child processes, see the [`shell`](https://github.com/tauri-apps/tauri-plugin-shell) plugin.
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application.
|
Access the system shell. Allows you to spawn child processes and manage files and URLs using their default application.
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Ensure a single instance of your tauri app is running.
|
Ensure a single instance of your tauri app is running.
|
||||||
|
|
||||||
|
|||||||
+14
-14
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx). It supports the `sqlite`, `mysql` and `postgres` drivers, enabled by a Cargo feature.
|
Interface with SQL databases through [sqlx](https://github.com/launchbadge/sqlx). It supports the `sqlite`, `mysql` and `postgres` drivers, enabled by a Cargo feature.
|
||||||
|
|
||||||
@@ -62,16 +62,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 Database from '@tauri-apps/plugin-sql';
|
import Database from "@tauri-apps/plugin-sql";
|
||||||
|
|
||||||
// sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`.
|
// sqlite. The path is relative to `tauri::api::path::BaseDirectory::App`.
|
||||||
const db = await Database.load('sqlite:test.db');
|
const db = await Database.load("sqlite:test.db");
|
||||||
// mysql
|
// mysql
|
||||||
const db = await Database.load('mysql://user:pass@host/database');
|
const db = await Database.load("mysql://user:pass@host/database");
|
||||||
// postgres
|
// postgres
|
||||||
const db = await Database.load('postgres://postgres:password@localhost/test');
|
const db = await Database.load("postgres://postgres:password@localhost/test");
|
||||||
|
|
||||||
await db.execute('INSERT INTO ...');
|
await db.execute("INSERT INTO ...");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
@@ -84,24 +84,24 @@ We use sqlx as our underlying library, adopting their query syntax:
|
|||||||
```javascript
|
```javascript
|
||||||
// INSERT and UPDATE examples for sqlite and postgres
|
// INSERT and UPDATE examples for sqlite and postgres
|
||||||
const result = await db.execute(
|
const result = await db.execute(
|
||||||
'INSERT into todos (id, title, status) VALUES ($1, $2, $3)',
|
"INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
|
||||||
[todos.id, todos.title, todos.status]
|
[todos.id, todos.title, todos.status],
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = await db.execute(
|
const result = await db.execute(
|
||||||
'UPDATE todos SET title = $1, completed = $2 WHERE id = $3',
|
"UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||||
[todos.title, todos.status, todos.id]
|
[todos.title, todos.status, todos.id],
|
||||||
);
|
);
|
||||||
|
|
||||||
// INSERT and UPDATE examples for mysql
|
// INSERT and UPDATE examples for mysql
|
||||||
const result = await db.execute(
|
const result = await db.execute(
|
||||||
'INSERT into todos (id, title, status) VALUES (?, ?, ?)',
|
"INSERT into todos (id, title, status) VALUES (?, ?, ?)",
|
||||||
[todos.id, todos.title, todos.status]
|
[todos.id, todos.title, todos.status],
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = await db.execute(
|
const result = await db.execute(
|
||||||
'UPDATE todos SET title = ?, completed = ? WHERE id = ?',
|
"UPDATE todos SET title = ?, completed = ? WHERE id = ?",
|
||||||
[todos.title, todos.status, todos.id]
|
[todos.title, todos.status, todos.id],
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Simple, persistent key-value store.
|
Simple, persistent key-value store.
|
||||||
|
|
||||||
@@ -60,13 +60,13 @@ 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 { Store } from '@tauri-apps/plugin-store';
|
import { Store } from "@tauri-apps/plugin-store";
|
||||||
|
|
||||||
const store = new Store('.settings.dat');
|
const store = new Store(".settings.dat");
|
||||||
|
|
||||||
await store.set('some-key', { value: 5 });
|
await store.set("some-key", { value: 5 });
|
||||||
|
|
||||||
const val = await store.get('some-key');
|
const val = await store.get("some-key");
|
||||||
assert(val, { value: 5 });
|
assert(val, { value: 5 });
|
||||||
|
|
||||||
await store.save(); // this manually saves the store, otherwise the store is only saved when your app is closed
|
await store.save(); // this manually saves the store, otherwise the store is only saved when your app is closed
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Store secrets and keys using the [IOTA Stronghold](https://github.com/iotaledger/stronghold.rs) encrypted database and secure runtime.
|
Store secrets and keys using the [IOTA Stronghold](https://github.com/iotaledger/stronghold.rs) encrypted database and secure runtime.
|
||||||
|
|
||||||
@@ -64,7 +64,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 { Stronghold, Location } from '@tauri-apps/plugin-stronghold';
|
import { Stronghold, Location } from "@tauri-apps/plugin-stronghold";
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
In-app updates for Tauri applications.
|
In-app updates for Tauri applications.
|
||||||
|
|
||||||
@@ -67,8 +67,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 { check } from '@tauri-apps/plugin-updater';
|
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();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Upload files from disk to a remote server over HTTP.
|
Upload files from disk to a remote server over HTTP.
|
||||||
Download files from a remote HTTP server to disk.
|
Download files from a remote HTTP server to disk.
|
||||||
@@ -61,24 +61,24 @@ 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 { upload } from '@tauri-apps/plugin-upload';
|
import { upload } from "@tauri-apps/plugin-upload";
|
||||||
|
|
||||||
upload(
|
upload(
|
||||||
'https://example.com/file-upload',
|
"https://example.com/file-upload",
|
||||||
'./path/to/my/file.txt',
|
"./path/to/my/file.txt",
|
||||||
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress
|
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress
|
||||||
{ 'Content-Type': 'text/plain' } // optional headers to send with the request
|
{ "Content-Type": "text/plain" }, // optional headers to send with the request
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { download } from 'tauri-plugin-upload-api';
|
import { download } from "tauri-plugin-upload-api";
|
||||||
|
|
||||||
download(
|
download(
|
||||||
'https://example.com/file-download-link',
|
"https://example.com/file-download-link",
|
||||||
'./path/to/save/my/file.txt',
|
"./path/to/save/my/file.txt",
|
||||||
(progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`), // a callback that will be called with the download progress
|
(progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`), // a callback that will be called with the download progress
|
||||||
{ 'Content-Type': 'text/plain' } // optional headers to send with the request
|
{ "Content-Type": "text/plain" }, // optional headers to send with the request
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Expose a WebSocket server to your Tauri frontend.
|
Expose a WebSocket server to your Tauri frontend.
|
||||||
|
|
||||||
@@ -60,11 +60,11 @@ 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 WebSocket from '@tauri-apps/plugin-websocket';
|
import WebSocket from "@tauri-apps/plugin-websocket";
|
||||||
|
|
||||||
const ws = await WebSocket.connect('wss://example.com');
|
const ws = await WebSocket.connect("wss://example.com");
|
||||||
|
|
||||||
await ws.send('Hello World');
|
await ws.send("Hello World");
|
||||||
|
|
||||||
await ws.disconnect();
|
await ws.disconnect();
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Save window positions and sizes and restore them when the app is reopened.
|
Save window positions and sizes and restore them when the app is reopened.
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ app.save_window_state(StateFlags::all()); // will save the state of all open win
|
|||||||
or through Javascript
|
or through Javascript
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { saveWindowState, StateFlags } from '@tauri-apps/plugin-window-state';
|
import { saveWindowState, StateFlags } from "@tauri-apps/plugin-window-state";
|
||||||
|
|
||||||
saveWindowState(StateFlags.ALL);
|
saveWindowState(StateFlags.ALL);
|
||||||
```
|
```
|
||||||
@@ -91,7 +91,7 @@ or through Javascript
|
|||||||
import {
|
import {
|
||||||
restoreStateCurrent,
|
restoreStateCurrent,
|
||||||
StateFlags,
|
StateFlags,
|
||||||
} from '@tauri-apps/plugin-window-state';
|
} from "@tauri-apps/plugin-window-state";
|
||||||
|
|
||||||
restoreStateCurrent(StateFlags.ALL);
|
restoreStateCurrent(StateFlags.ALL);
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||

|

|
||||||
|
|
||||||
Interact with the Tauri window.
|
Interact with the Tauri window.
|
||||||
|
|
||||||
@@ -60,19 +60,19 @@ 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 { appWindow, WebviewWindow } from '@tauri-apps/plugin-window';
|
import { appWindow, WebviewWindow } from "@tauri-apps/plugin-window";
|
||||||
|
|
||||||
// manipulating this window
|
// manipulating this window
|
||||||
await appWindow.setResizable(false);
|
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",
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user