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

@cycle/core

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cycle/core - npm Package Compare versions

Comparing version 7.0.0-rc7 to 7.0.0-rc8

53

dist/cycle.js

@@ -77,2 +77,10 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

function logToConsoleError(err) {
var target = err.stack || err;
if (console && console.error) {
console.error(target);
} else if (console && console.log) {
console.log(target);
}
}
function makeSinkProxies(drivers, streamAdapter) {

@@ -112,3 +120,14 @@ var sinkProxies = {};

}).map(function (name) {
return streamAdapter.streamSubscribe(sinks[name], sinkProxies[name].observer);
return streamAdapter.streamSubscribe(sinks[name], {
next: function next(x) {
sinkProxies[name].observer.next(x);
},
error: function error(err) {
logToConsoleError(err);
sinkProxies[name].observer.error(err);
},
complete: function complete(x) {
sinkProxies[name].observer.complete(x);
}
});
});

@@ -157,3 +176,2 @@ var disposeFunctions = results.filter(function (dispose) {

return function () {
streamAdapter.dispose(sinks, sinkProxies, sources);
disposeSources(sources);

@@ -172,11 +190,2 @@ disposeReplication();

var Rx = require('rx');
function logToConsoleError(err) {
var target = err.stack || err;
if (console && console.error) {
console.error(target);
}
else if (console && console.log) {
console.log(target);
}
}
var RxJSAdapter = {

@@ -201,11 +210,4 @@ adapt: function (originStream, originStreamSubscribe) {

},
dispose: function (sinks, sinkProxies, sources) {
Object.keys(sources).forEach(function (k) {
if (typeof sources[k].dispose === 'function') {
sources[k].dispose();
}
});
Object.keys(sinkProxies).forEach(function (k) {
sinkProxies[k].observer.complete();
});
remember: function (observable) {
return observable.shareReplay(1);
},

@@ -216,7 +218,4 @@ makeSubject: function () {

next: function (x) { stream.onNext(x); },
error: function (err) {
logToConsoleError(err);
stream.onError(err);
},
complete: function (x) { stream.onCompleted(); },
error: function (err) { stream.onError(err); },
complete: function (x) { stream.onCompleted(); }
};

@@ -230,7 +229,7 @@ return { stream: stream, observer: observer };

streamSubscribe: function (stream, observer) {
var subscription = stream.subscribe(function (x) { return observer.next(x); }, function (e) { return observer.error(e); }, function () { return observer.complete(); });
var subscription = stream.subscribe(function (x) { return observer.next(x); }, function (e) { return observer.error(e); }, function (x) { return observer.complete(x); });
return function () {
subscription.dispose();
};
},
}
};

@@ -237,0 +236,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,1 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var base_1=require("@cycle/base");var rx_adapter_1=require("@cycle/rx-adapter");var Cycle=function Cycle(main,drivers){return base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default})};function run(main,drivers){var run=base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default}).run;return run()}exports.run=run;Cycle.run=run;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function makeSinkProxies(drivers,streamAdapter){var sinkProxies={};for(var name_1 in drivers){if(drivers.hasOwnProperty(name_1)){var holdSubject=streamAdapter.makeSubject();var driverStreamAdapter=drivers[name_1].streamAdapter||streamAdapter;var stream=driverStreamAdapter.adapt(holdSubject.stream,streamAdapter.streamSubscribe);sinkProxies[name_1]={stream:stream,observer:holdSubject.observer}}}return sinkProxies}function callDrivers(drivers,sinkProxies,streamAdapter){var sources={};for(var name_2 in drivers){if(drivers.hasOwnProperty(name_2)){var driverOutput=drivers[name_2](sinkProxies[name_2].stream,streamAdapter,name_2);var driverStreamAdapter=drivers[name_2].streamAdapter;if(driverStreamAdapter&&driverStreamAdapter.isValidStream(driverOutput)){sources[name_2]=streamAdapter.adapt(driverOutput,driverStreamAdapter.streamSubscribe)}else{sources[name_2]=driverOutput}}}return sources}function replicateMany(sinks,sinkProxies,streamAdapter){var results=Object.keys(sinks).filter(function(name){return!!sinkProxies[name]}).map(function(name){return streamAdapter.streamSubscribe(sinks[name],sinkProxies[name].observer)});var disposeFunctions=results.filter(function(dispose){return typeof dispose==="function"});return function(){disposeFunctions.forEach(function(dispose){return dispose()})}}function disposeSources(sources){for(var k in sources){if(sources.hasOwnProperty(k)&&sources[k]&&typeof sources[k].dispose==="function"){sources[k].dispose()}}}var isObjectEmpty=function isObjectEmpty(obj){return Object.keys(obj).length===0};function Cycle(main,drivers,options){if(typeof main!=="function"){throw new Error("First argument given to Cycle must be the 'main' "+"function.")}if((typeof drivers==="undefined"?"undefined":_typeof(drivers))!=="object"||drivers===null){throw new Error("Second argument given to Cycle must be an object "+"with driver functions as properties.")}if(isObjectEmpty(drivers)){throw new Error("Second argument given to Cycle must be an object "+"with at least one driver function declared as a property.")}var streamAdapter=options.streamAdapter;if(!streamAdapter||isObjectEmpty(streamAdapter)){throw new Error("Third argument given to Cycle must be an options object "+"with the streamAdapter key supplied with a valid stream adapter.")}var sinkProxies=makeSinkProxies(drivers,streamAdapter);var sources=callDrivers(drivers,sinkProxies,streamAdapter);var sinks=main(sources);if(typeof window!=="undefined"){window.Cyclejs={sinks:sinks}}var run=function run(){var disposeReplication=replicateMany(sinks,sinkProxies,streamAdapter);return function(){streamAdapter.dispose(sinks,sinkProxies,sources);disposeSources(sources);disposeReplication()}};return{sinks:sinks,sources:sources,run:run}}Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{}],3:[function(require,module,exports){"use strict";var Rx=require("rx");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var RxJSAdapter={adapt:function(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return Rx.Observable.create(function(destinationObserver){var originObserver={next:function(x){return destinationObserver.onNext(x)},error:function(e){return destinationObserver.onError(e)},complete:function(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeSubject:function(){var stream=new Rx.Subject;var observer={next:function(x){stream.onNext(x)},error:function(err){logToConsoleError(err);stream.onError(err)},complete:function(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function(stream){return typeof stream.subscribeOnNext==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function(stream,observer){var subscription=stream.subscribe(function(x){return observer.next(x)},function(e){return observer.error(e)},function(){return observer.complete()});return function(){subscription.dispose()}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=RxJSAdapter},{rx:undefined}]},{},[1])(1)});
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var base_1=require("@cycle/base");var rx_adapter_1=require("@cycle/rx-adapter");var Cycle=function Cycle(main,drivers){return base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default})};function run(main,drivers){var run=base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default}).run;return run()}exports.run=run;Cycle.run=run;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}function makeSinkProxies(drivers,streamAdapter){var sinkProxies={};for(var name_1 in drivers){if(drivers.hasOwnProperty(name_1)){var holdSubject=streamAdapter.makeSubject();var driverStreamAdapter=drivers[name_1].streamAdapter||streamAdapter;var stream=driverStreamAdapter.adapt(holdSubject.stream,streamAdapter.streamSubscribe);sinkProxies[name_1]={stream:stream,observer:holdSubject.observer}}}return sinkProxies}function callDrivers(drivers,sinkProxies,streamAdapter){var sources={};for(var name_2 in drivers){if(drivers.hasOwnProperty(name_2)){var driverOutput=drivers[name_2](sinkProxies[name_2].stream,streamAdapter,name_2);var driverStreamAdapter=drivers[name_2].streamAdapter;if(driverStreamAdapter&&driverStreamAdapter.isValidStream(driverOutput)){sources[name_2]=streamAdapter.adapt(driverOutput,driverStreamAdapter.streamSubscribe)}else{sources[name_2]=driverOutput}}}return sources}function replicateMany(sinks,sinkProxies,streamAdapter){var results=Object.keys(sinks).filter(function(name){return!!sinkProxies[name]}).map(function(name){return streamAdapter.streamSubscribe(sinks[name],{next:function next(x){sinkProxies[name].observer.next(x)},error:function error(err){logToConsoleError(err);sinkProxies[name].observer.error(err)},complete:function complete(x){sinkProxies[name].observer.complete(x)}})});var disposeFunctions=results.filter(function(dispose){return typeof dispose==="function"});return function(){disposeFunctions.forEach(function(dispose){return dispose()})}}function disposeSources(sources){for(var k in sources){if(sources.hasOwnProperty(k)&&sources[k]&&typeof sources[k].dispose==="function"){sources[k].dispose()}}}var isObjectEmpty=function isObjectEmpty(obj){return Object.keys(obj).length===0};function Cycle(main,drivers,options){if(typeof main!=="function"){throw new Error("First argument given to Cycle must be the 'main' "+"function.")}if((typeof drivers==="undefined"?"undefined":_typeof(drivers))!=="object"||drivers===null){throw new Error("Second argument given to Cycle must be an object "+"with driver functions as properties.")}if(isObjectEmpty(drivers)){throw new Error("Second argument given to Cycle must be an object "+"with at least one driver function declared as a property.")}var streamAdapter=options.streamAdapter;if(!streamAdapter||isObjectEmpty(streamAdapter)){throw new Error("Third argument given to Cycle must be an options object "+"with the streamAdapter key supplied with a valid stream adapter.")}var sinkProxies=makeSinkProxies(drivers,streamAdapter);var sources=callDrivers(drivers,sinkProxies,streamAdapter);var sinks=main(sources);if(typeof window!=="undefined"){window.Cyclejs={sinks:sinks}}var run=function run(){var disposeReplication=replicateMany(sinks,sinkProxies,streamAdapter);return function(){disposeSources(sources);disposeReplication()}};return{sinks:sinks,sources:sources,run:run}}Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{}],3:[function(require,module,exports){"use strict";var Rx=require("rx");var RxJSAdapter={adapt:function(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return Rx.Observable.create(function(destinationObserver){var originObserver={next:function(x){return destinationObserver.onNext(x)},error:function(e){return destinationObserver.onError(e)},complete:function(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},remember:function(observable){return observable.shareReplay(1)},makeSubject:function(){var stream=new Rx.Subject;var observer={next:function(x){stream.onNext(x)},error:function(err){stream.onError(err)},complete:function(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function(stream){return typeof stream.subscribeOnNext==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function(stream,observer){var subscription=stream.subscribe(function(x){return observer.next(x)},function(e){return observer.error(e)},function(x){return observer.complete(x)});return function(){subscription.dispose()}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=RxJSAdapter},{rx:undefined}]},{},[1])(1)});
{
"name": "@cycle/core",
"version": "7.0.0-rc7",
"version": "7.0.0-rc8",
"author": "Andre Staltz",

@@ -25,4 +25,4 @@ "description": "The Cycle run() function meant to be used with RxJS v4",

"dependencies": {
"@cycle/base": "^3.0.0",
"@cycle/rx-adapter": "^2.0.0"
"@cycle/base": "^4.0.0",
"@cycle/rx-adapter": "^3.0.0"
},

@@ -29,0 +29,0 @@ "peerDependencies": {

@@ -81,3 +81,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

if (drivers.hasOwnProperty(name_1)) {
var holdSubject = streamAdapter.makeHoldSubject();
var holdSubject = streamAdapter.makeSubject();
var driverStreamAdapter = drivers[name_1].streamAdapter || streamAdapter;

@@ -169,3 +169,3 @@ var stream = driverStreamAdapter.adapt(holdSubject.stream, streamAdapter.streamSubscribe);

"use strict";
var rx_1 = require('rx');
var Rx = require('rx');
function logToConsoleError(err) {

@@ -185,3 +185,3 @@ var target = err.stack || err;

}
return rx_1.Observable.create(function (destinationObserver) {
return Rx.Observable.create(function (destinationObserver) {
var originObserver = {

@@ -210,4 +210,4 @@ next: function (x) { return destinationObserver.onNext(x); },

},
makeHoldSubject: function () {
var stream = new rx_1.ReplaySubject(1);
makeSubject: function () {
var stream = new Rx.Subject();
var observer = {

@@ -214,0 +214,0 @@ next: function (x) { stream.onNext(x); },

@@ -1,1 +0,1 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var base_1=require("@cycle/base");var rx_adapter_1=require("@cycle/rx-adapter");var Cycle=function Cycle(main,drivers){return base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default})};function run(main,drivers){var run=base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default}).run;return run()}exports.run=run;Cycle.run=run;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function makeSinkProxies(drivers,streamAdapter){var sinkProxies={};for(var name_1 in drivers){if(drivers.hasOwnProperty(name_1)){var holdSubject=streamAdapter.makeHoldSubject();var driverStreamAdapter=drivers[name_1].streamAdapter||streamAdapter;var stream=driverStreamAdapter.adapt(holdSubject.stream,streamAdapter.streamSubscribe);sinkProxies[name_1]={stream:stream,observer:holdSubject.observer}}}return sinkProxies}function callDrivers(drivers,sinkProxies,streamAdapter){var sources={};for(var name_2 in drivers){if(drivers.hasOwnProperty(name_2)){var driverOutput=drivers[name_2](sinkProxies[name_2].stream,streamAdapter,name_2);var driverStreamAdapter=drivers[name_2].streamAdapter;if(driverStreamAdapter&&driverStreamAdapter.isValidStream(driverOutput)){sources[name_2]=streamAdapter.adapt(driverOutput,driverStreamAdapter.streamSubscribe)}else{sources[name_2]=driverOutput}}}return sources}function replicateMany(sinks,sinkProxies,streamAdapter){var results=Object.keys(sinks).filter(function(name){return!!sinkProxies[name]}).map(function(name){return streamAdapter.streamSubscribe(sinks[name],sinkProxies[name].observer)});var disposeFunctions=results.filter(function(dispose){return typeof dispose==="function"});return function(){disposeFunctions.forEach(function(dispose){return dispose()})}}function disposeSources(sources){for(var k in sources){if(sources.hasOwnProperty(k)&&sources[k]&&typeof sources[k].dispose==="function"){sources[k].dispose()}}}var isObjectEmpty=function isObjectEmpty(obj){return Object.keys(obj).length===0};function Cycle(main,drivers,options){if(typeof main!=="function"){throw new Error("First argument given to Cycle must be the 'main' "+"function.")}if((typeof drivers==="undefined"?"undefined":_typeof(drivers))!=="object"||drivers===null){throw new Error("Second argument given to Cycle must be an object "+"with driver functions as properties.")}if(isObjectEmpty(drivers)){throw new Error("Second argument given to Cycle must be an object "+"with at least one driver function declared as a property.")}var streamAdapter=options.streamAdapter;if(!streamAdapter||isObjectEmpty(streamAdapter)){throw new Error("Third argument given to Cycle must be an options object "+"with the streamAdapter key supplied with a valid stream adapter.")}var sinkProxies=makeSinkProxies(drivers,streamAdapter);var sources=callDrivers(drivers,sinkProxies,streamAdapter);var sinks=main(sources);if(typeof window!=="undefined"){window.Cyclejs={sinks:sinks}}var run=function run(){var disposeReplication=replicateMany(sinks,sinkProxies,streamAdapter);return function(){streamAdapter.dispose(sinks,sinkProxies,sources);disposeSources(sources);disposeReplication()}};return{sinks:sinks,sources:sources,run:run}}Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{}],3:[function(require,module,exports){"use strict";var rx_1=require("rx");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var RxJSAdapter={adapt:function(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return rx_1.Observable.create(function(destinationObserver){var originObserver={next:function(x){return destinationObserver.onNext(x)},error:function(e){return destinationObserver.onError(e)},complete:function(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeHoldSubject:function(){var stream=new rx_1.ReplaySubject(1);var observer={next:function(x){stream.onNext(x)},error:function(err){logToConsoleError(err);stream.onError(err)},complete:function(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function(stream){return typeof stream.subscribeOnNext==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function(stream,observer){var subscription=stream.subscribe(function(x){return observer.next(x)},function(e){return observer.error(e)},function(){return observer.complete()});return function(){subscription.dispose()}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=RxJSAdapter},{rx:undefined}]},{},[1])(1)});
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var base_1=require("@cycle/base");var rx_adapter_1=require("@cycle/rx-adapter");var Cycle=function Cycle(main,drivers){return base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default})};function run(main,drivers){var run=base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default}).run;return run()}exports.run=run;Cycle.run=run;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function makeSinkProxies(drivers,streamAdapter){var sinkProxies={};for(var name_1 in drivers){if(drivers.hasOwnProperty(name_1)){var holdSubject=streamAdapter.makeSubject();var driverStreamAdapter=drivers[name_1].streamAdapter||streamAdapter;var stream=driverStreamAdapter.adapt(holdSubject.stream,streamAdapter.streamSubscribe);sinkProxies[name_1]={stream:stream,observer:holdSubject.observer}}}return sinkProxies}function callDrivers(drivers,sinkProxies,streamAdapter){var sources={};for(var name_2 in drivers){if(drivers.hasOwnProperty(name_2)){var driverOutput=drivers[name_2](sinkProxies[name_2].stream,streamAdapter,name_2);var driverStreamAdapter=drivers[name_2].streamAdapter;if(driverStreamAdapter&&driverStreamAdapter.isValidStream(driverOutput)){sources[name_2]=streamAdapter.adapt(driverOutput,driverStreamAdapter.streamSubscribe)}else{sources[name_2]=driverOutput}}}return sources}function replicateMany(sinks,sinkProxies,streamAdapter){var results=Object.keys(sinks).filter(function(name){return!!sinkProxies[name]}).map(function(name){return streamAdapter.streamSubscribe(sinks[name],sinkProxies[name].observer)});var disposeFunctions=results.filter(function(dispose){return typeof dispose==="function"});return function(){disposeFunctions.forEach(function(dispose){return dispose()})}}function disposeSources(sources){for(var k in sources){if(sources.hasOwnProperty(k)&&sources[k]&&typeof sources[k].dispose==="function"){sources[k].dispose()}}}var isObjectEmpty=function isObjectEmpty(obj){return Object.keys(obj).length===0};function Cycle(main,drivers,options){if(typeof main!=="function"){throw new Error("First argument given to Cycle must be the 'main' "+"function.")}if((typeof drivers==="undefined"?"undefined":_typeof(drivers))!=="object"||drivers===null){throw new Error("Second argument given to Cycle must be an object "+"with driver functions as properties.")}if(isObjectEmpty(drivers)){throw new Error("Second argument given to Cycle must be an object "+"with at least one driver function declared as a property.")}var streamAdapter=options.streamAdapter;if(!streamAdapter||isObjectEmpty(streamAdapter)){throw new Error("Third argument given to Cycle must be an options object "+"with the streamAdapter key supplied with a valid stream adapter.")}var sinkProxies=makeSinkProxies(drivers,streamAdapter);var sources=callDrivers(drivers,sinkProxies,streamAdapter);var sinks=main(sources);if(typeof window!=="undefined"){window.Cyclejs={sinks:sinks}}var run=function run(){var disposeReplication=replicateMany(sinks,sinkProxies,streamAdapter);return function(){streamAdapter.dispose(sinks,sinkProxies,sources);disposeSources(sources);disposeReplication()}};return{sinks:sinks,sources:sources,run:run}}Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{}],3:[function(require,module,exports){"use strict";var Rx=require("rx");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var RxJSAdapter={adapt:function(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return Rx.Observable.create(function(destinationObserver){var originObserver={next:function(x){return destinationObserver.onNext(x)},error:function(e){return destinationObserver.onError(e)},complete:function(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeSubject:function(){var stream=new Rx.Subject;var observer={next:function(x){stream.onNext(x)},error:function(err){logToConsoleError(err);stream.onError(err)},complete:function(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function(stream){return typeof stream.subscribeOnNext==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function(stream,observer){var subscription=stream.subscribe(function(x){return observer.next(x)},function(e){return observer.error(e)},function(){return observer.complete()});return function(){subscription.dispose()}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=RxJSAdapter},{rx:undefined}]},{},[1])(1)});
{
"name": "@cycle/rx-run",
"version": "7.0.0-rc6",
"version": "7.0.0-rc7",
"author": "Andre Staltz",

@@ -25,4 +25,4 @@ "description": "The Cycle run() function meant to be used with RxJS v4",

"dependencies": {
"@cycle/base": "^2.1.1",
"@cycle/rx-adapter": "^1.0.4"
"@cycle/base": "^3.0.0",
"@cycle/rx-adapter": "^2.0.0"
},

@@ -44,4 +44,4 @@ "peerDependencies": {

"tslint": "3.6.0",
"typescript": "^1.8.9",
"typings": "^0.7.12",
"typescript": "^1.8.7",
"typings": "^1.0.4",
"uglify-js": "2.5.0"

@@ -48,0 +48,0 @@ },

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