# wire.data.DataPromise

## Methods

Use the following methods on data promises.

| Name          | Description                                              |
| ------------- | -------------------------------------------------------- |
| resolve(data) | Resolves a promise as successful and returns the `data`. |
| reject        | Rejects a promise.                                       |

## Events

Use the following callbacks when working with data promises.

| Name       | Description                                           |
| ---------- | ----------------------------------------------------- |
| always     | Called when a promise is either resolved or rejected. |
| done       | Called when a promise is resolved.                    |
| fail       | Called when a promise is rejected.                    |
| processing | Called when a promise is pending an update.           |

```javascript
const promise = new wire.data.DataPromise();

promise
    .done( (data) => {
        // data is avaialble
    })
    .processing( () => {
        // new query is running
    })
    .fail( (ex) => {
        // processing failed
        // do something with the exception object
    })
    .always( () => {
        // all done whether fail or success
        // clean up    
    });
```
