1+ import { GestureRelations } from '../../v3/types' ;
12import type IGestureHandler from '../handlers/IGestureHandler' ;
23import { Config , Handler } from '../interfaces' ;
34
@@ -11,45 +12,46 @@ export default class InteractionManager {
1112 // eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
1213 private constructor ( ) { }
1314
14- public configureInteractions ( handler : IGestureHandler , config : Config ) {
15+ public configureInteractions (
16+ handler : IGestureHandler ,
17+ config : GestureRelations | Config
18+ ) {
1519 this . dropRelationsForHandlerWithTag ( handler . handlerTag ) ;
1620
1721 if ( config . waitFor ) {
1822 const waitFor : number [ ] = [ ] ;
19- config . waitFor . forEach ( ( otherHandler : Handler ) : void => {
20- // New API reference
21- if ( typeof otherHandler === 'number' ) {
22- waitFor . push ( otherHandler ) ;
23- } else {
24- // Old API reference
25- waitFor . push ( otherHandler . handlerTag ) ;
26- }
23+ config . waitFor . forEach ( ( otherHandler : Handler | number ) => {
24+ waitFor . push (
25+ typeof otherHandler === 'number'
26+ ? otherHandler
27+ : otherHandler . handlerTag
28+ ) ;
2729 } ) ;
2830
2931 this . waitForRelations . set ( handler . handlerTag , waitFor ) ;
3032 }
3133
3234 if ( config . simultaneousHandlers ) {
3335 const simultaneousHandlers : number [ ] = [ ] ;
34- config . simultaneousHandlers . forEach ( ( otherHandler : Handler ) : void => {
35- if ( typeof otherHandler === 'number' ) {
36- simultaneousHandlers . push ( otherHandler ) ;
37- } else {
38- simultaneousHandlers . push ( otherHandler . handlerTag ) ;
39- }
36+ config . simultaneousHandlers . forEach ( ( otherHandler : Handler | number ) => {
37+ simultaneousHandlers . push (
38+ typeof otherHandler === 'number'
39+ ? otherHandler
40+ : otherHandler . handlerTag
41+ ) ;
4042 } ) ;
4143
4244 this . simultaneousRelations . set ( handler . handlerTag , simultaneousHandlers ) ;
4345 }
4446
4547 if ( config . blocksHandlers ) {
4648 const blocksHandlers : number [ ] = [ ] ;
47- config . blocksHandlers . forEach ( ( otherHandler : Handler ) : void => {
48- if ( typeof otherHandler === 'number' ) {
49- blocksHandlers . push ( otherHandler ) ;
50- } else {
51- blocksHandlers . push ( otherHandler . handlerTag ) ;
52- }
49+ config . blocksHandlers . forEach ( ( otherHandler : Handler | number ) => {
50+ blocksHandlers . push (
51+ typeof otherHandler === 'number'
52+ ? otherHandler
53+ : otherHandler . handlerTag
54+ ) ;
5355 } ) ;
5456
5557 this . blocksHandlersRelations . set ( handler . handlerTag , blocksHandlers ) ;
0 commit comments