Sha256: 2665c2fe2bdc4daab2cb8fc47e77cfaaa02a5aea32dbf8f60a01cca84f8f5d81

Contents?: true

Size: 700 Bytes

Versions: 7

Compression:

Stored size: 700 Bytes

Contents

module Hyperloop
  class << self
    def js_import(value, client_only: nil, server_only: nil, defines:)
      defines = [*defines]
      if RUBY_ENGINE != 'opal'
        import(value, client_only: client_only, server_only: server_only, js_import: true)
      else
        on_server = `typeof Opal.global.document === 'undefined'`
        return if (server_only && !on_server) || (client_only && on_server)
        defines.each do |name|
          next unless `Opal.global[#{name}] === undefined`
          raise "The package #{name} was not found. Add it to the webpack "\
                "#{client_only ? 'client_only.js' : 'client_and_server.js'} manifest."
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyperloop-config-0.99.6 lib/hyperloop/js_imports.rb
hyperloop-config-0.99.5 lib/hyperloop/js_imports.rb
hyperloop-config-0.99.4 lib/hyperloop/js_imports.rb
hyperloop-config-0.99.3 lib/hyperloop/js_imports.rb
hyperloop-config-0.99.2 lib/hyperloop/js_imports.rb
hyperloop-config-0.99.1 lib/hyperloop/js_imports.rb
hyperloop-config-0.99.0 lib/hyperloop/js_imports.rb