telefunc
Version:
Remote functions. Instead of API.
19 lines (18 loc) • 734 B
JavaScript
// Mechanism used by Vite/Next/Nuxt plugins for automatically loading `.telefunc.js` files.
export { loadTelefuncFilesUsingRegistration };
export { registerTelefunction };
import { getGlobalObject } from '../utils.js';
const g = getGlobalObject('loadTelefuncFilesUsingRegistration.ts', {
telefuncFilesLoaded: null,
});
function loadTelefuncFilesUsingRegistration() {
return g.telefuncFilesLoaded;
}
function registerTelefunction(telefunction, exportName, telefuncFilePath) {
var _a;
g.telefuncFilesLoaded = (_a = g.telefuncFilesLoaded) !== null && _a !== void 0 ? _a : {};
g.telefuncFilesLoaded[telefuncFilePath] = {
...g.telefuncFilesLoaded[telefuncFilePath],
[exportName]: telefunction,
};
}