Method: Browser::EventSource#state

Defined in:
opal/browser/event_source.rb

#state:connecting, ... (readonly)

Returns the state of the event source.

Returns:

  • (:connecting, :open, :closed)

    the state of the event source

[View source]

45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'opal/browser/event_source.rb', line 45

def state
  %x{
    switch (#@native.readyState) {
      case window.EventSource.CONNECTING:
        return "connecting";

      case window.EventSource.OPEN:
        return "open";

      case window.EventSource.CLOSED:
        return "closed";
    }
  }
end