Fixing some bug
This commit is contained in:
parent
0781323acb
commit
6720432e24
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hibas123/utils",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"description": "Different Utilities, that are not worth own packages",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -28,7 +28,7 @@ export default class AwaitStore<T = any> {
|
||||
|
||||
awaitValue(val: T): PromiseLike<void> & { catch: (cb: (err: any) => PromiseLike<void>) => PromiseLike<void>, ignore: () => void } {
|
||||
|
||||
let ignore: () => void;
|
||||
let ignore: () => void = () => undefined;
|
||||
|
||||
let prms = new Promise<void>(yes => {
|
||||
const cb = () => {
|
||||
@ -41,13 +41,16 @@ export default class AwaitStore<T = any> {
|
||||
return false
|
||||
}
|
||||
|
||||
if (this._value === val) {
|
||||
yes();
|
||||
} else {
|
||||
ignore = () => {
|
||||
this.observable.unsubscribe(cb);
|
||||
}
|
||||
|
||||
if (!cb()) {
|
||||
this.observable.subscribe(cb);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user