Class: Glimmer::Opal::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/glimmer/opal/shell.rb

Instance Method Summary collapse

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

#domObject



26
27
28
29
30
31
# File 'lib/glimmer/opal/shell.rb', line 26

def dom
  @dom ||= DOM {
    body {
    }
  }
end

#textObject



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