How to use the svelte/store.get function in svelte

To help you get started, we’ve selected a few svelte examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ctx-core / ctx-core / packages / auth0-management / fetch.ts View on Github external
export function _audience() {
	return `https://${get(__AUTH0_DOMAIN)}/api/v2/`
}
export function _body__client_credentials__management() {
github ctx-core / ctx-core / packages / auth0 / store.ts View on Github external
export function reload__opened__auth0() {
	if (!unsubscribe__reload__opened__auth0) {
		unsubscribe__reload__opened__auth0 = true
		unsubscribe__reload__opened__auth0 =
			subscribe(__email__auth0, reload__opened__auth0)
		return
	}
	const email__auth0 = get(__email__auth0)
	__opened__auth0.set(email__auth0 ? false : 'login')
}
export function clear__error__token__auth0() {
github ctx-core / ctx-core / packages / search / store.ts View on Github external
return ()=>{
		log(`${logPrefix}|_down__item__search|()`)
		const search_result = get(__search_result)
		const data = (search_result && search_result.data) || []
		const idx = _idx__next(data.length, get(__idx) || 0)
		__idx.set(idx)
	}
}
github ctx-core / ctx-core / packages / search / store.ts View on Github external
return ()=>{
		log(`${logPrefix}|_up__item__search|()`)
		const search_result = get(__search_result)
		const data = (search_result && search_result.data) || []
		const idx = _idx__prev(data.length, get(__idx) || 0)
		__idx.set(idx)
	}
}
github ctx-core / ctx-core / packages / table / store.ts View on Github external
function assign__highlight__rows() {
	log(`${logPrefix}|assign__highlight__rows`)
	const row_id = get(__row_id)
	const rows__data = get(__rows__data)
	const filter__rows__data = get(__filter__rows__data)
	const rows__data__ = filter__rows__data || rows__data
	let highlight__rows__data
	if (rows__data__) {
		highlight__rows__data = []
		for (let i = 0; i < rows__data__.length; i++) {
			const row = rows__data__[i]
			if (row.row_id === row_id) {
				highlight__rows__data.push(row)
			}
		}
	}
	const table__highlight__rows__data =
		highlight__rows__data
		&& _hash__key(highlight__rows__data, 'row_id')
	__highlight__rows__data.set(highlight__rows__data)
	__table__highlight__rows__data.set(table__highlight__rows__data)
github ctx-core / ctx-core / packages / layer / store.ts View on Github external
export function unshift__a1__layer(...a1__layer__) {
	log(`${logPrefix}|unshift__a1__layer`)
	__a1__layer.set(_union([a1__layer__, get(__a1__layer) || []]))
}
export function remove__a1__layer(...a1__layer__) {
github ctx-core / ctx-core / packages / scroll / store.ts View on Github external
export function _active__active__Sticky__Scroll(key) {
	log(`${logPrefix}|_active__active__Sticky__Scroll`)
	const active__Sticky__Scroll = get(__active__Sticky__Scroll)
	const active =
		active__Sticky__Scroll
		? active__Sticky__Scroll[key]
		: false
	return active
}
export function _match__active__Sticky__Scroll(key, active) {
github ctx-core / ctx-core / packages / table / store.ts View on Github external
export function set__row() {
	log(`${logPrefix}|agent__row|set__row`)
	const rows = get(__rows)
	const row_id = get(__row_id)
	if (!rows || !row_id) return
	let row
	for (let i = 0; i < rows.length; i++) {
		const row__ = rows[i]
		if (row__.row_id === row_id) {
			row = row__
			break
		}
	}
	__row.set(row)
}
github ctx-core / ctx-core / packages / search / store.ts View on Github external
async (
			query,
			set
		)=>{
			if (!query) {
				(clear || (()=>{
					set({ done: true, loading: false, query, data: [] })
				}))()
				return
			}
			const search__previous = get(store__search)
			const query__previous = search__previous && search__previous.query
			if (query__previous === query) {
				return
			}
			set({
				loading: true,
				query,
			})
			const data = await _data({ query })
			if (query === get(__query)) {
				set({
					done: true,
					loading: false,
					query,
					data,
				})