useMultiFrame.ts 352 B

12345678910111213141516171819202122232425
  1. const MAP = new Map();
  2. export const useMultiFrame = () => {
  3. function setMap(path, Comp) {
  4. MAP.set(path, Comp);
  5. }
  6. function getMap(path?) {
  7. if (path) {
  8. return MAP.get(path);
  9. }
  10. return [...MAP.entries()];
  11. }
  12. function delMap(path) {
  13. MAP.delete(path);
  14. }
  15. return {
  16. setMap,
  17. getMap,
  18. delMap,
  19. MAP
  20. };
  21. };