Files
pathfinder/js/app/promises/promise.deferred.js
Mark Friedrich af59235b73 - new "undo" function for "signature table", closed #218, closed #726
- improved "signature table" added "loading" spinner if table gets updated or data is processed
- improved ajax endpoints for "signatures". Moved into new REST API
- improved ajax endpoints for "structures". Moved into new REST API
- upgraded DB "Cortex", PHP lib `v1.6.0-dev` → `v1.6.0`
- upgraded DB "Schema", PHP lib `v2.2.2` → `v2.2.3`
- upgraded some 3rd party NodeJs packaged (or development) in `package.json`
2019-03-22 17:33:43 +01:00

39 lines
1006 B
JavaScript

define([], () => {
'use strict';
/**
* Deferred Promise implementation
* @see https://stackoverflow.com/a/47112177/4329969
*/
return class DeferredPromise {
constructor(){
this._promise = new Promise((resolve, reject) => {
// assign the resolve and reject functions to `this`
// making them usable on the class instance
this.resolve = resolve;
this.reject = reject;
});
// bind `then` and `catch` to implement the same interface as Promise
this.then = this._promise.then.bind(this._promise);
this.catch = this._promise.catch.bind(this._promise);
}
set data(data){
if(data){
this._data = data;
}
return this._data;
}
get data(){
return this._data;
}
get [Symbol.toStringTag]() {
return 'Promise';
}
};
});