Options
All
  • Public
  • Public/Protected
  • All
Menu

Serves resources stored in the bundle. Some resources are removed from the bundle and stored separately to shrink what needs to be kept in memory.

Hierarchy

  • ServeResourceHandler

Implements

Index

Constructors

constructor

  • Parameters

    • app: ViewerApplication
    • resourceGetter: function
        • (key: string): Promise<string>
        • Parameters

          • key: string

          Returns Promise<string>

    • resourceSetter: function
        • (key: string, value: string): Promise<void>
        • Parameters

          • key: string
          • value: string

          Returns Promise<void>

    • resourceRemover: function
        • (key: string): Promise<void>
        • Parameters

          • key: string

          Returns Promise<void>

    Returns ServeResourceHandler

Properties

app

isReady

isReady: Observable<boolean>

name

name: string

resourceGetter

resourceGetter: function

Type declaration

    • (key: string): Promise<string>
    • Parameters

      • key: string

      Returns Promise<string>

resourceRemover

resourceRemover: function

Type declaration

    • (key: string): Promise<void>
    • Parameters

      • key: string

      Returns Promise<void>

resourceSetter

resourceSetter: function

Type declaration

    • (key: string, value: string): Promise<void>
    • Parameters

      • key: string
      • value: string

      Returns Promise<void>

Methods

clear

  • clear(): void
  • Clear all known resources.

    Returns void

getResourceValue

  • getResourceValue(key: string): Promise<any>
  • Get the resouce for the given key.

    Parameters

    • key: string

    Returns Promise<any>

handle

  • Serve the request using the given rule from the bundle.

    Parameters

    Returns boolean

    Whether the request was successfully handled.

loadBundle

  • loadBundle(bundle: Bundle): void
  • Serve all future requests with resources from the given bundle.

    Parameters

    • bundle: Bundle

      The bundle to serve from.

    Returns void

stripAndStoreBundle

  • Strip large values out of the bundle and store them separately. This does not make the bundle active. That is done with loadBundle.

    Parameters

    • bundle: Bundle

      The bundle to process.

    Returns Promise<Bundle>

    a promise of the bundle that was passed in, after it is processed.

unstoreBundle

  • Unstore all entries stored by stripAndStoreBundle. The values are not returned to the bundle. It's assumed we're just going to throw it away.

    Parameters

    • bundle: Bundle

      The bundle to process.

    Returns Promise<Bundle>

    a promise of the bundle that was passed in, after it is processed.

updateEntry

  • Updates an entry in the bundle.

    Parameters

    Returns Promise<void>

Static getResourceStorageKey

  • getResourceStorageKey(bundleId: string, entryKey: string): string
  • Parameters

    • bundleId: string
    • entryKey: string

    Returns string