Class: Dommy::PromiseRejectionEvent

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

Overview

PromiseRejectionEvent — fired as unhandledrejection / rejectionhandled when a promise rejects with no handler (event.promise / event.reason). Critically, its mere existence is what Promise feature-detection (core-js et al.) checks: without it, libraries decide the native Promise is incomplete and swap in a polyfill whose microtask queue the host scheduler cannot flush — silently starving every .then/await and hanging SPA hydration (this is why note.com rendered only a shell).

Constant Summary

Constants inherited from Event

Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, 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) ⇒ PromiseRejectionEvent

Returns a new instance of PromiseRejectionEvent.



800
801
802
803
804
# File 'lib/dommy/event.rb', line 800

def initialize(type, init = nil)
  super
  @promise = read_init(init, "promise")
  @reason = read_init(init, "reason")
end

Instance Attribute Details

#promiseObject (readonly)

Returns the value of attribute promise.



798
799
800
# File 'lib/dommy/event.rb', line 798

def promise
  @promise
end

#reasonObject (readonly)

Returns the value of attribute reason.



798
799
800
# File 'lib/dommy/event.rb', line 798

def reason
  @reason
end

Instance Method Details

#__js_get__(key) ⇒ Object



806
807
808
809
810
811
812
# File 'lib/dommy/event.rb', line 806

def __js_get__(key)
  case key
  when "promise" then @promise
  when "reason" then @reason
  else super
  end
end