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