Skip to content

Commit

Permalink
feat: warn when no config properties
Browse files Browse the repository at this point in the history
  • Loading branch information
romainlq committed Jun 2, 2018
1 parent 1fba4c7 commit 2ff8c73
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,25 @@ const trySetSize = () => {
};

module.exports.decorateConfig = config => {

if(config[CONFIG_KEY].width && config[CONFIG_KEY].height) {
if (config[CONFIG_KEY].width && config[CONFIG_KEY].height) {
width = config[CONFIG_KEY].width || DEFAULT_WIDTH;
height = config[CONFIG_KEY].height || DEFAULT_HEIGHT;
} else {
console.log('hyper-window-size: \'config.hyperWindowSize\' does not contain both width and height properties');
width = DEFAULT_WIDTH;
height = DEFAULT_HEIGHT;
console.warn("hyper-window-size: `'config.hyperWindowSize'` does not contain both width and height properties");
}

if(config[CONFIG_KEY].startX && config[CONFIG_KEY].startY) {
if (config[CONFIG_KEY].startX && config[CONFIG_KEY].startY) {
startX = config[CONFIG_KEY].startX || DEFAULT_POS_X;
startY = config[CONFIG_KEY].startY || DEFAULT_POS_Y;
} else {
console.log('hyper-window-size: \'config.hyperWindowSize\' does not contain both startX and startY properties');
console.warn("hyper-window-size: `'config.hyperWindowSize'` does not contain both startX and startY properties");
startX = DEFAULT_POS_X;
startY = DEFAULT_POS_Y;
}
trySetSize();

return config;

};

module.exports.onWindow = browserWindow => {
Expand Down

0 comments on commit 2ff8c73

Please sign in to comment.