Skip to content

Commit

Permalink
change interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ielgnaw committed Jul 18, 2017
1 parent 4173f4d commit 7a73700
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
30 changes: 14 additions & 16 deletions examples/custom_emulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@ const path = require('path')

Chromy.addCustomDevice([
{
iPad: {
width: 1536,
height: 2048,
deviceScaleFactor: 2.0,
pageScaleFactor: 1.0,
mobile: true,
userAgent: 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
}
name: 'iPad',
width: 1536,
height: 2048,
deviceScaleFactor: 2.0,
pageScaleFactor: 1.0,
mobile: true,
userAgent: 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
},
{
customApp: {
width: 640,
height: 880,
deviceScaleFactor: 2.0,
pageScaleFactor: 1.0,
mobile: true,
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12F70 baiduboxapp/6.9.0.0'
}
name: 'customApp',
width: 640,
height: 880,
deviceScaleFactor: 2.0,
pageScaleFactor: 1.0,
mobile: true,
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12F70 baiduboxapp/6.9.0.0'
}
])

Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ class Chromy extends Document {
cusDevices = [cusDevices]
}
cusDevices.forEach(item => {
const deviceName = Object.keys(item)[0]
devices[deviceName] = item[deviceName]
devices[item.name] = item
})
}

Expand Down

0 comments on commit 7a73700

Please sign in to comment.