forked from cybrespace/pinafore
		
	remove unnecessary resize event listener
This commit is contained in:
		
							parent
							
								
									0a7f56004f
								
							
						
					
					
						commit
						208316b914
					
				
					 1 changed files with 4 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -1,28 +1,22 @@
 | 
			
		|||
<:Window bind:innerHeight />
 | 
			
		||||
<div class="container" on:scroll="onScroll(event)" on:fullscreen="onFullscreenChange()" ref:node>
 | 
			
		||||
<div class="container"
 | 
			
		||||
     on:scroll="onScroll(event)"
 | 
			
		||||
     on:fullscreen="onFullscreenChange()"
 | 
			
		||||
     ref:node>
 | 
			
		||||
  <slot></slot>
 | 
			
		||||
</div>
 | 
			
		||||
<script>
 | 
			
		||||
  import { virtualListStore } from '../_utils/virtualListStore'
 | 
			
		||||
 | 
			
		||||
  import debounce from 'lodash/debounce'
 | 
			
		||||
  import throttle from 'lodash/throttle'
 | 
			
		||||
  import { isFullscreen, attachFullscreenListener, detachFullscreenListener } from '../_utils/fullscreen'
 | 
			
		||||
  import { mark, stop } from '../_utils/marks'
 | 
			
		||||
 | 
			
		||||
  const SCROLL_EVENT_DELAY = 300
 | 
			
		||||
  const RESIZE_EVENT_DELAY = 700
 | 
			
		||||
 | 
			
		||||
  export default {
 | 
			
		||||
    oncreate() {
 | 
			
		||||
      mark('onCreate VirtualListContainer')
 | 
			
		||||
      let node = this.refs.node
 | 
			
		||||
      this.observe('innerHeight', debounce(() => {
 | 
			
		||||
        // respond to window resize events
 | 
			
		||||
        this.store.set({
 | 
			
		||||
          offsetHeight: node.offsetHeight
 | 
			
		||||
        })
 | 
			
		||||
      }, RESIZE_EVENT_DELAY))
 | 
			
		||||
      this.store.set({
 | 
			
		||||
        scrollTop: node.scrollTop,
 | 
			
		||||
        scrollHeight: node.scrollHeight,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue