@vixoniccom/module-packager 2.10.2-test.7 → 2.10.3-dev.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/index.html DELETED
@@ -1,88 +0,0 @@
1
- <!DOCTYPE html>
2
- <html style="width: 100%; height: 100%; margin: 0; padding: 0;">
3
-
4
- <head>
5
- <title></title>
6
- </head>
7
-
8
- <body style="width: 100%; height: 100%; margin: 0; padding: 0;">
9
- <webview style="width: 100%; height: 100%; margin: 0; padding: 0;" id="webview"></webview>
10
- <script type="text/javascript">
11
- // import path from 'path'
12
- // import { ipcRenderer } from 'electron'
13
- // import remote from '@electron/remote'
14
- // import ModuleController from '@vixoniccom/module-controller'
15
- const path = require('path')
16
- const ModuleController = require('@vixoniccom/module-controller')
17
- const { ipcRenderer } = require('electron')
18
- const remote = require('@electron/remote')
19
-
20
- ipcRenderer.on('init', (event, options) => {
21
- console.log('[WEBVIEW] init', options)
22
- let webview = document.getElementById('webview')
23
- let win = remote.getCurrentWindow()
24
- webview.setAttribute('nodeintegration', '');
25
- webview.setAttribute('webpreferences', 'contextIsolation=no, nodeIntegration=yes');
26
- webview.addEventListener('did-finish-load', () => {
27
- console.log('[WEBVIEW] did-finish-load fired');
28
- win.show()
29
- win.focus()
30
- })
31
-
32
- webview.addEventListener('did-fail-load', (e) => {
33
- console.error('[WEBVIEW] did-fail-load', e);
34
- });
35
-
36
- console.log('[WEBVIEW] Resolved src:', options.mode === 'watch'
37
- ? `http://localhost:${options.port}/index.html`
38
- : `file://${path.join(options.build, 'index.html')}`);
39
-
40
- webview.src = options.mode === 'watch'
41
- ? `http://localhost:${options.port}/index.html`
42
- : `file://${path.join(options.build, 'index.html')}`
43
-
44
- function getData() {
45
- let data = {}
46
- try {
47
- data.parameters = require(path.join(options.src, '/test/parameters.json')).parameters
48
- } catch (err) {
49
- console.log(err)
50
- console.log('No parameters.')
51
- }
52
-
53
- let escaped = path.join(options.mode === 'watch' ? options.src : options.build, 'test', 'downloads')
54
- console.log("🚀 ~ getData ~ escaped:", escaped)
55
-
56
- // Add file:// to watch because in this mode the app will be in a localhost hosted environment.
57
- if (options.mode === 'watch') escaped = `file://${escaped}`
58
- escaped = escaped.replace(/\\/g, '/')
59
-
60
- data.downloadsPath = escaped
61
-
62
- try {
63
- data.services = require(path.join(options.src, '/test/services.json')).services
64
- console.log(data.services)
65
- } catch (err) {
66
- console.log('No services.')
67
- }
68
-
69
- return data
70
- }
71
-
72
- function getSchema() {
73
- let data = {}
74
- try {
75
- data = require(path.join(options.src, '../configuration.json')).schema
76
- } catch (err) {
77
- console.log('No schema.')
78
- }
79
- return data
80
- }
81
-
82
- ModuleController.init(win, webview, getData(), getSchema(), options.mode === 'watch')
83
- })
84
- </script>
85
-
86
- </body>
87
-
88
- </html>