win_webview2 1.0.3 → 1.0.4

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Win Webview2
2
2
 
3
+ ## npm install
4
+
5
+ ```npm i win_webview2```
6
+
3
7
 
4
8
  Win Webview2 is a GUI toolkit for building desktop applications with Node.js. It is similar to Electron but significantly smaller because Win Webview2 utilizes Microsoft WebView2, which is already installed on Windows 10 and later versions.
5
9
 
@@ -24,4 +28,25 @@ A menu will appear in the terminal with the following options:
24
28
  "icon_path": "./icon.png",
25
29
  "outdir": "./dist"
26
30
  }
27
- ```
31
+ ```
32
+
33
+ ## Open Webview Frome Node
34
+
35
+ ```js
36
+ import { openDialogFile, openDialogFolder, openWeb } from 'win_webview2';
37
+
38
+ function openWebview(address) {
39
+ openWeb({
40
+ height : 400,
41
+ width: 800,
42
+ kiosk : false,
43
+ maximize : false,
44
+ title : "auto",
45
+ url : address,
46
+ isDebugMode : false
47
+ })
48
+ }
49
+
50
+ ```
51
+
52
+ look at github examples folder for detail
package/argtype.ts CHANGED
@@ -7,6 +7,7 @@ export type OpenWebArg = {
7
7
  kiosk: boolean
8
8
  maximize: boolean
9
9
  title: string
10
+ isDebugMode : boolean
10
11
  }
11
12
 
12
13
  export type OpenDialogFileArg = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "win_webview2",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/nnttoo/win_webview2"
Binary file
Binary file
package/index.js DELETED
@@ -1,98 +0,0 @@
1
-
2
- var ffi = require('ffi-napi');
3
-
4
- var arc = require('os').arch();
5
- const path = require("path")
6
-
7
- let libFilePath = "./bin/Win32/";
8
- if (arc == "x64") {
9
- console.log("using x64")
10
- libFilePath = "./bin/x64/";
11
- }
12
-
13
- libFilePath = path.join(__dirname, libFilePath);
14
-
15
- const mainDllPath = path.join(libFilePath, "win_webview2_lib.dll");
16
- const webviewDllPath = path.join(libFilePath, "WebView2Loader.dll");
17
-
18
- ffi.Library(webviewDllPath);
19
-
20
-
21
-
22
-
23
- module.exports = {
24
-
25
-
26
-
27
- // void OpenWebview(
28
- // const char* url,
29
- // int width,
30
- // int height,
31
- // bool maximize,
32
- // bool kiosk,
33
- // const char* title,
34
- // const char* windowclassname,
35
- // const char* windowParentclassname,
36
- // CallbackType cb
37
-
38
- // )
39
-
40
- /**
41
- * @typedef OpenWebviewProp
42
- * @property {string} url
43
- * @property {int} width
44
- * @property {int} height
45
- * @property {bool} maximize
46
- * @property {bool} kiosk
47
- * @property {string} title
48
- * @property {string} windowclassname
49
- * @property {string} windowParentclassname
50
- * @property {SimpleFFIcallback} ffiCallback
51
- * @property {(string : str)=>void} callback
52
- *
53
- * @param {OpenWebviewProp} prop
54
- */
55
- openWebview: (prop) => {
56
- var libm = ffi.Library(mainDllPath, {
57
- 'OpenWebview': ['void',
58
- [
59
- 'string', //url
60
- 'int', //width
61
- 'int', // height
62
- 'bool', // maximize
63
- 'bool', // kiosk
64
- 'string', // title.
65
- 'string', // windowclassname
66
- 'string', // windowParentclassname
67
- 'pointer', // CallbackType
68
- ]]
69
- });
70
-
71
- return new Promise((r,x)=>{
72
- libm.OpenWebview.async(
73
- prop.url,
74
- prop.width,
75
- prop.height,
76
- prop.maximize,
77
- prop.kiosk,
78
- prop.title,
79
- prop.windowclassname,
80
- prop.windowParentclassname,
81
-
82
- prop.ffiCallback,
83
- (e, res) => {
84
- if(e){
85
- x(e);
86
- } else {
87
- r(res);
88
- }
89
- }
90
-
91
- )
92
- })
93
-
94
-
95
-
96
-
97
- }
98
- }