Class: Browser::Event::Custom
- Inherits:
-
Browser::Event
- Object
- Browser::Event
- Browser::Event::Custom
- Defined in:
- lib/diamonds/opal/browser/event/custom.rb
Defined Under Namespace
Classes: Definition
Instance Attribute Summary
Attributes inherited from Browser::Event
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(event, callback = nil) ⇒ Custom
constructor
A new instance of Custom.
- #method_missing(id) ⇒ Object
Methods inherited from Browser::Event
aliases, #arguments, #arguments=, class_for, create, #name, name_for, new, #off, #prevent, #prevented?, #stop, #stop!, #stopped?, #target
Constructor Details
#initialize(event, callback = nil) ⇒ Custom
Returns a new instance of Custom.
52 53 54 55 56 |
# File 'lib/diamonds/opal/browser/event/custom.rb', line 52 def initialize(event, callback = nil) super(event, callback) @detail = Hash.new(`#{event}.detail`) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id) ⇒ Object
58 59 60 61 62 |
# File 'lib/diamonds/opal/browser/event/custom.rb', line 58 def method_missing(id, *) return @detail[id] if @detail.has_key?(id) super end |
Class Method Details
.construct(name, desc) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/diamonds/opal/browser/event/custom.rb', line 19 def self.construct(name, desc) `new CustomEvent(name, { bubbles: desc.bubbles, cancelable: desc.cancelable, detail: desc })` end |
.supported? ⇒ Boolean
6 7 8 |
# File 'lib/diamonds/opal/browser/event/custom.rb', line 6 def self.supported? Browser.supports? 'Event.Custom' end |