Sha256: 5c7c7ece87c30792d7ea80872f14fe7dce15709def4e6f957e730d52b3d98e06
Contents?: true
Size: 1.03 KB
Versions: 5
Compression:
Stored size: 1.03 KB
Contents
module ReactiveRuby class ComponentLoader attr_reader :v8_context private :v8_context def initialize(v8_context) unless v8_context raise ArgumentError.new('Could not obtain ExecJS runtime context') end @v8_context = v8_context end def load(file = components) return true if loaded? !!v8_context.eval(opal(file)) end def load!(file = components) return true if loaded? self.load(file) ensure raise "No react.rb components found in #{components}.rb" unless loaded? end def loaded? !!v8_context.eval('Opal.React') end private def components # Make this configurable at some point 'components' end def opal(file) if Opal::Processor.respond_to?(:load_asset_code) Opal::Processor.load_asset_code(assets, file) else Opal::Sprockets.load_asset(file, assets) end rescue # What exception is being caught here? end def assets ::Rails.application.assets end end end
Version data entries
5 entries across 5 versions & 2 rubygems