<Await />
component.promise
An already started Promise instance or function that returns a Promise, automatically invoked..promise
Promise | function(controller: AbortController): Promise
promise
will cancel any pending promise and listen to the new one. The promise function is automatically invoked during component construction. If promise
is initially undefined, the Ember Await state will be pending
.Note thatreload
will not do anything whenpromise
has been passed as property not a function.
defer
function(args: any[], controller: AbortController): Promise
run(...args)
. The defer
is commonly used to send data to the server following a user action, such as submitting a form. You can use this in conjunction with promise
to fill the form with existing data, then updating it on submit with defer
.Be aware that when using bothpromise
anddefer
, the shape of their fulfilled value should match, because they both update the samedata
.
initialValue
any | Error
data
or error
(if instance of Error); useful for server-side rendering. When an initialValue
is provided, the promise
will not be invoked on first render if it is a function. Instead, status
will be immediately set to fulfilled
or rejected
and your components will render accordingly. If you want to trigger the promise
regardless, you can call reload()
.Note thatonResolve
oronReject
is not invoked in this case.
onResolve
function(data: any): void
onReject
function(reason: Error): void
onCancel
function(): void
cancel()
or automatically due to arguments changes or unrendering.