sprockets-preload 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -9
- data/assets/sprockets/preload/load.coffee.erb +5 -2
- data/lib/sprockets/preload/engine.rb +1 -1
- data/lib/sprockets/preload/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: 45f0a6d6d7ec678e7d785146a05cdc88ffcf22e0
|
4
|
+
data.tar.gz: aebed604cab1b988ee830d26b890660d58c4fed7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 858a0a0c7d2f807b05f518fe8d72a0b41929d42cb302a321fb551c8c88fd2df63780009a521984b64cf52f040e0d3e5b7d42ca810d5a2cb94107373500a834be
|
7
|
+
data.tar.gz: 6ddc6e4e57f0488afb9870b124281e3635d455b0b1d3de4220e18a1bea8c9fb195b28317f2d65fe325bd3d16841dfaf67a20959d585e73f68ca7cdb76009206a
|
data/README.md
CHANGED
@@ -17,8 +17,10 @@ Imagine that you are riding on Rails and have the following `application.js` whe
|
|
17
17
|
//= include jquery-ui
|
18
18
|
//= include front
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
$(function(){
|
21
|
+
// Starting application
|
22
|
+
Front.start();
|
23
|
+
});
|
22
24
|
```
|
23
25
|
|
24
26
|
Let's make user experience smooth:
|
@@ -33,8 +35,10 @@ Let's make user experience smooth:
|
|
33
35
|
//= preload jquery-ui
|
34
36
|
//= preload front
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
+
$(function(){
|
39
|
+
// Starting application
|
40
|
+
Front.start();
|
41
|
+
});
|
38
42
|
```
|
39
43
|
|
40
44
|
3. Delay initialization to the moment when detached assets are loaded:
|
@@ -47,7 +51,7 @@ Let's make user experience smooth:
|
|
47
51
|
|
48
52
|
SprocketsPreload.success = function() {
|
49
53
|
// Starting application
|
50
|
-
|
54
|
+
Front.start();
|
51
55
|
}
|
52
56
|
```
|
53
57
|
|
@@ -61,7 +65,7 @@ Let's make user experience smooth:
|
|
61
65
|
|
62
66
|
SprocketsPreload.success = function() {
|
63
67
|
// Starting application
|
64
|
-
|
68
|
+
Front.start();
|
65
69
|
}
|
66
70
|
|
67
71
|
SprocketsPreload.progress = function(percent) {
|
@@ -82,7 +86,7 @@ Let's make user experience smooth:
|
|
82
86
|
|
83
87
|
SprocketsPreload.success = function() {
|
84
88
|
// Starting application
|
85
|
-
|
89
|
+
Front.start();
|
86
90
|
}
|
87
91
|
|
88
92
|
SprocketsPreload.progress = function(percent) {
|
@@ -115,7 +119,7 @@ SprocketsPreload.localStorage = false;
|
|
115
119
|
|
116
120
|
SprocketsPreload.success = function() {
|
117
121
|
// Starting application
|
118
|
-
|
122
|
+
Front.start();
|
119
123
|
}
|
120
124
|
|
121
125
|
SprocketsPreload.progress = function(percent) {
|
@@ -141,4 +145,4 @@ SprocketsPreload.progress = function(percent) {
|
|
141
145
|
|
142
146
|
## License
|
143
147
|
|
144
|
-
It is free software, and may be redistributed under the terms of MIT license.
|
148
|
+
It is free software, and may be redistributed under the terms of MIT license.
|
@@ -52,8 +52,11 @@
|
|
52
52
|
# Loads asset using localStorage as a manual cache
|
53
53
|
#
|
54
54
|
loadCached: (url, version, size) ->
|
55
|
-
|
56
|
-
|
55
|
+
try
|
56
|
+
attempt = localStorage['sprockets-preload']
|
57
|
+
attempt = JSON.parse(attempt) if attempt
|
58
|
+
catch
|
59
|
+
delete localStorage['sprockets-preload']
|
57
60
|
|
58
61
|
if attempt?.version == version
|
59
62
|
@inject defer: true, text: attempt.source
|
@@ -9,7 +9,7 @@ module Sprockets
|
|
9
9
|
Sprockets::Preload.environment = app.assets
|
10
10
|
Sprockets::Preload.precompiles = app.config.assets.precompile
|
11
11
|
|
12
|
-
app.config.assets.precompile += ['sprockets/preload/assets'
|
12
|
+
app.config.assets.precompile += ['sprockets/preload/assets.js']
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-preload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Staal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|