forked from cybrespace/pinafore
		
	remove deprecated observe() from stores, take 2 (#249)
This commit is contained in:
		
							parent
							
								
									dbba271f39
								
							
						
					
					
						commit
						814716cc8d
					
				
					 2 changed files with 10 additions and 6 deletions
				
			
		| 
						 | 
					@ -104,12 +104,13 @@ virtualListStore.compute('allVisibleItemsHaveHeight',
 | 
				
			||||||
if (process.browser && process.env.NODE_ENV !== 'production') {
 | 
					if (process.browser && process.env.NODE_ENV !== 'production') {
 | 
				
			||||||
  window.virtualListStore = virtualListStore
 | 
					  window.virtualListStore = virtualListStore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  virtualListStore.observe('visibleItems', () => {
 | 
					  virtualListStore.on('state', ({changed}) => {
 | 
				
			||||||
 | 
					    if (changed.visibleItems) {
 | 
				
			||||||
      window.visibleItemsChangedCount = (window.visibleItemsChangedCount || 0) + 1
 | 
					      window.visibleItemsChangedCount = (window.visibleItemsChangedCount || 0) + 1
 | 
				
			||||||
  })
 | 
					    }
 | 
				
			||||||
 | 
					    if (changed.rawVisibleItems) {
 | 
				
			||||||
  virtualListStore.observe('rawVisibleItems', () => {
 | 
					 | 
				
			||||||
      window.rawVisibleItemsChangedCount = (window.rawVisibleItemsChangedCount || 0) + 1
 | 
					      window.rawVisibleItemsChangedCount = (window.rawVisibleItemsChangedCount || 0) + 1
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@ import { observers } from './observers/observers'
 | 
				
			||||||
import { computations } from './computations/computations'
 | 
					import { computations } from './computations/computations'
 | 
				
			||||||
import { mixins } from './mixins/mixins'
 | 
					import { mixins } from './mixins/mixins'
 | 
				
			||||||
import { LocalStorageStore } from './LocalStorageStore'
 | 
					import { LocalStorageStore } from './LocalStorageStore'
 | 
				
			||||||
 | 
					import { observe } from 'svelte-extras'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const KEYS_TO_STORE_IN_LOCAL_STORAGE = new Set([
 | 
					const KEYS_TO_STORE_IN_LOCAL_STORAGE = new Set([
 | 
				
			||||||
  'currentInstance',
 | 
					  'currentInstance',
 | 
				
			||||||
| 
						 | 
					@ -24,6 +25,8 @@ class PinaforeStore extends LocalStorageStore {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PinaforeStore.prototype.observe = observe
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const store = new PinaforeStore({
 | 
					export const store = new PinaforeStore({
 | 
				
			||||||
  instanceNameInSearch: '',
 | 
					  instanceNameInSearch: '',
 | 
				
			||||||
  queryInSearch: '',
 | 
					  queryInSearch: '',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue