refract-xstream
Advanced tools
Comparing version 1.0.0-5 to 1.0.0-6
@@ -30,10 +30,2 @@ import xs from 'xstream'; | ||
var __assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var subscribeToSink = function (sink, next, error) { | ||
@@ -85,4 +77,3 @@ return sink.subscribe({ | ||
}); | ||
var createPropObservable = function (propName, opts) { | ||
var options = __assign({ initialValue: true }, opts); | ||
var createPropObservable = function (propName) { | ||
var listenerType = propName | ||
@@ -94,11 +85,4 @@ ? typeof _this.props[propName] === 'function' | ||
return createObservable(function (listener) { | ||
if (options.initialValue) { | ||
if (listenerType === 'props') { | ||
listener.next(_this.props[propName]); | ||
} | ||
if (listenerType === 'allProps') { | ||
listener.next(_this.props); | ||
} | ||
} | ||
if (listenerType === 'allProps') { | ||
listener.next(_this.props); | ||
_this.listeners.allProps = _this.listeners.allProps.concat(listener); | ||
@@ -109,2 +93,5 @@ return function () { | ||
} | ||
if (listenerType === 'props') { | ||
listener.next(_this.props[propName]); | ||
} | ||
_this.listeners[listenerType][propName] = (_this.listeners[listenerType][propName] || []).concat(listener); | ||
@@ -119,3 +106,5 @@ return function () { | ||
unmount: unmountObservable, | ||
observe: function (propName, options) { return createPropObservable(propName, options); } | ||
observe: function (propName) { | ||
return createPropObservable(propName); | ||
} | ||
}; | ||
@@ -122,0 +111,0 @@ var sinkObservable = aperture(_this.props)(_this.component); |
27
index.js
@@ -36,10 +36,2 @@ 'use strict'; | ||
var __assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var subscribeToSink = function (sink, next, error) { | ||
@@ -91,4 +83,3 @@ return sink.subscribe({ | ||
}); | ||
var createPropObservable = function (propName, opts) { | ||
var options = __assign({ initialValue: true }, opts); | ||
var createPropObservable = function (propName) { | ||
var listenerType = propName | ||
@@ -100,11 +91,4 @@ ? typeof _this.props[propName] === 'function' | ||
return createObservable(function (listener) { | ||
if (options.initialValue) { | ||
if (listenerType === 'props') { | ||
listener.next(_this.props[propName]); | ||
} | ||
if (listenerType === 'allProps') { | ||
listener.next(_this.props); | ||
} | ||
} | ||
if (listenerType === 'allProps') { | ||
listener.next(_this.props); | ||
_this.listeners.allProps = _this.listeners.allProps.concat(listener); | ||
@@ -115,2 +99,5 @@ return function () { | ||
} | ||
if (listenerType === 'props') { | ||
listener.next(_this.props[propName]); | ||
} | ||
_this.listeners[listenerType][propName] = (_this.listeners[listenerType][propName] || []).concat(listener); | ||
@@ -125,3 +112,5 @@ return function () { | ||
unmount: unmountObservable, | ||
observe: function (propName, options) { return createPropObservable(propName, options); } | ||
observe: function (propName) { | ||
return createPropObservable(propName); | ||
} | ||
}; | ||
@@ -128,0 +117,0 @@ var sinkObservable = aperture(_this.props)(_this.component); |
{ | ||
"name": "refract-xstream", | ||
"version": "1.0.0-5", | ||
"version": "1.0.0-6", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "jsnext:main": "index.es.js", |
@@ -18,5 +18,1 @@ import { Listener } from './observable' | ||
export type ErrorHandler<P> = (intialProps: P) => (error: any) => void | ||
export interface ObserveOptions { | ||
initialValue: boolean | ||
} |
import { withEffects } from './withEffects' | ||
import { ObservableComponent, Aperture } from './observable' | ||
import { ErrorHandler, Handler, ObserveOptions } from './baseTypes' | ||
import { ErrorHandler, Handler } from './baseTypes' | ||
import { compose, Compose } from './compose' | ||
@@ -12,5 +12,4 @@ | ||
ErrorHandler, | ||
ObserveOptions, | ||
compose, | ||
Compose | ||
} |
import xs, { Stream, Listener, Subscription } from 'xstream' | ||
import { ObserveOptions } from './baseTypes' | ||
@@ -7,6 +6,3 @@ export { Listener, Subscription } | ||
export interface ObservableComponent { | ||
observe: <T>( | ||
propName: string, | ||
options?: Partial<ObserveOptions> | ||
) => Stream<T> | ||
observe: <T>(propName: string) => Stream<T> | ||
mount: Stream<any> | ||
@@ -13,0 +9,0 @@ unmount: Stream<any> |
import * as React from 'react' | ||
import { PropListeners, Listeners, Handler, ErrorHandler } from './baseTypes' | ||
import { | ||
PropListeners, | ||
Listeners, | ||
Handler, | ||
ErrorHandler, | ||
ObserveOptions | ||
} from './baseTypes' | ||
import { | ||
Subscription, | ||
@@ -62,10 +56,3 @@ Listener, | ||
const createPropObservable = <T>( | ||
propName?: string, | ||
opts?: Partial<ObserveOptions> | ||
) => { | ||
const options: ObserveOptions = { | ||
initialValue: true, | ||
...opts | ||
} | ||
const createPropObservable = <T>(propName?: string) => { | ||
const listenerType = propName | ||
@@ -78,13 +65,5 @@ ? typeof this.props[propName] === 'function' | ||
return createObservable<T>(listener => { | ||
if (options.initialValue) { | ||
if (listenerType === 'props') { | ||
listener.next(this.props[propName]) | ||
} | ||
if (listenerType === 'allProps') { | ||
listener.next(this.props) | ||
if (listenerType === 'allProps') { | ||
listener.next(this.props) | ||
} | ||
} | ||
if (listenerType === 'allProps') { | ||
this.listeners.allProps = this.listeners.allProps.concat( | ||
@@ -99,2 +78,6 @@ listener | ||
if (listenerType === 'props') { | ||
listener.next(this.props[propName]) | ||
} | ||
this.listeners[listenerType][propName] = ( | ||
@@ -115,6 +98,4 @@ this.listeners[listenerType][propName] || [] | ||
unmount: unmountObservable, | ||
observe: <T>( | ||
propName?: string, | ||
options?: Partial<ObserveOptions> | ||
) => createPropObservable<T>(propName, options) | ||
observe: <T>(propName?: string) => | ||
createPropObservable<T>(propName) | ||
} | ||
@@ -121,0 +102,0 @@ |
@@ -14,4 +14,1 @@ import { Listener } from './observable' | ||
export declare type ErrorHandler<P> = (intialProps: P) => (error: any) => void | ||
export interface ObserveOptions { | ||
initialValue: boolean | ||
} |
import { withEffects } from './withEffects' | ||
import { ObservableComponent, Aperture } from './observable' | ||
import { ErrorHandler, Handler, ObserveOptions } from './baseTypes' | ||
import { ErrorHandler, Handler } from './baseTypes' | ||
import { compose, Compose } from './compose' | ||
@@ -11,5 +11,4 @@ export { | ||
ErrorHandler, | ||
ObserveOptions, | ||
compose, | ||
Compose | ||
} |
import xs, { Stream, Listener, Subscription } from 'xstream' | ||
import { ObserveOptions } from './baseTypes' | ||
export { Listener, Subscription } | ||
export interface ObservableComponent { | ||
observe: <T>( | ||
propName: string, | ||
options?: Partial<ObserveOptions> | ||
) => Stream<T> | ||
observe: <T>(propName: string) => Stream<T> | ||
mount: Stream<any> | ||
@@ -10,0 +6,0 @@ unmount: Stream<any> |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
36888
17
1
149
787