Class: BundleRegistry

pc.BundleRegistry

Keeps track of which assets are in bundles and loads files from bundles.

Constructor

(private) new BundleRegistry(assets)

Parameters:
Name Type Description
assets pc.AssetRegistry The asset registry
Source:

Methods

(private) canLoadUrl(url) → {Boolean}

Returns true if there is a bundle that contains the specified URL and that bundle is either loaded or currently being loaded.
Parameters:
Name Type Description
url String The url
Source:
Returns:
True or false
Type
Boolean

(private) hasUrl(url) → {Boolean}

Returns true if there is a bundle that contains the specified URL
Parameters:
Name Type Description
url String The url
Source:
Returns:
True or false
Type
Boolean

(private) list() → {Array.<pc.Asset>}

Lists all of the available bundles. This includes bundles that are not loaded.
Source:
Returns:
An array of bundle assets.
Type
Array.<pc.Asset>

(private) listBundlesForAsset(asset) → {Array.<pc.Asset>}

Lists all of the available bundles that reference the specified asset id.
Parameters:
Name Type Description
asset pc.Asset The asset
Source:
Returns:
An array of bundle assets or null if the asset is not in any bundle.
Type
Array.<pc.Asset>

(private) loadUrl(url, callback)

Loads the specified file URL from a bundle that is either loaded or currently being loaded.
Parameters:
Name Type Description
url String The URL. Make sure you are using a relative URL that does not contain any query parameters.
callback function The callback is called when the file has been loaded or if an error occures. The callback expects the first argment to be the error message (if any) and the second argument is the file blob URL.
Source:
Example
var url = asset.getFileUrl().split('?')[0]; // get normalized asset URL
this.app.bundles.loadFile(url, function (err, blobUrl) {
    // do something with the blob URL
});