Skip to content

Commit ba74b75

Browse files
author
Joanne Pham
committed
Address PR review comments
1. Use const 2. Allow width and height to be set with optional parameters 3. Use ES6 string template
1 parent 4f38f9e commit ba74b75

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

addon/services/ember-oauth2.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,11 @@ export default Ember.Service.extend(Ember.Evented, {
8080
@return {Object} On resolve returns reference to the opened window.
8181
On reject returns Object with reference to dialog and error.
8282
*/
83-
openWindow(url) {
84-
let windowWidth = 600;
85-
let windowHeight = 800;
86-
let windowLeft = (window.screen.width / 2) - (windowWidth / 2);
87-
let windowTop = (window.screen.height / 2) - (windowHeight / 2);
88-
let options = 'menubar, width=' + windowWidth + ', height=' + windowHeight + ', top=' + windowTop + ', left=' + windowLeft;
89-
let dialog = window.open(url, 'Authorize', options);
83+
openWindow(url, windowWidth=600, windowHeight=800) {
84+
const windowLeft = (window.screen.width / 2) - (windowWidth / 2);
85+
const windowTop = (window.screen.height / 2) - (windowHeight / 2);
86+
const options = `menubar, width=${windowWidth}, height=${windowHeight}, top=${windowTop}, left=${windowLeft}`;
87+
const dialog = window.open(url, 'Authorize', options);
9088
if (window.focus && dialog) { dialog.focus(); }
9189
return new Ember.RSVP.Promise(function(resolve, reject) {
9290
if (dialog) {

0 commit comments

Comments
 (0)