Class: Dommy::ErrorEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/dommy/event.rb

Overview

ErrorEvent — the event interface for an uncaught error (fired at window.onerror). Error-reporting code constructs it directly (new ErrorEvent("error", { message, error, … })); without the constructor that call is "not a function" and takes the whole app down before it renders (x.com's client bootstrap does exactly this).

Constant Summary

Constants inherited from Event

Dommy::Event::AT_TARGET, Dommy::Event::BUBBLING_PHASE, Dommy::Event::CAPTURING_PHASE, Dommy::Event::NONE

Instance Attribute Summary collapse

Attributes inherited from Event

#type

Instance Method Summary collapse

Methods inherited from Event

#__internal_clear_propagation_flags__, #__internal_mark_trusted__, #__internal_prepare_for_dispatch__, #__internal_record_path__, #__internal_run_passive__, #__internal_set_current_target__, #__internal_set_dispatch_flag__, #__internal_set_event_phase__, #__js_call__, #__js_set__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?

Methods included from Bridge::Methods

included

Constructor Details

#initialize(type, init = nil) ⇒ ErrorEvent

Returns a new instance of ErrorEvent.



769
770
771
772
773
774
775
776
# File 'lib/dommy/event.rb', line 769

def initialize(type, init = nil)
  super
  @message = read_init(init, "message") || ""
  @filename = read_init(init, "filename") || ""
  @lineno = read_init(init, "lineno") || 0
  @colno = read_init(init, "colno") || 0
  @error = read_init(init, "error")
end

Instance Attribute Details

#colnoObject (readonly)

Returns the value of attribute colno.



767
768
769
# File 'lib/dommy/event.rb', line 767

def colno
  @colno
end

#errorObject (readonly)

Returns the value of attribute error.



767
768
769
# File 'lib/dommy/event.rb', line 767

def error
  @error
end

#filenameObject (readonly)

Returns the value of attribute filename.



767
768
769
# File 'lib/dommy/event.rb', line 767

def filename
  @filename
end

#linenoObject (readonly)

Returns the value of attribute lineno.



767
768
769
# File 'lib/dommy/event.rb', line 767

def lineno
  @lineno
end

#messageObject (readonly)

Returns the value of attribute message.



767
768
769
# File 'lib/dommy/event.rb', line 767

def message
  @message
end

Instance Method Details

#__js_get__(key) ⇒ Object



778
779
780
781
782
783
784
785
786
787
# File 'lib/dommy/event.rb', line 778

def __js_get__(key)
  case key
  when "message" then @message
  when "filename" then @filename
  when "lineno" then @lineno
  when "colno" then @colno
  when "error" then @error
  else super
  end
end