Skip to content

Commit edfb89c

Browse files
committed
Improve selector docs
1 parent 14ce520 commit edfb89c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,27 @@ have a `.progress` property, or a `.elements` property which is a list of object
9090
`.progress` properties. Pace will automatically handle all scaling to make the progress
9191
changes look smooth to the user.
9292

93+
Elements
94+
--------
95+
96+
Elements being rendered to the screen is one way for us to decide that the page has been
97+
rendered. If you would like to use that source of information (not required at all),
98+
specify one or more selectors. You can comma seperate the selectors to propertly handle
99+
error states, where the progress bar should disappear, but the element were looking for
100+
may never apper:
101+
102+
```javascript
103+
paceOptions = {
104+
elements: {
105+
selectors: ['.timeline,.timeline-error', '.user-profile,.profile-error']
106+
}
107+
}
108+
```
109+
110+
Pace will consider the elements test successful when each selector matches something. For
111+
this example, when either `.timeline` or `.timeline-error` exist, and either `.user-profile`
112+
or `.profile-error` exit.
113+
93114
Restart Rules
94115
-------------
95116

@@ -104,7 +125,7 @@ paceOptions: {
104125

105126
You can always trigger a restart manually by calling `Pace.restart()`
106127

107-
See [the source](pace.coffee) for a full list of all options.
128+
See [the source](https://github.com/HubSpot/pace/blob/master/pace.coffee) for a full list of all options.
108129

109130
API
110131
---

0 commit comments

Comments
 (0)