Tracks bandwidth samples and estimates available bandwidth.
- Implementations:
- Extends:
- EventTarget
- Source:
Methods
-
getBandwidth() → {number}
-
Get estimated bandwidth in bits per second.
- Implementations:
- Source:
Returns:
- Type
- number
-
getDataAge() → {number}
-
Get the age of the data in seconds. This is the time since the last sample was collected.
- Implementations:
- Source:
Returns:
- Type
- number
-
sample(delayMs, bytes)
-
Takes a bandwidth sample and dispatches a 'bandwidth' event.
Parameters:
Name Type Description delayMs
number The time it took to collect the sample, in ms. bytes
number The number of bytes downloaded. - Implementations:
- Source:
Fires:
-
supportsCaching() → {boolean}
-
Indicates that this BandwidthEstimator can correctly handle bandwidth samples from cached responses. Cached responses make bandwidth estimation difficult, which then makes sensible adaptation decisions difficult or impossible. So, it's recommended that implementations return false, unless they were explicitly designed to take into account cached responses. If this returns false then all AJAX requests using this BandwidthEstimator will force the end-point to forego caching.
- Implementations:
- Source:
Returns:
- Type
- boolean
Events
-
BandwidthEvent
-
Fired when a new bandwidth estimate is available.
Properties:
Name Type Description type
string 'bandwidth' bubbles
boolean false - Source:
Listeners of This Event: