Sha256: fe0452af7de44bacb43307c6ec607a91ece6aed100d21cfcdb9bc5277c6fa590
Contents?: true
Size: 1.44 KB
Versions: 3
Compression:
Stored size: 1.44 KB
Contents
module Browser module Window extend DelegateNative extend EventTarget @native = `window` module_function if `#@native.requestAnimationFrame !== undefined` # Add the given block to the current iteration of the event loop. If this # is called from another `animation_frame` call, the block is run in the # following iteration of the event loop. def animation_frame &block `requestAnimationFrame(function(now) { #{block.call `now`} })` self end else def animation_frame &block after(0, &block) self end end # Run the given block every `duration` seconds # # @param duration [Numeric] the number of seconds between runs def set_interval duration, &block `setInterval(function() { #{block.call} }, duration)` end def set_timeout duration, &block `setTimeout(function() { #{block.call} }, duration)` end # return [History] the browser's History object def history Browser::History.new(`window.history`) end # @return [Location] the browser's Location object def location Browser::Location.new(`window.location`) end # Scroll to the specified (x,y) coordinates def scroll x, y `window.scrollTo(x, y)` end end module_function # return [Window] the browser's Window object def window Window end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
isomorfeus-preact-22.9.0.rc3 | lib/browser/window.rb |
isomorfeus-preact-22.9.0.rc2 | lib/browser/window.rb |
isomorfeus-preact-22.9.0.rc1 | lib/browser/window.rb |