twine-rails 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: 6e115c17e5eca602d8855f0c445e98e9bbf03f28
4
- data.tar.gz: 4c954ef99e3a0ab642d2bd20123773522faa9d82
3
+ metadata.gz: 1b153b73f51569db921642e0bcb0e2ba27bc0054
4
+ data.tar.gz: a6ee47343dd4f96334bc4d31a31a2fb1424ed58c
5
5
  SHA512:
6
- metadata.gz: caa0a7f28e6ae36e1915341441f7ed09b0b0cdc9176d0bd07cfc9c08db33e8c026d105b46caf0e4ab9c118c8f7ac3a2bc54bf28ad19c53ada12699f892da2d9f
7
- data.tar.gz: f5a1abc2a3c4d5fed24349b3bdc1866d334985b7d54b01ca4938635ad0ff52dc02db89e335ed0b583cbff1527d99883662eeae1bf0d1e9452bf65ec0c548c90f
6
+ metadata.gz: 2a803dd841f1e521838ea9877a3171f4cdc04cfe0b09168e8f75a58be123f715e59a5e0ce5024116989e97c3f0c47ed21f1705584c377075d995d3a2b4178382
7
+ data.tar.gz: 869d2e712bf92af2c19fe2c011eaa88f9ed37f171a4b00b4e4823d44399b099b261e9f7a238ce7bd193c67b99a7209aa66584d93df2b01beeb042181c2f2deee
data/README.md CHANGED
@@ -117,6 +117,28 @@ Example:
117
117
  <div context='bar' define='{bar: new Foo}'></div>
118
118
  ```
119
119
 
120
+ ## Twine.shouldDiscardEvent
121
+
122
+ Lets you register a function to ignore certain events in order to improve performance. If the function you set returns true, then the event processing chain will be halted
123
+
124
+ Example:
125
+
126
+ ```coffee
127
+ Twine.shouldDiscardEvent.click = (event) ->
128
+ $target = $(event.target)
129
+ $target.hasClass('disabled')
130
+ ```
131
+
132
+ ## Dev Console
133
+
134
+ To get the current context in the dev console, inspect an element then type:
135
+
136
+ ```javascript
137
+ Twine.context($0)
138
+ ```
139
+
140
+ Where context expects a node and `$0` is shorthand for the current node in the dev console.
141
+
120
142
  ## Contributing
121
143
 
122
144
  1. Clone the repo: `git clone git@github.com:Shopify/twine`
@@ -213,7 +213,7 @@ Twine.bindingTypes =
213
213
 
214
214
  refresh = ->
215
215
  newValue = fn.call(node, context, rootContext)
216
- return if newValue == lastValue
216
+ return if newValue == lastValue # return if we can and avoid a DOM operation
217
217
 
218
218
  lastValue = newValue
219
219
  return if newValue == node[valueAttribute]
@@ -274,7 +274,7 @@ Twine.bindingTypes =
274
274
  return refresh: ->
275
275
  newValue = fn.call(node, context, rootContext)
276
276
  for key, value of newValue when lastValue[key] != value
277
- $(node).attr(key, value)
277
+ $(node).attr(key, value || null)
278
278
  lastValue = newValue
279
279
 
280
280
  define: (node, context, definition) ->
@@ -1,3 +1,3 @@
1
1
  module TwineRails
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twine-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Li
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-08 00:00:00.000000000 Z
13
+ date: 2015-08-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coffee-rails