import { event } from '../../index' import type { EventState } from '../../index' import type { WindowSizeState } from './types' export * from './types' export const windowSizeEvent = () => { const mount = () => { self.change() window.addEventListener('resize', self.change) } const clean = () => { window.removeEventListener('resize', self.change) } const change = () => { self.callback() self.snapshot = [self] self.width = window.innerWidth self.height = window.innerHeight } const self = event({ width: 1920, height: 1080, change, mount, clean, }) as EventState self.snapshot = [self] return self }