gpt4 book ai didi

Angular SwUpdate 激活 deprication

转载 作者:行者123 更新时间:2023-12-05 09:29:25 25 4
gpt4 key购买 nike

在我的 Angular 项目中,我有这种代码:

this.swUpdate.available.subscribe(() => {
...
});

它工作正常,但给了我关于 activated 被弃用的警告。

我应该怎么做才能修复此警告?

最佳答案

我相信 activatedactivateUpdate() 是不同的东西。您调用 activateUpdate(),然后当它完成时,activated 发生。

此外,activatedavailable 绝对是不同的东西(你的问题都提到了)。 available 表示检测到更新; activated 表示已经安装。

根据文档(https://angular.io/api/service-worker/SwUpdate),available 的替换是:

import {filter, map} from 'rxjs/operators';
// ...
const updatesAvailable = swUpdate.versionUpdates.pipe(
filter((evt): evt is VersionReadyEvent => evt.type === 'VERSION_READY'),
map(evt => ({
type: 'UPDATE_AVAILABLE',
current: evt.currentVersion,
available: evt.latestVersion,
})));

关于Angular SwUpdate 激活 deprication,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70684682/

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