Sha256: 37a5a70a268d1cfc05e64ce3d5eb5675e403b2afdb5db0e4bd891ae717556ea9

Contents?: true

Size: 885 Bytes

Versions: 2

Compression:

Stored size: 885 Bytes

Contents

module Kernel
  def promise_after(time_ms)
    p = Promise.new
    after(time_ms) { p.resolve(true) }
    p
  end

  def on_browser?;   Isomorfeus.on_browser?;   end
  def on_ssr?;       Isomorfeus.on_ssr?;       end
  def on_server?;    Isomorfeus.on_server?;    end
  def on_desktop?;   Isomorfeus.on_desktop?;   end
  def on_ios?;       Isomorfeus.on_ios?;       end
  def on_android?;   Isomorfeus.on_android?;   end
  def on_mobile?;    Isomorfeus.on_mobile?;    end
  def on_database?;  Isomorfeus.on_database?;  end
  def on_tvos?;      Isomorfeus.on_tvos?;      end
  def on_androidtv?; Isomorfeus.on_androidtv?; end
  def on_tv?;        Isomorfeus.on_tv?;        end

  if RUBY_ENGINE == 'opal'
    def after(time_ms, &block)
      `setTimeout(#{block.to_n}, time_ms);`
    end
  else
    def after(time_ms, &block)
      sleep time_ms/1000
      block.call
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
isomorfeus-redux-4.0.23 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.0.22 lib/isomorfeus/core_ext/kernel.rb