Search code examples
angularreduxngrxngrx-storengrx-store-4.0

Get the status of @ngrx/store-devtools programmatically


I am trying to get the status of the devtools with NgRx to send it to the server and be able to import it elsewhere without having to use the Chrome or Firefox plugin, that is, I need to export a JSON as the plugin does but programmatically, does anyone know how I can to achieve this? thank you very much!

The part of devtools that I need programmatically.


Solution

  • The answer is as follows: Inject StoreDevTools as follows:

    constructor (_store: Store <State>,
    _devtools: StoreDevtools)
    

    and then get the history like this:

    _devtools.liftedState.subscribe (...)
    

    With the result generated in the subscribe, you can import it into the plugin in order to debug as necessary.

    Regards!