hyper-react 0.12.6 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c46f55b15c1674d0c80af31f41ed30d3e3a18a4b
4
- data.tar.gz: b936525a6872c6439e50a6e869502c48e17ef303
3
+ metadata.gz: 44aee5bb00f9e340cd5d892e7f2a38e38bc0d1d3
4
+ data.tar.gz: 6ca48472eec183e3c32300cd218234645f113fa6
5
5
  SHA512:
6
- metadata.gz: 273429cf528f972e82f1507380620c09b7bc24fe309a20bb6c1f4ba6ac4ad3aa8807ffac869e845431f2affb1a8c15bb62a65af0b4df7d9ad7a547554388e4a7
7
- data.tar.gz: 41eb7b2eb00a5343a31c762d1fcf34ede6e4cbcf84b7b6f20dbcb9571de8951fcfd048033878eccd3890de71a7b3f678fda689c7135c5ea1e5f8ed4287a1401d
6
+ metadata.gz: 2d52361feb3a174d2453ea0f098e31ab8d04f03a06235ecdbca94fb9b9f0e1502c92cd2bd524fa688394e085240313c11535bef673afa9aae3f0a04264fa694f
7
+ data.tar.gz: 195be570e47647c4b058989be793a08b55712a2f90896116b503b60dc620239feabd15e5181016f51533f274e50b1d78d5da7cd9986017297883ba4f6a6cf79e
@@ -17,4 +17,7 @@ if RUBY_ENGINE != 'opal'
17
17
  end
18
18
  end
19
19
  end
20
+ module Hyperloop
21
+ define_setting :prerendering, :on
22
+ end
20
23
  end
@@ -136,12 +136,16 @@ module React
136
136
  end
137
137
 
138
138
  class IsomorphicProcCall
139
+
140
+ attr_reader :context
141
+
139
142
  def result
140
143
  @result.first if @result
141
144
  end
142
145
 
143
- def initialize(name, block, *args)
146
+ def initialize(name, block, context, *args)
144
147
  @name = name
148
+ @context = context
145
149
  block.call(self, *args)
146
150
  @result ||= send_to_server(*args) if IsomorphicHelpers.on_opal_server?
147
151
  end
@@ -190,7 +194,7 @@ module React
190
194
  if RUBY_ENGINE != 'opal'
191
195
  def isomorphic_method(name, &block)
192
196
  React::IsomorphicHelpers::Context.send(:define_method, name) do |args_as_json|
193
- React::IsomorphicHelpers::IsomorphicProcCall.new(name, block, *JSON.parse(args_as_json)).result
197
+ React::IsomorphicHelpers::IsomorphicProcCall.new(name, block, self, *JSON.parse(args_as_json)).result
194
198
  end
195
199
  end
196
200
  else
@@ -198,10 +202,11 @@ module React
198
202
 
199
203
  def isomorphic_method(name, &block)
200
204
  self.class.send(:define_method, name) do | *args |
201
- React::IsomorphicHelpers::IsomorphicProcCall.new(name, block, *args).result
205
+ React::IsomorphicHelpers::IsomorphicProcCall.new(name, block, self, *args).result
202
206
  end
203
207
  end
204
208
  end
209
+
205
210
  end
206
211
  end
207
212
  end
@@ -10,6 +10,18 @@ module ReactiveRuby
10
10
  ReactiveRuby::Rails::ComponentMount
11
11
  end
12
12
  config.after_initialize do
13
+ ::ApplicationController.class_eval do
14
+ before_action do
15
+ if params.has_key? 'hyperloop-prerendering'
16
+ params['hyperloop-prerendering'].to_s == 'on'
17
+ elsif params.has_key? 'hyperloop_prerendering'
18
+ params['hyperloop_prerendering'].to_s == 'on'
19
+ else
20
+ Hyperloop.prerendering.to_s == 'on'
21
+ end && next
22
+ params[:no_prerender] = '1'
23
+ end
24
+ end
13
25
  class ::HyperloopController < ::ApplicationController
14
26
  def action_missing(name)
15
27
  render_component
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = "0.12.6"
2
+ VERSION = "0.12.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyper-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.6
4
+ version: 0.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chang
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-05-09 00:00:00.000000000 Z
13
+ date: 2017-06-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: opal