@@ -25,14 +25,14 @@ class StimulusLazyControllerHandler {
25
25
this . lazyLoadNewControllers ( document . documentElement ) ;
26
26
}
27
27
lazyLoadExistingControllers ( element ) {
28
- this . queryControllerNamesWithin ( element ) . forEach ( controllerName => this . loadLazyController ( controllerName ) ) ;
28
+ this . queryControllerNamesWithin ( element ) . forEach ( ( controllerName ) => this . loadLazyController ( controllerName ) ) ;
29
29
}
30
30
async loadLazyController ( name ) {
31
31
if ( canRegisterController ( name , this . application ) ) {
32
32
if ( this . lazyControllers [ name ] === undefined ) {
33
33
console . error ( `Failed to autoload controller: ${ name } ` ) ;
34
34
}
35
- const controllerModule = await ( this . lazyControllers [ name ] ( ) ) ;
35
+ const controllerModule = await this . lazyControllers [ name ] ( ) ;
36
36
registerController ( name , controllerModule . default , this . application ) ;
37
37
}
38
38
}
@@ -41,8 +41,9 @@ class StimulusLazyControllerHandler {
41
41
for ( const { attributeName, target, type } of mutationsList ) {
42
42
switch ( type ) {
43
43
case 'attributes' : {
44
- if ( attributeName === controllerAttribute && target . getAttribute ( controllerAttribute ) ) {
45
- extractControllerNamesFrom ( target ) . forEach ( controllerName => this . loadLazyController ( controllerName ) ) ;
44
+ if ( attributeName === controllerAttribute &&
45
+ target . getAttribute ( controllerAttribute ) ) {
46
+ extractControllerNamesFrom ( target ) . forEach ( ( controllerName ) => this . loadLazyController ( controllerName ) ) ;
46
47
}
47
48
break ;
48
49
}
@@ -58,7 +59,9 @@ class StimulusLazyControllerHandler {
58
59
} ) ;
59
60
}
60
61
queryControllerNamesWithin ( element ) {
61
- return Array . from ( element . querySelectorAll ( `[${ controllerAttribute } ]` ) ) . map ( extractControllerNamesFrom ) . flat ( ) ;
62
+ return Array . from ( element . querySelectorAll ( `[${ controllerAttribute } ]` ) )
63
+ . map ( extractControllerNamesFrom )
64
+ . flat ( ) ;
62
65
}
63
66
}
64
67
function registerController ( name , controller , application ) {
@@ -71,7 +74,7 @@ function extractControllerNamesFrom(element) {
71
74
if ( ! controllerNameValue ) {
72
75
return [ ] ;
73
76
}
74
- return controllerNameValue . split ( / \s + / ) . filter ( content => content . length ) ;
77
+ return controllerNameValue . split ( / \s + / ) . filter ( ( content ) => content . length ) ;
75
78
}
76
79
function canRegisterController ( name , application ) {
77
80
return ! application . router . modulesByIdentifier . has ( name ) ;
0 commit comments