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 +4 -4
- data/README.md +22 -0
- data/lib/assets/javascripts/twine.js.coffee +2 -2
- data/lib/twine-rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b153b73f51569db921642e0bcb0e2ba27bc0054
|
4
|
+
data.tar.gz: a6ee47343dd4f96334bc4d31a31a2fb1424ed58c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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) ->
|
data/lib/twine-rails/version.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coffee-rails
|