prerender_rails_embedded 0.2.5 → 0.2.6

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjY5N2MxZjNkN2FmYTU3YmJiNTVmN2RkN2EzZGY4ZDhmYmMxNjEzNg==
4
+ YTNiZmE4NWJhYTNhOGQ0ZDkwY2M1ZGVhNzEwOTkxNjBjNWNjYTRlMg==
5
5
  data.tar.gz: !binary |-
6
- NzNhNjc5Zjc1NGE4NmFkZDMyNzQ5YjkzOWUzMTFlYzcyZjlmYjdmZg==
6
+ MWE3Yzk0NmNkMGJmYWVjMzBlMDljYTU3NzUxODc2NGRlMzYyMWUyMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2EyYTE4ZDYyODdlNGNiNzVlNjQyMWQzYzk1ZTk1ZTQ4OTBhYTAzMzhhZWVi
10
- ZWExMjY5MGUwYTYwNjg0MWZhNGY2NGYyMDA4Y2YzYThkN2UxMTVjOGRkZDE1
11
- OGMyZjU1MDBmMjdlNmM5NjNhNTdmZTFmMGZmYmI4NzA4NmY3Njc=
9
+ MjM1ZTBjMGMwYmY2YmNhMmQ1ZTlmNGZiMDdjMDIzOTZlY2I4YjEyYmQ5Yjk1
10
+ MDVhNmE0YzRkYTUxNzA5ZWI0YmIxNTI4YTdlNDk3Y2VhNzY2NDBlOWVlN2Nk
11
+ NWNlMzhmODQ0ZGUzZDQ1ZDNjMDYzY2I3NjlhYWQ5NWFlMzcyNmE=
12
12
  data.tar.gz: !binary |-
13
- ZDQxMzdkZDk3OWUzZmVmZDhkMjM3Njg5MDkxNWY3M2JiNjNlOGUzODMwYjA1
14
- Y2JjY2ZkNGNhOWZmMGQ5Y2Y5ZTEzYjU5NzllZTg3OTg3NGQwODk0ZWQ4MDFi
15
- OTU2NzA1M2RhOTQ3OTA4ZTI3OGY1OWUyZWFkNWI5OTRkNmE1MTU=
13
+ ZjNkOTAxODk3MDU1OTgzYTE2ZGNlOGYyYzQ4ZWIyZmY4NTI4ZmQ3OGJmZDE2
14
+ NzUwNTViZGY5NTllMGFjY2Q5OWQyNjNiYmIxMjQ1ZTgyY2IwMDk2YzRmY2U3
15
+ Y2QwNWQ3YWQ1OWQ1MTA5ZDRkYWMwNzY1M2NkNTI5OGRkNGYzMzA=
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * TODO exceptions should exit immediately from phantomjs and they DON'T
3
- * TODO add a timeout for too long connections
4
3
  * TODO support 404 and error code in the same way prerender.io (server) does
5
4
  * @type {number}
6
5
  */
@@ -72,14 +71,16 @@ surrender.serveHtml = function(html) {
72
71
  phantom.exit();
73
72
  };
74
73
 
75
- surrender.evaluateJavascriptOnPage = function(t) {
74
+ surrender.evaluateJavascriptOnPage = function(t, msPassed) {
76
75
  var _this = t || this
77
76
  , out = page.evaluate(_this.javascriptToExecuteOnPage);
78
77
 
79
- if(!out.shouldWaitForPrerenderReady || (out.shouldWaitForPrerenderReady && out.prerenderReady)) {
78
+ if (msPassed === undefined) msPassed = 0;
79
+
80
+ if(!out.shouldWaitForPrerenderReady || (out.shouldWaitForPrerenderReady && out.prerenderReady) || msPassed >= 20000) {
80
81
  _this.serveHtml(out.html);
81
82
  } else {
82
- setTimeout(function(){_this.evaluateJavascriptOnPage(_this)}, EVALUATE_JAVASCRIPT_CHECK_TIMEOUT);
83
+ setTimeout(function(){_this.evaluateJavascriptOnPage(_this, msPassed + EVALUATE_JAVASCRIPT_CHECK_TIMEOUT)}, EVALUATE_JAVASCRIPT_CHECK_TIMEOUT);
83
84
  }
84
85
  return _this;
85
86
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'prerender_rails_embedded'
5
- spec.version = '0.2.5'
5
+ spec.version = '0.2.6'
6
6
  spec.authors = ['Gian Carlo Pace', 'Luca Mirra']
7
7
  spec.email = %w(giancarlo.pace@etalia.net)
8
8
  spec.description = %q{A plugin for prerender_rails middleware to render JavaScript web app on the fly calling phantomjs directly}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prerender_rails_embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gian Carlo Pace