Class: Browser::Window::Size

Inherits:
Object
  • Object
show all
Defined in:
opal/browser/window/size.rb

Overview

Allows access and manipulation of the Browser::Window size.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#inner_heightInteger

Returns the inner height of the window.

Returns:

  • (Integer)

    the inner height of the window



69
70
71
# File 'opal/browser/window/size.rb', line 69

def inner_height
  `#@native.innerHeight`
end

#inner_widthInteger

Returns the inner width of the window.

Returns:

  • (Integer)

    the inner width of the window



62
63
64
# File 'opal/browser/window/size.rb', line 62

def inner_width
  `#@native.innerWidth`
end

#widthInteger

Returns the width of the window.

Returns:

  • (Integer)

    the width of the window

Raises:

  • (NotImplementedError)


# File 'opal/browser/window/size.rb', line 27

Instance Method Details

#heightObject

Raises:

  • (NotImplementedError)


38
39
40
# File 'opal/browser/window/size.rb', line 38

def height
  `#@native.outerHeight`
end

#height=(value) ⇒ Object



55
56
57
# File 'opal/browser/window/size.rb', line 55

def height=(value)
  set(height: value)
end

#set(*args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'opal/browser/window/size.rb', line 12

def set(*args)
  if Hash === args.first
    width, height = args.first.values_at(:width, :height)
  else
    width, height = args
  end

  width  ||= self.width
  height ||= self.height

  `#@native.resizeTo(#{width}, #{height})`

  self
end