docs: update README.md and remove allowlist information (#381)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-20 16:28:27 -07:00
committed by GitHub
parent d677f73495
commit f4069f5588
43 changed files with 386 additions and 282 deletions
+24 -2
View File
@@ -1,4 +1,4 @@
# Window plugin
# Window
Interact with the Tauri window.
@@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
```toml
[dependencies]
tauri-plugin-window = "2.0.0-alpha"
# alternatively with Git:
tauri-plugin-window = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
```
@@ -26,6 +28,13 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
```sh
pnpm add @tauri-apps/plugin-window
# or
npm add @tauri-apps/plugin-window
# or
yarn add @tauri-apps/plugin-window
# alternatively with Git:
pnpm add https://github.com/tauri-apps/tauri-plugin-window#v2
# or
npm add https://github.com/tauri-apps/tauri-plugin-window#v2
@@ -51,7 +60,20 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import * as tauriWindow from "@tauri-apps/plugin-window";
import { appWindow, WebviewWindow } from "@tauri-apps/plugin-window";
// manipulating this window
await appWindow.setResizable(false);
// Creating new windows:
// loading embedded asset:
const webview = new WebviewWindow("theUniqueLabel", {
url: "path/to/page.html",
});
// alternatively, load a remote URL:
const webview = new WebviewWindow("theUniqueLabel", {
url: "https://github.com/tauri-apps/tauri",
});
```
## Contributing
-45
View File
@@ -5,51 +5,6 @@
/**
* Provides APIs to create windows, communicate with other windows and manipulate the current window.
*
* The APIs must be added to [`tauri.allowlist.window`](https://tauri.app/v1/api/config/#allowlistconfig.window) in `tauri.conf.json`:
* ```json
* {
* "tauri": {
* "allowlist": {
* "window": {
* "all": true, // enable all window APIs
* "create": true, // enable window creation
* "center": true,
* "requestUserAttention": true,
* "setResizable": true,
* "setTitle": true,
* "maximize": true,
* "unmaximize": true,
* "minimize": true,
* "unminimize": true,
* "show": true,
* "hide": true,
* "close": true,
* "setDecorations": true,
* "setShadow": true,
* "setAlwaysOnTop": true,
* "setContentProtected": true,
* "setSize": true,
* "setMinSize": true,
* "setMaxSize": true,
* "setPosition": true,
* "setFullscreen": true,
* "setFocus": true,
* "setIcon": true,
* "setSkipTaskbar": true,
* "setCursorGrab": true,
* "setCursorVisible": true,
* "setCursorIcon": true,
* "setCursorPosition": true,
* "setIgnoreCursorEvents": true,
* "startDragging": true,
* "print": true
* }
* }
* }
* }
* ```
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
*
* ## Window events
*
* Events can be listened to using `appWindow.listen`: