昨天我将我的应用程序从Angular 5迁移到了Angular 7。在此过程中,当我运行应用程序时建议我将EventSource更改为EventSourcePolyfill。但是自那以后,我一直面临奇怪的问题。这就是我在控制台中得到的问题:
ERROR TypeError: Cannot read property 'heartbeatTimeout' of undefined
at new EventSourcePolyfill (eventsource.js:155)
at AppFooterComponent.push../src/app/layout/footer/footer.component.ts.AppFooterComponent.connect (footer.component.ts:133)
at SafeSubscriber._next (footer.component.ts:52)
at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:196)
at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:134)
at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:77)
at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:54)
at AsyncAction.dispatch (timer.js:31)
at AsyncAction.push../node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js.AsyncAction._execute (AsyncAction.js:63)
at AsyncAction.push../node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js.AsyncAction.execute (AsyncAction.js:51)
这是我在代码中所做的:
import { EventSourcePolyfill } from 'ng-event-source';
let source = new EventSourcePolyfill('/api/v1/events/register');
有谁可以给我建议如何解决这个问题。
谢谢。
ng update
命令进行迁移吗?它有能力重构一些破坏性的更改吗?你是否遵循了 update.angular.io 上的说明?其中有一些步骤涉及 RxJS 迁移。 - Walter Luszczyk