@livx.cc/native-kit 0.45.17 → 0.45.19
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/package.json +1 -1
- package/src/modules/webview.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livx.cc/native-kit",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.19",
|
|
4
4
|
"description": "Isomorphic native-capabilities kit for PWAs — same API in browser and in an appwrap native shell. Zero dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Elya Livshitz",
|
package/src/modules/webview.ts
CHANGED
|
@@ -17,6 +17,18 @@ export interface WebViewOpenOptions {
|
|
|
17
17
|
bottom?: number;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/** A cookie as data; `expires` = unix seconds, absent/null = session cookie. A leading-dot `domain` = domain cookie. */
|
|
21
|
+
export interface WebViewCookie {
|
|
22
|
+
name: string;
|
|
23
|
+
value: string;
|
|
24
|
+
domain: string;
|
|
25
|
+
path?: string;
|
|
26
|
+
secure?: boolean;
|
|
27
|
+
httpOnly?: boolean;
|
|
28
|
+
expires?: number | null;
|
|
29
|
+
sameSite?: string | null;
|
|
30
|
+
}
|
|
31
|
+
|
|
20
32
|
export type WebViewNavOp = 'back' | 'forward' | 'reload' | 'go';
|
|
21
33
|
|
|
22
34
|
/**
|
|
@@ -51,6 +63,11 @@ export class WebViewModule {
|
|
|
51
63
|
return this.kit.invoke('webview.show', { ...opts });
|
|
52
64
|
}
|
|
53
65
|
|
|
66
|
+
/** Write cookies into the overlay's persistent jar (e.g. before {@link open}, to arrive signed in); resolves once stored. */
|
|
67
|
+
setCookies(cookies: WebViewCookie[]): Promise<{ set: number }> {
|
|
68
|
+
return this.kit.invoke('webview.cookies', { cookies });
|
|
69
|
+
}
|
|
70
|
+
|
|
54
71
|
/** Tear the overlay down (fires {@link onClosed}). */
|
|
55
72
|
close(): Promise<void> {
|
|
56
73
|
return this.kit.invoke('webview.close', {});
|