As a newcomer to Windows Runtime Component, I've been exploring ways to accomplish the following task.
I'm looking to extend a C++ interface in JavaScript.
namespace MySDK {
public interface class LoggerPlugin
{
public:
virtual void Log (Platform::String^ Tag, Platform::String^ Messsage);
};
}
The C++ code snippet is as follows:
namespace MySDK {
public ref class Logger sealed : public Platform::Object
{
public:
static Logger^ GetInstance ();
void SetPlugin (LoggerPlugin^ Plugin);
};
}
My attempt at solving this issue may seem naive as I am unsure how to proceed.
var plugin = {
log: function(tag, message) {
console.log(tag + ':' + message);
}
};
MySdk.Logger.getInstance().setPlugin(plugin);
However, I encounter an error message which says:
JavaScript runtime error: Type mismatch
Unfortunately, I haven't come across any helpful documentation or examples on this topic. It would be greatly appreciated if someone could provide me with a sample solution.