worldwideweb 0.0.6 → 0.0.8

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/main.cjs ADDED
@@ -0,0 +1,70 @@
1
+ const { app, BrowserWindow, Menu } = require('electron')
2
+
3
+ function createWindow () {
4
+ const mainWindow = new BrowserWindow({
5
+ width: 1024,
6
+ height: 768,
7
+ webPreferences: {
8
+ nodeIntegration: false
9
+ }
10
+ })
11
+
12
+ mainWindow.loadURL('https://databrowser.io/') // Load a URL to start with
13
+
14
+ const mainMenu = Menu.buildFromTemplate(menuTemplate)
15
+ Menu.setApplicationMenu(mainMenu)
16
+ }
17
+
18
+ const menuTemplate = [
19
+ {
20
+ label: 'File',
21
+ submenu: [
22
+ {
23
+ label: 'Exit',
24
+ click () {
25
+ app.quit()
26
+ }
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ label: 'Navigation',
32
+ submenu: [
33
+ {
34
+ label: 'Back',
35
+ accelerator: 'CmdOrCtrl+[',
36
+ click (item, focusedWindow) {
37
+ if (focusedWindow) focusedWindow.webContents.goBack()
38
+ }
39
+ },
40
+ {
41
+ label: 'Forward',
42
+ accelerator: 'CmdOrCtrl+]',
43
+ click (item, focusedWindow) {
44
+ if (focusedWindow) focusedWindow.webContents.goForward()
45
+ }
46
+ },
47
+ {
48
+ label: 'Reload',
49
+ accelerator: 'CmdOrCtrl+R',
50
+ click (item, focusedWindow) {
51
+ if (focusedWindow) focusedWindow.reload()
52
+ }
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+
58
+ app.whenReady().then(createWindow)
59
+
60
+ app.on('window-all-closed', () => {
61
+ if (process.platform !== 'darwin') {
62
+ app.quit()
63
+ }
64
+ })
65
+
66
+ app.on('activate', () => {
67
+ if (BrowserWindow.getAllWindows().length === 0) {
68
+ createWindow()
69
+ }
70
+ })
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "worldwideweb",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "WorldWideWeb browser in JavaScript",
5
- "main": "index.js",
5
+ "main": "main.cjs",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "start": "electron ."
8
9
  },
9
10
  "repository": {
10
11
  "type": "git",
@@ -19,5 +20,8 @@
19
20
  "bugs": {
20
21
  "url": "https://github.com/melvincarvalho/worldwideweb/issues"
21
22
  },
22
- "homepage": "https://github.com/melvincarvalho/worldwideweb#readme"
23
+ "homepage": "https://github.com/melvincarvalho/worldwideweb#readme",
24
+ "devDependencies": {
25
+ "electron": "^24.2.0"
26
+ }
23
27
  }