Sometimes it may be useful to have a promise that we can resolve from the outside. While this is not a pattern I'd encourage it can be useful in a few situations. This class is inspired by the angularjs $q Defer objects
export async function deferExample() { const d = defer<boolean>(); mockLoadPerson2().then((p) => d.resolve(p)); return d.promise;} Copy
export async function deferExample() { const d = defer<boolean>(); mockLoadPerson2().then((p) => d.resolve(p)); return d.promise;}
Generated using TypeDoc
Sometimes it may be useful to have a promise that we can resolve from the outside. While this is not a pattern I'd encourage it can be useful in a few situations. This class is inspired by the angularjs $q Defer objects