RubyApp 0.7.14 → 0.7.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,6 +42,7 @@ module RubyApp
42
42
  @session = nil
43
43
  @source = nil
44
44
  end
45
+ @delay = 0
45
46
  @statements = []
46
47
  end
47
48
 
@@ -53,6 +54,11 @@ module RubyApp
53
54
  self.source.send(:on_event, self)
54
55
  end
55
56
 
57
+ def delay(duration)
58
+ @delay = duration
59
+ return self
60
+ end
61
+
56
62
  def now=(value)
57
63
  self.execute("RubyApp.now = #{value.to_json};")
58
64
  end
@@ -294,6 +300,7 @@ module RubyApp
294
300
  '_class' => self.class.to_s,
295
301
  'now' => @now,
296
302
  'source' => @source ? @source.element_id : nil,
303
+ 'delay' => @delay,
297
304
  'statements' => @statements
298
305
  }
299
306
  end
@@ -60,12 +60,18 @@
60
60
  request = $.ajax({type:'POST', url:location.href, data:event});
61
61
  request
62
62
  .success( function(event) {
63
- $.each(event.statements, function(index, statement) {
64
- // RubyApp.log('EVAL ' + statement)
65
- eval(statement);
66
- } );
67
- var _stop = new Date();
68
- RubyApp.log('SUCCESS ' + event._class + ' ' + ((_stop - _start) / 1000) + 's');
63
+ var onSuccess = function() {
64
+ $.each(event.statements, function(index, statement) {
65
+ // RubyApp.log('EVAL ' + statement)
66
+ eval(statement);
67
+ } );
68
+ var _stop = new Date();
69
+ RubyApp.log('SUCCESS ' + event._class + ' ' + ((_stop - _start) / 1000) + 's');
70
+ };
71
+ if (event.delay > 0)
72
+ window.setTimeout(onSuccess, event.delay);
73
+ else
74
+ onSuccess();
69
75
  } )
70
76
  .error( function(request, message, exception) {
71
77
  var _stop = new Date();
@@ -1,4 +1,4 @@
1
1
  module RubyApp
2
- VERSION = "0.7.14"
2
+ VERSION = "0.7.15"
3
3
  ROOT = File.expand_path(File.dirname(__FILE__))
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RubyApp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.14
4
+ version: 0.7.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -1561,7 +1561,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1561
1561
  version: '0'
1562
1562
  segments:
1563
1563
  - 0
1564
- hash: -1186954489530126662
1564
+ hash: -1441367662488162587
1565
1565
  required_rubygems_version: !ruby/object:Gem::Requirement
1566
1566
  none: false
1567
1567
  requirements:
@@ -1570,7 +1570,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1570
1570
  version: '0'
1571
1571
  segments:
1572
1572
  - 0
1573
- hash: -1186954489530126662
1573
+ hash: -1441367662488162587
1574
1574
  requirements: []
1575
1575
  rubyforge_project:
1576
1576
  rubygems_version: 1.8.25