11import { Component , ReactElement } from "react" ;
22import { toast , Toaster } from "react-hot-toast" ;
33import Axios from "axios" ;
4+ import md5 from "md5-node" ;
45
56// components
67import ListItem from "../components/ListItem" ;
@@ -14,17 +15,16 @@ import LeftSidebar from "../containers/explorer/LeftSidebar";
1415import RightSidebar from "../containers/explorer/RightSidebar" ;
1516
1617import Utils from "../../Utils" ;
18+ import Emitter from "../emitter" ;
1719import { FetchDirInfoResponse , ExplorerProps , ExplorerState } from "../types" ;
20+ import { hostname , apiUrl } from "../global" ;
1821import * as config from "../../config.json" ;
1922import { plugins } from "../../plugins" ;
2023
2124// icons
2225import starOutline from "../../icons/star_outline.svg" ;
2326import starRate from "../../icons/star_rate.svg" ;
24- import md5 from "md5-node" ;
2527
26- export const hostname = "http://" + window . location . hostname ;
27- const apiUrl = hostname + ":3301" ;
2828const root = config . explorer . root ;
2929
3030export default class Explorer extends Component < ExplorerProps , ExplorerState > {
@@ -308,7 +308,8 @@ export default class Explorer extends Component<ExplorerProps, ExplorerState> {
308308 }
309309 } ) ;
310310
311- document . addEventListener ( "fileListUpdate" , ( ) => this . refreshItemList ( ) ) ;
311+ // document.addEventListener("fileListUpdate", () => this.refreshItemList());
312+ Emitter . get ( ) . on ( "fileListUpdate" , ( ) => this . refreshItemList ( ) ) ;
312313
313314 this . refreshItemList ( ) ;
314315 this . refreshStarredList ( ) ;
0 commit comments