Interface ISharedResource

A shared resource is a resource that can be shared between multiple objects. This will track when a resource is no longer being used and can be removed.

interface ISharedResource {
    isClosed: boolean;
    isISharedResource: true;
    name: string;
    addReference(ref): void;
    addUnloadListener(listener): void;
    deleteReference(ref): void;
    getMimeType(): Promise<string>;
    toBuffer(): Promise<ArrayBuffer>;
    toJSON(): Promise<SharedResourceJSON>;
}

Hierarchy (view full)

Properties

isClosed: boolean

true if the resource if all references have been deleted.

isISharedResource: true

For runtime introspection.

name: string

The options name of the resource

Methods

  • Add a reference to the resource.

    Parameters

    • ref: any

    Returns void

  • This is only called once.

    Parameters

    • listener: SharedResourceListener

    Returns void

  • Delete a reference to the resource.

    Parameters

    • ref: any

    Returns void

  • The mimetype of the resource

    Returns Promise<string>

  • Return the resource as a Promise to array buffer

    Returns Promise<ArrayBuffer>