@tauri-apps/plugin-window-state 2.0.0-rc.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -7
- package/dist-js/index.cjs +3 -3
- package/dist-js/index.d.ts +1 -1
- package/dist-js/index.js +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Save window positions and sizes and restore them when the app is reopened.
|
|
4
4
|
|
|
5
|
+
| Platform | Supported |
|
|
6
|
+
| -------- | --------- |
|
|
7
|
+
| Linux | ✓ |
|
|
8
|
+
| Windows | ✓ |
|
|
9
|
+
| macOS | ✓ |
|
|
10
|
+
| Android | x |
|
|
11
|
+
| iOS | x |
|
|
12
|
+
|
|
5
13
|
## Install
|
|
6
14
|
|
|
7
|
-
_This plugin requires a Rust version of at least **1.
|
|
15
|
+
_This plugin requires a Rust version of at least **1.78**_
|
|
8
16
|
|
|
9
17
|
There are three general methods of installation that we can recommend.
|
|
10
18
|
|
|
@@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
|
|
|
18
26
|
|
|
19
27
|
```toml
|
|
20
28
|
[dependencies]
|
|
21
|
-
tauri-plugin-window-state = "2.0.0
|
|
29
|
+
tauri-plugin-window-state = "2.0.0"
|
|
22
30
|
# alternatively with Git:
|
|
23
31
|
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
|
24
32
|
```
|
|
@@ -71,9 +79,9 @@ app.save_window_state(StateFlags::all()); // will save the state of all open win
|
|
|
71
79
|
or through Javascript
|
|
72
80
|
|
|
73
81
|
```javascript
|
|
74
|
-
import { saveWindowState, StateFlags } from
|
|
82
|
+
import { saveWindowState, StateFlags } from '@tauri-apps/plugin-window-state'
|
|
75
83
|
|
|
76
|
-
saveWindowState(StateFlags.ALL)
|
|
84
|
+
saveWindowState(StateFlags.ALL)
|
|
77
85
|
```
|
|
78
86
|
|
|
79
87
|
To manually restore a windows state from disk you can call the `restore_state()` method exposed by the `WindowExt` trait:
|
|
@@ -90,10 +98,10 @@ or through Javascript
|
|
|
90
98
|
```javascript
|
|
91
99
|
import {
|
|
92
100
|
restoreStateCurrent,
|
|
93
|
-
StateFlags
|
|
94
|
-
} from
|
|
101
|
+
StateFlags
|
|
102
|
+
} from '@tauri-apps/plugin-window-state'
|
|
95
103
|
|
|
96
|
-
restoreStateCurrent(StateFlags.ALL)
|
|
104
|
+
restoreStateCurrent(StateFlags.ALL)
|
|
97
105
|
```
|
|
98
106
|
|
|
99
107
|
## Contributing
|
package/dist-js/index.cjs
CHANGED
|
@@ -20,13 +20,13 @@ exports.StateFlags = void 0;
|
|
|
20
20
|
* Save the state of all open windows to disk.
|
|
21
21
|
*/
|
|
22
22
|
async function saveWindowState(flags) {
|
|
23
|
-
await core.invoke(
|
|
23
|
+
await core.invoke('plugin:window-state|save_window_state', { flags });
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Restore the state for the specified window from disk.
|
|
27
27
|
*/
|
|
28
28
|
async function restoreState(label, flags) {
|
|
29
|
-
await core.invoke(
|
|
29
|
+
await core.invoke('plugin:window-state|restore_state', { label, flags });
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Restore the state for the current window from disk.
|
|
@@ -38,7 +38,7 @@ async function restoreStateCurrent(flags) {
|
|
|
38
38
|
* Get the name of the file used to store window state.
|
|
39
39
|
*/
|
|
40
40
|
async function filename() {
|
|
41
|
-
return await core.invoke(
|
|
41
|
+
return await core.invoke('plugin:window-state|filename');
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
exports.filename = filename;
|
package/dist-js/index.d.ts
CHANGED
package/dist-js/index.js
CHANGED
|
@@ -18,13 +18,13 @@ var StateFlags;
|
|
|
18
18
|
* Save the state of all open windows to disk.
|
|
19
19
|
*/
|
|
20
20
|
async function saveWindowState(flags) {
|
|
21
|
-
await invoke(
|
|
21
|
+
await invoke('plugin:window-state|save_window_state', { flags });
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Restore the state for the specified window from disk.
|
|
25
25
|
*/
|
|
26
26
|
async function restoreState(label, flags) {
|
|
27
|
-
await invoke(
|
|
27
|
+
await invoke('plugin:window-state|restore_state', { label, flags });
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Restore the state for the current window from disk.
|
|
@@ -36,7 +36,7 @@ async function restoreStateCurrent(flags) {
|
|
|
36
36
|
* Get the name of the file used to store window state.
|
|
37
37
|
*/
|
|
38
38
|
async function filename() {
|
|
39
|
-
return await invoke(
|
|
39
|
+
return await invoke('plugin:window-state|filename');
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export { StateFlags, filename, restoreState, restoreStateCurrent, saveWindowState };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-window-state",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Save window positions and sizes and restore them when the app is reopened.",
|
|
5
|
-
"license": "MIT
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"authors": [
|
|
7
7
|
"Tauri Programme within The Commons Conservancy"
|
|
8
8
|
],
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"LICENSE"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@tauri-apps/api": "^2.0.0
|
|
28
|
+
"@tauri-apps/api": "^2.0.0"
|
|
29
29
|
}
|
|
30
30
|
}
|