Sha256: e085a12dee20926b1088e7bcf931a40e9fb997c809fe30ca58d4550efddb91cc

Contents?: true

Size: 658 Bytes

Versions: 3

Compression:

Stored size: 658 Bytes

Contents

module Browser; class Window

class View
  def initialize(window)
    @window = window
    @native = window.to_n
  end

  if Browser.supports? 'Window.innerSize'
    def width
      `#@native.innerWidth`
    end

    def height
      `#@native.innerHeight`
    end
  elsif Browser.supports? 'Element.clientSize'
    def height
      `#@native.document.documentElement.clientHeight`
    end

    def width
      `#@native.document.documentElement.clientWidth`
    end
  else
    def width
      raise NotImplementedError, 'window size unsupported'
    end

    def height
      raise NotImplementedError, 'window size unsupported'
    end
  end
end

end; end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
diamonds-0.1.5 lib/diamonds/opal/browser/window/view.rb
opal-browser-0.2.0 opal/browser/window/view.rb
opal-browser-0.2.0.beta1 opal/browser/window/view.rb