@@ -133,7 +133,7 @@ Returns boolean value if any loader exists in page.
133133</template >
134134```
135135
136- #### ` .is(loader String | Matcher) `
136+ #### ` .is(loader String | Matcher) ` or ` .waiting(loader String | Matcher) `
137137
138138Returns boolean value if given loader exists in page.
139139
@@ -143,6 +143,16 @@ Returns boolean value if given loader exists in page.
143143</template >
144144```
145145
146+ You can use ** ` waiting ` ** alias instead of ** ` is ` ** .
147+
148+ ``` html
149+ <template >
150+ <div v-if =" $wait.waiting('fetching users')" >
151+ Fetching users...
152+ </div >
153+ </template >
154+ ```
155+
146156Also you can use matcher to make it more flexible:
147157
148158Please see [ matcher] ( https://github.com/sindresorhus/matcher/ ) library to see how to use matchers.
@@ -153,7 +163,7 @@ Please see [matcher](https://github.com/sindresorhus/matcher/) library to see ho
153163</template >
154164```
155165
156- #### ` .is(loaders Array<String | Matcher>) `
166+ #### ` .is(loaders Array<String | Matcher>) ` or ` .waiting(loaders Array<String | Matcher>) `
157167
158168Returns boolean value if some of given loaders exists in page.
159169
@@ -183,6 +193,44 @@ Stops the given loader.
183193</template >
184194```
185195
196+ #### ` .progress(loader String, current [, total = 100]) `
197+
198+ Sets the progress of the given loader.
199+
200+ ``` html
201+ <template >
202+ <progress min =" 0" max =" 100" :value =" $wait.percent('downloading')" />
203+ <button @click =" $wait.progress('downloading', 10)" >Set progress to 10</button >
204+ <button @click =" $wait.progress('downloading', 50)" >Set progress to 50</button >
205+ <button @click =" $wait.progress('downloading', 50, 200)" >Set progress to 50 of 200 (25%)</button >
206+ </template >
207+ ```
208+
209+ ##### Completing the Progress
210+
211+ To complete the progress, ` current ` value should be set bigger than ` 100 ` .
212+ If you ` total ` is given, ` current ` must be bigger than ` total ` .
213+
214+ ``` html
215+ <button @click =" $wait.progress('downloading', 101)" >Set as downloaded (101 of 100)</button >
216+ ```
217+
218+ or
219+
220+ ``` html
221+ <button @click =" $wait.progress('downloading', 5, 6)" >Set as downloaded (6 of 5)</button >
222+ ```
223+
224+ #### ` .percent(loader String) `
225+
226+ Returns the percentage of the given loader.
227+
228+ ``` html
229+ <template >
230+ <progress min =" 0" max =" 100" :value =" $wait.percent('downloading')" />
231+ </template >
232+ ```
233+
186234## 🏹 Directives
187235
188236You can use directives to make your template cleaner.
@@ -258,6 +306,16 @@ Toggles given loader on click.
258306</template >
259307```
260308
309+ #### ` v-wait:click.progress='["loader name", 80]' `
310+
311+ Sets the progress of given loader on click.
312+
313+ ``` html
314+ <template >
315+ <button v-wait:click.progress =' ["downloading", 80]' >Set the "downloading" loader to 80</button >
316+ </template >
317+ ```
318+
261319## 🔌 Loading Action and Getter Mappers
262320
263321** vue-wait** provides ` mapWaitingActions ` and ` mapWaitingGetters ` mapper to be used with your Vuex stores.
@@ -316,7 +374,7 @@ actions: {
316374},
317375```
318376
319- #### ` waitFor(loader String, func Function, [,force_sync = false]) `
377+ #### ` waitFor(loader String, func Function [,forceSync = false]) `
320378
321379Decorator that wraps function, will trigger a loading and will end loader after the original function (` func ` argument) is finished.
322380
0 commit comments