Files
puter/src/services/ExportService.js
T
KernelDeimos 51bac4486f Add class registry (first pass)
In the first pass I add a `register` method and update `defineComponent`
so it calls `register` as well. This made it possible to create a
proof-of-concept for registered classes. Additionally ExportService was
added to expose registered classes to service scripts. This first pass
works, but it would be better if all types of classes (components or
otherwise) were registered via the same method.
2024-05-27 21:16:50 -04:00

25 lines
536 B
JavaScript

import { Service } from "../definitions.js";
/**
* This service is responsible for exporting definitions to the
* service script SDK. This is the SDK that services provided by
* the backend will use.
*/
export class ExportService extends Service {
constructor () {
super();
this.exports_ = {};
}
register (name, definition) {
this.exports_[name] = definition;
}
get (name) {
if ( name ) {
return this.exports_[name];
}
return this.exports_;
}
}