Class: Browser::Event::Message
Defined Under Namespace
Classes: Definition
Instance Attribute Summary
#callback, #on
Class Method Summary
collapse
Instance Method Summary
collapse
aliases, #arguments, #arguments=, class_for, create, handlers, handles, #initialize, #name, name_for, new, #off, #prevent, #prevented?, #stop, #stop!, #stopped?, #target
Constructor Details
This class inherits a constructor from Browser::Event
Class Method Details
.construct(name, desc) ⇒ Object
21
22
23
|
# File 'opal/browser/event/message.rb', line 21
def self.construct(name, desc)
`new MessageEvent(#{name}, #{desc})`
end
|
.supported? ⇒ Boolean
10
11
12
|
# File 'opal/browser/event/message.rb', line 10
def self.supported?
Browser.supports? 'Event.Message'
end
|
Instance Method Details
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'opal/browser/event/message.rb', line 36
def data
%x{
if (window.ArrayBuffer && #@native.data instanceof ArrayBuffer) {
return #{Buffer.new(`#@native.data`)};
}
else if (window.Blob && #@native.data instanceof Blob) {
return #{Blob.new(`#@native.data`)};
}
else {
return #@native.data;
}
}
end
|
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'opal/browser/event/message.rb', line 52
def source
%x{
var source = #@native.source;
if (window.Window && source instanceof window.Window) {
return #{Window.new(`source`)};
}
else {
return nil;
}
}
end
|