Skip to content

editorGlobalsFileContainer

Class: FileContainer

Generic class that holds a list of files and their contents as part of an Asset. These files could be a resource, a serialized assembly, …

Hierarchy

  • FileContainer

Resource

Index

Constructors

Properties

Methods

Constructors

constructor

+ new FileContainer(options: Partial‹IFileContainerOptions›): FileContainer

Defined in src/assets/FileContainer.ts:30

Parameters:

Name Type Default
options Partial‹IFileContainerOptions {}

Returns: FileContainer

Properties

Private Readonly apiSpecificData

apiSpecificData: Record‹string, any›

Defined in src/assets/FileContainer.ts:30


Private containingAsset

containingAsset: Asset | null = null

Defined in src/assets/FileContainer.ts:25


Private Readonly fileContents

fileContents: Record‹string, Object3D | string | Texture | ArrayBuffer | Record‹string, any››

Defined in src/assets/FileContainer.ts:24


Private Readonly files

files: string[] = []

Defined in src/assets/FileContainer.ts:23


Private hasContentsLoaded

hasContentsLoaded: boolean = false

Defined in src/assets/FileContainer.ts:29


Private hasNamesLoaded

hasNamesLoaded: boolean = false

Defined in src/assets/FileContainer.ts:28


Private Readonly id

id: string | null = null

Defined in src/assets/FileContainer.ts:27


Private Readonly name

name: string | null = null

Defined in src/assets/FileContainer.ts:26

Methods

addFile

addFile(name: string): void

Defined in src/assets/FileContainer.ts:90

Adds a file entry

Parameters:

Name Type Description
name string name of the file to add

Returns: void


getApiSpecificData

getApiSpecificData(fileName: string): any

Defined in src/assets/FileContainer.ts:171

Parameters:

Name Type
fileName string

Returns: any


getContainingAsset

getContainingAsset(): Asset

Defined in src/assets/FileContainer.ts:143

Returns: Asset

the asset that contains this resource


getContent

getContentT›(fileName: string): T

Defined in src/assets/FileContainer.ts:119

Type parameters:

T: Object3D | string | Texture | ArrayBuffer | Record‹string, any› | null

Parameters:

Name Type
fileName string

Returns: T

the content of the specified file, if it already has been loaded, null otherwise.


getFiles

getFiles(): string[]

Defined in src/assets/FileContainer.ts:82

TODO Rename to getFileNames or return actual files

Returns: string[]

a (cloned) list of file names that are in this container


getHasContentsLoaded

getHasContentsLoaded(): boolean

Defined in src/assets/FileContainer.ts:67

Returns: boolean

if all file contents have been loaded see {@link AssetLoader#loadResource}


getHasNamesLoaded

getHasNamesLoaded(): boolean

Defined in src/assets/FileContainer.ts:53

Returns: boolean

if all file names have been loaded see {@link IAssetApi#fillInContainerDetails}


getId

getId(): string

Defined in src/assets/FileContainer.ts:158

Returns: string

the id of the FileContainer. An AssetApi implementation may choose to use unique IDs in additions to the container's name. Null, if unused.


getName

getName(): string

Defined in src/assets/FileContainer.ts:150

Returns: string

name of the FileContainer. Its meaning is that of a folder name.


hasFile

hasFile(fileName: any): boolean

Defined in src/assets/FileContainer.ts:112

Parameters:

Name Type
fileName any

Returns: boolean

whether the resource has the specified file


removeFile

removeFile(name: string): void

Defined in src/assets/FileContainer.ts:101

Removes the specified file and its contents

Parameters:

Name Type Description
name string name of the file

Returns: void


setApiSpecificData

setApiSpecificData(fileName: string, data: any): void

Defined in src/assets/FileContainer.ts:166

Set additional data that is specific to the api implementation this container is created by. Only to be used by the API itself.

Parameters:

Name Type
fileName string
data any

Returns: void


setContainingAsset

setContainingAsset(asset: any): void

Defined in src/assets/FileContainer.ts:135

Parameters:

Name Type
asset any

Returns: void


setContent

setContent(fileName: string, content: Object3D | string | Texture | ArrayBuffer | Record‹string, any›): void

Defined in src/assets/FileContainer.ts:128

Cache the content of a specified file of the resource

Parameters:

Name Type
fileName string
content Object3D | string | Texture | ArrayBuffer | Record‹string, any›

Returns: void


setHasContentsLoaded

setHasContentsLoaded(): void

Defined in src/assets/FileContainer.ts:74

Only to be called by AssetLoader / AssetApi

Returns: void


setHasNamesLoaded

setHasNamesLoaded(): void

Defined in src/assets/FileContainer.ts:60

Only to be called by AssetLoader / AssetAPI

Returns: void