Sha256: bcf3249ddae90a16055409c523c50307f86adc504919f7ecc97f3453769ff94d

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

module Opal
  module Bootbox
    module_function

    def bootbox_call(method, *args, &block)
      Native.call(`bootbox`, method, *args, &block)
    end

    # Creates an alert window.
    # The given block is optional.
    # No result is passed to the given block.
    def alert(*args, &block)
      bootbox_call(__method__, *args, &block)
    end

    # Creates a confirm window.
    # The result passed to given block is true or false.
    def confirm(*args, &block)
      bootbox_call(__method__, *args, &block)
    end

    # Creates a prompt window.
    # The result passed to given block is a String or nil.
    def prompt(*args, &block)
      bootbox_call(__method__, *args, &block)
    end

  end
end
$bootbox = Opal::Bootbox

if RUBY_ENGINE == 'opal'
else
  require 'opal'
  require 'opal/bootbox/version'
  Opal.append_path File.expand_path('../..', __FILE__).untaint
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-bootbox-0.1.0 lib/opal/bootbox.rb