Created
June 23, 2021 17:02
-
-
Save garrettlancaster/c82fecdea83c4f744123e65b9686df8e to your computer and use it in GitHub Desktop.
Revisions
-
garrettlancaster revised this gist
Jun 23, 2021 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,6 @@ const machine = Machine({ }, guards: { isChar: (_, {keydown}) => { return keydown.key.length === 1; } } -
garrettlancaster created this gist
Jun 23, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ const machine = Machine({ initial: 'Closed', states: { Closed: { on: { keydown: { cond: 'isChar', target: 'Open', actions: 'focus' } } }, Open: { on: { closed: 'Closed' } } } }, { actions: { focus: (_, {select}) => { console.log('focus', select) Select2.focusSearch(select) } }, guards: { isChar: (_, {keydown}) => { if (!keydown) { return } return keydown.key.length === 1; } } })