pepka 1.9.2 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.cjs CHANGED
@@ -104,18 +104,25 @@ class QPromise extends Promise {
104
104
  if (resolve)
105
105
  this.ff();
106
106
  else {
107
- this.catch(noop);
107
+ super.catch(noop);
108
108
  this.rj('canceled');
109
109
  this.oncancel(this._cancel_data);
110
110
  }
111
111
  }
112
112
  constructor(fn, oncancel = noop) {
113
+ let _ff, _rj, _cancel_data;
113
114
  super((ff, rj) => {
114
- this.ff = ff;
115
- this.rj = rj;
116
- this._cancel_data = fn(ff, rj);
115
+ _ff = ff;
116
+ _rj = rj;
117
+ _cancel_data = fn(ff, rj);
117
118
  });
118
119
  this.oncancel = oncancel;
120
+ const set_cb = () => { this.ff = _ff; this.rj = _rj; this._cancel_data = _cancel_data; };
121
+ // @ts-ignore-next
122
+ if (!isUndef(_ff) || !isUndef(_rj))
123
+ set_cb();
124
+ else
125
+ setTimeout(set_cb);
119
126
  }
120
127
  }
121
128
 
package/dist/bundle.mjs CHANGED
@@ -102,18 +102,25 @@ class QPromise extends Promise {
102
102
  if (resolve)
103
103
  this.ff();
104
104
  else {
105
- this.catch(noop);
105
+ super.catch(noop);
106
106
  this.rj('canceled');
107
107
  this.oncancel(this._cancel_data);
108
108
  }
109
109
  }
110
110
  constructor(fn, oncancel = noop) {
111
+ let _ff, _rj, _cancel_data;
111
112
  super((ff, rj) => {
112
- this.ff = ff;
113
- this.rj = rj;
114
- this._cancel_data = fn(ff, rj);
113
+ _ff = ff;
114
+ _rj = rj;
115
+ _cancel_data = fn(ff, rj);
115
116
  });
116
117
  this.oncancel = oncancel;
118
+ const set_cb = () => { this.ff = _ff; this.rj = _rj; this._cancel_data = _cancel_data; };
119
+ // @ts-ignore-next
120
+ if (!isUndef(_ff) || !isUndef(_rj))
121
+ set_cb();
122
+ else
123
+ setTimeout(set_cb);
117
124
  }
118
125
  }
119
126
 
package/package.json CHANGED
@@ -41,7 +41,7 @@
41
41
  "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
42
42
  "all": "npm run dev && npm run prod"
43
43
  },
44
- "version": "1.9.2",
44
+ "version": "1.9.3",
45
45
  "devDependencies": {
46
46
  "@rollup/plugin-commonjs": "^29.0.2",
47
47
  "@rollup/plugin-node-resolve": "^16.0.3",
package/src/utils.ts CHANGED
@@ -23,15 +23,20 @@ export class QPromise<T> extends Promise<T> {
23
23
  public cancel(resolve = false) {
24
24
  if(resolve) this.ff()
25
25
  else {
26
- this.catch(noop)
26
+ super.catch(noop)
27
27
  this.rj('canceled')
28
28
  this.oncancel(this._cancel_data)
29
29
  }
30
30
  }
31
31
  constructor(fn: AnyFunc<any, [AnyFunc, AnyFunc, AnyFunc?]>, private oncancel = noop) {
32
+ let _ff: AnyFunc, _rj: AnyFunc, _cancel_data: any
32
33
  super((ff, rj) => {
33
- this.ff=ff; this.rj = rj
34
- this._cancel_data = fn(ff, rj)
34
+ _ff=ff; _rj=rj
35
+ _cancel_data = fn(ff, rj)
35
36
  })
37
+ const set_cb = () => {this.ff=_ff; this.rj=_rj; this._cancel_data=_cancel_data}
38
+ // @ts-ignore-next
39
+ if(!isUndef(_ff) || !isUndef(_rj)) set_cb()
40
+ else setTimeout(set_cb)
36
41
  }
37
42
  }