mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-27 03:42:34 +00:00
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:
@@ -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() {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user