fix(core): update
This commit is contained in:
parent
5f7580b28f
commit
5fdd756672
23692
package-lock.json
generated
23692
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -12,18 +12,18 @@
|
|||||||
"build": "(tsbuild --web && tsbundle npm)"
|
"build": "(tsbuild --web && tsbundle npm)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.29",
|
||||||
"@gitzone/tsbundle": "^1.0.78",
|
"@gitzone/tsbundle": "^1.0.88",
|
||||||
"@gitzone/tsrun": "^1.2.12",
|
"@gitzone/tsrun": "^1.2.18",
|
||||||
"@gitzone/tstest": "^1.0.44",
|
"@gitzone/tstest": "^1.0.60",
|
||||||
"@pushrocks/tapbundle": "^3.2.9",
|
"@pushrocks/tapbundle": "^4.0.0",
|
||||||
"@types/node": "^14.11.2",
|
"@types/node": "^17.0.10",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^4.0.17",
|
"@pushrocks/lik": "^5.0.0",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
"rxjs": "^6.6.3"
|
"rxjs": "^6.6.3"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -4,12 +4,12 @@ import * as smartrx from '../ts/index';
|
|||||||
|
|
||||||
tap.test('should create a valid instance of observableinstake', async () => {
|
tap.test('should create a valid instance of observableinstake', async () => {
|
||||||
const testObservableIntake = new smartrx.ObservableIntake();
|
const testObservableIntake = new smartrx.ObservableIntake();
|
||||||
expect(testObservableIntake).to.be.instanceOf(smartrx.ObservableIntake);
|
expect(testObservableIntake).toBeInstanceOf(smartrx.ObservableIntake);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('expect testObserservableIntake to push things', async (tools) => {
|
tap.test('expect testObserservableIntake to push things', async (tools) => {
|
||||||
const testObserservableIntake = new smartrx.ObservableIntake();
|
const testObserservableIntake = new smartrx.ObservableIntake();
|
||||||
testObserservableIntake.subscribe((value) => {
|
testObserservableIntake.subscribe((value: any) => {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ tap.test('expect testObserservableIntake to push things', async (tools) => {
|
|||||||
testObserservableIntake.push('wow');
|
testObserservableIntake.push('wow');
|
||||||
testObserservableIntake.makeBuffered();
|
testObserservableIntake.makeBuffered();
|
||||||
testObserservableIntake.push('jo');
|
testObserservableIntake.push('jo');
|
||||||
testObserservableIntake.subscribe((value) => {
|
testObserservableIntake.subscribe((value: any) => {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
testObserservableIntake.signalComplete();
|
testObserservableIntake.signalComplete();
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@ let testEmitter: events.EventEmitter;
|
|||||||
|
|
||||||
tap.test('should create an instance', async () => {
|
tap.test('should create an instance', async () => {
|
||||||
testObservablemap = new smartrx.Observablemap();
|
testObservablemap = new smartrx.Observablemap();
|
||||||
expect(testObservablemap).be.instanceof(smartrx.Observablemap);
|
expect(testObservablemap).toBeInstanceOf(smartrx.Observablemap);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should accept a new emitter', async () => {
|
tap.test('should accept a new emitter', async () => {
|
||||||
@ -27,8 +27,8 @@ tap.test('should accept a new emitter', async () => {
|
|||||||
});
|
});
|
||||||
testObservable2 = testObservablemap.getObservableForEmitterEvent(testEmitter, 'event1');
|
testObservable2 = testObservablemap.getObservableForEmitterEvent(testEmitter, 'event1');
|
||||||
testObservable3 = testObservablemap.getObservableForEmitterEvent(testEmitter, 'event2');
|
testObservable3 = testObservablemap.getObservableForEmitterEvent(testEmitter, 'event2');
|
||||||
expect(testObservable1 === testObservable2).to.be.true;
|
expect(testObservable1 === testObservable2).toBeTrue();
|
||||||
expect(testObservable1 === testObservable3).to.be.false;
|
expect(testObservable1 === testObservable3).toBeFalse();
|
||||||
testEmitter.emit('event1');
|
testEmitter.emit('event1');
|
||||||
await done.promise;
|
await done.promise;
|
||||||
});
|
});
|
||||||
|
@ -8,33 +8,33 @@ export class ObservableIntake<T> {
|
|||||||
public completed: Promise<void>;
|
public completed: Promise<void>;
|
||||||
private completedDeffered: plugins.smartpromise.Deferred<void>;
|
private completedDeffered: plugins.smartpromise.Deferred<void>;
|
||||||
private observableFunctions: any = {
|
private observableFunctions: any = {
|
||||||
next: (payloadArg) => {
|
next: (payloadArg: T) => {
|
||||||
// nothing
|
// nothing
|
||||||
},
|
},
|
||||||
complete: (payloadArg) => {
|
complete: (payloadArg: T) => {
|
||||||
// nothing
|
// nothing
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
private generator = null;
|
private generator: Generator<T> = null;
|
||||||
private buffered = false;
|
private buffered = false;
|
||||||
private payloadBuffer = [];
|
private payloadBuffer: any[] = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.observable = plugins.rxjs.Observable.create((observerArg) => {
|
this.observable = plugins.rxjs.Observable.create((observerArg: plugins.rxjs.Observer<any>) => {
|
||||||
this.observableFunctions.next = (...args) => {
|
this.observableFunctions.next = (...args: any) => {
|
||||||
return observerArg.next(...args);
|
return observerArg.next(args);
|
||||||
};
|
};
|
||||||
this.observableFunctions.complete = (...args) => {
|
this.observableFunctions.complete = () => {
|
||||||
this.completedDeffered.resolve();
|
this.completedDeffered.resolve();
|
||||||
return observerArg.complete(...args);
|
return observerArg.complete();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.completedDeffered = plugins.smartpromise.defer();
|
this.completedDeffered = plugins.smartpromise.defer();
|
||||||
this.completed = this.completedDeffered.promise;
|
this.completed = this.completedDeffered.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setObservable(observableFunc) {
|
public setObservable(observableFunc: plugins.rxjs.Observable<any>) {
|
||||||
this.observable = observableFunc();
|
this.observable = observableFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public push(payloadArg: T) {
|
public push(payloadArg: T) {
|
||||||
@ -59,7 +59,7 @@ export class ObservableIntake<T> {
|
|||||||
* sets a generator to query the next pushed value
|
* sets a generator to query the next pushed value
|
||||||
* @param generatorArg
|
* @param generatorArg
|
||||||
*/
|
*/
|
||||||
public setGenerator(generatorArg) {
|
public setGenerator(generatorArg: Generator<T>) {
|
||||||
this.generator = generatorArg;
|
this.generator = generatorArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ export class ObservableIntake<T> {
|
|||||||
this.buffered = true;
|
this.buffered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public subscribe(...args) {
|
public subscribe(...args: any) {
|
||||||
return this.observable.subscribe(...args);
|
return this.observable.subscribe(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +83,8 @@ export class ObservableIntake<T> {
|
|||||||
if (this.payloadBuffer.length > 0) {
|
if (this.payloadBuffer.length > 0) {
|
||||||
this.internalPush(this.payloadBuffer.shift());
|
this.internalPush(this.payloadBuffer.shift());
|
||||||
} else {
|
} else {
|
||||||
const nextPayload = this.generator();
|
const nextPayload = this.generator.next();
|
||||||
this.internalPush(nextPayload);
|
this.internalPush(nextPayload.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ export class ObservableIntake<T> {
|
|||||||
this.observableFunctions.complete();
|
this.observableFunctions.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private internalPush(payloadArg) {
|
private internalPush(payloadArg: T) {
|
||||||
this.observableFunctions.next(payloadArg);
|
this.observableFunctions.next(payloadArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ export class Observablemap {
|
|||||||
* In case event has been registered before the same observable is returned.
|
* In case event has been registered before the same observable is returned.
|
||||||
*/
|
*/
|
||||||
public getObservableForEmitterEvent<T>(emitterArg: IEventEmitter<T>, eventArg: string) {
|
public getObservableForEmitterEvent<T>(emitterArg: IEventEmitter<T>, eventArg: string) {
|
||||||
const existingBundle = this.observableEmitterBundleObjectmap.find((bundleArg) => {
|
const existingBundle = this.observableEmitterBundleObjectmap.findSync((bundleArg) => {
|
||||||
return bundleArg.emitter === emitterArg && bundleArg.event === eventArg;
|
return bundleArg.emitter === emitterArg && bundleArg.event === eventArg;
|
||||||
});
|
});
|
||||||
if (existingBundle) {
|
if (existingBundle) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// this file is intended to keep the bundle size down
|
// this file is intended to keep the bundle size down
|
||||||
|
|
||||||
export { Observable, Subject, fromEvent, ReplaySubject, Subscription } from 'rxjs';
|
export { Observable, Subject, fromEvent, ReplaySubject, Subscription, Observer } from 'rxjs';
|
||||||
|
|
||||||
import { startWith, takeUntil, map, debounce, debounceTime } from 'rxjs/operators';
|
import { startWith, takeUntil, map, debounce, debounceTime } from 'rxjs/operators';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user