New source found from dndbeyond.com
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
import React, { useContext, useMemo } from "react";
|
||||
|
||||
import { InventoryManager } from "@dndbeyond/character-rules-engine/es";
|
||||
import {
|
||||
InventoryManager,
|
||||
getInventoryManager,
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
interface InventoryManagerContextValue {
|
||||
inventoryManager: InventoryManager;
|
||||
}
|
||||
const initContext: InventoryManagerContextValue = {
|
||||
inventoryManager: new InventoryManager(),
|
||||
inventoryManager: null!,
|
||||
};
|
||||
export const InventoryManagerContext =
|
||||
React.createContext<InventoryManagerContextValue>(initContext);
|
||||
|
||||
export function InventoryManagerProvider({ children }) {
|
||||
const inventoryManager: InventoryManager = useMemo(
|
||||
() => new InventoryManager(),
|
||||
() => getInventoryManager(),
|
||||
[]
|
||||
);
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user