new Resolution()
Private constructor. Instances are normally created internally and passed to resolvers.
Methods
-
committed()
-
Obtain a Promise that will be resolved when the final instance and state has been resolved. Otherwise, it will be rejected with the cause of the resolution failure.
Returns:
- Type
- Promise
-
done()
-
Mark this resolution as done regardless of the current resolved or failed state. "Done" means that, even though a resolver may call the
next()
callback, the process will be aborted and no further resolvers will be invoked. -
error()
-
Get the error that failed the resolution. This error was set by the #fail method.
Returns:
The resolution failure error, ornull
if not failed.- Type
- Error | null
-
fail(error)
-
Fail this resolution with the given error.
Parameters:
Name Type Description error
Error The error representing the cause of the resolution failure. -
failed()
-
Determine if the resolution has failed.
Returns:
true
if #fail was called with an error.- Type
- boolean
-
instance(require)
-
Get the instance that will be the result of the component resolution. This instance is set by the #resolve method.
Parameters:
Name Type Description require
boolean | undefined true
if the instance must be defined,false
if the instance must not be defined, or omit the parameter if no defined checks should occur.Throws:
ResolutionError whenrequire
istrue
and the instance isn't defined orrequire
isfalse
and the instance is defined.Returns:
- Type
- * | null
-
isDone()
-
Determine if this resolution is done; that further resolvers will not be invoked.
Returns:
The done state of this component resolution.- Type
- boolean
-
resolve(instance)
-
Resolve the given instance of a component. This will be come the result of the Container#resolve call that triggered this resolution.
Parameters:
Name Type Description instance
* | null The instance to resolve. -
resolved()
-
Determine if an instance has been resolved.
Returns:
- Type
- boolean
-
toString()
-
Obtain a string representation of this instance.
Returns:
- Type
- string