dev: puter.call

Instead of puter.drivers.call, make it puter.call. This is accomplished
by allowing puter.js modules to mutate the `puter` object on
initialization. Support for an optional `_init` method, similar to
backend services, is added to Puter modules to help with this.
This commit is contained in:
KernelDeimos
2025-04-22 15:21:36 -04:00
parent 9935f5a0be
commit 790e3bdffc
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -416,6 +416,7 @@ export default window.puter = (function() {
const instance = new cls(this.context, parameters);
this.modules_.push(name);
this[name] = instance;
if ( instance._init ) instance._init({ puter: this });
}
updateSubmodules() {
+4
View File
@@ -109,6 +109,10 @@ class Drivers {
get: () => this.APIOrigin,
});
}
_init ({ puter }) {
puter.call = this.call.bind(this);
}
/**
* Sets a new authentication token and resets the socket connection with the updated token, if applicable.