Module: Isomorfeus

Defined in:
lib/isomorfeus/config.rb,
lib/isomorfeus/top_level_ssr.rb,
lib/isomorfeus/react_view_helper.rb,
lib/isomorfeus/top_level_browser.rb,
lib/isomorfeus/execution_environment.rb

Defined Under Namespace

Modules: ReactViewHelper Classes: TopLevel

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.envObject

Returns the value of attribute env.



7
8
9
# File 'lib/isomorfeus/config.rb', line 7

def env
  @env
end

.initial_state_fetchedObject

Returns the value of attribute initial_state_fetched.



4
5
6
# File 'lib/isomorfeus/config.rb', line 4

def initial_state_fetched
  @initial_state_fetched
end

.initializedObject (readonly)

Returns the value of attribute initialized.



6
7
8
# File 'lib/isomorfeus/config.rb', line 6

def initialized
  @initialized
end

.on_browserObject

Returns the value of attribute on_browser.



4
5
6
# File 'lib/isomorfeus/execution_environment.rb', line 4

def on_browser
  @on_browser
end

.on_ssrObject

Returns the value of attribute on_ssr.



5
6
7
# File 'lib/isomorfeus/execution_environment.rb', line 5

def on_ssr
  @on_ssr
end

.server_side_renderingObject

Returns the value of attribute server_side_rendering.



83
84
85
# File 'lib/isomorfeus/config.rb', line 83

def server_side_rendering
  @server_side_rendering
end

.top_componentObject

Returns the value of attribute top_component.



5
6
7
# File 'lib/isomorfeus/config.rb', line 5

def top_component
  @top_component
end

Class Method Details

.add_client_init_class_name(init_class_name) ⇒ Object



25
26
27
# File 'lib/isomorfeus/config.rb', line 25

def add_client_init_class_name(init_class_name)
  client_init_class_names << init_class_name
end

.add_client_option(key, value = nil) ⇒ Object



29
30
31
32
# File 'lib/isomorfeus/config.rb', line 29

def add_client_option(key, value = nil)
  self.class.attr_accessor(key)
  self.send("#{key}=", value)
end

.cached_component_class(class_name) ⇒ Object

only used for SSR



40
41
42
43
# File 'lib/isomorfeus/config.rb', line 40

def cached_component_class(class_name)
  return cached_component_classes[class_name] if cached_component_classes.key?(class_name)
  cached_component_classes[class_name] = "::#{class_name}".constantize
end

.cached_component_classesObject

only used for SSR



35
36
37
# File 'lib/isomorfeus/config.rb', line 35

def cached_component_classes
  @cached_component_classes ||= {}
end

.configuration(&block) ⇒ Object



86
87
88
# File 'lib/isomorfeus/config.rb', line 86

def configuration(&block)
  block.call(self)
end

.development?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/isomorfeus/config.rb', line 58

def development?
  @development
end

.execute_init_classesObject



45
46
47
48
49
# File 'lib/isomorfeus/config.rb', line 45

def execute_init_classes
  client_init_class_names.each do |constant|
    constant.constantize.send(:init)
  end
end

.force_init!Object



16
17
18
19
20
21
22
23
# File 'lib/isomorfeus/config.rb', line 16

def force_init!
  unless Isomorfeus.initial_state_fetched
    Isomorfeus.initial_state_fetched = true
    Redux::Store.preloaded_state = Isomorfeus.store.get_state
  end
  Isomorfeus.force_init_store!
  execute_init_classes
end

.force_renderObject



74
75
76
77
# File 'lib/isomorfeus/config.rb', line 74

def force_render
  top_component.JS.forceUpdate()
  nil
end

.initObject



9
10
11
12
13
14
# File 'lib/isomorfeus/config.rb', line 9

def init
  return if initialized
  @initialized = true
  Isomorfeus.init_store
  execute_init_classes
end

.on_browser?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/isomorfeus/execution_environment.rb', line 7

def on_browser?
  @on_browser
end

.on_server?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/isomorfeus/execution_environment.rb', line 15

def on_server?
  false
end

.on_ssr?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/isomorfeus/execution_environment.rb', line 11

def on_ssr?
  @on_ssr
end

.production?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/isomorfeus/config.rb', line 62

def production?
  @production
end

.ssr_contextsObject



109
110
111
# File 'lib/isomorfeus/config.rb', line 109

def ssr_contexts
  @ssr_contexts ||= {}
end

.start_app!Object



70
71
72
# File 'lib/isomorfeus/config.rb', line 70

def start_app!
  Isomorfeus::TopLevel.mount!
end

.test?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/isomorfeus/config.rb', line 66

def test?
  @test
end

.versionObject



113
114
115
# File 'lib/isomorfeus/config.rb', line 113

def version
  Isomorfeus::VERSION
end