Class jaws.Assets
Loads and processes assets as images, sound, video, json Used internally by JawsJS to create jaws.assets
- Defined in: assets.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
|
Add a random argument-string to assets-urls when loading to bypass any cache
|
|
|
Convert the color fuchia to transparent when loading .bmp-files
|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
|
add(src)
Add array of paths or single path to asset-list.
|
|
|
getOrLoad(src, onload, onerror)
Calls onload right away if asset is available since before, otherwise try to load it
|
|
|
isLoaded(src)
Return true if src is loaded in full
|
|
|
isLoading(src)
Return true if src is in the process of loading (but not yet finishing)
|
|
|
load(src, onload, onerror)
Load a single url src.
|
|
|
loadAll(options)
Load all pre-specified assets
|
Class Detail
jaws.Assets()
Field Detail
{bool}
bust_cache
Add a random argument-string to assets-urls when loading to bypass any cache
{bool}
fuchia_to_transparent
Convert the color fuchia to transparent when loading .bmp-files
Method Detail
-
add(src)Add array of paths or single path to asset-list. Later load with loadAll()
jaws.assets.add("player.png") jaws.assets.add(["media/bullet1.png", "media/bullet2.png"]) jaws.assets.loadAll({onfinish: start_game})- Parameters:
- src
-
getOrLoad(src, onload, onerror)Calls onload right away if asset is available since before, otherwise try to load it
- Parameters:
- src
- onload
- onerror
-
isLoaded(src)Return true if src is loaded in full
- Parameters:
- src
-
isLoading(src)Return true if src is in the process of loading (but not yet finishing)
- Parameters:
- src
-
load(src, onload, onerror)Load a single url src. if onload is specified, it's called on loading-success if onerror is specified, it will be called on any loading-error
jaws.load("media/foo.png")- Parameters:
- src
- onload
- onerror
-
loadAll(options)Load all pre-specified assets
- Parameters:
- options