Sha256: be03f12bb45a231bf3953f38b16845adc7d6eb0e75a0bc278acc8b0192c4edf8

Contents?: true

Size: 884 Bytes

Versions: 20

Compression:

Stored size: 884 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

20 entries across 20 versions & 1 rubygems

Version Path
isomorfeus-redux-4.2.0 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.18 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.17 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.16 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.15 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.14 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.13 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.12 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.11 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.10 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.9 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.8 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.7 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.6 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.5 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.4 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.3 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.2 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.1 lib/isomorfeus/core_ext/kernel.rb
isomorfeus-redux-4.1.0 lib/isomorfeus/core_ext/kernel.rb