|
|
@ -1,4 +1,5 @@
|
|
|
|
import { run_all, noop, safe_not_equal, is_function } from 'svelte/internal';
|
|
|
|
import { run_all, noop, safe_not_equal, is_function } from 'svelte/internal';
|
|
|
|
|
|
|
|
export { get_store_value as get } from 'svelte/internal';
|
|
|
|
|
|
|
|
|
|
|
|
/** Callback to inform of a value updates. */
|
|
|
|
/** Callback to inform of a value updates. */
|
|
|
|
type Subscriber<T> = (value: T) => void;
|
|
|
|
type Subscriber<T> = (value: T) => void;
|
|
|
@ -189,13 +190,3 @@ export function derived<T, S extends Stores>(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Get the current value from a store by subscribing and immediately unsubscribing.
|
|
|
|
|
|
|
|
* @param store readable
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
export function get<T>(store: Readable<T>): T {
|
|
|
|
|
|
|
|
let value: T | undefined;
|
|
|
|
|
|
|
|
store.subscribe((_: T) => value = _)();
|
|
|
|
|
|
|
|
return value as T;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|