diff --git a/src/puter-js/src/index.js b/src/puter-js/src/index.js index e4014f2df..dc59a90d8 100644 --- a/src/puter-js/src/index.js +++ b/src/puter-js/src/index.js @@ -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() { diff --git a/src/puter-js/src/modules/Drivers.js b/src/puter-js/src/modules/Drivers.js index 7e63875b0..8a587caea 100644 --- a/src/puter-js/src/modules/Drivers.js +++ b/src/puter-js/src/modules/Drivers.js @@ -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.