mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
fix(stronghold): remove constructor, add static load function (#416)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"stronghold-js": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Added `Stronghold.load` and removed its constructor.
|
||||||
@@ -395,21 +395,20 @@ export class Stronghold {
|
|||||||
* @param path
|
* @param path
|
||||||
* @param password
|
* @param password
|
||||||
*/
|
*/
|
||||||
constructor(path: string, password: string) {
|
private constructor(path: string) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
void this.reload(password);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force a reload of the snapshot. The password must match.
|
* Load the snapshot if it exists (password must match), or start a fresh stronghold instance otherwise.
|
||||||
* @param password
|
* @param password
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
private async reload(password: string): Promise<void> {
|
static async load(path: string, password: string): Promise<Stronghold> {
|
||||||
return await invoke("plugin:stronghold|initialize", {
|
return await invoke("plugin:stronghold|initialize", {
|
||||||
snapshotPath: this.path,
|
snapshotPath: path,
|
||||||
password,
|
password,
|
||||||
});
|
}).then(() => new Stronghold(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user