@uirouter/rx
Advanced tools
Comparing version 0.5.0-alpha.1 to 0.5.0
/** | ||
* Reactive extensions for UI-Router | ||
* @version v0.5.0-alpha.1 | ||
* @version v0.5.0 | ||
* @link https://github.com/ui-router/rx#readme | ||
* @license MIT License, http://www.opensource.org/licenses/MIT | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("rxjs/operators")):"function"==typeof define&&define.amd?define(["exports","rxjs/operators"],e):e(t["@uirouter/rx"]={},null)}(this,function(t,e){"use strict";var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function i(t){return"function"==typeof t}var o=!1,s={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;o=t},get useDeprecatedSynchronousErrorHandling(){return o}};function u(t){setTimeout(function(){throw t})}var c={closed:!0,next:function(t){},error:function(t){if(s.useDeprecatedSynchronousErrorHandling)throw t;u(t)},complete:function(){}},h=Array.isArray||function(t){return t&&"number"==typeof t.length};function a(t){return null!=t&&"object"==typeof t}var p,l={e:{}};function f(){try{return p.apply(this,arguments)}catch(t){return l.e=t,l}}function d(t){return p=t,f}var b=function(t){function e(r){var n=t.call(this,r?r.length+" errors occurred during unsubscription:\n "+r.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"")||this;return n.errors=r,n.name="UnsubscriptionError",Object.setPrototypeOf(n,e.prototype),n}return n(e,t),e}(Error),y=function(){function t(t){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){var r=this._parent,n=this._parents,o=this._unsubscribe,s=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var u=-1,c=n?n.length:0;r;)r.remove(this),r=++u<c&&n[u]||null;if(i(o))d(o).call(this)===l&&(e=!0,t=t||(l.e instanceof b?v(l.e.errors):[l.e]));if(h(s))for(u=-1,c=s.length;++u<c;){var p=s[u];if(a(p))if(d(p.unsubscribe).call(p)===l){e=!0,t=t||[];var f=l.e;f instanceof b?t=t.concat(v(f.errors)):t.push(f)}}if(e)throw new b(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var r=e;switch(typeof e){case"function":r=new t(e);case"object":if(r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if("function"!=typeof r._addParent){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return(this._subscriptions||(this._subscriptions=[])).push(r),r._addParent(this),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.prototype._addParent=function(t){var e=this._parent,r=this._parents;e&&e!==t?r?-1===r.indexOf(t)&&r.push(t):this._parents=[t]:this._parent=t},t.EMPTY=((e=new t).closed=!0,e),t}();function v(t){return t.reduce(function(t,e){return t.concat(e instanceof b?e.errors:e)},[])}var w="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("rxSubscriber"):"@@rxSubscriber",_=function(t){function e(e,r,n){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=c;break;case 1:if(!e){i.destination=c;break}if("object"==typeof e){if(m(e)){var o=e[w]();i.syncErrorThrowable=o.syncErrorThrowable,i.destination=o,o.add(i)}else i.syncErrorThrowable=!0,i.destination=new E(i,e);break}default:i.syncErrorThrowable=!0,i.destination=new E(i,e,r,n)}return i}return n(e,t),e.prototype[w]=function(){return this},e.create=function(t,r,n){var i=new e(t,r,n);return i.syncErrorThrowable=!1,i},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parent,e=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=t,this._parents=e,this},e}(y),E=function(t){function e(e,r,n,o){var s,u=t.call(this)||this;u._parentSubscriber=e;var h=u;return i(r)?s=r:r&&(s=r.next,n=r.error,o=r.complete,r!==c&&(i((h=Object.create(r)).unsubscribe)&&u.add(h.unsubscribe.bind(h)),h.unsubscribe=u.unsubscribe.bind(u))),u._context=h,u._next=s,u._error=n,u._complete=o,u}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;s.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=s.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):u(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;u(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};s.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),s.useDeprecatedSynchronousErrorHandling)throw t;u(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!s.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return s.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(u(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(_);function m(t){return t instanceof _||"syncErrorThrowable"in t&&t[w]}var g="function"==typeof Symbol&&Symbol.observable||"@@observable";function S(){}var x=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=function(t,e,r){if(t){if(t instanceof _)return t;if(t[w])return t[w]()}return t||e||r?new _(t,e,r):new _(c)}(t,e,r);if(n?n.call(i,this.source):i.add(this.source||!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),s.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){s.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=T(e))(function(e,n){var i;i=r.subscribe(function(e){try{t(e)}catch(t){n(t),i&&i.unsubscribe()}},n,e)})},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[g]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return 0===e.length?this:((t=e)?1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}:S)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=T(t))(function(t,r){var n;e.subscribe(function(t){return n=t},function(t){return r(t)},function(){return t(n)})})},t.create=function(e){return new t(e)},t}();function T(t){if(t||(t=s.Promise||Promise),!t)throw new Error("no Promise impl found");return t}var I=function(t){function e(){var r=t.call(this,"object unsubscribed")||this;return r.name="ObjectUnsubscribedError",Object.setPrototypeOf(r,e.prototype),r}return n(e,t),e}(Error),O=function(t){function e(e,r){var n=t.call(this)||this;return n.subject=e,n.subscriber=r,n.closed=!1,n}return n(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var r=e.indexOf(this.subscriber);-1!==r&&e.splice(r,1)}}},e}(y),N=function(t){function e(e){var r=t.call(this,e)||this;return r.destination=e,r}return n(e,t),e}(_),P=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return n(e,t),e.prototype[w]=function(){return new N(this)},e.prototype.lift=function(t){var e=new j(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new I;if(!this.isStopped)for(var e=this.observers,r=e.length,n=e.slice(),i=0;i<r;i++)n[i].next(t)},e.prototype.error=function(t){if(this.closed)throw new I;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,r=e.length,n=e.slice(),i=0;i<r;i++)n[i].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new I;this.isStopped=!0;for(var t=this.observers,e=t.length,r=t.slice(),n=0;n<e;n++)r[n].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new I;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new I;return this.hasError?(t.error(this.thrownError),y.EMPTY):this.isStopped?(t.complete(),y.EMPTY):(this.observers.push(t),new O(this,t))},e.prototype.asObservable=function(){var t=new x;return t.source=this,t},e.create=function(t,e){return new j(t,e)},e}(x),j=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return n(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):y.EMPTY},e}(P);var k=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n.pending=!1,n}return n(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),setInterval(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){if(void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r=!1,n=void 0;try{this.work(t)}catch(t){r=!0,n=!!t&&t||new Error(t)}if(r)return this.unsubscribe(),n},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,r=e.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,r){return t.call(this)||this}return n(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(y)),A=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return n(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):e.flush(this)},e}(k),D=function(){function t(e,r){void 0===r&&(r=t.now),this.SchedulerAction=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(r,e)},t.now=Date.now?Date.now:function(){return+new Date},t}(),M=function(t){function e(r,n){void 0===n&&(n=D.now);var i=t.call(this,r,function(){return e.delegate&&e.delegate!==i?e.delegate.now():n()})||this;return i.actions=[],i.active=!1,i.scheduled=void 0,i}return n(e,t),e.prototype.schedule=function(r,n,i){return void 0===n&&(n=0),e.delegate&&e.delegate!==this?e.delegate.schedule(r,n,i):t.prototype.schedule.call(this,r,n,i)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var r;this.active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(D),H=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(M))(A),V=new x(function(t){return t.complete()});function Y(t){return t?function(t){return new x(function(e){return t.schedule(function(){return e.complete()})})}(t):V}var F=function(t){return function(e){for(var r=0,n=t.length;r<n&&!e.closed;r++)e.next(t[r]);e.closed||e.complete()}};function U(t,e){return new x(e?function(r){var n=new y,i=0;return n.add(e.schedule(function(){i!==t.length?(r.next(t[i++]),r.closed||n.add(this.schedule())):r.complete()})),n}:F(t))}function C(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r,n=t[t.length-1];switch((r=n)&&"function"==typeof r.schedule?t.pop():n=void 0,t.length){case 0:return Y(n);case 1:return n?U(t,n):function(t){var e=new x(function(e){e.next(t),e.complete()});return e._isScalar=!0,e.value=t,e}(t[0]);default:return U(t,n)}}function R(t){var e=t.error;t.subscriber.error(e)}var W=function(){function t(t,e,r){this.kind=t,this.value=e,this.error=r,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,r){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return r&&r()}},t.prototype.accept=function(t,e,r){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,r)},t.prototype.toObservable=function(){var t,e;switch(this.kind){case"N":return C(this.value);case"E":return t=this.error,new x(e?function(r){return e.schedule(R,0,{error:t,subscriber:r})}:function(e){return e.error(t)});case"C":return Y()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}(),q=function(t){function e(e,r,n){void 0===n&&(n=0);var i=t.call(this,e)||this;return i.scheduler=r,i.delay=n,i}return n(e,t),e.dispatch=function(t){var e=t.notification,r=t.destination;e.observe(r),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.add(this.scheduler.schedule(e.dispatch,this.delay,new z(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(W.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(W.createError(t))},e.prototype._complete=function(){this.scheduleMessage(W.createComplete())},e}(_),z=function(){return function(t,e){this.notification=t,this.destination=e}}(),$=function(t){function e(e,r,n){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===r&&(r=Number.POSITIVE_INFINITY);var i=t.call(this)||this;return i.scheduler=n,i._events=[],i._infiniteTimeWindow=!1,i._bufferSize=e<1?1:e,i._windowTime=r<1?1:r,r===Number.POSITIVE_INFINITY?(i._infiniteTimeWindow=!0,i.next=i.nextInfiniteTimeWindow):i.next=i.nextTimeWindow,i}return n(e,t),e.prototype.nextInfiniteTimeWindow=function(e){var r=this._events;r.push(e),r.length>this._bufferSize&&r.shift(),t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this._events.push(new B(this._getNow(),e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,r=this._infiniteTimeWindow,n=r?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,o=n.length;if(this.closed)throw new I;if(this.isStopped||this.hasError?e=y.EMPTY:(this.observers.push(t),e=new O(this,t)),i&&t.add(t=new q(t,i)),r)for(var s=0;s<o&&!t.closed;s++)t.next(n[s]);else for(s=0;s<o&&!t.closed;s++)t.next(n[s].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||H).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,r=this._windowTime,n=this._events,i=n.length,o=0;o<i&&!(t-n[o].time<r);)o++;return i>e&&(o=Math.max(o,i-e)),o>0&&n.splice(0,o),n},e}(P),B=function(){return function(t,e){this.time=t,this.value=e}}();Error,Error,Error;var G=function(){function t(t){this.name="@uirouter/rx",this.deregisterFns=[];var r=new $(1),n=r.pipe(e.mergeMap(function(t){return t.promise.then(function(){return t})})),i=n.pipe(e.map(function(t){return t.params()})),o=new $(1);function s(e,r){var n={currentStates:t.stateRegistry.get(),registered:[],deregistered:[]};e&&(n[e]=r),o.next(n)}this.deregisterFns.push(t.transitionService.onStart({},function(t){return r.next(t)})),this.deregisterFns.push(t.stateRegistry.onStatesChanged(s)),s(null,null),Object.assign(t.globals,{start$:r,success$:n,params$:i,states$:o})}return t.prototype.dispose=function(){this.deregisterFns.forEach(function(t){return t()}),this.deregisterFns=[]},t}(),J=G;t.UIRouterRx=G,t.UIRouterRxPlugin=J,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define(["exports","rxjs","rxjs/operators"],t):t(e["@uirouter/rx"]={},null,null)}(this,function(e,t,r){"use strict";var n=function(){function e(e){this.name="@uirouter/rx",this.deregisterFns=[];var n=new t.ReplaySubject(1),s=n.pipe(r.mergeMap(function(e){return e.promise.then(function(){return e},function(){return null})}),r.filter(function(e){return!!e})),i=s.pipe(r.map(function(e){return e.params()})),u=new t.ReplaySubject(1);function o(t,r){var n={currentStates:e.stateRegistry.get(),registered:[],deregistered:[]};t&&(n[t]=r),u.next(n)}this.deregisterFns.push(e.transitionService.onStart({},function(e){return n.next(e)})),this.deregisterFns.push(e.stateRegistry.onStatesChanged(o)),o(null,null),Object.assign(e.globals,{start$:n,success$:s,params$:i,states$:u})}return e.prototype.dispose=function(){this.deregisterFns.forEach(function(e){return e()}),this.deregisterFns=[]},e}(),s=n;e.UIRouterRx=n,e.UIRouterRxPlugin=s,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ui-router-rx.min.js.map |
@@ -0,1 +1,21 @@ | ||
# 0.5.0 (2018-05-08) | ||
[Compare `@uirouter/rx` versions 0.4.5 and 0.5.0](https://github.com/ui-router/rx/compare/0.4.5...0.5.0) | ||
### Bug Fixes | ||
* **onError:** Handle transition error so rxjs doesn't log rejections ([84e6210](https://github.com/ui-router/rx/commit/84e6210)) | ||
### Features | ||
* upgrade to rxjs 6 ([46b8158](https://github.com/ui-router/rx/commit/46b8158)) | ||
### BREAKING CHANGES | ||
* rxjs 6.0.0 or higher is now required to use this module | ||
# 0.5.0-alpha.1 (2018-05-07) | ||
@@ -2,0 +22,0 @@ [Compare `@uirouter/rx` versions 0.4.5 and 0.5.0-alpha.1](https://github.com/ui-router/rx/compare/0.4.5...0.5.0-alpha.1) |
/** @module rx */ | ||
/** */ | ||
import { ReplaySubject } from 'rxjs'; | ||
import { map, mergeMap } from 'rxjs/operators'; | ||
import { map, mergeMap, filter } from 'rxjs/operators'; | ||
/** Augments UIRouterGlobals with observables for transition starts, successful transitions, and state parameters */ | ||
@@ -11,3 +11,3 @@ var UIRouterRx = /** @class */ (function () { | ||
var start$ = new ReplaySubject(1); | ||
var success$ = start$.pipe(mergeMap(function (t) { return t.promise.then(function () { return t; }); })); | ||
var success$ = start$.pipe(mergeMap(function (t) { return t.promise.then(function () { return t; }, function () { return null; }); }), filter(function (t) { return !!t; })); | ||
var params$ = success$.pipe(map(function (transition) { return transition.params(); })); | ||
@@ -14,0 +14,0 @@ var states$ = new ReplaySubject(1); |
@@ -13,3 +13,3 @@ "use strict"; | ||
var start$ = new rxjs_1.ReplaySubject(1); | ||
var success$ = start$.pipe(operators_1.mergeMap(function (t) { return t.promise.then(function () { return t; }); })); | ||
var success$ = start$.pipe(operators_1.mergeMap(function (t) { return t.promise.then(function () { return t; }, function () { return null; }); }), operators_1.filter(function (t) { return !!t; })); | ||
var params$ = success$.pipe(operators_1.map(function (transition) { return transition.params(); })); | ||
@@ -16,0 +16,0 @@ var states$ = new rxjs_1.ReplaySubject(1); |
{ | ||
"name": "@uirouter/rx", | ||
"version": "0.5.0-alpha.1", | ||
"version": "0.5.0", | ||
"description": "Reactive extensions for UI-Router", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -34,57 +34,29 @@ import nodeResolve from 'rollup-plugin-node-resolve'; | ||
function isExternal(id) { | ||
// @uirouter/core and ui-router-rx should be external | ||
// All rxjs and @angular/* should be external | ||
// except for @angular/router/src/router_config_loader | ||
let externals = [/^rxjs\/.*/, /^@uirouter\/.*/, /^@angular\/.*/, /^angular$/]; | ||
return externals.map(regex => regex.exec(id)).reduce((acc, val) => acc || !!val, false); | ||
// @uirouter/core and rxjs should be external | ||
let externals = [/^rxjs\/?/, /\/rxjs\//, /^@uirouter\/.*/]; | ||
let isExternal = externals.map(regex => regex.exec(id)).reduce((acc, val) => acc || !!val, false); | ||
// console.log(id, isExternal); | ||
return isExternal; | ||
} | ||
const CONFIG = { | ||
moduleName: '@uirouter/rx', | ||
entry: 'lib-esm/index.js', | ||
dest: '_bundles/ui-router-rx' + extension, | ||
input: 'lib-esm/index.js', | ||
output: { | ||
file: '_bundles/ui-router-rx' + extension, | ||
name: '@uirouter/rx', | ||
globals: { | ||
'@uirouter/core': '@uirouter/core', | ||
'@uirouter/rx': '@uirouter/rx', | ||
}, | ||
sourcemap: true, | ||
banner: banner, | ||
format: 'umd', | ||
exports: 'named', | ||
}, | ||
sourceMap: true, | ||
format: 'umd', | ||
exports: 'named', | ||
plugins: plugins, | ||
banner: banner, | ||
onwarn: onwarn, | ||
external: isExternal, | ||
globals: { | ||
'rxjs/ReplaySubject': 'Rx', | ||
// Copied these from @angular/router rollup config | ||
'rxjs/BehaviorSubject': 'Rx', | ||
'rxjs/Observable': 'Rx', | ||
'rxjs/Subject': 'Rx', | ||
'rxjs/Subscription': 'Rx', | ||
'rxjs/util/EmptyError': 'Rx', | ||
'rxjs/observable/from': 'Rx.Observable', | ||
'rxjs/observable/fromPromise': 'Rx.Observable', | ||
'rxjs/observable/forkJoin': 'Rx.Observable', | ||
'rxjs/observable/of': 'Rx.Observable', | ||
'rxjs/operator/toPromise': 'Rx.Observable.prototype', | ||
'rxjs/operator/map': 'Rx.Observable.prototype', | ||
'rxjs/operator/mergeAll': 'Rx.Observable.prototype', | ||
'rxjs/operator/concatAll': 'Rx.Observable.prototype', | ||
'rxjs/operator/mergeMap': 'Rx.Observable.prototype', | ||
'rxjs/operator/reduce': 'Rx.Observable.prototype', | ||
'rxjs/operator/every': 'Rx.Observable.prototype', | ||
'rxjs/operator/first': 'Rx.Observable.prototype', | ||
'rxjs/operator/catch': 'Rx.Observable.prototype', | ||
'rxjs/operator/last': 'Rx.Observable.prototype', | ||
'rxjs/operator/filter': 'Rx.Observable.prototype', | ||
'rxjs/operator/concatMap': 'Rx.Observable.prototype', | ||
'@uirouter/core': '@uirouter/core', | ||
'@uirouter/rx': '@uirouter/rx', | ||
'@angular/core': 'ng.core', | ||
'@angular/common': 'ng.common', | ||
}, | ||
}; | ||
export default CONFIG; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
34615
255