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)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tsbundle": "^1.0.78",
|
||||
"@gitzone/tsrun": "^1.2.12",
|
||||
"@gitzone/tstest": "^1.0.44",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.11.2",
|
||||
"@gitzone/tsbuild": "^2.1.29",
|
||||
"@gitzone/tsbundle": "^1.0.88",
|
||||
"@gitzone/tsrun": "^1.2.18",
|
||||
"@gitzone/tstest": "^1.0.60",
|
||||
"@pushrocks/tapbundle": "^4.0.0",
|
||||
"@types/node": "^17.0.10",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^4.0.17",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/lik": "^5.0.0",
|
||||
"@pushrocks/smartpromise": "^3.1.6",
|
||||
"rxjs": "^6.6.3"
|
||||
},
|
||||
"files": [
|
||||
|
@ -4,12 +4,12 @@ import * as smartrx from '../ts/index';
|
||||
|
||||
tap.test('should create a valid instance of observableinstake', async () => {
|
||||
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) => {
|
||||
const testObserservableIntake = new smartrx.ObservableIntake();
|
||||
testObserservableIntake.subscribe((value) => {
|
||||
testObserservableIntake.subscribe((value: any) => {
|
||||
console.log(value);
|
||||
});
|
||||
|
||||
@ -25,7 +25,7 @@ tap.test('expect testObserservableIntake to push things', async (tools) => {
|
||||
testObserservableIntake.push('wow');
|
||||
testObserservableIntake.makeBuffered();
|
||||
testObserservableIntake.push('jo');
|
||||
testObserservableIntake.subscribe((value) => {
|
||||
testObserservableIntake.subscribe((value: any) => {
|
||||
console.log(value);
|
||||
testObserservableIntake.signalComplete();
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ let testEmitter: events.EventEmitter;
|
||||
|
||||
tap.test('should create an instance', async () => {
|
||||
testObservablemap = new smartrx.Observablemap();
|
||||
expect(testObservablemap).be.instanceof(smartrx.Observablemap);
|
||||
expect(testObservablemap).toBeInstanceOf(smartrx.Observablemap);
|
||||
});
|
||||
|
||||
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');
|
||||
testObservable3 = testObservablemap.getObservableForEmitterEvent(testEmitter, 'event2');
|
||||
expect(testObservable1 === testObservable2).to.be.true;
|
||||
expect(testObservable1 === testObservable3).to.be.false;
|
||||
expect(testObservable1 === testObservable2).toBeTrue();
|
||||
expect(testObservable1 === testObservable3).toBeFalse();
|
||||
testEmitter.emit('event1');
|
||||
await done.promise;
|
||||
});
|
||||
|
@ -8,33 +8,33 @@ export class ObservableIntake<T> {
|
||||
public completed: Promise<void>;
|
||||
private completedDeffered: plugins.smartpromise.Deferred<void>;
|
||||
private observableFunctions: any = {
|
||||
next: (payloadArg) => {
|
||||
next: (payloadArg: T) => {
|
||||
// nothing
|
||||
},
|
||||
complete: (payloadArg) => {
|
||||
complete: (payloadArg: T) => {
|
||||
// nothing
|
||||
},
|
||||
};
|
||||
private generator = null;
|
||||
private generator: Generator<T> = null;
|
||||
private buffered = false;
|
||||
private payloadBuffer = [];
|
||||
private payloadBuffer: any[] = [];
|
||||
|
||||
constructor() {
|
||||
this.observable = plugins.rxjs.Observable.create((observerArg) => {
|
||||
this.observableFunctions.next = (...args) => {
|
||||
return observerArg.next(...args);
|
||||
this.observable = plugins.rxjs.Observable.create((observerArg: plugins.rxjs.Observer<any>) => {
|
||||
this.observableFunctions.next = (...args: any) => {
|
||||
return observerArg.next(args);
|
||||
};
|
||||
this.observableFunctions.complete = (...args) => {
|
||||
this.observableFunctions.complete = () => {
|
||||
this.completedDeffered.resolve();
|
||||
return observerArg.complete(...args);
|
||||
return observerArg.complete();
|
||||
};
|
||||
});
|
||||
this.completedDeffered = plugins.smartpromise.defer();
|
||||
this.completed = this.completedDeffered.promise;
|
||||
}
|
||||
|
||||
public setObservable(observableFunc) {
|
||||
this.observable = observableFunc();
|
||||
public setObservable(observableFunc: plugins.rxjs.Observable<any>) {
|
||||
this.observable = observableFunc;
|
||||
}
|
||||
|
||||
public push(payloadArg: T) {
|
||||
@ -59,7 +59,7 @@ export class ObservableIntake<T> {
|
||||
* sets a generator to query the next pushed value
|
||||
* @param generatorArg
|
||||
*/
|
||||
public setGenerator(generatorArg) {
|
||||
public setGenerator(generatorArg: Generator<T>) {
|
||||
this.generator = generatorArg;
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ export class ObservableIntake<T> {
|
||||
this.buffered = true;
|
||||
}
|
||||
|
||||
public subscribe(...args) {
|
||||
public subscribe(...args: any) {
|
||||
return this.observable.subscribe(...args);
|
||||
}
|
||||
|
||||
@ -83,8 +83,8 @@ export class ObservableIntake<T> {
|
||||
if (this.payloadBuffer.length > 0) {
|
||||
this.internalPush(this.payloadBuffer.shift());
|
||||
} else {
|
||||
const nextPayload = this.generator();
|
||||
this.internalPush(nextPayload);
|
||||
const nextPayload = this.generator.next();
|
||||
this.internalPush(nextPayload.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +97,7 @@ export class ObservableIntake<T> {
|
||||
this.observableFunctions.complete();
|
||||
}
|
||||
|
||||
private internalPush(payloadArg) {
|
||||
private internalPush(payloadArg: T) {
|
||||
this.observableFunctions.next(payloadArg);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ export class Observablemap {
|
||||
* In case event has been registered before the same observable is returned.
|
||||
*/
|
||||
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;
|
||||
});
|
||||
if (existingBundle) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// 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';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user