session-check 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,13 @@
1
1
  <script>
2
2
  var should_session_check = <%= !current_user.nil? %>;
3
3
  (function () {
4
+ var check_every_s = 10;
4
5
  var session_time_left = <%= session_time %>;
5
6
  var force_sign_in = function () {
6
7
  window.location = '/users/sign_in';
7
8
  };
8
9
  var session_check = function () {
9
- session_time_left = session_time_left - 10;
10
+ session_time_left = session_time_left - check_every_s;
10
11
  if (should_session_check && session_time_left < 0) {
11
12
  $.get('/session_check/time_to_session_expiry')
12
13
  .done(function (d) {
@@ -16,9 +17,9 @@
16
17
  })
17
18
  .fail(force_sign_in);
18
19
  }
19
- setTimeout(session_check, 1000);
20
+ setTimeout(session_check, check_every_s * 1000);
20
21
  };
21
- setTimeout(session_check, 1000);
22
+ setTimeout(session_check, check_every_s * 1000);
22
23
  $.ajaxSetup({
23
24
  complete: function (xhr) {
24
25
  session_time_left = <%= session_time %>;
@@ -1,5 +1,5 @@
1
1
  module Session
2
2
  module Check
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: session-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-20 00:00:00.000000000 Z
12
+ date: 2013-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime