forked from chromedp/chromedp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
56 lines (42 loc) · 1.14 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Package device contains device emulation definitions for use with chromedp's
// Emulate action.
package device
//go:generate go run gen.go
// Info holds device information for use with chromedp.Emulate.
type Info struct {
// Name is the device name.
Name string
// UserAgent is the device user agent string.
UserAgent string
// Width is the viewport width.
Width int64
// Height is the viewport height.
Height int64
// Scale is the device viewport scale factor.
Scale float64
// Landscape indicates whether or not the device is in landscape mode or
// not.
Landscape bool
// Mobile indicates whether it is a mobile device or not.
Mobile bool
// Touch indicates whether the device has touch enabled.
Touch bool
}
// String satisfies fmt.Stringer.
func (i Info) String() string {
return i.Name
}
// Device satisfies chromedp.Device.
func (i Info) Device() Info {
return i
}
// infoType provides the enumerated device type.
type infoType int
// String satisfies fmt.Stringer.
func (i infoType) String() string {
return devices[i].String()
}
// Device satisfies chromedp.Device.
func (i infoType) Device() Info {
return devices[i]
}