import TrackedAsyncData from '../tracked-async-data.ts'; /** Given a `Promise`, return a `TrackedAsyncData` object which exposes the state of the promise, as well as the resolved value or thrown error once the promise resolves or fails. The function and helper accept any data, so you may use it freely in contexts where you are receiving data which may or may not be a `Promise`. ## Example Given a component class like this, you can use the result in your template: ```gjs import Component from '@glimmer/component'; import { cached } from 'ember-cached-decorator-polyfill'; import { load } from 'ember-tracked-data/helpers/load'; export default class ExtraInfo extends Component { @cached get someData() { return load(fetch('some-url', this.args.someArg)); } } ``` You can also use the helper directly in your template: ```hbs {{#let (load @somePromise) as |data|}} {{#if data.isLoading}} {{else if data.isLoaded}} {{else if data.isError}} {{/if}} {{/let}} ``` @param data The (async) data we want to operate on: a value or a `Promise` of a value. @returns An object containing the state(, value, and error). @note Prefer to use `TrackedAsyncData` directly! This function is provided simply for symmetry with the helper and backwards compatibility. */ declare function load(data: T | Promise): TrackedAsyncData; export { load, load as default }; //# sourceMappingURL=load.d.ts.map