You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-4Lines changed: 52 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,42 @@ Because of this, it's often overlooked in favor of styled `<div>` combos.
13
13
14
14
* Cross browser reset and styling to pull `<progress>` element in line with modern slim-style bars
15
15
* CSS helpers that provide classes and attributes to deal with things like positioning, growth style, simulation etc.
16
-
* Optional JS helper for better control and interaction with `<progress>` elements.
16
+
* Optional JS helper for better control and interaction with `<progress>` elements. For example; being able to hook into network request status and display this to the end user.
17
17
* Plays nice wherever the `<progress>` element is supported!
@@ -160,8 +193,7 @@ As for the methods available(`?` denotes an optional parameter);
160
193
*`setSpread(? {bool} spread)` - Set whether `<progress>` element should be spred style. By default will set to false.
161
194
*`setIndeterminate(? {bool} indeterminate)` - Set whether `<progress>` element is using `indeterminate` helper class. By default, will remove helper class.
162
195
*`togglePause` - Toggles pause attribute for play/pause animation.
163
-
*`setPosition({Array string} positions)` - Takes an array of positions that will be applied to the element. For example, `['top', 'fixed']` will set `ep--top ep--fixed` class to the `<progress>` element.
164
-
*`resetPosition` - Resets position by removing all classes.
196
+
*`setPosition(? {Array string} positions)` - Takes an optional array of positions that will be applied to the element. For example, `['top', 'fixed']` will set `ep--top ep--fixed` class to the `<progress>` element. If no positions are declared, all currently applied will be wiped.
165
197
*`increase(? {number} value, ? {function} cb)` - Increase progress value by optional increment with an optional callback. By default, increment is 5.
166
198
*`decrease(? {number} value, ? {function} cb)` - Decrease progress value by optional decrement with an optional callback. By default, decrement is 5.
167
199
*`reset` - Resets `<progress>` value to 0.
@@ -170,8 +202,24 @@ As for the methods available(`?` denotes an optional parameter);
170
202
*`simulate(? {number} step, ? {number} increment, ? {number} max)` - Simulation on the Javascript side is an example where we have more control than we do with CSS. Set a simulation by declaring a step duration in `ms`, an `increment` and a `max` value for the simulation to reach. The default simulation will increment by 5 every second until the `<progress>` element has a value of 99.
171
203
*`complete(? {function} cb)` - Complete a progress bar by setting value to 100 and then resetting it. Provide optional callback for when complete.
172
204
205
+
#### Hooking into network requests
206
+
Yep. You can easily integrate `ep` to communicate network request status to the end user. The most basic example being something like the following;
We start with a simple `progress` element. Reset it to make sure it starts at `0` and start a simulation. When we get the `OK` from our network request, set our element to complete :tada:
173
221
174
-
## What happened to progre(c)ss?
222
+
## What happened to progrecss?
175
223
For some time, I'd intended to revisit `progre(c)ss` with some ideas I had. When I finally got round to it, I went back over the issues and something struck me. Someone had pointed out why not use the `<progress>` element?
176
224
177
225
I'd previously struck this off because I liked being able to add `:pseudo` element progress bars to any element with relative ease where the `:pseudo` elements were available.
0 commit comments