import { ipcMain } from 'electron' ; import { Global } from '../global' ; import { getFoldersSync } from '../utils' ; import manager from './manager' ; export let ExtensionManager ; export function LoadExtension ( ) { ExtensionManager = new manager ( Global . ExtensionConfigPath ) ; function load ( ) { ExtensionManager . loadEnabled ( ) ; const extension = getFoldersSync ( Global . ExtensionFolderPath ) ; extension . forEach ( extension => ExtensionManager . load ( extension ) ) ; ExtensionManager . enableFromConfig ( ) ; ExtensionManager . save ( ) ; } load ( ) ; ipcMain . on ( 'refresh-extension' , event => { ExtensionManager . clear ( ) ; load ( ) ; event . returnValue = ExtensionManager . getDetails ( ) ; } ) ; }