import { writable } from 'svelte/store';
import { getContext, setContext } from 'svelte';

export function setFilter(context) {
	let contextFilter = writable(0);
	//console.log('setFilter: ', contextFilter);
	contextFilter.subscribe((value) => {
		//console.log('initial value: ', value);
	});
	setContext(context, contextFilter);
	//console.log('contextFilter (' + context + '): ', contextFilter);
}

export function getFilter(context) {
	//console.log('looking for writable for context ', context);
	let f = getContext(context);
	//console.log('returning filter writable: ', f);
	return f;
}
