Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Chromium is the Browser value corresponding to Chromium browsers, and try to mimic // their Performance implementation. Chromium = NewBrowser(true) // Gecko is the Browser value corresponding to the firefox browser, and try to mimic // its Performance implementation. Firefox's performance doesn't return floats with // decimal precision. Gecko = NewBrowser(false) )
Functions ¶
This section is empty.
Types ¶
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
func NewBrowser ¶
NewBrowser creates a new instance of the Browser struct with the specified decimal precision flag.
func (*Browser) NewPerformance ¶
func (b *Browser) NewPerformance(mode LengthMode) *Performance
NewPerformance creates a new instance of the Performance struct with the specified length mode and the starting time set to the current time.
func (*Browser) TimeOrigin ¶
TimeOrigin returns a string representation of the current time in milliseconds, with or without decimal precision depending on the associated Browser instance.
func (*Browser) TimeOriginString ¶
TimeOriginString returns a string representation of the current time in milliseconds, with or without decimal precision depending on the associated Browser instance.
type LengthMode ¶
type LengthMode int
const ( SingleDigitMode LengthMode = iota MediumLengthMode LargeLengthMode )
func (LengthMode) Index ¶
func (l LengthMode) Index() int
type Performance ¶
type Performance struct { Mode LengthMode // contains filtered or unexported fields }
func (*Performance) Add ¶
func (p *Performance) Add(offset int64)
Add adds the specified offset value to the underlying offset.
func (*Performance) Current ¶
func (p *Performance) Current() float64
Current returns a float of the current offset with the random decimal value added to it, to match the Browser implementation.
func (*Performance) CurrentString ¶
func (p *Performance) CurrentString() string
CurrentString returns a string representation of the current offset value, including the random decimal value generated to match the Browser implementation.
func (*Performance) Min ¶
func (p *Performance) Min(offset int64)
Min subtracts the specified offset value from the underlying offset.
func (*Performance) Now ¶
func (p *Performance) Now() float64
Now returns the elapsed time since the start of the Performance instance, with or without decimal precision depending on the Browser.