springroll.AssetSizes Class
Manages filtering of loads to load assets sized for the current device.
define
(
-
id
-
maxSize
-
scale
-
fallback
)
Adds a new size definition.
Parameters:
-
id
String
The name of the folder which contains assets of this size.
-
maxSize
Int
The maximum size in points capable of using this size.
-
scale
Number
-
fallback
Array
The size fallbacks if this size isn't available
for the current asset request.
destroy
()
Destroy and don't use after this
refresh
Object
Recalculate the current preferred size based on width and height
reset
()
Removes all currently defined sizes.
size
Object
Get a size based on the current asset sizes supported
Parameters:
-
[supported]
Object
optional
Return the preferred size if nothing is set
Returns:
Object:
Return the size object with id, scale, maxSize and fallback keys
test
Boolean
Make sure we have a token
_sizes
Array
private
The collection of size objects
_sizesMap
_sizesMap
private
SIZE_TOKEN
String
static
The URL substitution string.
Default: "%SIZE%"