Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import React, { useMemo } from "react";
|
||||
|
||||
import {
|
||||
getSpellsManager,
|
||||
SpellsManager,
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
interface SpellsManagerContextValue {
|
||||
spellsManager: SpellsManager;
|
||||
}
|
||||
|
||||
const initContext: SpellsManagerContextValue = {
|
||||
spellsManager: null!,
|
||||
};
|
||||
export const SpellsManagerContext =
|
||||
React.createContext<SpellsManagerContextValue>(initContext);
|
||||
|
||||
export function SpellsManagerProvider({ children }) {
|
||||
// TODO: try getting the initialized sub and cleaning it up in here?
|
||||
const spellsManager: SpellsManager = useMemo(() => getSpellsManager(), []);
|
||||
return (
|
||||
<SpellsManagerContext.Provider value={{ spellsManager }}>
|
||||
{children}
|
||||
</SpellsManagerContext.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user