Skip to content

Commit fe3f271

Browse files
authored
Merge pull request #12 from victorvoid/dev
New API to draw, now is lazy
2 parents 12cbba6 + 44a03c2 commit fe3f271

25 files changed

+5893
-1076
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
build

Makefile

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ The best way to create a placeholder layout effect.
33

44
What is it?
55
-------------
6+
67
Placeload.js is a library to customize your interface previews/skeleton screen that yield a fantastic user experience.
78

89
![](https://github.com/victorvoid/placeload.js/blob/master/placeload-desc.jpg)
910

10-
1111
Getting started
1212
------------
1313

14-
Compiled and production-ready code can be found in the lib directory. The src directory contains development code.
15-
14+
Compiled and production-ready code can be found in the dist directory. The lib directory contains development code.
1615

1716
Install placeload.js with npm:
1817

@@ -29,57 +28,58 @@ $ bower install https://github.com/victorvoid/placeload.js.git
2928
### 1. Include placeload on your site.
3029

3130
```html
32-
<link href="lib/placeload.css">
31+
<link href="dist/placeload.min.css">
3332

34-
<script src="lib/placeload.js"></script>
33+
<script src="dist/placeload.min.js"></script>
3534
```
3635

3736
### 2. Paint your placeholder
3837

3938
```js
40-
var placeUserUI = new Placeload('.user__panel--placeholder');
41-
placeUserUI.draw({
42-
width: '300px',
43-
height: '200px'
44-
});
45-
46-
placeUserUI.draw({
47-
width: '400px',
48-
height: '20px',
49-
marginTop: '10px'
50-
});
51-
52-
placeUserUI.draw({
53-
width: '400px',
54-
height: '20px',
55-
marginTop: '10px'
56-
});
57-
58-
placeUserUI.draw({
59-
width: '250px',
60-
height: '20px',
61-
marginTop: '10px'
62-
});
39+
40+
import Placeload from 'placeload.js'
41+
42+
Placeload
43+
.$('.user-placeload')
44+
.config({speed: '2s'})
45+
.line((element) => element.width(300).height(200))
46+
.fold(
47+
(err) => console.log('error: ', err),
48+
(allElements) => console.log('allElements: ', allElements)
49+
)
6350
```
6451

65-
![](https://github.com/victorvoid/placeload.js/blob/master/docs/imgs/placeload_example.gif)
52+
### 3. Placeload uses lazy evaluation, in that nothing is evaluated until necessary.
6653

67-
Demos
68-
--------
54+
```js
6955

70-
[User load - vanillajs](https://victorvoid.github.io/placeload.js/examples/vanillajs/user_load/index.html)
56+
import Placeload from 'placeload.js'
7157

58+
const userContainer = Placeload
59+
.$('.user-placeload')
60+
.config({speed: '2s'})
61+
.line((element) => element.width(300).height(200))
62+
.config({spaceBetween: '30px'})
63+
.line((element) => element.width(400).height(20))
64+
.config({spaceBetween: '30px'})
65+
.line((element) => element.width(400).height(20))
66+
.config({spaceBetween: '30px'})
67+
.line((element) => element.width(250).height(20))
7268

73-
Learning More
74-
-------------
7569

76-
Read the [reference documentation](https://victorvoid.github.io/placeload.js/#documentation).
70+
userContainer.fold(
71+
(err) => console.log('error: ', err),
72+
(allElements) => console.log('allElements: ', allElements)
73+
)
74+
```
75+
76+
![](https://github.com/victorvoid/placeload.js/blob/master/docs/imgs/placeload_example.gif)
7777

7878
Authors
7979
--------
8080
The repo is written and maintained by [Victor Igor](https://github.com/victorvoid). Other contributors that have submitted something, in alphabetical order:
8181

82-
- [Raniel Oliveira](https://github.com/raniel182)
82+
- [Raniel Oliveira](https://github.com/raniel182) - UX
8383

8484
License
8585
-------

compile.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)