File tree 2 files changed +17
-9
lines changed
2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 1
1
import { reactive } from "vue" ;
2
2
3
3
class Wait {
4
- list = reactive ( { } ) ;
5
- is = ( name ) => ! ! this . list [ name ] ;
6
- start = ( name ) => ! this . list [ name ] && ( this . list [ name ] = Date . now ( ) ) ;
7
- end = ( name ) => {
4
+ constructor ( ) {
5
+ this . list = reactive ( { } ) ;
6
+ }
7
+ is ( name ) {
8
+ return ! ! this . list [ name ] ;
9
+ }
10
+ start ( name ) {
11
+ return ! this . list [ name ] && ( this . list [ name ] = Date . now ( ) ) ;
12
+ }
13
+ end ( name ) {
8
14
const start = this . list [ name ] ;
9
15
delete this . list [ name ] ;
10
16
return Date . now ( ) - start ;
11
- } ;
12
- any = ( ) => Object . keys ( this . list ) . length ;
13
- clear = ( ) => {
17
+ }
18
+ any ( ) {
19
+ return Object . keys ( this . list ) . length ;
20
+ }
21
+ clear ( ) {
14
22
let clearList = { } ;
15
23
Object . keys ( this . list ) . forEach ( ( item ) => {
16
24
clearList [ item ] = this . end ( item ) ;
17
25
} ) ;
18
26
return clearList ;
19
- } ;
27
+ }
20
28
}
21
29
22
30
export const $wait = new Wait ( ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @meforma/vue-wait-for" ,
3
- "version" : " 0.0.1 " ,
3
+ "version" : " 0.0.2 " ,
4
4
"description" : " A loader manager for vuejs 3 with reactive method" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments