# ApplicationCacheController Class

Defined in: `js/controller/ApplicationCacheController.js:11`
Module: controller
Parent Module: StructureJS

The ApplicationCacheController is a static class works with the window applicationCache object.

## Index

Show: Inherited Protected Private Deprecated

### Properties

- _appCache static
- _eventDispatcher static
- isEnabled static

### Methods

- _onCached static
- _onChecking static
- _onDownloading static
- _onError static
- _onNoUpdate static
- _onObsolete static
- _onProgress static
- _onUpdateReady static
- addEventListener static
- dispatchEvent static
- removeEventListener static

## Properties

### `_appCache` ApplicationCache private static

Defined in `js/controller/ApplicationCacheController.js:247`

A reference to the applicationCache property on the window object.

### `_eventDispatcher` EventDispatcher private static

Defined in `js/controller/ApplicationCacheController.js:256`

A reference to the EventDispatcher object.

### `isEnabled` Boolean public static

Defined in `js/controller/ApplicationCacheController.js:265`

The isEnabled property is used to keep track of the enabled state.

Default: false

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

## Methods

### `_onCached`
(

- `event`

)
private static

Defined in `js/controller/ApplicationCacheController.js:89`

The resources listed in the manifest have been fully downloaded, and the application is now cached locally.

#### Parameters:

- `event` DOMApplicationCacheEvent

  The native browser event from the DOMApplicationCache.

### `_onChecking`
(

- `event`

)
private static

Defined in `js/controller/ApplicationCacheController.js:102`

The browser is checking for an update, or is attempting to download the cache manifest for the first time. This is always the first event in the sequence.

#### Parameters:

- `event` DOMApplicationCacheEvent

  The native browser event from the DOMApplicationCache.

### `_onDownloading`
(

- `event`

)
private static

Defined in `js/controller/ApplicationCacheController.js:116`

The browser has started to download the cache manifest, either for the first time or because changes have been detected.

#### Parameters:

- `event` DOMApplicationCacheEvent

  The native browser event from the DOMApplicationCache.

### `_onError`
(

- `event`

)
private static

Defined in `js/controller/ApplicationCacheController.js:129`

An error occurred at some point - this could be caused by a number of things. This will always be the last event in the sequence.

#### Parameters:

- `event` DOMApplicationCacheEvent

  The native browser event from the DOMApplicationCache.

### `_onNoUpdate`
(

- `event`

)
private static

Defined in `js/controller/ApplicationCacheController.js:142`

The cache manifest hadn't changed.

#### Parameters:

- `event` DOMApplicationCacheEvent

  The native browser event from the DOMApplicationCache.

### `_onObsolete`
(

- `event`

)
private static

Defined in `js/controller/ApplicationCacheController.js:154`

The cache manifest file could not be found, indicating that the cache is no longer needed. The application cache is being deleted.

#### Parameters:

- `event` DOMApplicationCacheEvent

  The native browser event from the DOMApplicationCache.

### `_onProgress`
(

- `event`

)
private static

Defined in `js/controller/ApplicationCacheController.js:167`

The browser had downloaded and cached an asset. This is fired once for every file that is downloaded (including the current page which is cached implicitly).

#### Parameters:

- `event` DOMApplicationCacheEvent

  The native browser event from the DOMApplicationCache.

### `_onUpdateReady`
(

- `event`

)
private static

Defined in `js/controller/ApplicationCacheController.js:180`

The resources listed in the manifest have been newly re-downloaded, and the script can use swapCache() to switch to the new cache.

#### Parameters:

- `event` DOMApplicationCacheEvent

  The native browser event from the DOMApplicationCache.

### `addEventListener`
(

- `type`
- `callback`
- `scope`
- `[priority=0]`

)
static

Defined in `js/controller/ApplicationCacheController.js:193`

Registers an event listener object with an ApplicationCacheController object so that the listener receives notification of an event.

#### Parameters:

- `type` String

  The type of event.

- `callback` Function

  The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing, as this example shows. @example function(event:Event):void

- `scope` Any

  Binds the scope to a particular object (scope is basically what "this" refers to in your function). This can be very useful in JavaScript because scope isn't generally maintained.

- `[priority=0]` Int optional

  Influences the order in which the listeners are called. Listeners with lower priorities are called after ones with higher priorities.

#### Example:

     ApplicationCacheController.addEventListener(ApplicationCacheEvent.UPDATE_READY, this._handlerMethod, this);
     _handlerMethod(event) {
         console.log(event.target + " sent the event.");
     }

### `dispatchEvent`
(

- `event`

)
static

Defined in `js/controller/ApplicationCacheController.js:230`

Dispatches an event within the ApplicationCacheController object.

#### Parameters:

- `event` ApplicationCacheEvent

  The Event object that is dispatched into the event flow. You can create custom events, the only requirement is all events must extend the ApplicationCacheEvent.

#### Example:

     let event = new ApplicationCacheEvent(ApplicationCacheEvent.UPDATE_READY);
     ApplicationCacheController.dispatchEvent(event);

     // Here is a common inline event being dispatched
     ApplicationCacheController.dispatchEvent(new ApplicationCacheEvent(ApplicationCacheEvent.UPDATE_READY));

### `removeEventListener`
(

- `type`
- `callback`
- `scope`

)
static

Defined in `js/controller/ApplicationCacheController.js:212`

Removes a specified listener from the ApplicationCacheController object.

#### Parameters:

- `type` String

  The type of event.

- `callback` Function

  The listener object to remove.

- `scope` Any

  The scope of the listener object to be removed. This was added because it was need for the ApplicationCacheController class. To keep things consistent this parameter is required.

#### Example:

     ApplicationCacheController.removeEventListener(ApplicationCacheEvent.UPDATE_READY, this._handlerMethod, this);
     _handlerMethod(event) {
         console.log(event.target + " sent the event.");
     }

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index