Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b1451d9

Browse files
divyanshu rawatdivyanshu rawat
divyanshu rawat
authored and
divyanshu rawat
committed
sample application a countdown
1 parent 71cbafb commit b1451d9

File tree

6 files changed

+74
-1
lines changed

6 files changed

+74
-1
lines changed

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "electron-js",
33
"version": "1.0.0",
44
"description": "",
5-
"main": "index.js",
5+
"main": "src/main.js",
66
"scripts": {
77
"start": "electron ."
88
},

‎src/count.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
3+
module.exports = function countdown(){
4+
5+
let count = 10;
6+
var interval = setInterval(_ => {
7+
count--;
8+
9+
console.log("count : ",count);
10+
if(count == 0){
11+
12+
clearInterval(interval);
13+
}
14+
},1000)
15+
16+
}

‎src/index.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
h1{
3+
4+
font-family: sans-serif;
5+
color: red;
6+
}

‎src/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
<html>
4+
<head>
5+
6+
<link rel="stylesheet" type="text/css" href="index.css">
7+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
8+
<!-- <script type="text/javascript" src = "count.js"></script> -->
9+
</head>
10+
<body>
11+
<h1> Welcome </h1>
12+
</body>
13+
14+
<script>require('./render')</script>
15+
</html>

‎src/main.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const electron = require("electron");
2+
3+
const app = electron.app;
4+
5+
const countdown = require('./count');
6+
7+
let mainWindow;
8+
// In order to see some UI in my electron application I have importing browserwindow module.
9+
10+
const BrowserWindow = electron.BrowserWindow;
11+
12+
app.on('ready', _=> {
13+
14+
mainWindow = new BrowserWindow({
15+
16+
width:400,
17+
height:300
18+
19+
20+
})
21+
22+
23+
mainWindow.loadURL('file://' + __dirname + '/index.html');
24+
25+
countdown();
26+
27+
mainWindow.on('closed',_ =>{
28+
29+
console.log("Closed");
30+
31+
mainWindow = null;
32+
33+
});
34+
35+
36+
})

‎src/render.js

Whitespace-only changes.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /