| 24 | } |
| 25 | |
| 26 | export const deviceEnquire = function (callback) { |
| 27 | const matchDesktop = { |
| 28 | match: () => { |
| 29 | callback && callback(DEVICE_TYPE.DESKTOP) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | const matchTablet = { |
| 34 | match: () => { |
| 35 | callback && callback(DEVICE_TYPE.TABLET) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | const matchMobile = { |
| 40 | match: () => { |
| 41 | callback && callback(DEVICE_TYPE.MOBILE) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | enquireJs |
| 46 | .register('screen and (max-width: 765px)', matchMobile) |
| 47 | .register('screen and (min-width: 766px) and (max-width: 1279px)', matchTablet) |
| 48 | .register('screen and (min-width: 1280px)', matchDesktop) |
| 49 | } |