plinth/browser/eventsource

Types

pub type EventSource

Values

pub fn constructor() -> Result(
  fn(String, Bool) -> EventSource,
  Nil,
)

Returns the EventSource constructor if it’s available in the current JavaScript environment.

Starting an event source doesn’t return an error any url is accepted. If the url provided is not valid it will be treated as a path of the current origin.

pub fn on_close(
  source: EventSource,
  handle: fn(event.Event(Nil)) -> Nil,
) -> Nil
pub fn on_message(
  source: EventSource,
  handle: fn(event.Event(message_event.T)) -> Nil,
) -> Nil
pub fn on_open(
  source: EventSource,
  handle: fn(event.Event(Nil)) -> Nil,
) -> Nil
Search Document