Home Reference Source
import LocalPromise from 'remote-context/lib/LocalPromise.js'
public class | source

LocalPromise

Example:

const obj = {
  find: () => Promise.resolve('foo')
};

const promise = new LocalPromise(obj);

// resolve the value
promise.then(value => {
  // `value` === `obj`
});

// resolve property of the value
promise.find().then(value => {
  // `value` === 'foo'
});

Constructor Summary

Public Constructor
public

constructor(value: *, rejected: boolean): function

Create a local promise from a given value.

Public Constructors

public constructor(value: *, rejected: boolean): function source

Create a local promise from a given value.

Params:

NameTypeAttributeDescription
value *

The given value

rejected boolean

True if the value should reject

Return:

function

The local promise