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

refract-preact-xstream

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

refract-preact-xstream - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

30

index.es.js

@@ -106,2 +106,10 @@ import xs from 'xstream';

var data = function () { return xs.from(dataObservable); };
var fromEvent = function (eventName, valueTransformer) {
return data()
.filter(isEvent(eventName))
.map(function (data) {
var value = data.payload.value;
return valueTransformer ? valueTransformer(value) : value;
});
};
return {

@@ -139,11 +147,5 @@ mount: data()

},
fromEvent: function (eventName, valueTransformer) {
return data()
.filter(isEvent(eventName))
.map(function (data) {
var value = data.payload.value;
return valueTransformer ? valueTransformer(value) : value;
});
},
pushEvent: pushEvent
fromEvent: fromEvent,
pushEvent: pushEvent,
useEvent: function (eventName) { return [fromEvent(eventName), pushEvent(eventName)]; }
};

@@ -171,4 +173,4 @@ };

};
var finalHandler = function (initialProps) {
var effectHandler = handler(initialProps);
var finalHandler = function (initialProps, initialContext) {
var effectHandler = handler(initialProps, initialContext);
return function (effect) {

@@ -238,4 +240,6 @@ if (isValidElement(effect)) {

var component = createComponent(instance, dataObservable, pushEvent);
var sinkObservable = aperture(instance.props)(component);
var sinkSubscription = subscribeToSink(sinkObservable, finalHandler(instance.props), errorHandler ? errorHandler(instance.props) : undefined);
var sinkObservable = aperture(instance.props, instance.context)(component);
var sinkSubscription = subscribeToSink(sinkObservable, finalHandler(instance.props, instance.context), errorHandler
? errorHandler(instance.props, instance.context)
: undefined);
instance.reDecorateProps = function (nextProps) {

@@ -242,0 +246,0 @@ Object.keys(nextProps).forEach(function (propName) {

@@ -112,2 +112,10 @@ 'use strict';

var data = function () { return xs.from(dataObservable); };
var fromEvent = function (eventName, valueTransformer) {
return data()
.filter(isEvent(eventName))
.map(function (data) {
var value = data.payload.value;
return valueTransformer ? valueTransformer(value) : value;
});
};
return {

@@ -145,11 +153,5 @@ mount: data()

},
fromEvent: function (eventName, valueTransformer) {
return data()
.filter(isEvent(eventName))
.map(function (data) {
var value = data.payload.value;
return valueTransformer ? valueTransformer(value) : value;
});
},
pushEvent: pushEvent
fromEvent: fromEvent,
pushEvent: pushEvent,
useEvent: function (eventName) { return [fromEvent(eventName), pushEvent(eventName)]; }
};

@@ -177,4 +179,4 @@ };

};
var finalHandler = function (initialProps) {
var effectHandler = handler(initialProps);
var finalHandler = function (initialProps, initialContext) {
var effectHandler = handler(initialProps, initialContext);
return function (effect) {

@@ -244,4 +246,6 @@ if (isValidElement(effect)) {

var component = createComponent(instance, dataObservable, pushEvent);
var sinkObservable = aperture(instance.props)(component);
var sinkSubscription = subscribeToSink(sinkObservable, finalHandler(instance.props), errorHandler ? errorHandler(instance.props) : undefined);
var sinkObservable = aperture(instance.props, instance.context)(component);
var sinkSubscription = subscribeToSink(sinkObservable, finalHandler(instance.props, instance.context), errorHandler
? errorHandler(instance.props, instance.context)
: undefined);
instance.reDecorateProps = function (nextProps) {

@@ -248,0 +252,0 @@ Object.keys(nextProps).forEach(function (propName) {

{
"name": "refract-preact-xstream",
"description": "Refract bindings for Preact with xstream: harness the power of reactive programming to supercharge your components!",
"version": "2.0.0",
"version": "2.1.0",
"main": "index.js",

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

@@ -42,3 +42,3 @@ <p align="center">

* [Manage side effects](https://refract.js.org/) like API calls, analytics, logging, etc.
* [Manipulate, replace and inject props](https://refract.js.org/usage/pushing-props), you can even [fully replace Redux `connect` HoC](https://refract.js.org/recipes/replace-connect)
* [Manipulate, replace and inject props](https://refract.js.org/usage/pushing-to-props), you can even [fully replace Redux `connect` HoC](https://refract.js.org/recipes/replacing-connect)
* [Handle state](https://refract.js.org/recipes/handling-state)

@@ -45,0 +45,0 @@ * [Render components](https://refract.js.org/usage/rendering-components)

@@ -1,3 +0,9 @@

export declare type Handler<P, E> = (intialProps: P) => (val: E) => void
export declare type ErrorHandler<P> = (intialProps: P) => (error: any) => void
export declare type Handler<P, E, C = any> = (
intialProps: P,
initialContext: C
) => (val: E) => void
export declare type ErrorHandler<P, C = any> = (
intialProps: P,
initialContext: C
) => (error: any) => void
export declare type PushEvent = (eventName: string) => <T>(val: T) => void
import { Handler, ErrorHandler } from './baseTypes'
import { Aperture } from './observable'
declare const configureComponent: <P, E>(
handler: Handler<P, E>,
errorHandler?: ErrorHandler<P>
declare const configureComponent: <P, E, Ctx>(
handler: Handler<P, E, Ctx>,
errorHandler?: ErrorHandler<P, any>
) => (
aperture: Aperture<P, E>,
aperture: Aperture<P, E, Ctx>,
instance: any,

@@ -9,0 +9,0 @@ isValidElement?: (val: any) => boolean,

@@ -16,5 +16,7 @@ import { Stream, Listener, Subscription } from 'xstream'

pushEvent: PushEvent
useEvent: <T>(eventName: string) => [Stream<T>, (val: T) => any]
}
export declare type Aperture<P, E> = (
props: P
export declare type Aperture<P, E, C = any> = (
initialProps: P,
initialContext: C
) => (component: ObservableComponent) => Stream<E>

@@ -21,0 +23,0 @@ export declare const subscribeToSink: <T>(

@@ -11,6 +11,6 @@ import { ComponentFactory, VNode } from 'preact'

export declare const withEffects: <P, E, CP = P>(
handler: Handler<P, E>,
errorHandler?: ErrorHandler<P>
handler: Handler<P, E, any>,
errorHandler?: ErrorHandler<P, any>
) => (
aperture: Aperture<P, E>
aperture: Aperture<P, E, any>
) => (

@@ -17,0 +17,0 @@ BaseComponent?: ComponentFactory<

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