@datorama/akita-ng-effects
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -445,3 +445,3 @@ (function (global, factory) { | ||
function Effect(options) { | ||
options = __assign({ dispatch: true }, options); | ||
options = __assign({ dispatch: false }, options); | ||
return function (classProto, propKey) { | ||
@@ -464,3 +464,3 @@ var returnValue; | ||
var effect = actions$(); | ||
options = __assign({ dispatch: true }, options); | ||
options = __assign({ dispatch: false }, options); | ||
setMetadata(effect, null, options); | ||
@@ -467,0 +467,0 @@ return effect; |
@@ -15,3 +15,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs"),require("@datorama/akita"),require("rxjs/operators"),require("ts-action"),require("ts-action-operators")):"function"==typeof define&&define.amd?define("@datorama/akita-ng-effects",["exports","@angular/core","rxjs","@datorama/akita","rxjs/operators","ts-action","ts-action-operators"],e):e(((t=t||self).datorama=t.datorama||{},t.datorama["akita-ng-effects"]={}),t.ng.core,t.rxjs,t.akita,t.rxjs.operators,t.tsAction,t.tsActionOperators)}(this,(function(t,e,r,o,n,a,c){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};var u=function(){return(u=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};Object.create;Object.create;var s=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,t),r.prototype.dispatch=function(t){this.logAction(t),this.next(t)},r.prototype.logAction=function(t){var e=t.type,r=function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}return r}(t,["type"]),n=Object.getOwnPropertyNames(r).length>0;o.logAction(e,null,n?r:null)},r.ɵprov=e["ɵɵdefineInjectable"]({factory:function(){return new r},token:r,providedIn:"root"}),r.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],r}(r.Subject),f=new e.InjectionToken("@datorama/akita Internal Root Effects"),p=new e.InjectionToken("@datorama/akita Root Effects"),d=new e.InjectionToken("@datorama/akita Internal Feature Effects"),y=new e.InjectionToken("@datorama/akita Feature Effects"),l=function(){function t(t){this.actions$=t,this.effectInstanceSources=[],this.destroyEffects$=new r.Subject}return t.prototype.addEffectInstance=function(t){this.effectInstanceSources.push(t),this.subscribeToEffects(t)},t.prototype.subscribeToEffects=function(t){var e=this,r=function(r){var a=t[r];a.hasOwnProperty("isEffect")&&a.isEffect&&a.pipe(n.takeUntil(o.destroyEffects$)).subscribe((function(t){return e.dispatchAction(a,t)}))},o=this;for(var a in t)r(a)},t.prototype.dispatchAction=function(t,e){t.dispatchAction&&this.checkAction(e)&&this.actions$.dispatch(e)},t.prototype.checkAction=function(t){if(t.hasOwnProperty("type"))return!0;throw new TypeError("Make sure to provide a valid action type or set the option {dispatch: false}")},t.prototype.ngOnDestroy=function(){this.destroyEffects$.next(),this.effectInstanceSources=[]},t.ctorParameters=function(){return[{type:s}]},t.ɵprov=e["ɵɵdefineInjectable"]({factory:function(){return new t(e["ɵɵinject"](s))},token:t,providedIn:"root"}),t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:s}]},t}(),h=function(){function t(t,e,r,o){var n=this;this.moduleManager=t,this.actions=e,this.parentModule=o,this.rootGuard(),r.forEach((function(t){return n.moduleManager.addEffectInstance(t)}))}return t.prototype.rootGuard=function(){if(this.parentModule)throw new Error("EffectsRootModule is already loaded. Import it in the AppModule only")},t.ctorParameters=function(){return[{type:l},{type:s},{type:Array,decorators:[{type:e.Inject,args:[p]}]},{type:t,decorators:[{type:e.Optional},{type:e.SkipSelf}]}]},t.decorators=[{type:e.NgModule}],t.ctorParameters=function(){return[{type:l},{type:s},{type:Array,decorators:[{type:e.Inject,args:[p]}]},{type:t,decorators:[{type:e.Optional},{type:e.SkipSelf}]}]},t}(),b=function(){function t(t,e){var r=this;this.moduleManager=t,e.forEach((function(t){return r.moduleManager.addEffectInstance(t)}))}return t.ctorParameters=function(){return[{type:l},{type:Array,decorators:[{type:e.Inject,args:[y]}]}]},t.decorators=[{type:e.NgModule}],t.ctorParameters=function(){return[{type:l},{type:Array,decorators:[{type:e.Inject,args:[y]}]}]},t}(),j=function(){function t(){}return t.forRoot=function(t){return void 0===t&&(t=[]),{ngModule:h,providers:[l,s,t,{provide:f,useValue:t},{provide:p,useFactory:g,deps:[e.Injector,f]}]}},t.forFeature=function(t){return void 0===t&&(t=[]),{ngModule:b,providers:[t,{provide:d,useValue:t},{provide:y,useFactory:g,deps:[e.Injector,d]}]}},t.decorators=[{type:e.NgModule,args:[{}]}],t}();function g(t,e){return e.map((function(e){return t.get(e)}))}function m(t,e,r){Object.defineProperty(t,"isEffect",{enumerable:!0,configurable:!1,writable:!1,value:!0}),Object.defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:e}),Object.defineProperty(t,"dispatchAction",{enumerable:!0,configurable:!1,writable:!1,value:r.dispatch})}Object.defineProperty(t,"createAction",{enumerable:!0,get:function(){return a.action}}),Object.defineProperty(t,"payload",{enumerable:!0,get:function(){return a.payload}}),Object.defineProperty(t,"props",{enumerable:!0,get:function(){return a.props}}),Object.defineProperty(t,"ofType",{enumerable:!0,get:function(){return c.ofType}}),t.Actions=s,t.AkitaNgEffectsModule=j,t.Effect=function(t){return t=u({dispatch:!0},t),function(e,r){var o;Object.defineProperty(e,r,{get:function(){return o},set:function(e){m(e,r,t),o=e},enumerable:!0})}},t.EffectsRootModule=h,t.createEffect=function(t,e){var r=t();return m(r,null,e=u({dispatch:!0},e)),r},t.ɵa=g,t.ɵb=f,t.ɵc=p,t.ɵd=d,t.ɵe=y,t.ɵf=l,t.ɵg=b,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
***************************************************************************** */var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};var u=function(){return(u=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};Object.create;Object.create;var s=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,t),r.prototype.dispatch=function(t){this.logAction(t),this.next(t)},r.prototype.logAction=function(t){var e=t.type,r=function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}return r}(t,["type"]),n=Object.getOwnPropertyNames(r).length>0;o.logAction(e,null,n?r:null)},r.ɵprov=e["ɵɵdefineInjectable"]({factory:function(){return new r},token:r,providedIn:"root"}),r.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],r}(r.Subject),f=new e.InjectionToken("@datorama/akita Internal Root Effects"),p=new e.InjectionToken("@datorama/akita Root Effects"),d=new e.InjectionToken("@datorama/akita Internal Feature Effects"),y=new e.InjectionToken("@datorama/akita Feature Effects"),l=function(){function t(t){this.actions$=t,this.effectInstanceSources=[],this.destroyEffects$=new r.Subject}return t.prototype.addEffectInstance=function(t){this.effectInstanceSources.push(t),this.subscribeToEffects(t)},t.prototype.subscribeToEffects=function(t){var e=this,r=function(r){var a=t[r];a.hasOwnProperty("isEffect")&&a.isEffect&&a.pipe(n.takeUntil(o.destroyEffects$)).subscribe((function(t){return e.dispatchAction(a,t)}))},o=this;for(var a in t)r(a)},t.prototype.dispatchAction=function(t,e){t.dispatchAction&&this.checkAction(e)&&this.actions$.dispatch(e)},t.prototype.checkAction=function(t){if(t.hasOwnProperty("type"))return!0;throw new TypeError("Make sure to provide a valid action type or set the option {dispatch: false}")},t.prototype.ngOnDestroy=function(){this.destroyEffects$.next(),this.effectInstanceSources=[]},t.ctorParameters=function(){return[{type:s}]},t.ɵprov=e["ɵɵdefineInjectable"]({factory:function(){return new t(e["ɵɵinject"](s))},token:t,providedIn:"root"}),t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:s}]},t}(),h=function(){function t(t,e,r,o){var n=this;this.moduleManager=t,this.actions=e,this.parentModule=o,this.rootGuard(),r.forEach((function(t){return n.moduleManager.addEffectInstance(t)}))}return t.prototype.rootGuard=function(){if(this.parentModule)throw new Error("EffectsRootModule is already loaded. Import it in the AppModule only")},t.ctorParameters=function(){return[{type:l},{type:s},{type:Array,decorators:[{type:e.Inject,args:[p]}]},{type:t,decorators:[{type:e.Optional},{type:e.SkipSelf}]}]},t.decorators=[{type:e.NgModule}],t.ctorParameters=function(){return[{type:l},{type:s},{type:Array,decorators:[{type:e.Inject,args:[p]}]},{type:t,decorators:[{type:e.Optional},{type:e.SkipSelf}]}]},t}(),b=function(){function t(t,e){var r=this;this.moduleManager=t,e.forEach((function(t){return r.moduleManager.addEffectInstance(t)}))}return t.ctorParameters=function(){return[{type:l},{type:Array,decorators:[{type:e.Inject,args:[y]}]}]},t.decorators=[{type:e.NgModule}],t.ctorParameters=function(){return[{type:l},{type:Array,decorators:[{type:e.Inject,args:[y]}]}]},t}(),j=function(){function t(){}return t.forRoot=function(t){return void 0===t&&(t=[]),{ngModule:h,providers:[l,s,t,{provide:f,useValue:t},{provide:p,useFactory:g,deps:[e.Injector,f]}]}},t.forFeature=function(t){return void 0===t&&(t=[]),{ngModule:b,providers:[t,{provide:d,useValue:t},{provide:y,useFactory:g,deps:[e.Injector,d]}]}},t.decorators=[{type:e.NgModule,args:[{}]}],t}();function g(t,e){return e.map((function(e){return t.get(e)}))}function m(t,e,r){Object.defineProperty(t,"isEffect",{enumerable:!0,configurable:!1,writable:!1,value:!0}),Object.defineProperty(t,"name",{enumerable:!0,configurable:!1,writable:!1,value:e}),Object.defineProperty(t,"dispatchAction",{enumerable:!0,configurable:!1,writable:!1,value:r.dispatch})}Object.defineProperty(t,"createAction",{enumerable:!0,get:function(){return a.action}}),Object.defineProperty(t,"payload",{enumerable:!0,get:function(){return a.payload}}),Object.defineProperty(t,"props",{enumerable:!0,get:function(){return a.props}}),Object.defineProperty(t,"ofType",{enumerable:!0,get:function(){return c.ofType}}),t.Actions=s,t.AkitaNgEffectsModule=j,t.Effect=function(t){return t=u({dispatch:!1},t),function(e,r){var o;Object.defineProperty(e,r,{get:function(){return o},set:function(e){m(e,r,t),o=e},enumerable:!0})}},t.EffectsRootModule=h,t.createEffect=function(t,e){var r=t();return m(r,null,e=u({dispatch:!1},e)),r},t.ɵa=g,t.ɵb=f,t.ɵc=p,t.ɵd=d,t.ɵe=y,t.ɵf=l,t.ɵg=b,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=datorama-akita-ng-effects.umd.min.js.map |
import { setMetadata } from './effect.utils'; | ||
export function createEffect(actions$, options) { | ||
const effect = actions$(); | ||
options = Object.assign({ dispatch: true }, options); | ||
options = Object.assign({ dispatch: false }, options); | ||
setMetadata(effect, null, options); | ||
@@ -6,0 +6,0 @@ return effect; |
import { setMetadata } from './effect.utils'; | ||
export function Effect(options) { | ||
options = Object.assign({ dispatch: true }, options); | ||
options = Object.assign({ dispatch: false }, options); | ||
return function (classProto, propKey) { | ||
@@ -5,0 +5,0 @@ let returnValue; |
@@ -5,3 +5,3 @@ import { __assign } from "tslib"; | ||
var effect = actions$(); | ||
options = __assign({ dispatch: true }, options); | ||
options = __assign({ dispatch: false }, options); | ||
setMetadata(effect, null, options); | ||
@@ -8,0 +8,0 @@ return effect; |
import { __assign } from "tslib"; | ||
import { setMetadata } from './effect.utils'; | ||
export function Effect(options) { | ||
options = __assign({ dispatch: true }, options); | ||
options = __assign({ dispatch: false }, options); | ||
return function (classProto, propKey) { | ||
@@ -6,0 +6,0 @@ var returnValue; |
@@ -199,3 +199,3 @@ import { __rest } from 'tslib'; | ||
function Effect(options) { | ||
options = Object.assign({ dispatch: true }, options); | ||
options = Object.assign({ dispatch: false }, options); | ||
return function (classProto, propKey) { | ||
@@ -218,3 +218,3 @@ let returnValue; | ||
const effect = actions$(); | ||
options = Object.assign({ dispatch: true }, options); | ||
options = Object.assign({ dispatch: false }, options); | ||
setMetadata(effect, null, options); | ||
@@ -221,0 +221,0 @@ return effect; |
@@ -219,3 +219,3 @@ import { __extends, __rest, __assign } from 'tslib'; | ||
function Effect(options) { | ||
options = __assign({ dispatch: true }, options); | ||
options = __assign({ dispatch: false }, options); | ||
return function (classProto, propKey) { | ||
@@ -238,3 +238,3 @@ var returnValue; | ||
var effect = actions$(); | ||
options = __assign({ dispatch: true }, options); | ||
options = __assign({ dispatch: false }, options); | ||
setMetadata(effect, null, options); | ||
@@ -241,0 +241,0 @@ return effect; |
{ | ||
"name": "@datorama/akita-ng-effects", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A Reactive State Management extension dealing with side effects.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
211830