| 618 | |
| 619 | const position = (name.match(startRegex)) ? before : after // eslint-disable-line |
| 620 | const handler = store => next => action => { |
| 621 | // Subscribe to EVERYTHING |
| 622 | if (action.type === name) { |
| 623 | callback({ // eslint-disable-line |
| 624 | payload: action, |
| 625 | instance: instance, |
| 626 | plugins: customPlugins, |
| 627 | abort: nonAbortable |
| 628 | }) |
| 629 | } |
| 630 | /* For future matching of event subpaths `track:*` etc |
| 631 | } else if (name.match(/\*$/)) { |
| 632 | const match = (name === '*') ? '.' : name |
| 633 | const regex = new RegExp(`${match}`, 'g') |
| 634 | } */ |
| 635 | return next(action) |
| 636 | } |
| 637 | addMiddleware(handler, position) |
| 638 | return () => removeMiddleware(handler, position) |
| 639 | }, |