render-react 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddd5c97adcd6ba8d8c1a2a594f5da398da5cc2d5
4
- data.tar.gz: 53670580d70661bf44f81713ababbebe7093fb44
3
+ metadata.gz: 8207624f1aecc2a35548dca05f898163debeacd3
4
+ data.tar.gz: 7c21458d4d3e758d3217af9bbdddc1a6118ceea0
5
5
  SHA512:
6
- metadata.gz: f48287b850dc575b70231c3bcc2b922480d0f5496d805bb4a0933f8958dd542e9a0b9237bd37ac67825abf09f5cc226581e80c4415d79b85c4e04229de0df29e
7
- data.tar.gz: 39420f25acaf5124b3b1e6abb5b0f917c92ab81456ee108877f0c397aa6792ad0ded243eec207d132fbd8949f07475ab3123ceb35864a039b69cd517a29f094f
6
+ metadata.gz: 817c39361103f3fa94e277518f9a5e187170143b038b086f73574accdfe6c3263d1e26826f42d2ca90f17612f5b32c4440d154fcf67bb3a3c6b66348c2e05d0c
7
+ data.tar.gz: 7bd123ad0228db99f0934395240a1a634ecd884a91584a7d9cd66ad7203012b1689fc39e80b9dc246b929db55623e7cdf3cc3ea9fdab81662113cef2bc32c8ca
File without changes
@@ -21,14 +21,7 @@ module Render
21
21
  js_lib_files.each { |file| @cxt.load(file) }
22
22
  end
23
23
 
24
- def bootstrap
25
- if @durability && @durability <= 0
26
- @cxt.destroy
27
- @cxt = nil
28
- end
29
-
30
- create_context unless @cxt
31
-
24
+ def load_components
32
25
  Config.paths.each do |path|
33
26
  files = Dir.glob(File.join(path, '**', '*.js'))
34
27
  files.each do |filename|
@@ -37,8 +30,22 @@ module Render
37
30
  lookup[name.to_sym] = true
38
31
  end
39
32
  end
33
+ end
40
34
 
41
- @durability -= 1
35
+ def bootstrap
36
+ if @durability
37
+ if @durability <= 0
38
+ @cxt.destroy
39
+ @cxt = nil
40
+ create_context
41
+ load_components
42
+ else
43
+ @durability -= 1
44
+ end
45
+ else
46
+ create_context
47
+ load_components
48
+ end
42
49
  end
43
50
 
44
51
  def render(component_class, **props)
@@ -55,7 +62,7 @@ module Render
55
62
  @cxt.eval(code)
56
63
  end
57
64
 
58
- module_function :bootstrap, :create_context, :render, :lookup, :evaljs
65
+ module_function :bootstrap, :create_context, :render, :lookup, :evaljs, :load_components
59
66
  end
60
67
  end
61
68
  end
@@ -13,7 +13,9 @@ module Render
13
13
  end
14
14
 
15
15
  def new_context
16
- V8::Context.new
16
+ cxt = V8::Context.new
17
+ cxt.load File.join(gem_js_path, 'react.js')
18
+ cxt
17
19
  end
18
20
 
19
21
  def gem_js_path
@@ -1,5 +1,5 @@
1
1
  module Render
2
2
  module React
3
- VERSION = '0.0.3'.freeze
3
+ VERSION = '0.0.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Krasnoschekov
@@ -97,10 +97,8 @@ files:
97
97
  - Rakefile
98
98
  - bin/console
99
99
  - bin/setup
100
- - js/dist/compiler/_react.js
101
100
  - js/dist/compiler/react-dom-server.js
102
- - js/dist/compiler/react-dom.js
103
- - js/dist/transpiler/_react.js
101
+ - js/dist/react.js
104
102
  - js/dist/transpiler/babel.js
105
103
  - js/package.json
106
104
  - lib/render/react.rb
@@ -1,42 +0,0 @@
1
- /**
2
- * ReactDOM v15.3.0
3
- *
4
- * Copyright 2013-present, Facebook, Inc.
5
- * All rights reserved.
6
- *
7
- * This source code is licensed under the BSD-style license found in the
8
- * LICENSE file in the root directory of this source tree. An additional grant
9
- * of patent rights can be found in the PATENTS file in the same directory.
10
- *
11
- */
12
- // Based off https://github.com/ForbesLindesay/umd/blob/master/template.js
13
- ;(function(f) {
14
- // CommonJS
15
- if (typeof exports === "object" && typeof module !== "undefined") {
16
- module.exports = f(require('react'));
17
-
18
- // RequireJS
19
- } else if (typeof define === "function" && define.amd) {
20
- define(['react'], f);
21
-
22
- // <script>
23
- } else {
24
- var g;
25
- if (typeof window !== "undefined") {
26
- g = window;
27
- } else if (typeof global !== "undefined") {
28
- g = global;
29
- } else if (typeof self !== "undefined") {
30
- g = self;
31
- } else {
32
- // works providing we're not in "use strict";
33
- // needed for Java 8 Nashorn
34
- // see https://github.com/facebook/react/issues/3037
35
- g = this;
36
- }
37
- g.ReactDOM = f(g.React);
38
- }
39
-
40
- })(function(React) {
41
- return React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
42
- });