File tree 2 files changed +20
-6
lines changed
2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,18 @@ function Timer() {
17
17
var time = object . getCurrentTime ( ) ;
18
18
19
19
if ( time . minutes >= 25 ) {
20
- object . stop ( true ) ;
20
+ object . stop ( false ) ;
21
21
return ;
22
22
}
23
23
24
24
object . emit ( 'update' , time ) ;
25
25
}
26
26
27
27
object . stop = function ( interrupt ) {
28
+ if ( interrupt === typeof 'undefined' || interrupt == null ) {
29
+ interrupt = true ;
30
+ }
31
+
28
32
clearInterval ( interval ) ;
29
33
object . emit ( 'stop' , interrupt ) ;
30
34
}
Original file line number Diff line number Diff line change @@ -15,11 +15,21 @@ var menuTray = null,
15
15
menuItems = {
16
16
'start' : {
17
17
label : 'Start' ,
18
- click : timer . start
18
+ click : function ( ) {
19
+ timer . start ( )
20
+ }
19
21
} ,
20
22
'stop' : {
21
23
label : 'Stop' ,
22
- click : timer . stop
24
+ click : function ( ) {
25
+ timer . stop ( )
26
+ } ,
27
+ } ,
28
+ 'quit' : {
29
+ label : 'Quit Application' ,
30
+ click : function ( ) {
31
+ app . quit ( )
32
+ } ,
23
33
}
24
34
} ;
25
35
@@ -34,11 +44,11 @@ app.on('ready', function(){
34
44
function init ( ) {
35
45
menuTray = new tray ( path . join ( __dirname , 'assets/img/pomodoro-w.png' ) ) ;
36
46
menuTray . setTitle ( '' ) ;
37
- menuTray . setContextMenu ( menu . buildFromTemplate ( [ menuItems . start ] ) ) ;
47
+ menuTray . setContextMenu ( menu . buildFromTemplate ( [ menuItems . start , menuItems . quit ] ) ) ;
38
48
39
49
timer . on ( 'start' , function ( ) {
40
50
window . webContents . send ( 'play-sound' , path . join ( __dirname , 'assets/sound/windup.mp3' ) ) ;
41
- menuTray . setContextMenu ( menu . buildFromTemplate ( [ menuItems . stop ] ) ) ;
51
+ menuTray . setContextMenu ( menu . buildFromTemplate ( [ menuItems . stop , menuItems . quit ] ) ) ;
42
52
} ) ;
43
53
44
54
timer . on ( 'stop' , function ( interrupted ) {
@@ -51,7 +61,7 @@ function init() {
51
61
sound : path . join ( __dirname , 'assets/sound/bell.mp3' ) } ) ;
52
62
}
53
63
54
- menuTray . setContextMenu ( menu . buildFromTemplate ( [ menuItems . start ] ) ) ;
64
+ menuTray . setContextMenu ( menu . buildFromTemplate ( [ menuItems . start , menuItems . quit ] ) ) ;
55
65
} ) ;
56
66
57
67
timer . on ( 'update' , function ( data ) {
You can’t perform that action at this time.
0 commit comments