Download core/src/node/helper/module.ts from oldg591/jannn: direct link, hf CLI and curl.
- Browser
- Download file 715 Bytes
-
https://huggingface.co/spaces/oldg591/jannn/resolve/main/core/src/node/helper/module.ts
- Command line
-
hf download hf://spaces/oldg591/jannn/core/src/node/helper/module.ts
-
curl -L -o module.ts https://huggingface.co/spaces/oldg591/jannn/resolve/main/core/src/node/helper/module.ts
715 Bytes
| /** | |
| * Manages imported modules. | |
| */ | |
| export class ModuleManager { | |
| public requiredModules: Record<string, any> = {} | |
| public cleaningResource = false | |
| public static instance: ModuleManager = new ModuleManager() | |
| constructor() { | |
| if (ModuleManager.instance) { | |
| return ModuleManager.instance | |
| } | |
| } | |
| /** | |
| * Sets a module. | |
| * @param {string} moduleName - The name of the module. | |
| * @param {any | undefined} nodule - The module to set, or undefined to clear the module. | |
| */ | |
| setModule(moduleName: string, nodule: any | undefined) { | |
| this.requiredModules[moduleName] = nodule | |
| } | |
| /** | |
| * Clears all imported modules. | |
| */ | |
| clearImportedModules() { | |
| this.requiredModules = {} | |
| } | |
| } | |