我已经实现了这个事件源。但是,正如我使用的许多人所建议的那样,它不能在 IE 上工作
https://github.com/remy/polyfills/blob/master/EventSource.js这个用于 IE 的 pollyfill。
这是由
在我需要这个 EventSource 的代码中,我已经这样做了:
require('../../../style/vendors/EventSource.js'); --> In My Import
ngOnInit()
{
let es = new EventSource('http://localhost:8080/api/message');
}
但是,再次在 IE 上运行时,我得到了我之前得到的错误:
"ReferenceError: 'EventSource' is undefined
at MessageComponent.prototype.ngOnInit (http://localhost:8080/js/app.8c7c223048ac731c6001.js:42531:10)
请建议我是否缺少任何东西或 Pollyfills 的问题?