Sha256: f71926ba92291efc8c409a4cb75b5c1a7508a37f114da541f76bc2e6a26db26c

Contents?: true

Size: 695 Bytes

Versions: 5

Compression:

Stored size: 695 Bytes

Contents

module LucidApp
  module API
    def self.included(base)
      base.instance_exec do
        def theme(theme_hash = nil, &block)
          if block_given?
            %x{
              let result = block.$call();
              base.jss_theme = result.$to_n();
              return result;
            }
          elsif theme_hash
            `base.jss_theme = #{theme_hash.to_n}` if theme_hash
            theme_hash
          elsif `typeof base.jss_theme === 'object'`
            `Opal.Hash.$new(base.jss_theme)`
          else
            nil
          end
        end
        alias_method :theme=, :theme
      end

      def context
        @native.JS[:context]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
isomorfeus-react-16.9.19 lib/lucid_app/api.rb
isomorfeus-react-16.9.18 lib/lucid_app/api.rb
isomorfeus-react-16.9.17 lib/lucid_app/api.rb
isomorfeus-react-16.9.16 lib/lucid_app/api.rb
isomorfeus-react-16.9.15 lib/lucid_app/api.rb