@cycle/rx-adapter
Advanced tools
Comparing version
@@ -5,11 +5,3 @@ (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){ | ||
var rx_1 = typeof window !== "undefined" ? window['Rx'] : typeof global !== "undefined" ? global['Rx'] : null; | ||
function logToConsoleError(err) { | ||
var target = err.stack || err; | ||
if (console && console.error) { | ||
console.error(target); | ||
} else if (console && console.log) { | ||
console.log(target); | ||
} | ||
} | ||
var Rx = typeof window !== "undefined" ? window['Rx'] : typeof global !== "undefined" ? global['Rx'] : null; | ||
var RxJSAdapter = { | ||
@@ -20,3 +12,3 @@ adapt: function adapt(originStream, originStreamSubscribe) { | ||
} | ||
return rx_1.Observable.create(function (destinationObserver) { | ||
return Rx.Observable.create(function (destinationObserver) { | ||
var originObserver = { | ||
@@ -41,14 +33,7 @@ next: function next(x) { | ||
}, | ||
dispose: function dispose(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 remember(observable) { | ||
return observable.shareReplay(1); | ||
}, | ||
makeHoldSubject: function makeHoldSubject() { | ||
var stream = new rx_1.ReplaySubject(1); | ||
makeSubject: function makeSubject() { | ||
var stream = new Rx.Subject(); | ||
var observer = { | ||
@@ -59,3 +44,2 @@ next: function next(x) { | ||
error: function error(err) { | ||
logToConsoleError(err); | ||
stream.onError(err); | ||
@@ -77,4 +61,4 @@ }, | ||
return observer.error(e); | ||
}, function () { | ||
return observer.complete(); | ||
}, function (x) { | ||
return observer.complete(x); | ||
}); | ||
@@ -81,0 +65,0 @@ return function () { |
@@ -1,1 +0,1 @@ | ||
(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(global){"use strict";var rx_1=typeof window!=="undefined"?window["Rx"]:typeof global!=="undefined"?global["Rx"]:null;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 adapt(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return rx_1.Observable.create(function(destinationObserver){var originObserver={next:function next(x){return destinationObserver.onNext(x)},error:function error(e){return destinationObserver.onError(e)},complete:function complete(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},dispose:function dispose(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 makeHoldSubject(){var stream=new rx_1.ReplaySubject(1);var observer={next:function next(x){stream.onNext(x)},error:function error(err){logToConsoleError(err);stream.onError(err)},complete:function complete(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function isValidStream(stream){return typeof stream.subscribeOnNext==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function streamSubscribe(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}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]); | ||
(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(global){"use strict";var Rx=typeof window!=="undefined"?window["Rx"]:typeof global!=="undefined"?global["Rx"]:null;var RxJSAdapter={adapt:function adapt(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return Rx.Observable.create(function(destinationObserver){var originObserver={next:function next(x){return destinationObserver.onNext(x)},error:function error(e){return destinationObserver.onError(e)},complete:function complete(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},remember:function remember(observable){return observable.shareReplay(1)},makeSubject:function makeSubject(){var stream=new Rx.Subject;var observer={next:function next(x){stream.onNext(x)},error:function error(err){stream.onError(err)},complete:function complete(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function isValidStream(stream){return typeof stream.subscribeOnNext==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function streamSubscribe(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}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]); |
@@ -30,3 +30,3 @@ "use strict"; | ||
error: function (err) { stream.onError(err); }, | ||
complete: function (x) { stream.onCompleted(); } | ||
complete: function (x) { stream.onCompleted(); }, | ||
}; | ||
@@ -44,3 +44,3 @@ return { stream: stream, observer: observer }; | ||
}; | ||
} | ||
}, | ||
}; | ||
@@ -47,0 +47,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "@cycle/rx-adapter", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Cycle.js RxJS 4 Stream Adapter", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cyclejs/rx-adapter.git" | ||
}, | ||
"repository": "https://github.com/cyclejs/cyclejs/tree/master/packages/rx-adapter", | ||
"contributors": [ | ||
@@ -29,9 +26,8 @@ { | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/cyclejs/rx-adapter/issues" | ||
}, | ||
"homepage": "https://github.com/cyclejs/rx-adapter", | ||
"bugs": "https://github.com/cyclejs/cyclejs/issues", | ||
"homepage": "https://cycle.js.org", | ||
"browserify-shim": { | ||
"rx": "global:Rx" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
@@ -41,31 +37,28 @@ "rx": "*" | ||
"devDependencies": { | ||
"@cycle/base": "^4.0.0", | ||
"assert": "^1.3.0", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-register": "^6.4.3", | ||
"babelify": "^7.2.0", | ||
"browserify": "^13.0.0", | ||
"browserify-shim": "^3.8.12", | ||
"mkdirp": "^0.5.1", | ||
"mocha": "^2.3.4", | ||
"rx": "^4.0.7", | ||
"tslint": "3.6.0", | ||
"typescript": "^1.8.7", | ||
"typings": "^1.0.4", | ||
"uglify-js": "^2.6.1" | ||
"@cycle/base": "*", | ||
"rx": "^4.1.0" | ||
}, | ||
"scripts": { | ||
"lint": "tslint -c tslint.json src/*.ts", | ||
"premocha": "npm run lib", | ||
"mocha": "mocha --compilers js:babel-register test", | ||
"test": "npm run lint && npm run mocha", | ||
"prelib": "rm -rf lib/ && mkdirp lib/ && typings install", | ||
"lib": "tsc", | ||
"predist": "rm -rf dist/ && mkdirp dist/ && npm run lib", | ||
"dist": "browserify -t browserify-shim -t babelify --exclude rx lib/index.js -o dist/cycle-rx-adapter.js", | ||
"postdist": "uglifyjs dist/cycle-rx-adapter.js -o dist/cycle-rx-adapter.min.js", | ||
"start": "npm install && npm prune", | ||
"prepublish": "npm run lib", | ||
"preversion": "npm run dist" | ||
"lint": "../node_modules/.bin/tslint -c ../tslint.json src/**/*.ts", | ||
"mocha": "../node_modules/.bin/mocha --compilers js:babel-register test", | ||
"test": "npm run lint && npm run lib && npm run mocha", | ||
"test-ci": "npm run test", | ||
"prelib": "rm -rf lib/ && mkdir -p lib/", | ||
"lib": "../node_modules/.bin/tsc", | ||
"readme": ":", | ||
"browserify": "../node_modules/.bin/browserify -t browserify-shim -t babelify --exclude rx lib/index.js -o dist/cycle-rx-adapter.js", | ||
"uglify": "../node_modules/.bin/uglifyjs dist/cycle-rx-adapter.js -o dist/cycle-rx-adapter.min.js", | ||
"predist": "rm -rf dist/ && mkdir -p dist/ && npm run lib", | ||
"dist": "npm run lib && npm run browserify && npm run uglify", | ||
"preversion": "npm test", | ||
"version": "npm run dist && npm run readme && npm run changelog", | ||
"postversion": "git add -A && git commit -m \"release(${PWD##*/}): v$(cat package.json | ../node_modules/.bin/jase version)\" && git push origin master && npm publish", | ||
"release-patch": "false", | ||
"release-minor": "npm --no-git-tag-version version minor", | ||
"release-major": "npm --no-git-tag-version version major", | ||
"changelog": "node ../.scripts/update-changelogs.js ${PWD##*/}" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
@@ -1,2 +0,7 @@ | ||
# rx-adapter | ||
RxJS **version 4.x.x** StreamAdapter for run(). | ||
# Cycle.js Rx Stream Adapter | ||
Stream adapter interface for RxJS version **4.x.x**. | ||
``` | ||
npm install @cycle/rx-adapter | ||
``` |
@@ -8,3 +8,3 @@ import { | ||
} from '@cycle/base'; | ||
const Rx = require('rx'); | ||
import Rx = require('rx'); | ||
@@ -16,3 +16,3 @@ const RxJSAdapter: StreamAdapter = { | ||
} | ||
return <Rx.Observable<T>> Rx.Observable.create((destinationObserver: any) => { | ||
return Rx.Observable.create((destinationObserver: any) => { | ||
const originObserver: Observer<T> = { | ||
@@ -26,6 +26,6 @@ next: (x: T) => destinationObserver.onNext(x), | ||
if (typeof dispose === 'function') { | ||
(<DisposeFunction> dispose).call(null); | ||
(dispose as DisposeFunction).call(null); | ||
} | ||
}; | ||
}); | ||
}) as Rx.Observable<T>; | ||
}, | ||
@@ -42,3 +42,3 @@ | ||
error: (err: any) => { stream.onError(err); }, | ||
complete: (x?: T) => { stream.onCompleted(); } | ||
complete: (x?: T) => { stream.onCompleted(); }, | ||
}; | ||
@@ -58,3 +58,3 @@ return {stream, observer}; | ||
(e: any) => observer.error(e), | ||
(x?: T) => observer.complete(x) | ||
(x?: T) => observer.complete(x), | ||
); | ||
@@ -64,5 +64,5 @@ return () => { | ||
}; | ||
} | ||
}, | ||
}; | ||
export default RxJSAdapter; |
@@ -8,2 +8,3 @@ { | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
@@ -19,3 +20,3 @@ "module": "commonjs", | ||
"files": [ | ||
"typings/index.d.ts", | ||
"node_modules/rx/ts/rx.all.d.ts", | ||
"src/index.ts" | ||
@@ -22,0 +23,0 @@ ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
2
-85.71%8
166.67%16684
-14.83%12
-20%278
-19.19%2
100%5
25%