now has working intake
This commit is contained in:
@ -2,4 +2,10 @@ import * as plugins from './smartrx.plugins'
|
||||
|
||||
export let standardExport = 'Hi there! :) This is a exported string'
|
||||
export * from './smartrx.classes.observablemap'
|
||||
export * from './smartrx.classes.observable'
|
||||
export * from './smartrx.classes.observableintake'
|
||||
|
||||
import * as rxjs from 'rxjs'
|
||||
|
||||
export {
|
||||
rxjs
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
import { Observable as rxjsObservable } from 'rxjs'
|
||||
export {
|
||||
rxjsObservable
|
||||
}
|
||||
|
||||
export class Observable<T> extends rxjsObservable<T> {
|
||||
static fromIntake () {}
|
||||
}
|
50
ts/smartrx.classes.observableintake.ts
Normal file
50
ts/smartrx.classes.observableintake.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import * as plugins from './smartrx.plugins'
|
||||
import { Observable, Subscription } from 'rxjs'
|
||||
import { Deferred } from 'smartq'
|
||||
|
||||
/**
|
||||
* ObservableIntake
|
||||
*/
|
||||
export class ObservableIntake<T> {
|
||||
observable: Observable<T>
|
||||
completed: Promise<void>
|
||||
private completedDeffered: Deferred<void>
|
||||
private observableFunctions: any = {
|
||||
next: (payloadArg) => {
|
||||
// nothing
|
||||
},
|
||||
complete: (payloadArg) => {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
|
||||
constructor () {
|
||||
this.observable = Observable.create((observerArg) => {
|
||||
this.observableFunctions.next = (...args) => {
|
||||
return observerArg.next(...args)
|
||||
}
|
||||
this.observableFunctions.complete = (...args) => {
|
||||
this.completedDeffered.resolve()
|
||||
return observerArg.complete(...args)
|
||||
}
|
||||
})
|
||||
this.completedDeffered = plugins.smartq.defer()
|
||||
this.completed = this.completedDeffered.promise
|
||||
}
|
||||
|
||||
setObservable (observableFunc) {
|
||||
this.observable = observableFunc()
|
||||
}
|
||||
|
||||
push (payloadArg: T) {
|
||||
this.observableFunctions.next(payloadArg)
|
||||
}
|
||||
|
||||
subscribe (...args) {
|
||||
return this.observable.subscribe(...args)
|
||||
}
|
||||
|
||||
signalComplete () {
|
||||
this.observableFunctions.complete()
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
import * as plugins from './smartrx.plugins'
|
||||
import { Observable, rxjsObservable } from './smartrx.classes.observable'
|
||||
|
||||
import { Observable } from 'rxjs'
|
||||
import { Objectmap } from 'lik'
|
||||
import { Stringmap } from 'lik'
|
||||
|
||||
|
@ -2,9 +2,14 @@ import 'typings-global'
|
||||
import * as events from 'events'
|
||||
import * as lik from 'lik'
|
||||
import * as rxjs from 'rxjs'
|
||||
import * as smartevent from 'smartevent'
|
||||
import * as smartq from 'smartq'
|
||||
import 'typings-global'
|
||||
|
||||
export {
|
||||
events,
|
||||
lik,
|
||||
rxjs
|
||||
rxjs,
|
||||
smartevent,
|
||||
smartq
|
||||
}
|
||||
|
Reference in New Issue
Block a user