Thank you for your advice.
However, this was actually a different matter, this is regarding Cordova plugins. It looks like the easiest way to handle traditional callbacks, in my opinion after porting a few addons.
This is my sample:
this.AddDOMMessageHandlers([
["on-mobile-sdk", e => this._OnMobileSDK(e)]
]);
this.AddRuntimeMessageHandlers([
["StartSDK", e=> this._StartSDK(e)],
["Initialize", e => this._Initialize(e)]
]);
// Dom-Side.js
_StartSDK()
{
if (this._isMobile)
{
this._SDK = window["plugins"]["sdk"];
this.PostToRuntime("on-mobile-sdk", {});
}
else
{
console.warn("[Mobile SDK] You need to export to mobile in order to run.");
}
}
// Instance.js
_OnMobileSDK()
{
this._isMobile = true;
}
This is more effective as you add more methods, the ones above are for the purpose of visualization.
I was wondering if these are valid official SDK methods or should I rewrite it to what's supported. If it's not supported, could you kindly give me a quick reference to the methods I should use instead?
Thank you.