The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/ui/client/lib/menu.js

22 lines
604 B

import _ from 'underscore';
import EventEmitter from 'wolfy87-eventemitter';
import { menu } from '../../../ui-utils';
const emitter = new EventEmitter();
window.addEventListener('resize', _.debounce((() => {
let lastState = window.matchMedia('(min-width: 780px)').matches ? 'mini' : 'large';
emitter.emit('grid', lastState);
return () => {
const futureState = window.matchMedia('(min-width: 780px)').matches ? 'mini' : 'large';
if (lastState !== futureState) {
lastState = futureState;
emitter.emit('grid', lastState);
}
};
})(), 100));
emitter.on('grid', () => {
menu.close();
});