在ngrx DevTools中使用logOnly选项有什么用?

Yak*_*ain 6 redux ngrx angular

我在https://github.com/ngrx/platform/tree/master/docs/store-devtools阅读了简约文档,并了解您可以按如下方式添加检测:

StoreDevtoolsModule.instrument({
  logOnly: environment.production
})
Run Code Online (Sandbox Code Playgroud)

据说,如果logOnly标志为true,那么您的应用程序将以仅日志模式连接到Redux DevTools扩展,它将具有非常小的开销,因为它不应存储状态数据,而只记录正在发生的操作名称在运行时.

但在我的实验中,我仍然在ngrx DevTools面板中看到状态数据,那么使用的好处是logOnly:true什么?

And*_*ill 5

如果您向下滚动发送的链接,您将看到:

logOnly:布尔值-以仅日志方式连接到Devtools扩展。默认值为false,这将启用所有扩展功能。

带有扩展功能的链接。

基于此,我们可以假定设置logOnlytrue将关闭以下redux-devtools-extension功能:

const composeEnhancers = composeWithDevTools({
  features: {
    pause: true, // start/pause recording of dispatched actions
    lock: true, // lock/unlock dispatching actions and side effects    
    persist: true, // persist states on page reloading
    export: true, // export history of actions in a file
    import: 'custom', // import history of actions from a file
    jump: true, // jump back and forth (time travelling)
    skip: true, // skip (cancel) actions
    reorder: true, // drag and drop actions in the history list 
    dispatch: true, // dispatch custom actions or action creators
    test: true // generate tests for the selected actions
  },
});
Run Code Online (Sandbox Code Playgroud)

这对于生产环境非常理想,因为您可能不需要或不希望这些东西在实时应用程序上运行。