@openhps/core
Version:
Open Hybrid Positioning System - Core component
20 lines • 547 B
JavaScript
/**
* A push promise is a promise that is returned when pushing a dataframe to a graph.
*/
export class PushPromise extends Promise {
constructor(executor) {
super((resolve, reject) => {
// Handle promise resolution or rejection and call `complete`
executor(resolve, reject, () => {
// This will be invoked by the custom "complete" handler
if (this.oncompleted) {
this.oncompleted();
}
});
});
}
completed(oncompleted) {
this.oncompleted = oncompleted;
return this;
}
}