snabberb 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 9905574c98d778f67508b52d3195f97d3d95b00b6d8a729a086f74c48e03b532
4
- data.tar.gz: 770cb2d53f5aa816c0e156ba231ad5bacc26b77fc118ce8c2963930b56faaf25
3
+ metadata.gz: 98ff77b3a36c5ca9051b8daed1c6498da9ce011240cd5fe869969a1dbee957ec
4
+ data.tar.gz: 4dc1ed366b54af762a35bc206b3dbf55f2b8110a6fab8341dea9ec59862b808f
5
5
  SHA512:
6
- metadata.gz: 1590dacc07bd3dab3da4c7cc5b799744242f29d08e2bd87bff32f56aedfdb50c70225910f4dd8d0ed95372c5f6a45f7fe359db42c7221e78133273b35c8c4cb2
7
- data.tar.gz: 3d13da1d38258a606df13c4bdccb8afc2a38d15860f42a900718b903492cfdbe7a84d0342187cdde9bb3239075463cd5651785122bf7f00bcf008c745e1fccd6
6
+ metadata.gz: f67e569452ffeb5df152569141de8711fda3819ea7c67d4757f71b27864f6bfa743b9feb5bd0103f873743fab6b85899043c73c885b3fd5db3c1def1cdad5f00
7
+ data.tar.gz: 32e7c025a1bb9fcb4d9ef3e7b9adeadab45db078e6d2f3930e5e4bd30a4efa0067f20ceebc6ca4835860be9249c321f4f0987d9b36e0f04a9d84daa58e441cfb
@@ -16,7 +16,7 @@ GEM
16
16
  parser (~> 2.6)
17
17
  parser (2.6.4.1)
18
18
  ast (~> 2.4.0)
19
- rack (2.0.7)
19
+ rack (2.0.8)
20
20
 
21
21
  PLATFORMS
22
22
  ruby
@@ -25,7 +25,7 @@ GEM
25
25
  tilt (>= 1.4)
26
26
  parser (2.6.4.1)
27
27
  ast (~> 2.4.0)
28
- rack (2.0.7)
28
+ rack (2.0.8)
29
29
  roda (3.26.0)
30
30
  rack
31
31
  sprockets (3.7.2)
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'execjs'
4
- require 'json'
5
4
  require 'opal'
6
5
  require 'opal/sprockets'
7
6
  require 'roda'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snabberb
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
@@ -85,12 +85,16 @@ module Snabberb
85
85
  end
86
86
 
87
87
  # Update the dom with the request animation frame queue.
88
+ # Add to a queue of request_ids so we can track calls.
88
89
  def update
89
- `window.requestAnimationFrame(function(timestamp) {#{update!}})`
90
+ request_ids << `window.requestAnimationFrame(function(timestamp) {#{update!}})`
90
91
  end
91
92
 
92
- # Update the dom immediately.
93
+ # Update the dom immediately if this is the final animation request.
93
94
  def update!
95
+ request_ids.shift
96
+ return unless request_ids.empty?
97
+
94
98
  @@patcher ||= %x{snabbdom.init([
95
99
  snabbdom_attributes.default,
96
100
  snabbdom_class.default,
@@ -113,7 +117,7 @@ module Snabberb
113
117
 
114
118
  ivar = "@#{key}"
115
119
  instance_variable_set(ivar, value)
116
- root.instance_variable_set(ivar, value) if !root? && root.stores?(key)
120
+ @root.instance_variable_set(ivar, value) if !root? && @root.stores?(key)
117
121
 
118
122
  update
119
123
  end
@@ -126,6 +130,10 @@ module Snabberb
126
130
  class_needs.dig(key, :store)
127
131
  end
128
132
 
133
+ def request_ids
134
+ root? ? @request_ids ||= [] : @root.request_ids
135
+ end
136
+
129
137
  private
130
138
 
131
139
  def init_needs(needs)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snabberb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Mao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-11 00:00:00.000000000 Z
11
+ date: 2020-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal