Skip to content

Commit 790e3bd

Browse files
committed
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.
1 parent 9935f5a commit 790e3bd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/puter-js/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ export default window.puter = (function() {
416416
const instance = new cls(this.context, parameters);
417417
this.modules_.push(name);
418418
this[name] = instance;
419+
if ( instance._init ) instance._init({ puter: this });
419420
}
420421

421422
updateSubmodules() {

src/puter-js/src/modules/Drivers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ class Drivers {
109109
get: () => this.APIOrigin,
110110
});
111111
}
112+
113+
_init ({ puter }) {
114+
puter.call = this.call.bind(this);
115+
}
112116

113117
/**
114118
* Sets a new authentication token and resets the socket connection with the updated token, if applicable.

0 commit comments

Comments
 (0)