import { app } from '/src/app/global-api';
const $app = app;
      let mql;

const listener = () => {
  console.log(mql && !!mql.matches)
  this.$WEAPPS_COMP.state.smallScreen = mql && !!mql.matches;
}


export default {
  onAttached() {
    if (window.innerWidth < 1024) {
      this.$WEAPPS_COMP.state.smallScreen = true;
    }
    mql = window.matchMedia('(max-width: 1024px)');
    mql.addEventListener('change', listener);
  },
  onDetached() {
    mql.removeEventListener('change', listener);
  },
};