This commit is contained in:
parent
f1197d6ba0
commit
73a56357d9
8 changed files with 153 additions and 267 deletions
|
@ -18,12 +18,15 @@ const HeroSourceContext = createContext<Signal<HeroSource>>(
|
|||
|
||||
export const HeroSourceProvider = HeroSourceContext.Provider;
|
||||
|
||||
function useHeroSource() {
|
||||
export function useHeroSource() {
|
||||
return useContext(HeroSourceContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use hero value for the {@link key}.
|
||||
*
|
||||
* Note: the setter here won't set the value of the hero source.
|
||||
* To set hero source, use {@link useHeroSource} and set the corresponding key.
|
||||
*/
|
||||
export function useHeroSignal(
|
||||
key: string | symbol | number,
|
||||
|
@ -46,6 +49,7 @@ export function useHeroSignal(
|
|||
|
||||
return [get, set];
|
||||
} else {
|
||||
console.debug("no hero source")
|
||||
return [() => undefined, () => undefined];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue