Skip to content

Commit

Permalink
Moved useRootEngine to its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjpatty committed Mar 18, 2023
1 parent 3f2b7a6 commit 609b6a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export { NodeEditor } from "./NodeEditor";
export { FlumeConfig, Controls, Colors } from "./typeBuilders";
export { RootEngine } from "./RootEngine";
export const useRootEngine = (nodes, engine, context, options = {}) =>
Object.keys(nodes).length
? engine.resolveRootNode(nodes, { ...options, context })
: {};
export { useRootEngine } from "./useRootEngine";
export * from "./types";
12 changes: 12 additions & 0 deletions src/useRootEngine.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { RootEngine } from "./RootEngine";
import { NodeMap, RootEngineOptions } from "./types";

export const useRootEngine = <T extends { [inputName: string]: any }>(
nodes: NodeMap,
engine: RootEngine,
context: any,
options: RootEngineOptions = {}
): T =>
Object.keys(nodes).length
? engine.resolveRootNode<T>(nodes, { ...options, context })
: ({} as T);

0 comments on commit 609b6a8

Please sign in to comment.