logo
  • 教程列表
  • SO官方文檔
  • 伺服器傳送的事件
    • 設定伺服器的基本事件流
    • 關閉事件流
    • 將事件偵聽器繫結到 EventSource
  1. StackOverflow 文件
  2. JavaScript 教程
  3. 伺服器傳送的事件
  4. 關閉事件流

關閉事件流

Created: November-22, 2018

可以使用 EventSource.close() 方法關閉到伺服器的事件流

var eventSource = new EventSource("api/my-events");
// do things ...
eventSource.close(); // you will not receive anymore events from this object

.close() 方法什麼都不做,流已經關閉了。

  • 將事件偵聽器繫結到 EventSource
  • 設定伺服器的基本事件流

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明