Move WorkerPoolContext into WorkerPool.ts

This commit is contained in:
Tyler Hallada 2022-03-04 23:53:36 -05:00
parent eebae85a65
commit 5dd061627a
3 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import React, { useContext } from "react";
import { WorkerPoolContext } from "../pages/index";
import { WorkerPoolContext } from "../lib/WorkerPool";
import { useAppDispatch } from "../lib/hooks";
import { clearPlugins, setPending } from "../slices/plugins";
import styles from "../styles/DataDirPicker.module.css";

View File

@ -1,3 +1,5 @@
import { createContext } from "react";
import {
addPluginInOrder,
decrementPending,
@ -78,4 +80,6 @@ export class WorkerPool {
}
this.availableWorkers = [];
}
}
}
export const WorkerPoolContext = createContext<WorkerPool | null>(null);

View File

@ -1,4 +1,4 @@
import { createContext, useEffect, useCallback, useState } from "react";
import { useEffect, useCallback, useState } from "react";
import type { NextPage } from "next";
import Head from "next/head";
import "mapbox-gl/dist/mapbox-gl.css";
@ -6,9 +6,7 @@ import "mapbox-gl/dist/mapbox-gl.css";
import Map from "../components/Map";
import { useAppDispatch } from "../lib/hooks";
import { setPluginsTxtAndApplyLoadOrder } from "../slices/pluginsTxt";
import { WorkerPool } from "../lib/WorkerPool";
export const WorkerPoolContext = createContext<WorkerPool | null>(null);
import { WorkerPool, WorkerPoolContext } from "../lib/WorkerPool";
const Home: NextPage = () => {
const [workerPool, setWorkerPool] = useState<WorkerPool | null>(null);