Constructor
new Api(pObject, pRoute, pOriginopt)
Parameters
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pObject |
object | Promise | A bound object this |
||
pRoute |
Array.<any> | The stack of routes that led to this Api pointer. |
||
pOrigin |
object |
<optional> |
{} | An object to use as the origin of this Api. |
Members
proxified :Proxy
A proxy that returns this.route(A).proxified
when property A
is accessed and this.close(B)
when called with parameter B
.
then
and catch
however are directly passed through.
Methods
catch(fail) → {Promise}
Shorthand for this.close().catch()
.
Parameters
Name | Type | Description |
---|---|---|
fail |
function | The fail function. |
Returns
Rejects if this.close()
rejects.
- Type
- Promise
close(dataopt) → {Promise}
Closes the Api with the closing function of its exposed object.
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
data |
any |
<optional> |
The data to close with. |
Returns
A promise that resolves to the return value of the closing function.
- Type
- Promise