farjs-app
Version:
FAR.js - Cross-platform File and Archive Manager app in your terminal
31 lines (26 loc) • 669 B
JavaScript
/**
* @import { FolderShortcutsService } from "./popups/FolderShortcutsService.mjs"
*/
import React, { useContext } from "react";
const FSServices = {
Context: React.createContext(/** @type {FSServices | null} */ (null)),
/**
* @returns {FSServices}
*/
useServices: () => {
const ctx = useContext(FSServices.Context);
if (!ctx) {
throw Error(
"FSServices.Context is not found." +
"\nPlease, make sure you use FSServices.Context.Provider in parent components"
);
}
return ctx;
},
};
export default FSServices;
/**
* @typedef {{
* readonly folderShortcuts: FolderShortcutsService;
* }} FSServices
*/