@ngxs/devtools-plugin
Advanced tools
Comparing version 2.1.0-dev.615f8ef to 2.1.0-dev.62c57b4
@@ -9,6 +9,7 @@ (function (global, factory) { | ||
var NgxsReduxDevtoolsPlugin = /** @class */ (function () { | ||
function NgxsReduxDevtoolsPlugin(_options, _state) { | ||
function NgxsReduxDevtoolsPlugin(_options, _state, _injector) { | ||
var _this = this; | ||
this._options = _options; | ||
this._state = _state; | ||
this._injector = _injector; | ||
this.devtoolsExtension = null; | ||
@@ -34,3 +35,3 @@ this.windowObj = typeof window !== 'undefined' ? window : {}; | ||
else { | ||
var type = store.getActionTypeFromInstance(action); | ||
var type = store.getActionNameFromInstance(action); | ||
_this.devtoolsExtension.send(Object.assign({}, action, { type: type }), newState); | ||
@@ -51,3 +52,5 @@ } | ||
else if (action.type === 'ACTION') { | ||
console.warn('Dispatch is not supported at this time.'); | ||
var store$$1 = this._injector.get(store.Store); | ||
var actionPayload = JSON.parse(action.payload); | ||
store$$1.dispatch(actionPayload); | ||
} | ||
@@ -63,2 +66,3 @@ }; | ||
{ type: store.StateStream, }, | ||
{ type: core.Injector, }, | ||
]; }; | ||
@@ -65,0 +69,0 @@ var defaultNgxsDevtoolsOptions = { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@ngxs/store"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngxs/devtools-plugin",["exports","@angular/core","@ngxs/store","rxjs/operators"],t):t((e.ngxs=e.ngxs||{},e.ngxs["devtools-plugin"]={}),e.ng.core,e["ngxs-store"],e.Rx.Observable.prototype)}(this,function(e,t,i,r){"use strict";var o=new t.InjectionToken("NGXS_DEVTOOLS_OPTIONS"),n=function(){function e(e,t){var o=this;this._options=e,this._state=t,this.devtoolsExtension=null,this.windowObj="undefined"!=typeof window?window:{};var n=this.windowObj.__REDUX_DEVTOOLS_EXTENSION__||this.windowObj.devToolsExtension;n&&(this.devtoolsExtension=n.connect(e),this.devtoolsExtension.subscribe(function(e){return o.dispatched(e)}))}return e.prototype.handle=function(o,n,e){var s=this,t=this._options&&this._options.disabled;return!this.devtoolsExtension||t?e(o,n):e(o,n).pipe(r.tap(function(e){if("@@INIT"===i.getActionTypeFromInstance(n))s.devtoolsExtension.init(o);else{var t=i.getActionTypeFromInstance(n);s.devtoolsExtension.send(Object.assign({},n,{type:t}),e)}}))},e.prototype.dispatched=function(e){if("DISPATCH"===e.type)if("JUMP_TO_ACTION"===e.payload.type||"JUMP_TO_STATE"===e.payload.type){var t=JSON.parse(e.state);this._state.next(t)}else"TOGGLE_ACTION"===e.payload.type&&console.warn("Skip is not supported at this time.");else"ACTION"===e.type&&console.warn("Dispatch is not supported at this time.")},e}();n.decorators=[{type:t.Injectable}],n.ctorParameters=function(){return[{type:undefined,decorators:[{type:t.Inject,args:[o]}]},{type:i.StateStream}]};var s={name:"NGXS"},a=function(){function t(){}return t.forRoot=function(e){return{ngModule:t,providers:[{provide:i.NGXS_PLUGINS,useClass:n,multi:!0},{provide:o,useValue:Object.assign({},s,e)}]}},t}();a.decorators=[{type:t.NgModule,args:[{imports:[i.NgxsModule]}]}],a.ctorParameters=function(){return[]},e.NgxsReduxDevtoolsPluginModule=a,e.NgxsReduxDevtoolsPlugin=n,e.ɵb=o,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@ngxs/store"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngxs/devtools-plugin",["exports","@angular/core","@ngxs/store","rxjs/operators"],t):t((e.ngxs=e.ngxs||{},e.ngxs["devtools-plugin"]={}),e.ng.core,e["ngxs-store"],e.Rx.Observable.prototype)}(this,function(e,t,i,r){"use strict";var o=new t.InjectionToken("NGXS_DEVTOOLS_OPTIONS"),n=function(){function e(e,t,o){var n=this;this._options=e,this._state=t,this._injector=o,this.devtoolsExtension=null,this.windowObj="undefined"!=typeof window?window:{};var s=this.windowObj.__REDUX_DEVTOOLS_EXTENSION__||this.windowObj.devToolsExtension;s&&(this.devtoolsExtension=s.connect(e),this.devtoolsExtension.subscribe(function(e){return n.dispatched(e)}))}return e.prototype.handle=function(o,n,e){var s=this,t=this._options&&this._options.disabled;return!this.devtoolsExtension||t?e(o,n):e(o,n).pipe(r.tap(function(e){if("@@INIT"===i.getActionTypeFromInstance(n))s.devtoolsExtension.init(o);else{var t=i.getActionNameFromInstance(n);s.devtoolsExtension.send(Object.assign({},n,{type:t}),e)}}))},e.prototype.dispatched=function(e){if("DISPATCH"===e.type)if("JUMP_TO_ACTION"===e.payload.type||"JUMP_TO_STATE"===e.payload.type){var t=JSON.parse(e.state);this._state.next(t)}else"TOGGLE_ACTION"===e.payload.type&&console.warn("Skip is not supported at this time.");else if("ACTION"===e.type){var o=this._injector.get(i.Store),n=JSON.parse(e.payload);o.dispatch(n)}},e}();n.decorators=[{type:t.Injectable}],n.ctorParameters=function(){return[{type:undefined,decorators:[{type:t.Inject,args:[o]}]},{type:i.StateStream},{type:t.Injector}]};var s={name:"NGXS"},a=function(){function t(){}return t.forRoot=function(e){return{ngModule:t,providers:[{provide:i.NGXS_PLUGINS,useClass:n,multi:!0},{provide:o,useValue:Object.assign({},s,e)}]}},t}();a.decorators=[{type:t.NgModule,args:[{imports:[i.NgxsModule]}]}],a.ctorParameters=function(){return[]},e.NgxsReduxDevtoolsPluginModule=a,e.NgxsReduxDevtoolsPlugin=n,e.ɵb=o,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngxs-devtools-plugin.umd.min.js.map |
@@ -1,3 +0,3 @@ | ||
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core'; | ||
import { getActionTypeFromInstance, StateStream, NgxsModule, NGXS_PLUGINS } from '@ngxs/store'; | ||
import { InjectionToken, Injectable, Inject, Injector, NgModule } from '@angular/core'; | ||
import { getActionTypeFromInstance, StateStream, getActionNameFromInstance, Store, NgxsModule, NGXS_PLUGINS } from '@ngxs/store'; | ||
import { tap } from 'rxjs/operators'; | ||
@@ -36,6 +36,8 @@ | ||
* @param {?} _state | ||
* @param {?} _injector | ||
*/ | ||
constructor(_options, _state) { | ||
constructor(_options, _state, _injector) { | ||
this._options = _options; | ||
this._state = _state; | ||
this._injector = _injector; | ||
this.devtoolsExtension = null; | ||
@@ -68,3 +70,3 @@ this.windowObj = typeof window !== 'undefined' ? window : {}; | ||
else { | ||
const /** @type {?} */ type = getActionTypeFromInstance(action); | ||
const /** @type {?} */ type = getActionNameFromInstance(action); | ||
this.devtoolsExtension.send(Object.assign({}, action, { type }), newState); | ||
@@ -90,5 +92,6 @@ } | ||
else if (action.type === 'ACTION') { | ||
console.warn('Dispatch is not supported at this time.'); | ||
// const actionPayload = JSON.parse(action.payload); | ||
// this._store.dispatch(actionPayload); | ||
// Lazy get the store for circular depedency issues | ||
const /** @type {?} */ store = this._injector.get(Store); | ||
const /** @type {?} */ actionPayload = JSON.parse(action.payload); | ||
store.dispatch(actionPayload); | ||
} | ||
@@ -104,2 +107,3 @@ } | ||
{ type: StateStream, }, | ||
{ type: Injector, }, | ||
]; | ||
@@ -106,0 +110,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core'; | ||
import { getActionTypeFromInstance, StateStream, NgxsModule, NGXS_PLUGINS } from '@ngxs/store'; | ||
import { InjectionToken, Injectable, Inject, Injector, NgModule } from '@angular/core'; | ||
import { getActionTypeFromInstance, StateStream, getActionNameFromInstance, Store, NgxsModule, NGXS_PLUGINS } from '@ngxs/store'; | ||
import { tap } from 'rxjs/operators'; | ||
@@ -7,6 +7,7 @@ | ||
var NgxsReduxDevtoolsPlugin = /** @class */ (function () { | ||
function NgxsReduxDevtoolsPlugin(_options, _state) { | ||
function NgxsReduxDevtoolsPlugin(_options, _state, _injector) { | ||
var _this = this; | ||
this._options = _options; | ||
this._state = _state; | ||
this._injector = _injector; | ||
this.devtoolsExtension = null; | ||
@@ -32,3 +33,3 @@ this.windowObj = typeof window !== 'undefined' ? window : {}; | ||
else { | ||
var type = getActionTypeFromInstance(action); | ||
var type = getActionNameFromInstance(action); | ||
_this.devtoolsExtension.send(Object.assign({}, action, { type: type }), newState); | ||
@@ -49,3 +50,5 @@ } | ||
else if (action.type === 'ACTION') { | ||
console.warn('Dispatch is not supported at this time.'); | ||
var store = this._injector.get(Store); | ||
var actionPayload = JSON.parse(action.payload); | ||
store.dispatch(actionPayload); | ||
} | ||
@@ -61,2 +64,3 @@ }; | ||
{ type: StateStream, }, | ||
{ type: Injector, }, | ||
]; }; | ||
@@ -63,0 +67,0 @@ var defaultNgxsDevtoolsOptions = { |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"NgxsReduxDevtoolsPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":10,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@ngxs/store","name":"NgxsModule","line":11,"character":12}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPluginModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngxs/store","name":"NGXS_PLUGINS","line":19,"character":19},"useClass":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPlugin"},"multi":true},{"provide":{"__symbolic":"reference","name":"ɵb"},"useValue":{}}]}}}},"NgxsReduxDevtoolsPlugin":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":10,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":15,"character":15},"arguments":[{"__symbolic":"reference","name":"ɵb"}]}],null],"parameters":[{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","module":"@ngxs/store","name":"StateStream","line":15,"character":100}]}],"handle":[{"__symbolic":"method"}],"dispatched":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"interface"},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":46,"character":41},"arguments":["NGXS_DEVTOOLS_OPTIONS"]}},"origins":{"NgxsReduxDevtoolsPluginModule":"./src/devtools.module","NgxsReduxDevtoolsPlugin":"./src/devtools.plugin","ɵa":"./src/symbols","ɵb":"./src/symbols"},"importAs":"@ngxs/devtools-plugin"} | ||
{"__symbolic":"module","version":4,"metadata":{"NgxsReduxDevtoolsPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":10,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@ngxs/store","name":"NgxsModule","line":11,"character":12}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPluginModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngxs/store","name":"NGXS_PLUGINS","line":19,"character":19},"useClass":{"__symbolic":"reference","name":"NgxsReduxDevtoolsPlugin"},"multi":true},{"provide":{"__symbolic":"reference","name":"ɵb"},"useValue":{}}]}}}},"NgxsReduxDevtoolsPlugin":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":10,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":16,"character":5},"arguments":[{"__symbolic":"reference","name":"ɵb"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","module":"@ngxs/store","name":"StateStream","line":17,"character":20},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":18,"character":23}]}],"handle":[{"__symbolic":"method"}],"dispatched":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"interface"},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":46,"character":41},"arguments":["NGXS_DEVTOOLS_OPTIONS"]}},"origins":{"NgxsReduxDevtoolsPluginModule":"./src/devtools.module","NgxsReduxDevtoolsPlugin":"./src/devtools.plugin","ɵa":"./src/symbols","ɵb":"./src/symbols"},"importAs":"@ngxs/devtools-plugin"} |
{ | ||
"name": "@ngxs/devtools-plugin", | ||
"description": "redux devtools plugin for @ngxs/store", | ||
"version": "2.1.0-dev.615f8ef", | ||
"version": "2.1.0-dev.62c57b4", | ||
"peerDependencies": { | ||
"@angular/core": "^5.0.0", | ||
"@ngxs/store": "2.1.0-beta.3" | ||
"@ngxs/store": "2.1.0-beta.9" | ||
}, | ||
@@ -9,0 +9,0 @@ "main": "bundles/ngxs-devtools-plugin.umd.js", |
@@ -0,1 +1,2 @@ | ||
import { Injector } from '@angular/core'; | ||
import { NgxsPlugin, StateStream } from '@ngxs/store'; | ||
@@ -10,5 +11,6 @@ import { NgxsDevtoolsOptions, NgxsDevtoolsAction } from './symbols'; | ||
private _state; | ||
private _injector; | ||
private readonly devtoolsExtension; | ||
private readonly windowObj; | ||
constructor(_options: NgxsDevtoolsOptions, _state: StateStream); | ||
constructor(_options: NgxsDevtoolsOptions, _state: StateStream, _injector: Injector); | ||
/** | ||
@@ -15,0 +17,0 @@ * Middleware handle function |
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
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
51125
426