Skip to content

Commit

Permalink
Updated not keep overriding our emulation metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanndutoit committed Oct 23, 2017
1 parent bd6aa84 commit 1d75965
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -1324,12 +1324,28 @@ module.exports = exports = function(options) {

};

// handle the params
var lastConfig = null;

/**
* Handles setting emulation information
**/
ChromePage.emulate = function(params, fn) {

if(!params || (params || {}).width == 1280) return fn(null);
if(lastConfig &&
lastConfig.width == params.width &&
lastConfig.height == params.height) {

// nope
return fn(null);

} else {

if(!lastConfig) lastConfig = {};
lastConfig.height = params.height;
lastConfig.width = params.width;

}

// add to clear any other emulation
return Emulation.clearDeviceMetricsOverride()
Expand Down

0 comments on commit 1d75965

Please sign in to comment.