File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ export default Base.extend({
2323 init ( ) {
2424 this . options = parser . parse ( this . el , this . options , false ) ;
2525 this . $el . on ( "patterns-injected" , this . _init . bind ( this ) ) ;
26+
27+ this . change_handler = utils . debounce ( ( ) => {
28+ this . change_buttons_and_toggles ( ) ;
29+ this . change_checked ( ) ;
30+ } , 50 ) ;
31+
2632 this . _init ( ) ;
2733 } ,
2834
@@ -46,14 +52,9 @@ export default Base.extend({
4652 }
4753
4854 // update select/deselect button status
49- this . el . addEventListener ( "change" , this . _handler_change . bind ( this ) ) ;
5055 this . change_buttons_and_toggles ( ) ;
5156 this . change_checked ( ) ;
52- } ,
53-
54- _handler_change ( ) {
55- utils . debounce ( ( ) => this . change_buttons_and_toggles ( ) , 50 ) ( ) ;
56- utils . debounce ( ( ) => this . change_checked ( ) , 50 ) ( ) ;
57+ this . el . addEventListener ( "change" , this . change_handler . bind ( this ) ) ;
5758 } ,
5859
5960 destroy ( ) {
@@ -63,7 +64,7 @@ export default Base.extend({
6364 for ( const it of this . all_deselects ) {
6465 it . removeEventListener ( "click" , this . deselect_all ) ;
6566 }
66- this . el . removeEventListener ( "change" , this . _handler_change ) ;
67+ this . el . removeEventListener ( "change" , this . change_handler ) ;
6768 this . $el . off ( "patterns_injected" ) ;
6869 } ,
6970
You can’t perform that action at this time.
0 commit comments