Class: Glimmer::Opal::Shell
- Inherits:
-
Object
- Object
- Glimmer::Opal::Shell
- Defined in:
- lib/glimmer/opal/shell.rb
Instance Method Summary collapse
- #add_child(child) ⇒ Object
- #dom ⇒ Object
-
#initialize(args) ⇒ Shell
constructor
A new instance of Shell.
- #text ⇒ Object
- #text=(value) ⇒ Object
Constructor Details
#initialize(args) ⇒ Shell
Returns a new instance of Shell.
4 5 6 7 8 9 10 |
# File 'lib/glimmer/opal/shell.rb', line 4 def initialize(args) @args = args @children = [] $document.ready do $document.body.replace(dom) end end |
Instance Method Details
#add_child(child) ⇒ Object
20 21 22 23 24 |
# File 'lib/glimmer/opal/shell.rb', line 20 def add_child(child) return if @children.include?(child) @children << child dom << child.dom end |
#dom ⇒ Object
26 27 28 29 30 31 |
# File 'lib/glimmer/opal/shell.rb', line 26 def dom @dom ||= DOM { body { } } end |
#text ⇒ Object
12 13 14 |
# File 'lib/glimmer/opal/shell.rb', line 12 def text $document.title end |
#text=(value) ⇒ Object
16 17 18 |
# File 'lib/glimmer/opal/shell.rb', line 16 def text=(value) $document.title = value end |