gpt4 book ai didi

angular - ngrx DevTools 中的 logOnly 选项有什么用?

转载 作者:太空狗 更新时间:2023-10-29 17:26:55 25 4
gpt4 key购买 nike

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

StoreDevtoolsModule.instrument({
logOnly: environment.production
})

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

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

最佳答案

根据 the documentation :

logOnly: boolean - connect to the Devtools Extension in log-only mode. Default is false which enables all extension features.

带有指向 extensions features 的链接.

基于此我们可以假设将 logOnly 设置为 true 将关闭以下 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
}
})

这非常适合生产环境,因为您可能不需要或不希望在您的实时应用程序中运行这些主要以开发为中心的功能。

关于angular - ngrx DevTools 中的 logOnly 选项有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49028979/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com