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


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

def inner_height
  `#@native.innerHeight`
end

#inner_widthInteger

Returns the inner width of the window.

Returns:

  • (Integer)

    the inner width of the window


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

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 26

Instance Method Details

#heightObject

Raises:

  • (NotImplementedError)

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

def height
  `#@native.outerHeight`
end

#height=(value) ⇒ Object


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

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

#set(*args) ⇒ Object


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

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