I'm trying to use the library in a vue.js project, and it seems that it keeps track of it's state in the Global this, which I think is what is creating this error somehow. If I break on the error, it shows this:
/**
* Saves the provided function as a handler for the connection
* success Whenable event
*
* @param {Function} handler to be issued upon connection
*/
DynamicPlugin.prototype.whenConnected =
Plugin.prototype.whenConnected = function(handler) {
this._connect.whenEmitted(handler);
}
Where this is the global this and has no property _connect.
Here is the trace
TypeError: Cannot read property 'whenEmitted' of undefined
at DynamicPlugin.whenConnected.Plugin.whenConnected (jailed.js?c164:787)
at eval (utils.js?a2b6:70)
at new Promise (<anonymous>)
at promisify (utils.js?a2b6:68)
at _callee$ (evaluation.js?5b15:15)
at tryCatch (runtime.js?96cf:45)
at Generator.invoke [as _invoke] (runtime.js?96cf:274)
at Generator.prototype.<computed> [as next] (runtime.js?96cf:97)
at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
at _next (asyncToGenerator.js?1da1:25)
I'm trying to use the library in a vue.js project, and it seems that it keeps track of it's state in the
Global this
, which I think is what is creating this error somehow. If I break on the error, it shows this:Where
this
is the globalthis
and has no property_connect
.Here is the trace
This is how I'm using it: