File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
const extension = require ( 'extensionizer' )
2
- const height = 620
3
- const width = 360
4
-
2
+ const NOTIFICATION_HEIGHT = 620
3
+ const NOTIFICATION_WIDTH = 360
5
4
6
5
class NotificationManager {
7
6
@@ -26,13 +25,19 @@ class NotificationManager {
26
25
// bring focus to existing chrome popup
27
26
extension . windows . update ( popup . id , { focused : true } )
28
27
} else {
28
+ const screenWidth = window . screen . width
29
+ const screenHeight = window . screen . height
30
+ const notificationTop = ( screenHeight / 2 ) - ( NOTIFICATION_HEIGHT / 2 )
31
+ const notificationLeft = ( screenWidth / 2 ) - ( NOTIFICATION_WIDTH / 2 )
29
32
const cb = ( currentPopup ) => { this . _popupId = currentPopup . id }
30
33
// create new notification popup
31
34
const creation = extension . windows . create ( {
32
35
url : 'notification.html' ,
33
36
type : 'popup' ,
34
- width,
35
- height,
37
+ width : NOTIFICATION_WIDTH ,
38
+ height : NOTIFICATION_HEIGHT ,
39
+ top : Math . max ( notificationTop , 0 ) ,
40
+ left : Math . max ( notificationLeft , 0 ) ,
36
41
} , cb )
37
42
creation && creation . then && creation . then ( cb )
38
43
}
You can’t perform that action at this time.
0 commit comments