Home Reference Source
import AssetLoader from 'potassium-es/src/AssetLoader.js'
public class | source

AssetLoader

Extends:

EventHandler → AssetLoader

AssetLoader receives the URLs of assets to load, fetches them, and then fires an event when they're loaded or failed.

Static Member Summary

Static Public Members
public static get

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

async get(url: string): Promise<Blob?>

public

has(url: *): boolean

public

isFailed(url: *): boolean

public
public

isLoaded(url: *): boolean

public

Inherited Summary

From class EventHandler
public get

listeners: EventListener[]: *

public

addListener(callback: function(eventName: string, eventSource: EventHandler), eventName: Object | Symbol, once: bool)

public
public

removeListener(callback: *, eventName: undefined)

public

trigger(eventName: *, params: ...*)

Send an event to listeners

Static Public Members

public static get Singleton: * source

Public Constructors

public constructor() source

Public Methods

public async get(url: string): Promise<Blob?> source

Params:

NameTypeAttributeDescription
url string

Return:

Promise<Blob?>

public has(url: *): boolean source

Params:

NameTypeAttributeDescription
url *

Return:

boolean

true if the URL has been queued or fetched

public isFailed(url: *): boolean source

Params:

NameTypeAttributeDescription
url *

Return:

boolean

url true if a fetch has completed successfully

public isFetched(url: string): boolean source

Params:

NameTypeAttributeDescription
url string

Return:

boolean

true if the asset fetch has completed, even if it was a failure

public isLoaded(url: *): boolean source

Params:

NameTypeAttributeDescription
url *

Return:

boolean

url true if a fetch has completed successfully

public isQueued(url: string): boolean source

Params:

NameTypeAttributeDescription
url string

Return:

boolean

true if the URL is queued for fetching