Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

refract-xstream

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

refract-xstream - npm Package Compare versions

Comparing version 1.0.0-2 to 1.0.0-3

19

index.es.js

@@ -30,2 +30,10 @@ 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) {

@@ -76,3 +84,4 @@ return sink.subscribe({

});
var createPropObservable = function (propName) {
var createPropObservable = function (propName, opts) {
var options = __assign({ initialValue: true }, opts);
var listenerType = typeof _this.props[propName] === 'function'

@@ -83,2 +92,5 @@ ? 'fnProps'

_this.listeners[listenerType][propName] = (_this.listeners[listenerType][propName] || []).concat(listener);
if (listenerType === 'props' && options.initialValue) {
listener.next(_this.props[propName]);
}
return function () {

@@ -92,9 +104,6 @@ _this.listeners[listenerType][propName].filter(function (l) { return l !== listener; });

unmount: unmountObservable,
observe: function (propName) {
return createPropObservable(propName);
}
observe: function (propName, options) { return createPropObservable(propName, options); }
};
var sinkObservable = effectFactory(_this.props)(_this.component);
_this.sinkSubscription = subscribeToSink(sinkObservable, effectHandler(_this.props), errorHandler);
_this.sendNext();
return _this;

@@ -101,0 +110,0 @@ }

@@ -36,2 +36,10 @@ '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) {

@@ -82,3 +90,4 @@ return sink.subscribe({

});
var createPropObservable = function (propName) {
var createPropObservable = function (propName, opts) {
var options = __assign({ initialValue: true }, opts);
var listenerType = typeof _this.props[propName] === 'function'

@@ -89,2 +98,5 @@ ? 'fnProps'

_this.listeners[listenerType][propName] = (_this.listeners[listenerType][propName] || []).concat(listener);
if (listenerType === 'props' && options.initialValue) {
listener.next(_this.props[propName]);
}
return function () {

@@ -98,9 +110,6 @@ _this.listeners[listenerType][propName].filter(function (l) { return l !== listener; });

unmount: unmountObservable,
observe: function (propName) {
return createPropObservable(propName);
}
observe: function (propName, options) { return createPropObservable(propName, options); }
};
var sinkObservable = effectFactory(_this.props)(_this.component);
_this.sinkSubscription = subscribeToSink(sinkObservable, effectHandler(_this.props), errorHandler);
_this.sendNext();
return _this;

@@ -107,0 +116,0 @@ }

{
"name": "refract-xstream",
"version": "1.0.0-2",
"version": "1.0.0-3",
"main": "index.js",

@@ -5,0 +5,0 @@ "jsnext:main": "index.es.js",

@@ -15,1 +15,5 @@ import { Listener } from './observable'

export type EffectHandler<P, E> = (intialProps: P) => (val: E) => void
export interface ObserveOptions {
initialValue: boolean
}
import { withEffects } from './withEffects'
import { ObservableComponent, EffectFactory } from './observable'
import { EffectHandler } from './baseTypes'
import { EffectHandler, ObserveOptions } from './baseTypes'
export { withEffects, ObservableComponent, EffectFactory, EffectHandler }
export {
withEffects,
ObservableComponent,
EffectFactory,
EffectHandler,
ObserveOptions
}
import xs, { Stream, Listener, Subscription } from 'xstream'
import { ObserveOptions } from './baseTypes'

@@ -6,3 +7,6 @@ export { Listener, Subscription }

export interface ObservableComponent {
observe: <T>(propName: string) => Stream<T>
observe: <T>(
propName: string,
options: Partial<ObserveOptions>
) => Stream<T>
mount: Stream<any>

@@ -9,0 +13,0 @@ unmount: Stream<any>

import * as React from 'react'
import { PropListeners, Listeners, EffectHandler } from './baseTypes'
import {
PropListeners,
Listeners,
EffectHandler,
ObserveOptions
} from './baseTypes'
import {
Subscription,

@@ -55,3 +60,10 @@ Listener,

const createPropObservable = <T>(propName: string) => {
const createPropObservable = <T>(
propName: string,
opts: Partial<ObserveOptions>
) => {
const options: ObserveOptions = {
initialValue: true,
...opts
}
const listenerType =

@@ -67,2 +79,6 @@ typeof this.props[propName] === 'function'

if (listenerType === 'props' && options.initialValue) {
listener.next(this.props[propName])
}
return () => {

@@ -79,4 +95,6 @@ this.listeners[listenerType][propName].filter(

unmount: unmountObservable,
observe: <T>(propName: string) =>
createPropObservable<T>(propName)
observe: <T>(
propName: string,
options: Partial<ObserveOptions>
) => createPropObservable<T>(propName, options)
}

@@ -91,4 +109,2 @@

)
this.sendNext()
}

@@ -95,0 +111,0 @@

@@ -12,1 +12,4 @@ import { Listener } from './observable'

export declare type EffectHandler<P, E> = (intialProps: P) => (val: E) => void
export interface ObserveOptions {
initialValue: boolean
}
import { withEffects } from './withEffects'
import { ObservableComponent, EffectFactory } from './observable'
import { EffectHandler } from './baseTypes'
export { withEffects, ObservableComponent, EffectFactory, EffectHandler }
import { EffectHandler, ObserveOptions } from './baseTypes'
export {
withEffects,
ObservableComponent,
EffectFactory,
EffectHandler,
ObserveOptions
}
import xs, { Stream, Listener, Subscription } from 'xstream'
import { ObserveOptions } from './baseTypes'
export { Listener, Subscription }
export interface ObservableComponent {
observe: <T>(propName: string) => Stream<T>
observe: <T>(
propName: string,
options: Partial<ObserveOptions>
) => Stream<T>
mount: Stream<any>

@@ -6,0 +10,0 @@ unmount: Stream<any>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc