Class: Browser::Event::Custom

Inherits:
Browser::Event show all
Defined in:
opal/browser/event/custom.rb

Defined Under Namespace

Classes: Definition

Instance Attribute Summary

Attributes inherited from Browser::Event

#callback, #on

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Browser::Event

aliases, #arguments, #arguments=, class_for, create, handlers, handles, #name, name_for, new, #off, #prevent, #prevented?, #stop, #stop!, #stopped?, #target

Constructor Details

#initialize(event, callback = nil) ⇒ Custom

Returns a new instance of Custom.



56
57
58
# File 'opal/browser/event/custom.rb', line 56

def initialize(event, callback = nil)
  super(event, callback)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id) ⇒ Object



60
61
62
63
64
# File 'opal/browser/event/custom.rb', line 60

def method_missing(id, *)
  `if (#@native.detail != null && Object.hasOwn(#@native.detail, id)) return #@native.detail[id]`

  super
end

Class Method Details

.construct(name, desc) ⇒ Object



23
24
25
26
27
28
# File 'opal/browser/event/custom.rb', line 23

def self.construct(name, desc)
  `return new CustomEvent(name, {
    bubbles:    desc.bubbles,
    cancelable: desc.cancelable,
    detail:     desc })`
end

.supported?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'opal/browser/event/custom.rb', line 8

def self.supported?
  Browser.supports? 'Event.Custom'
end