Class: Dommy::ClipboardEvent

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

Overview

‘ClipboardEvent` — fires for copy / cut / paste. Carries the `clipboardData` payload as a DataTransfer.

Spec: w3c.github.io/clipboard-apis/#clipboard-event-interface

Instance Attribute Summary collapse

Attributes inherited from Event

#type

Instance Method Summary collapse

Methods inherited from Event

#__js_call__, #__js_set__, #__prepare_for_dispatch__, #__record_path__, #__set_current_target__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?

Constructor Details

#initialize(type, init = nil) ⇒ ClipboardEvent

Returns a new instance of ClipboardEvent.



696
697
698
699
# File 'lib/dommy/event.rb', line 696

def initialize(type, init = nil)
  super
  @clipboard_data = read_init(init, "clipboardData")
end

Instance Attribute Details

#clipboard_dataObject (readonly)

Returns the value of attribute clipboard_data.



701
702
703
# File 'lib/dommy/event.rb', line 701

def clipboard_data
  @clipboard_data
end

Instance Method Details

#__js_get__(key) ⇒ Object



703
704
705
706
707
708
709
710
# File 'lib/dommy/event.rb', line 703

def __js_get__(key)
  case key
  when "clipboardData"
    @clipboard_data
  else
    super
  end
end